xref: /openbsd/gnu/usr.bin/binutils/gdb/gdbarch.c (revision 11efff7f)
1 /* *INDENT-OFF* */ /* THIS FILE IS GENERATED */
2 
3 /* Dynamic architecture support for GDB, the GNU debugger.
4 
5    Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free
6    Software Foundation, Inc.
7 
8    This file is part of GDB.
9 
10    This program is free software; you can redistribute it and/or modify
11    it under the terms of the GNU General Public License as published by
12    the Free Software Foundation; either version 2 of the License, or
13    (at your option) any later version.
14 
15    This program is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18    GNU General Public License for more details.
19 
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 59 Temple Place - Suite 330,
23    Boston, MA 02111-1307, USA.  */
24 
25 /* This file was created with the aid of ``gdbarch.sh''.
26 
27    The Bourne shell script ``gdbarch.sh'' creates the files
28    ``new-gdbarch.c'' and ``new-gdbarch.h and then compares them
29    against the existing ``gdbarch.[hc]''.  Any differences found
30    being reported.
31 
32    If editing this file, please also run gdbarch.sh and merge any
33    changes into that script. Conversely, when making sweeping changes
34    to this file, modifying gdbarch.sh and using its output may prove
35    easier. */
36 
37 
38 #include "defs.h"
39 #include "arch-utils.h"
40 
41 #include "gdbcmd.h"
42 #include "inferior.h" /* enum CALL_DUMMY_LOCATION et.al. */
43 #include "symcat.h"
44 
45 #include "floatformat.h"
46 
47 #include "gdb_assert.h"
48 #include "gdb_string.h"
49 #include "gdb-events.h"
50 #include "reggroups.h"
51 #include "osabi.h"
52 #include "gdb_obstack.h"
53 
54 /* Static function declarations */
55 
56 static void alloc_gdbarch_data (struct gdbarch *);
57 
58 /* Non-zero if we want to trace architecture code.  */
59 
60 #ifndef GDBARCH_DEBUG
61 #define GDBARCH_DEBUG 0
62 #endif
63 int gdbarch_debug = GDBARCH_DEBUG;
64 
65 static const char *
pformat(const struct floatformat * format)66 pformat (const struct floatformat *format)
67 {
68   if (format == NULL)
69     return "(null)";
70   else
71     return  format->name;
72 }
73 
74 
75 /* Maintain the struct gdbarch object */
76 
77 struct gdbarch
78 {
79   /* Has this architecture been fully initialized?  */
80   int initialized_p;
81 
82   /* An obstack bound to the lifetime of the architecture.  */
83   struct obstack *obstack;
84 
85   /* basic architectural information */
86   const struct bfd_arch_info * bfd_arch_info;
87   int byte_order;
88   enum gdb_osabi osabi;
89 
90   /* target specific vector. */
91   struct gdbarch_tdep *tdep;
92   gdbarch_dump_tdep_ftype *dump_tdep;
93 
94   /* per-architecture data-pointers */
95   unsigned nr_data;
96   void **data;
97 
98   /* per-architecture swap-regions */
99   struct gdbarch_swap *swap;
100 
101   /* Multi-arch values.
102 
103      When extending this structure you must:
104 
105      Add the field below.
106 
107      Declare set/get functions and define the corresponding
108      macro in gdbarch.h.
109 
110      gdbarch_alloc(): If zero/NULL is not a suitable default,
111      initialize the new field.
112 
113      verify_gdbarch(): Confirm that the target updated the field
114      correctly.
115 
116      gdbarch_dump(): Add a fprintf_unfiltered call so that the new
117      field is dumped out
118 
119      ``startup_gdbarch()'': Append an initial value to the static
120      variable (base values on the host's c-type system).
121 
122      get_gdbarch(): Implement the set/get functions (probably using
123      the macro's as shortcuts).
124 
125      */
126 
127   int short_bit;
128   int int_bit;
129   int long_bit;
130   int long_long_bit;
131   int float_bit;
132   const struct floatformat * float_format;
133   int double_bit;
134   const struct floatformat * double_format;
135   int long_double_bit;
136   const struct floatformat * long_double_format;
137   int ptr_bit;
138   int addr_bit;
139   int bfd_vma_bit;
140   int char_signed;
141   gdbarch_read_pc_ftype *read_pc;
142   gdbarch_write_pc_ftype *write_pc;
143   gdbarch_read_sp_ftype *read_sp;
144   gdbarch_virtual_frame_pointer_ftype *virtual_frame_pointer;
145   gdbarch_pseudo_register_read_ftype *pseudo_register_read;
146   gdbarch_pseudo_register_write_ftype *pseudo_register_write;
147   int num_regs;
148   int num_pseudo_regs;
149   int sp_regnum;
150   int pc_regnum;
151   int ps_regnum;
152   int fp0_regnum;
153   gdbarch_stab_reg_to_regnum_ftype *stab_reg_to_regnum;
154   gdbarch_ecoff_reg_to_regnum_ftype *ecoff_reg_to_regnum;
155   gdbarch_dwarf_reg_to_regnum_ftype *dwarf_reg_to_regnum;
156   gdbarch_sdb_reg_to_regnum_ftype *sdb_reg_to_regnum;
157   gdbarch_dwarf2_reg_to_regnum_ftype *dwarf2_reg_to_regnum;
158   gdbarch_register_name_ftype *register_name;
159   gdbarch_register_type_ftype *register_type;
160   gdbarch_deprecated_register_byte_ftype *deprecated_register_byte;
161   gdbarch_unwind_dummy_id_ftype *unwind_dummy_id;
162   int deprecated_fp_regnum;
163   gdbarch_push_dummy_call_ftype *push_dummy_call;
164   gdbarch_deprecated_push_arguments_ftype *deprecated_push_arguments;
165   int deprecated_register_size;
166   int call_dummy_location;
167   gdbarch_push_dummy_code_ftype *push_dummy_code;
168   gdbarch_print_registers_info_ftype *print_registers_info;
169   gdbarch_print_float_info_ftype *print_float_info;
170   gdbarch_print_vector_info_ftype *print_vector_info;
171   gdbarch_register_sim_regno_ftype *register_sim_regno;
172   gdbarch_register_bytes_ok_ftype *register_bytes_ok;
173   gdbarch_cannot_fetch_register_ftype *cannot_fetch_register;
174   gdbarch_cannot_store_register_ftype *cannot_store_register;
175   gdbarch_get_longjmp_target_ftype *get_longjmp_target;
176   int believe_pcc_promotion;
177   gdbarch_convert_register_p_ftype *convert_register_p;
178   gdbarch_register_to_value_ftype *register_to_value;
179   gdbarch_value_to_register_ftype *value_to_register;
180   gdbarch_pointer_to_address_ftype *pointer_to_address;
181   gdbarch_address_to_pointer_ftype *address_to_pointer;
182   gdbarch_integer_to_address_ftype *integer_to_address;
183   gdbarch_deprecated_store_struct_return_ftype *deprecated_store_struct_return;
184   gdbarch_return_value_ftype *return_value;
185   gdbarch_extract_return_value_ftype *extract_return_value;
186   gdbarch_store_return_value_ftype *store_return_value;
187   gdbarch_deprecated_extract_return_value_ftype *deprecated_extract_return_value;
188   gdbarch_deprecated_store_return_value_ftype *deprecated_store_return_value;
189   gdbarch_deprecated_use_struct_convention_ftype *deprecated_use_struct_convention;
190   gdbarch_deprecated_extract_struct_value_address_ftype *deprecated_extract_struct_value_address;
191   gdbarch_skip_prologue_ftype *skip_prologue;
192   gdbarch_inner_than_ftype *inner_than;
193   gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc;
194   gdbarch_adjust_breakpoint_address_ftype *adjust_breakpoint_address;
195   gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint;
196   gdbarch_memory_remove_breakpoint_ftype *memory_remove_breakpoint;
197   CORE_ADDR decr_pc_after_break;
198   CORE_ADDR deprecated_function_start_offset;
199   gdbarch_remote_translate_xfer_address_ftype *remote_translate_xfer_address;
200   CORE_ADDR frame_args_skip;
201   gdbarch_unwind_pc_ftype *unwind_pc;
202   gdbarch_unwind_sp_ftype *unwind_sp;
203   gdbarch_deprecated_saved_pc_after_call_ftype *deprecated_saved_pc_after_call;
204   gdbarch_frame_num_args_ftype *frame_num_args;
205   gdbarch_deprecated_stack_align_ftype *deprecated_stack_align;
206   gdbarch_frame_align_ftype *frame_align;
207   gdbarch_deprecated_reg_struct_has_addr_ftype *deprecated_reg_struct_has_addr;
208   gdbarch_stabs_argument_has_addr_ftype *stabs_argument_has_addr;
209   int frame_red_zone_size;
210   gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr;
211   gdbarch_addr_bits_remove_ftype *addr_bits_remove;
212   gdbarch_smash_text_address_ftype *smash_text_address;
213   gdbarch_software_single_step_ftype *software_single_step;
214   gdbarch_print_insn_ftype *print_insn;
215   gdbarch_skip_trampoline_code_ftype *skip_trampoline_code;
216   gdbarch_skip_solib_resolver_ftype *skip_solib_resolver;
217   gdbarch_in_solib_call_trampoline_ftype *in_solib_call_trampoline;
218   gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline;
219   gdbarch_in_function_epilogue_p_ftype *in_function_epilogue_p;
220   gdbarch_construct_inferior_arguments_ftype *construct_inferior_arguments;
221   gdbarch_elf_make_msymbol_special_ftype *elf_make_msymbol_special;
222   gdbarch_coff_make_msymbol_special_ftype *coff_make_msymbol_special;
223   const char * name_of_malloc;
224   int cannot_step_breakpoint;
225   int have_nonsteppable_watchpoint;
226   gdbarch_address_class_type_flags_ftype *address_class_type_flags;
227   gdbarch_address_class_type_flags_to_name_ftype *address_class_type_flags_to_name;
228   gdbarch_address_class_name_to_type_flags_ftype *address_class_name_to_type_flags;
229   gdbarch_register_reggroup_p_ftype *register_reggroup_p;
230   gdbarch_fetch_pointer_argument_ftype *fetch_pointer_argument;
231   gdbarch_regset_from_core_section_ftype *regset_from_core_section;
232 };
233 
234 
235 /* The default architecture uses host values (for want of a better
236    choice). */
237 
238 extern const struct bfd_arch_info bfd_default_arch_struct;
239 
240 struct gdbarch startup_gdbarch =
241 {
242   1, /* Always initialized.  */
243   NULL, /* The obstack.  */
244   /* basic architecture information */
245   &bfd_default_arch_struct,  /* bfd_arch_info */
246   BFD_ENDIAN_BIG,  /* byte_order */
247   GDB_OSABI_UNKNOWN,  /* osabi */
248   /* target specific vector and its dump routine */
249   NULL, NULL,
250   /*per-architecture data-pointers and swap regions */
251   0, NULL, NULL,
252   /* Multi-arch values */
253   8 * sizeof (short),  /* short_bit */
254   8 * sizeof (int),  /* int_bit */
255   8 * sizeof (long),  /* long_bit */
256   8 * sizeof (LONGEST),  /* long_long_bit */
257   8 * sizeof (float),  /* float_bit */
258   0,  /* float_format */
259   8 * sizeof (double),  /* double_bit */
260   0,  /* double_format */
261   8 * sizeof (long double),  /* long_double_bit */
262   0,  /* long_double_format */
263   8 * sizeof (void*),  /* ptr_bit */
264   8 * sizeof (void*),  /* addr_bit */
265   8 * sizeof (void*),  /* bfd_vma_bit */
266   1,  /* char_signed */
267   0,  /* read_pc */
268   0,  /* write_pc */
269   0,  /* read_sp */
270   0,  /* virtual_frame_pointer */
271   0,  /* pseudo_register_read */
272   0,  /* pseudo_register_write */
273   0,  /* num_regs */
274   0,  /* num_pseudo_regs */
275   -1,  /* sp_regnum */
276   -1,  /* pc_regnum */
277   -1,  /* ps_regnum */
278   0,  /* fp0_regnum */
279   0,  /* stab_reg_to_regnum */
280   0,  /* ecoff_reg_to_regnum */
281   0,  /* dwarf_reg_to_regnum */
282   0,  /* sdb_reg_to_regnum */
283   0,  /* dwarf2_reg_to_regnum */
284   0,  /* register_name */
285   0,  /* register_type */
286   generic_register_byte,  /* deprecated_register_byte */
287   0,  /* unwind_dummy_id */
288   -1,  /* deprecated_fp_regnum */
289   0,  /* push_dummy_call */
290   0,  /* deprecated_push_arguments */
291   0,  /* deprecated_register_size */
292   0,  /* call_dummy_location */
293   0,  /* push_dummy_code */
294   default_print_registers_info,  /* print_registers_info */
295   0,  /* print_float_info */
296   0,  /* print_vector_info */
297   0,  /* register_sim_regno */
298   0,  /* register_bytes_ok */
299   0,  /* cannot_fetch_register */
300   0,  /* cannot_store_register */
301   0,  /* get_longjmp_target */
302   0,  /* believe_pcc_promotion */
303   0,  /* convert_register_p */
304   0,  /* register_to_value */
305   0,  /* value_to_register */
306   0,  /* pointer_to_address */
307   0,  /* address_to_pointer */
308   0,  /* integer_to_address */
309   0,  /* deprecated_store_struct_return */
310   0,  /* return_value */
311   0,  /* extract_return_value */
312   0,  /* store_return_value */
313   0,  /* deprecated_extract_return_value */
314   0,  /* deprecated_store_return_value */
315   0,  /* deprecated_use_struct_convention */
316   0,  /* deprecated_extract_struct_value_address */
317   0,  /* skip_prologue */
318   0,  /* inner_than */
319   0,  /* breakpoint_from_pc */
320   0,  /* adjust_breakpoint_address */
321   0,  /* memory_insert_breakpoint */
322   0,  /* memory_remove_breakpoint */
323   0,  /* decr_pc_after_break */
324   0,  /* deprecated_function_start_offset */
325   generic_remote_translate_xfer_address,  /* remote_translate_xfer_address */
326   0,  /* frame_args_skip */
327   0,  /* unwind_pc */
328   0,  /* unwind_sp */
329   0,  /* deprecated_saved_pc_after_call */
330   0,  /* frame_num_args */
331   0,  /* deprecated_stack_align */
332   0,  /* frame_align */
333   0,  /* deprecated_reg_struct_has_addr */
334   default_stabs_argument_has_addr,  /* stabs_argument_has_addr */
335   0,  /* frame_red_zone_size */
336   convert_from_func_ptr_addr_identity,  /* convert_from_func_ptr_addr */
337   0,  /* addr_bits_remove */
338   0,  /* smash_text_address */
339   0,  /* software_single_step */
340   0,  /* print_insn */
341   0,  /* skip_trampoline_code */
342   generic_skip_solib_resolver,  /* skip_solib_resolver */
343   0,  /* in_solib_call_trampoline */
344   0,  /* in_solib_return_trampoline */
345   generic_in_function_epilogue_p,  /* in_function_epilogue_p */
346   construct_inferior_arguments,  /* construct_inferior_arguments */
347   0,  /* elf_make_msymbol_special */
348   0,  /* coff_make_msymbol_special */
349   "malloc",  /* name_of_malloc */
350   0,  /* cannot_step_breakpoint */
351   0,  /* have_nonsteppable_watchpoint */
352   0,  /* address_class_type_flags */
353   0,  /* address_class_type_flags_to_name */
354   0,  /* address_class_name_to_type_flags */
355   default_register_reggroup_p,  /* register_reggroup_p */
356   0,  /* fetch_pointer_argument */
357   0,  /* regset_from_core_section */
358   /* startup_gdbarch() */
359 };
360 
361 struct gdbarch *current_gdbarch = &startup_gdbarch;
362 
363 /* Create a new ``struct gdbarch'' based on information provided by
364    ``struct gdbarch_info''. */
365 
366 struct gdbarch *
gdbarch_alloc(const struct gdbarch_info * info,struct gdbarch_tdep * tdep)367 gdbarch_alloc (const struct gdbarch_info *info,
368                struct gdbarch_tdep *tdep)
369 {
370   /* NOTE: The new architecture variable is named ``current_gdbarch''
371      so that macros such as TARGET_DOUBLE_BIT, when expanded, refer to
372      the current local architecture and not the previous global
373      architecture.  This ensures that the new architectures initial
374      values are not influenced by the previous architecture.  Once
375      everything is parameterised with gdbarch, this will go away.  */
376   struct gdbarch *current_gdbarch;
377 
378   /* Create an obstack for allocating all the per-architecture memory,
379      then use that to allocate the architecture vector.  */
380   struct obstack *obstack = XMALLOC (struct obstack);
381   obstack_init (obstack);
382   current_gdbarch = obstack_alloc (obstack, sizeof (*current_gdbarch));
383   memset (current_gdbarch, 0, sizeof (*current_gdbarch));
384   current_gdbarch->obstack = obstack;
385 
386   alloc_gdbarch_data (current_gdbarch);
387 
388   current_gdbarch->tdep = tdep;
389 
390   current_gdbarch->bfd_arch_info = info->bfd_arch_info;
391   current_gdbarch->byte_order = info->byte_order;
392   current_gdbarch->osabi = info->osabi;
393 
394   /* Force the explicit initialization of these. */
395   current_gdbarch->short_bit = 2*TARGET_CHAR_BIT;
396   current_gdbarch->int_bit = 4*TARGET_CHAR_BIT;
397   current_gdbarch->long_bit = 4*TARGET_CHAR_BIT;
398   current_gdbarch->long_long_bit = 2*TARGET_LONG_BIT;
399   current_gdbarch->float_bit = 4*TARGET_CHAR_BIT;
400   current_gdbarch->double_bit = 8*TARGET_CHAR_BIT;
401   current_gdbarch->long_double_bit = 8*TARGET_CHAR_BIT;
402   current_gdbarch->ptr_bit = TARGET_INT_BIT;
403   current_gdbarch->bfd_vma_bit = TARGET_ARCHITECTURE->bits_per_address;
404   current_gdbarch->char_signed = -1;
405   current_gdbarch->write_pc = generic_target_write_pc;
406   current_gdbarch->virtual_frame_pointer = legacy_virtual_frame_pointer;
407   current_gdbarch->num_regs = -1;
408   current_gdbarch->sp_regnum = -1;
409   current_gdbarch->pc_regnum = -1;
410   current_gdbarch->ps_regnum = -1;
411   current_gdbarch->fp0_regnum = -1;
412   current_gdbarch->stab_reg_to_regnum = no_op_reg_to_regnum;
413   current_gdbarch->ecoff_reg_to_regnum = no_op_reg_to_regnum;
414   current_gdbarch->dwarf_reg_to_regnum = no_op_reg_to_regnum;
415   current_gdbarch->sdb_reg_to_regnum = no_op_reg_to_regnum;
416   current_gdbarch->dwarf2_reg_to_regnum = no_op_reg_to_regnum;
417   current_gdbarch->deprecated_register_byte = generic_register_byte;
418   current_gdbarch->deprecated_fp_regnum = -1;
419   current_gdbarch->call_dummy_location = AT_ENTRY_POINT;
420   current_gdbarch->print_registers_info = default_print_registers_info;
421   current_gdbarch->register_sim_regno = legacy_register_sim_regno;
422   current_gdbarch->cannot_fetch_register = cannot_register_not;
423   current_gdbarch->cannot_store_register = cannot_register_not;
424   current_gdbarch->convert_register_p = generic_convert_register_p;
425   current_gdbarch->pointer_to_address = unsigned_pointer_to_address;
426   current_gdbarch->address_to_pointer = unsigned_address_to_pointer;
427   current_gdbarch->return_value = legacy_return_value;
428   current_gdbarch->extract_return_value = legacy_extract_return_value;
429   current_gdbarch->store_return_value = legacy_store_return_value;
430   current_gdbarch->deprecated_use_struct_convention = generic_use_struct_convention;
431   current_gdbarch->memory_insert_breakpoint = default_memory_insert_breakpoint;
432   current_gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint;
433   current_gdbarch->remote_translate_xfer_address = generic_remote_translate_xfer_address;
434   current_gdbarch->stabs_argument_has_addr = default_stabs_argument_has_addr;
435   current_gdbarch->convert_from_func_ptr_addr = convert_from_func_ptr_addr_identity;
436   current_gdbarch->addr_bits_remove = core_addr_identity;
437   current_gdbarch->smash_text_address = core_addr_identity;
438   current_gdbarch->skip_trampoline_code = generic_skip_trampoline_code;
439   current_gdbarch->skip_solib_resolver = generic_skip_solib_resolver;
440   current_gdbarch->in_solib_call_trampoline = generic_in_solib_call_trampoline;
441   current_gdbarch->in_solib_return_trampoline = generic_in_solib_return_trampoline;
442   current_gdbarch->in_function_epilogue_p = generic_in_function_epilogue_p;
443   current_gdbarch->construct_inferior_arguments = construct_inferior_arguments;
444   current_gdbarch->elf_make_msymbol_special = default_elf_make_msymbol_special;
445   current_gdbarch->coff_make_msymbol_special = default_coff_make_msymbol_special;
446   current_gdbarch->name_of_malloc = "malloc";
447   current_gdbarch->register_reggroup_p = default_register_reggroup_p;
448   /* gdbarch_alloc() */
449 
450   return current_gdbarch;
451 }
452 
453 
454 /* Allocate extra space using the per-architecture obstack.  */
455 
456 void *
gdbarch_obstack_zalloc(struct gdbarch * arch,long size)457 gdbarch_obstack_zalloc (struct gdbarch *arch, long size)
458 {
459   void *data = obstack_alloc (arch->obstack, size);
460   memset (data, 0, size);
461   return data;
462 }
463 
464 
465 /* Free a gdbarch struct.  This should never happen in normal
466    operation --- once you've created a gdbarch, you keep it around.
467    However, if an architecture's init function encounters an error
468    building the structure, it may need to clean up a partially
469    constructed gdbarch.  */
470 
471 void
gdbarch_free(struct gdbarch * arch)472 gdbarch_free (struct gdbarch *arch)
473 {
474   struct obstack *obstack;
475   gdb_assert (arch != NULL);
476   gdb_assert (!arch->initialized_p);
477   obstack = arch->obstack;
478   obstack_free (obstack, 0); /* Includes the ARCH.  */
479   xfree (obstack);
480 }
481 
482 
483 /* Ensure that all values in a GDBARCH are reasonable.  */
484 
485 /* NOTE/WARNING: The parameter is called ``current_gdbarch'' so that it
486    just happens to match the global variable ``current_gdbarch''.  That
487    way macros refering to that variable get the local and not the global
488    version - ulgh.  Once everything is parameterised with gdbarch, this
489    will go away. */
490 
491 static void
verify_gdbarch(struct gdbarch * current_gdbarch)492 verify_gdbarch (struct gdbarch *current_gdbarch)
493 {
494   struct ui_file *log;
495   struct cleanup *cleanups;
496   long dummy;
497   char *buf;
498   log = mem_fileopen ();
499   cleanups = make_cleanup_ui_file_delete (log);
500   /* fundamental */
501   if (current_gdbarch->byte_order == BFD_ENDIAN_UNKNOWN)
502     fprintf_unfiltered (log, "\n\tbyte-order");
503   if (current_gdbarch->bfd_arch_info == NULL)
504     fprintf_unfiltered (log, "\n\tbfd_arch_info");
505   /* Check those that need to be defined for the given multi-arch level. */
506   /* Skip verify of short_bit, invalid_p == 0 */
507   /* Skip verify of int_bit, invalid_p == 0 */
508   /* Skip verify of long_bit, invalid_p == 0 */
509   /* Skip verify of long_long_bit, invalid_p == 0 */
510   /* Skip verify of float_bit, invalid_p == 0 */
511   if (current_gdbarch->float_format == 0)
512     current_gdbarch->float_format = default_float_format (current_gdbarch);
513   /* Skip verify of double_bit, invalid_p == 0 */
514   if (current_gdbarch->double_format == 0)
515     current_gdbarch->double_format = default_double_format (current_gdbarch);
516   /* Skip verify of long_double_bit, invalid_p == 0 */
517   if (current_gdbarch->long_double_format == 0)
518     current_gdbarch->long_double_format = default_double_format (current_gdbarch);
519   /* Skip verify of ptr_bit, invalid_p == 0 */
520   if (current_gdbarch->addr_bit == 0)
521     current_gdbarch->addr_bit = TARGET_PTR_BIT;
522   /* Skip verify of bfd_vma_bit, invalid_p == 0 */
523   if (current_gdbarch->char_signed == -1)
524     current_gdbarch->char_signed = 1;
525   /* Skip verify of read_pc, has predicate */
526   /* Skip verify of write_pc, invalid_p == 0 */
527   /* Skip verify of read_sp, has predicate */
528   /* Skip verify of virtual_frame_pointer, invalid_p == 0 */
529   /* Skip verify of pseudo_register_read, has predicate */
530   /* Skip verify of pseudo_register_write, has predicate */
531   if (current_gdbarch->num_regs == -1)
532     fprintf_unfiltered (log, "\n\tnum_regs");
533   /* Skip verify of num_pseudo_regs, invalid_p == 0 */
534   /* Skip verify of sp_regnum, invalid_p == 0 */
535   /* Skip verify of pc_regnum, invalid_p == 0 */
536   /* Skip verify of ps_regnum, invalid_p == 0 */
537   /* Skip verify of fp0_regnum, invalid_p == 0 */
538   /* Skip verify of stab_reg_to_regnum, invalid_p == 0 */
539   /* Skip verify of ecoff_reg_to_regnum, invalid_p == 0 */
540   /* Skip verify of dwarf_reg_to_regnum, invalid_p == 0 */
541   /* Skip verify of sdb_reg_to_regnum, invalid_p == 0 */
542   /* Skip verify of dwarf2_reg_to_regnum, invalid_p == 0 */
543   /* Skip verify of register_type, has predicate */
544   /* Skip verify of deprecated_register_byte, has predicate */
545   /* Skip verify of unwind_dummy_id, has predicate */
546   /* Skip verify of deprecated_fp_regnum, invalid_p == 0 */
547   /* Skip verify of push_dummy_call, has predicate */
548   /* Skip verify of deprecated_push_arguments, has predicate */
549   /* Skip verify of call_dummy_location, invalid_p == 0 */
550   /* Skip verify of push_dummy_code, has predicate */
551   /* Skip verify of print_registers_info, invalid_p == 0 */
552   /* Skip verify of print_float_info, has predicate */
553   /* Skip verify of print_vector_info, has predicate */
554   /* Skip verify of register_sim_regno, invalid_p == 0 */
555   /* Skip verify of register_bytes_ok, has predicate */
556   /* Skip verify of cannot_fetch_register, invalid_p == 0 */
557   /* Skip verify of cannot_store_register, invalid_p == 0 */
558   /* Skip verify of get_longjmp_target, has predicate */
559   /* Skip verify of convert_register_p, invalid_p == 0 */
560   /* Skip verify of pointer_to_address, invalid_p == 0 */
561   /* Skip verify of address_to_pointer, invalid_p == 0 */
562   /* Skip verify of integer_to_address, has predicate */
563   /* Skip verify of deprecated_store_struct_return, has predicate */
564   /* Skip verify of return_value, has predicate */
565   /* Skip verify of extract_return_value, invalid_p == 0 */
566   /* Skip verify of store_return_value, invalid_p == 0 */
567   /* Skip verify of deprecated_use_struct_convention, invalid_p == 0 */
568   /* Skip verify of deprecated_extract_struct_value_address, has predicate */
569   if (current_gdbarch->skip_prologue == 0)
570     fprintf_unfiltered (log, "\n\tskip_prologue");
571   if (current_gdbarch->inner_than == 0)
572     fprintf_unfiltered (log, "\n\tinner_than");
573   if (current_gdbarch->breakpoint_from_pc == 0)
574     fprintf_unfiltered (log, "\n\tbreakpoint_from_pc");
575   /* Skip verify of adjust_breakpoint_address, has predicate */
576   /* Skip verify of memory_insert_breakpoint, invalid_p == 0 */
577   /* Skip verify of memory_remove_breakpoint, invalid_p == 0 */
578   /* Skip verify of decr_pc_after_break, invalid_p == 0 */
579   /* Skip verify of deprecated_function_start_offset, invalid_p == 0 */
580   /* Skip verify of remote_translate_xfer_address, invalid_p == 0 */
581   /* Skip verify of frame_args_skip, invalid_p == 0 */
582   /* Skip verify of unwind_pc, has predicate */
583   /* Skip verify of unwind_sp, has predicate */
584   /* Skip verify of deprecated_saved_pc_after_call, has predicate */
585   /* Skip verify of frame_num_args, has predicate */
586   /* Skip verify of deprecated_stack_align, has predicate */
587   /* Skip verify of frame_align, has predicate */
588   /* Skip verify of deprecated_reg_struct_has_addr, has predicate */
589   /* Skip verify of stabs_argument_has_addr, invalid_p == 0 */
590   /* Skip verify of convert_from_func_ptr_addr, invalid_p == 0 */
591   /* Skip verify of addr_bits_remove, invalid_p == 0 */
592   /* Skip verify of smash_text_address, invalid_p == 0 */
593   /* Skip verify of software_single_step, has predicate */
594   if (current_gdbarch->print_insn == 0)
595     fprintf_unfiltered (log, "\n\tprint_insn");
596   /* Skip verify of skip_trampoline_code, invalid_p == 0 */
597   /* Skip verify of skip_solib_resolver, invalid_p == 0 */
598   /* Skip verify of in_solib_call_trampoline, invalid_p == 0 */
599   /* Skip verify of in_solib_return_trampoline, invalid_p == 0 */
600   /* Skip verify of in_function_epilogue_p, invalid_p == 0 */
601   /* Skip verify of construct_inferior_arguments, invalid_p == 0 */
602   /* Skip verify of elf_make_msymbol_special, invalid_p == 0 */
603   /* Skip verify of coff_make_msymbol_special, invalid_p == 0 */
604   /* Skip verify of name_of_malloc, invalid_p == 0 */
605   /* Skip verify of cannot_step_breakpoint, invalid_p == 0 */
606   /* Skip verify of have_nonsteppable_watchpoint, invalid_p == 0 */
607   /* Skip verify of address_class_type_flags, has predicate */
608   /* Skip verify of address_class_type_flags_to_name, has predicate */
609   /* Skip verify of address_class_name_to_type_flags, has predicate */
610   /* Skip verify of register_reggroup_p, invalid_p == 0 */
611   /* Skip verify of fetch_pointer_argument, has predicate */
612   /* Skip verify of regset_from_core_section, has predicate */
613   buf = ui_file_xstrdup (log, &dummy);
614   make_cleanup (xfree, buf);
615   if (strlen (buf) > 0)
616     internal_error (__FILE__, __LINE__,
617                     "verify_gdbarch: the following are invalid ...%s",
618                     buf);
619   do_cleanups (cleanups);
620 }
621 
622 
623 /* Print out the details of the current architecture. */
624 
625 /* NOTE/WARNING: The parameter is called ``current_gdbarch'' so that it
626    just happens to match the global variable ``current_gdbarch''.  That
627    way macros refering to that variable get the local and not the global
628    version - ulgh.  Once everything is parameterised with gdbarch, this
629    will go away. */
630 
631 void
gdbarch_dump(struct gdbarch * current_gdbarch,struct ui_file * file)632 gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file)
633 {
634   const char *gdb_xm_file = "<not-defined>";
635   const char *gdb_nm_file = "<not-defined>";
636   const char *gdb_tm_file = "<not-defined>";
637 #if defined (GDB_XM_FILE)
638   gdb_xm_file = GDB_XM_FILE;
639 #endif
640   fprintf_unfiltered (file,
641                       "gdbarch_dump: GDB_XM_FILE = %s\n",
642                       gdb_xm_file);
643 #if defined (GDB_NM_FILE)
644   gdb_nm_file = GDB_NM_FILE;
645 #endif
646   fprintf_unfiltered (file,
647                       "gdbarch_dump: GDB_NM_FILE = %s\n",
648                       gdb_nm_file);
649 #if defined (GDB_TM_FILE)
650   gdb_tm_file = GDB_TM_FILE;
651 #endif
652   fprintf_unfiltered (file,
653                       "gdbarch_dump: GDB_TM_FILE = %s\n",
654                       gdb_tm_file);
655 #ifdef TARGET_ADDR_BIT
656   fprintf_unfiltered (file,
657                       "gdbarch_dump: TARGET_ADDR_BIT # %s\n",
658                       XSTRING (TARGET_ADDR_BIT));
659 #endif
660   fprintf_unfiltered (file,
661                       "gdbarch_dump: addr_bit = %s\n",
662                       paddr_d (current_gdbarch->addr_bit));
663 #ifdef ADDR_BITS_REMOVE
664   fprintf_unfiltered (file,
665                       "gdbarch_dump: %s # %s\n",
666                       "ADDR_BITS_REMOVE(addr)",
667                       XSTRING (ADDR_BITS_REMOVE (addr)));
668 #endif
669   fprintf_unfiltered (file,
670                       "gdbarch_dump: addr_bits_remove = <0x%lx>\n",
671                       (long) current_gdbarch->addr_bits_remove);
672   fprintf_unfiltered (file,
673                       "gdbarch_dump: gdbarch_address_class_name_to_type_flags_p() = %d\n",
674                       gdbarch_address_class_name_to_type_flags_p (current_gdbarch));
675   fprintf_unfiltered (file,
676                       "gdbarch_dump: address_class_name_to_type_flags = <0x%lx>\n",
677                       (long) current_gdbarch->address_class_name_to_type_flags);
678 #ifdef ADDRESS_CLASS_TYPE_FLAGS_P
679   fprintf_unfiltered (file,
680                       "gdbarch_dump: %s # %s\n",
681                       "ADDRESS_CLASS_TYPE_FLAGS_P()",
682                       XSTRING (ADDRESS_CLASS_TYPE_FLAGS_P ()));
683 #endif
684   fprintf_unfiltered (file,
685                       "gdbarch_dump: gdbarch_address_class_type_flags_p() = %d\n",
686                       gdbarch_address_class_type_flags_p (current_gdbarch));
687 #ifdef ADDRESS_CLASS_TYPE_FLAGS
688   fprintf_unfiltered (file,
689                       "gdbarch_dump: %s # %s\n",
690                       "ADDRESS_CLASS_TYPE_FLAGS(byte_size, dwarf2_addr_class)",
691                       XSTRING (ADDRESS_CLASS_TYPE_FLAGS (byte_size, dwarf2_addr_class)));
692 #endif
693   fprintf_unfiltered (file,
694                       "gdbarch_dump: address_class_type_flags = <0x%lx>\n",
695                       (long) current_gdbarch->address_class_type_flags);
696   fprintf_unfiltered (file,
697                       "gdbarch_dump: gdbarch_address_class_type_flags_to_name_p() = %d\n",
698                       gdbarch_address_class_type_flags_to_name_p (current_gdbarch));
699   fprintf_unfiltered (file,
700                       "gdbarch_dump: address_class_type_flags_to_name = <0x%lx>\n",
701                       (long) current_gdbarch->address_class_type_flags_to_name);
702 #ifdef ADDRESS_TO_POINTER
703   fprintf_unfiltered (file,
704                       "gdbarch_dump: %s # %s\n",
705                       "ADDRESS_TO_POINTER(type, buf, addr)",
706                       XSTRING (ADDRESS_TO_POINTER (type, buf, addr)));
707 #endif
708   fprintf_unfiltered (file,
709                       "gdbarch_dump: address_to_pointer = <0x%lx>\n",
710                       (long) current_gdbarch->address_to_pointer);
711   fprintf_unfiltered (file,
712                       "gdbarch_dump: gdbarch_adjust_breakpoint_address_p() = %d\n",
713                       gdbarch_adjust_breakpoint_address_p (current_gdbarch));
714   fprintf_unfiltered (file,
715                       "gdbarch_dump: adjust_breakpoint_address = <0x%lx>\n",
716                       (long) current_gdbarch->adjust_breakpoint_address);
717 #ifdef BELIEVE_PCC_PROMOTION
718   fprintf_unfiltered (file,
719                       "gdbarch_dump: BELIEVE_PCC_PROMOTION # %s\n",
720                       XSTRING (BELIEVE_PCC_PROMOTION));
721 #endif
722   fprintf_unfiltered (file,
723                       "gdbarch_dump: believe_pcc_promotion = %s\n",
724                       paddr_d (current_gdbarch->believe_pcc_promotion));
725 #ifdef TARGET_ARCHITECTURE
726   fprintf_unfiltered (file,
727                       "gdbarch_dump: TARGET_ARCHITECTURE # %s\n",
728                       XSTRING (TARGET_ARCHITECTURE));
729 #endif
730   fprintf_unfiltered (file,
731                       "gdbarch_dump: bfd_arch_info = %s\n",
732                       TARGET_ARCHITECTURE->printable_name);
733 #ifdef TARGET_BFD_VMA_BIT
734   fprintf_unfiltered (file,
735                       "gdbarch_dump: TARGET_BFD_VMA_BIT # %s\n",
736                       XSTRING (TARGET_BFD_VMA_BIT));
737 #endif
738   fprintf_unfiltered (file,
739                       "gdbarch_dump: bfd_vma_bit = %s\n",
740                       paddr_d (current_gdbarch->bfd_vma_bit));
741 #ifdef BREAKPOINT_FROM_PC
742   fprintf_unfiltered (file,
743                       "gdbarch_dump: %s # %s\n",
744                       "BREAKPOINT_FROM_PC(pcptr, lenptr)",
745                       XSTRING (BREAKPOINT_FROM_PC (pcptr, lenptr)));
746 #endif
747   fprintf_unfiltered (file,
748                       "gdbarch_dump: breakpoint_from_pc = <0x%lx>\n",
749                       (long) current_gdbarch->breakpoint_from_pc);
750 #ifdef TARGET_BYTE_ORDER
751   fprintf_unfiltered (file,
752                       "gdbarch_dump: TARGET_BYTE_ORDER # %s\n",
753                       XSTRING (TARGET_BYTE_ORDER));
754 #endif
755   fprintf_unfiltered (file,
756                       "gdbarch_dump: byte_order = %s\n",
757                       paddr_d (current_gdbarch->byte_order));
758 #ifdef CALL_DUMMY_LOCATION
759   fprintf_unfiltered (file,
760                       "gdbarch_dump: CALL_DUMMY_LOCATION # %s\n",
761                       XSTRING (CALL_DUMMY_LOCATION));
762 #endif
763   fprintf_unfiltered (file,
764                       "gdbarch_dump: call_dummy_location = %s\n",
765                       paddr_d (current_gdbarch->call_dummy_location));
766 #ifdef CANNOT_FETCH_REGISTER
767   fprintf_unfiltered (file,
768                       "gdbarch_dump: %s # %s\n",
769                       "CANNOT_FETCH_REGISTER(regnum)",
770                       XSTRING (CANNOT_FETCH_REGISTER (regnum)));
771 #endif
772   fprintf_unfiltered (file,
773                       "gdbarch_dump: cannot_fetch_register = <0x%lx>\n",
774                       (long) current_gdbarch->cannot_fetch_register);
775 #ifdef CANNOT_STEP_BREAKPOINT
776   fprintf_unfiltered (file,
777                       "gdbarch_dump: CANNOT_STEP_BREAKPOINT # %s\n",
778                       XSTRING (CANNOT_STEP_BREAKPOINT));
779 #endif
780   fprintf_unfiltered (file,
781                       "gdbarch_dump: cannot_step_breakpoint = %s\n",
782                       paddr_d (current_gdbarch->cannot_step_breakpoint));
783 #ifdef CANNOT_STORE_REGISTER
784   fprintf_unfiltered (file,
785                       "gdbarch_dump: %s # %s\n",
786                       "CANNOT_STORE_REGISTER(regnum)",
787                       XSTRING (CANNOT_STORE_REGISTER (regnum)));
788 #endif
789   fprintf_unfiltered (file,
790                       "gdbarch_dump: cannot_store_register = <0x%lx>\n",
791                       (long) current_gdbarch->cannot_store_register);
792 #ifdef TARGET_CHAR_SIGNED
793   fprintf_unfiltered (file,
794                       "gdbarch_dump: TARGET_CHAR_SIGNED # %s\n",
795                       XSTRING (TARGET_CHAR_SIGNED));
796 #endif
797   fprintf_unfiltered (file,
798                       "gdbarch_dump: char_signed = %s\n",
799                       paddr_d (current_gdbarch->char_signed));
800 #ifdef COFF_MAKE_MSYMBOL_SPECIAL
801   fprintf_unfiltered (file,
802                       "gdbarch_dump: %s # %s\n",
803                       "COFF_MAKE_MSYMBOL_SPECIAL(val, msym)",
804                       XSTRING (COFF_MAKE_MSYMBOL_SPECIAL (val, msym)));
805 #endif
806   fprintf_unfiltered (file,
807                       "gdbarch_dump: coff_make_msymbol_special = <0x%lx>\n",
808                       (long) current_gdbarch->coff_make_msymbol_special);
809   fprintf_unfiltered (file,
810                       "gdbarch_dump: construct_inferior_arguments = <0x%lx>\n",
811                       (long) current_gdbarch->construct_inferior_arguments);
812   fprintf_unfiltered (file,
813                       "gdbarch_dump: convert_from_func_ptr_addr = <0x%lx>\n",
814                       (long) current_gdbarch->convert_from_func_ptr_addr);
815 #ifdef CONVERT_REGISTER_P
816   fprintf_unfiltered (file,
817                       "gdbarch_dump: %s # %s\n",
818                       "CONVERT_REGISTER_P(regnum, type)",
819                       XSTRING (CONVERT_REGISTER_P (regnum, type)));
820 #endif
821   fprintf_unfiltered (file,
822                       "gdbarch_dump: convert_register_p = <0x%lx>\n",
823                       (long) current_gdbarch->convert_register_p);
824 #ifdef DECR_PC_AFTER_BREAK
825   fprintf_unfiltered (file,
826                       "gdbarch_dump: DECR_PC_AFTER_BREAK # %s\n",
827                       XSTRING (DECR_PC_AFTER_BREAK));
828 #endif
829   fprintf_unfiltered (file,
830                       "gdbarch_dump: decr_pc_after_break = 0x%s\n",
831                       paddr_nz (current_gdbarch->decr_pc_after_break));
832 #ifdef DEPRECATED_EXTRACT_RETURN_VALUE
833   fprintf_unfiltered (file,
834                       "gdbarch_dump: %s # %s\n",
835                       "DEPRECATED_EXTRACT_RETURN_VALUE(type, regbuf, valbuf)",
836                       XSTRING (DEPRECATED_EXTRACT_RETURN_VALUE (type, regbuf, valbuf)));
837 #endif
838   fprintf_unfiltered (file,
839                       "gdbarch_dump: deprecated_extract_return_value = <0x%lx>\n",
840                       (long) current_gdbarch->deprecated_extract_return_value);
841 #ifdef DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P
842   fprintf_unfiltered (file,
843                       "gdbarch_dump: %s # %s\n",
844                       "DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P()",
845                       XSTRING (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P ()));
846 #endif
847   fprintf_unfiltered (file,
848                       "gdbarch_dump: gdbarch_deprecated_extract_struct_value_address_p() = %d\n",
849                       gdbarch_deprecated_extract_struct_value_address_p (current_gdbarch));
850 #ifdef DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS
851   fprintf_unfiltered (file,
852                       "gdbarch_dump: %s # %s\n",
853                       "DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(regcache)",
854                       XSTRING (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS (regcache)));
855 #endif
856   fprintf_unfiltered (file,
857                       "gdbarch_dump: deprecated_extract_struct_value_address = <0x%lx>\n",
858                       (long) current_gdbarch->deprecated_extract_struct_value_address);
859 #ifdef DEPRECATED_FP_REGNUM
860   fprintf_unfiltered (file,
861                       "gdbarch_dump: DEPRECATED_FP_REGNUM # %s\n",
862                       XSTRING (DEPRECATED_FP_REGNUM));
863 #endif
864   fprintf_unfiltered (file,
865                       "gdbarch_dump: deprecated_fp_regnum = %s\n",
866                       paddr_d (current_gdbarch->deprecated_fp_regnum));
867 #ifdef DEPRECATED_FUNCTION_START_OFFSET
868   fprintf_unfiltered (file,
869                       "gdbarch_dump: DEPRECATED_FUNCTION_START_OFFSET # %s\n",
870                       XSTRING (DEPRECATED_FUNCTION_START_OFFSET));
871 #endif
872   fprintf_unfiltered (file,
873                       "gdbarch_dump: deprecated_function_start_offset = 0x%s\n",
874                       paddr_nz (current_gdbarch->deprecated_function_start_offset));
875 #ifdef DEPRECATED_PUSH_ARGUMENTS_P
876   fprintf_unfiltered (file,
877                       "gdbarch_dump: %s # %s\n",
878                       "DEPRECATED_PUSH_ARGUMENTS_P()",
879                       XSTRING (DEPRECATED_PUSH_ARGUMENTS_P ()));
880 #endif
881   fprintf_unfiltered (file,
882                       "gdbarch_dump: gdbarch_deprecated_push_arguments_p() = %d\n",
883                       gdbarch_deprecated_push_arguments_p (current_gdbarch));
884 #ifdef DEPRECATED_PUSH_ARGUMENTS
885   fprintf_unfiltered (file,
886                       "gdbarch_dump: %s # %s\n",
887                       "DEPRECATED_PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr)",
888                       XSTRING (DEPRECATED_PUSH_ARGUMENTS (nargs, args, sp, struct_return, struct_addr)));
889 #endif
890   fprintf_unfiltered (file,
891                       "gdbarch_dump: deprecated_push_arguments = <0x%lx>\n",
892                       (long) current_gdbarch->deprecated_push_arguments);
893 #ifdef DEPRECATED_REG_STRUCT_HAS_ADDR_P
894   fprintf_unfiltered (file,
895                       "gdbarch_dump: %s # %s\n",
896                       "DEPRECATED_REG_STRUCT_HAS_ADDR_P()",
897                       XSTRING (DEPRECATED_REG_STRUCT_HAS_ADDR_P ()));
898 #endif
899   fprintf_unfiltered (file,
900                       "gdbarch_dump: gdbarch_deprecated_reg_struct_has_addr_p() = %d\n",
901                       gdbarch_deprecated_reg_struct_has_addr_p (current_gdbarch));
902 #ifdef DEPRECATED_REG_STRUCT_HAS_ADDR
903   fprintf_unfiltered (file,
904                       "gdbarch_dump: %s # %s\n",
905                       "DEPRECATED_REG_STRUCT_HAS_ADDR(gcc_p, type)",
906                       XSTRING (DEPRECATED_REG_STRUCT_HAS_ADDR (gcc_p, type)));
907 #endif
908   fprintf_unfiltered (file,
909                       "gdbarch_dump: deprecated_reg_struct_has_addr = <0x%lx>\n",
910                       (long) current_gdbarch->deprecated_reg_struct_has_addr);
911 #ifdef DEPRECATED_REGISTER_BYTE_P
912   fprintf_unfiltered (file,
913                       "gdbarch_dump: %s # %s\n",
914                       "DEPRECATED_REGISTER_BYTE_P()",
915                       XSTRING (DEPRECATED_REGISTER_BYTE_P ()));
916 #endif
917   fprintf_unfiltered (file,
918                       "gdbarch_dump: gdbarch_deprecated_register_byte_p() = %d\n",
919                       gdbarch_deprecated_register_byte_p (current_gdbarch));
920 #ifdef DEPRECATED_REGISTER_BYTE
921   fprintf_unfiltered (file,
922                       "gdbarch_dump: %s # %s\n",
923                       "DEPRECATED_REGISTER_BYTE(reg_nr)",
924                       XSTRING (DEPRECATED_REGISTER_BYTE (reg_nr)));
925 #endif
926   fprintf_unfiltered (file,
927                       "gdbarch_dump: deprecated_register_byte = <0x%lx>\n",
928                       (long) current_gdbarch->deprecated_register_byte);
929 #ifdef DEPRECATED_REGISTER_SIZE
930   fprintf_unfiltered (file,
931                       "gdbarch_dump: DEPRECATED_REGISTER_SIZE # %s\n",
932                       XSTRING (DEPRECATED_REGISTER_SIZE));
933 #endif
934   fprintf_unfiltered (file,
935                       "gdbarch_dump: deprecated_register_size = %s\n",
936                       paddr_d (current_gdbarch->deprecated_register_size));
937 #ifdef DEPRECATED_SAVED_PC_AFTER_CALL_P
938   fprintf_unfiltered (file,
939                       "gdbarch_dump: %s # %s\n",
940                       "DEPRECATED_SAVED_PC_AFTER_CALL_P()",
941                       XSTRING (DEPRECATED_SAVED_PC_AFTER_CALL_P ()));
942 #endif
943   fprintf_unfiltered (file,
944                       "gdbarch_dump: gdbarch_deprecated_saved_pc_after_call_p() = %d\n",
945                       gdbarch_deprecated_saved_pc_after_call_p (current_gdbarch));
946 #ifdef DEPRECATED_SAVED_PC_AFTER_CALL
947   fprintf_unfiltered (file,
948                       "gdbarch_dump: %s # %s\n",
949                       "DEPRECATED_SAVED_PC_AFTER_CALL(frame)",
950                       XSTRING (DEPRECATED_SAVED_PC_AFTER_CALL (frame)));
951 #endif
952   fprintf_unfiltered (file,
953                       "gdbarch_dump: deprecated_saved_pc_after_call = <0x%lx>\n",
954                       (long) current_gdbarch->deprecated_saved_pc_after_call);
955 #ifdef DEPRECATED_STACK_ALIGN_P
956   fprintf_unfiltered (file,
957                       "gdbarch_dump: %s # %s\n",
958                       "DEPRECATED_STACK_ALIGN_P()",
959                       XSTRING (DEPRECATED_STACK_ALIGN_P ()));
960 #endif
961   fprintf_unfiltered (file,
962                       "gdbarch_dump: gdbarch_deprecated_stack_align_p() = %d\n",
963                       gdbarch_deprecated_stack_align_p (current_gdbarch));
964 #ifdef DEPRECATED_STACK_ALIGN
965   fprintf_unfiltered (file,
966                       "gdbarch_dump: %s # %s\n",
967                       "DEPRECATED_STACK_ALIGN(sp)",
968                       XSTRING (DEPRECATED_STACK_ALIGN (sp)));
969 #endif
970   fprintf_unfiltered (file,
971                       "gdbarch_dump: deprecated_stack_align = <0x%lx>\n",
972                       (long) current_gdbarch->deprecated_stack_align);
973 #ifdef DEPRECATED_STORE_RETURN_VALUE
974   fprintf_unfiltered (file,
975                       "gdbarch_dump: %s # %s\n",
976                       "DEPRECATED_STORE_RETURN_VALUE(type, valbuf)",
977                       XSTRING (DEPRECATED_STORE_RETURN_VALUE (type, valbuf)));
978 #endif
979   fprintf_unfiltered (file,
980                       "gdbarch_dump: deprecated_store_return_value = <0x%lx>\n",
981                       (long) current_gdbarch->deprecated_store_return_value);
982 #ifdef DEPRECATED_STORE_STRUCT_RETURN_P
983   fprintf_unfiltered (file,
984                       "gdbarch_dump: %s # %s\n",
985                       "DEPRECATED_STORE_STRUCT_RETURN_P()",
986                       XSTRING (DEPRECATED_STORE_STRUCT_RETURN_P ()));
987 #endif
988   fprintf_unfiltered (file,
989                       "gdbarch_dump: gdbarch_deprecated_store_struct_return_p() = %d\n",
990                       gdbarch_deprecated_store_struct_return_p (current_gdbarch));
991 #ifdef DEPRECATED_STORE_STRUCT_RETURN
992   fprintf_unfiltered (file,
993                       "gdbarch_dump: %s # %s\n",
994                       "DEPRECATED_STORE_STRUCT_RETURN(addr, sp)",
995                       XSTRING (DEPRECATED_STORE_STRUCT_RETURN (addr, sp)));
996 #endif
997   fprintf_unfiltered (file,
998                       "gdbarch_dump: deprecated_store_struct_return = <0x%lx>\n",
999                       (long) current_gdbarch->deprecated_store_struct_return);
1000 #ifdef DEPRECATED_USE_STRUCT_CONVENTION
1001   fprintf_unfiltered (file,
1002                       "gdbarch_dump: %s # %s\n",
1003                       "DEPRECATED_USE_STRUCT_CONVENTION(gcc_p, value_type)",
1004                       XSTRING (DEPRECATED_USE_STRUCT_CONVENTION (gcc_p, value_type)));
1005 #endif
1006   fprintf_unfiltered (file,
1007                       "gdbarch_dump: deprecated_use_struct_convention = <0x%lx>\n",
1008                       (long) current_gdbarch->deprecated_use_struct_convention);
1009 #ifdef TARGET_DOUBLE_BIT
1010   fprintf_unfiltered (file,
1011                       "gdbarch_dump: TARGET_DOUBLE_BIT # %s\n",
1012                       XSTRING (TARGET_DOUBLE_BIT));
1013 #endif
1014   fprintf_unfiltered (file,
1015                       "gdbarch_dump: double_bit = %s\n",
1016                       paddr_d (current_gdbarch->double_bit));
1017 #ifdef TARGET_DOUBLE_FORMAT
1018   fprintf_unfiltered (file,
1019                       "gdbarch_dump: TARGET_DOUBLE_FORMAT # %s\n",
1020                       XSTRING (TARGET_DOUBLE_FORMAT));
1021 #endif
1022   fprintf_unfiltered (file,
1023                       "gdbarch_dump: double_format = %s\n",
1024                       pformat (current_gdbarch->double_format));
1025 #ifdef DWARF2_REG_TO_REGNUM
1026   fprintf_unfiltered (file,
1027                       "gdbarch_dump: %s # %s\n",
1028                       "DWARF2_REG_TO_REGNUM(dwarf2_regnr)",
1029                       XSTRING (DWARF2_REG_TO_REGNUM (dwarf2_regnr)));
1030 #endif
1031   fprintf_unfiltered (file,
1032                       "gdbarch_dump: dwarf2_reg_to_regnum = <0x%lx>\n",
1033                       (long) current_gdbarch->dwarf2_reg_to_regnum);
1034 #ifdef DWARF_REG_TO_REGNUM
1035   fprintf_unfiltered (file,
1036                       "gdbarch_dump: %s # %s\n",
1037                       "DWARF_REG_TO_REGNUM(dwarf_regnr)",
1038                       XSTRING (DWARF_REG_TO_REGNUM (dwarf_regnr)));
1039 #endif
1040   fprintf_unfiltered (file,
1041                       "gdbarch_dump: dwarf_reg_to_regnum = <0x%lx>\n",
1042                       (long) current_gdbarch->dwarf_reg_to_regnum);
1043 #ifdef ECOFF_REG_TO_REGNUM
1044   fprintf_unfiltered (file,
1045                       "gdbarch_dump: %s # %s\n",
1046                       "ECOFF_REG_TO_REGNUM(ecoff_regnr)",
1047                       XSTRING (ECOFF_REG_TO_REGNUM (ecoff_regnr)));
1048 #endif
1049   fprintf_unfiltered (file,
1050                       "gdbarch_dump: ecoff_reg_to_regnum = <0x%lx>\n",
1051                       (long) current_gdbarch->ecoff_reg_to_regnum);
1052 #ifdef ELF_MAKE_MSYMBOL_SPECIAL
1053   fprintf_unfiltered (file,
1054                       "gdbarch_dump: %s # %s\n",
1055                       "ELF_MAKE_MSYMBOL_SPECIAL(sym, msym)",
1056                       XSTRING (ELF_MAKE_MSYMBOL_SPECIAL (sym, msym)));
1057 #endif
1058   fprintf_unfiltered (file,
1059                       "gdbarch_dump: elf_make_msymbol_special = <0x%lx>\n",
1060                       (long) current_gdbarch->elf_make_msymbol_special);
1061 #ifdef EXTRACT_RETURN_VALUE
1062   fprintf_unfiltered (file,
1063                       "gdbarch_dump: %s # %s\n",
1064                       "EXTRACT_RETURN_VALUE(type, regcache, valbuf)",
1065                       XSTRING (EXTRACT_RETURN_VALUE (type, regcache, valbuf)));
1066 #endif
1067   fprintf_unfiltered (file,
1068                       "gdbarch_dump: extract_return_value = <0x%lx>\n",
1069                       (long) current_gdbarch->extract_return_value);
1070 #ifdef FETCH_POINTER_ARGUMENT_P
1071   fprintf_unfiltered (file,
1072                       "gdbarch_dump: %s # %s\n",
1073                       "FETCH_POINTER_ARGUMENT_P()",
1074                       XSTRING (FETCH_POINTER_ARGUMENT_P ()));
1075 #endif
1076   fprintf_unfiltered (file,
1077                       "gdbarch_dump: gdbarch_fetch_pointer_argument_p() = %d\n",
1078                       gdbarch_fetch_pointer_argument_p (current_gdbarch));
1079 #ifdef FETCH_POINTER_ARGUMENT
1080   fprintf_unfiltered (file,
1081                       "gdbarch_dump: %s # %s\n",
1082                       "FETCH_POINTER_ARGUMENT(frame, argi, type)",
1083                       XSTRING (FETCH_POINTER_ARGUMENT (frame, argi, type)));
1084 #endif
1085   fprintf_unfiltered (file,
1086                       "gdbarch_dump: fetch_pointer_argument = <0x%lx>\n",
1087                       (long) current_gdbarch->fetch_pointer_argument);
1088 #ifdef TARGET_FLOAT_BIT
1089   fprintf_unfiltered (file,
1090                       "gdbarch_dump: TARGET_FLOAT_BIT # %s\n",
1091                       XSTRING (TARGET_FLOAT_BIT));
1092 #endif
1093   fprintf_unfiltered (file,
1094                       "gdbarch_dump: float_bit = %s\n",
1095                       paddr_d (current_gdbarch->float_bit));
1096 #ifdef TARGET_FLOAT_FORMAT
1097   fprintf_unfiltered (file,
1098                       "gdbarch_dump: TARGET_FLOAT_FORMAT # %s\n",
1099                       XSTRING (TARGET_FLOAT_FORMAT));
1100 #endif
1101   fprintf_unfiltered (file,
1102                       "gdbarch_dump: float_format = %s\n",
1103                       pformat (current_gdbarch->float_format));
1104 #ifdef FP0_REGNUM
1105   fprintf_unfiltered (file,
1106                       "gdbarch_dump: FP0_REGNUM # %s\n",
1107                       XSTRING (FP0_REGNUM));
1108 #endif
1109   fprintf_unfiltered (file,
1110                       "gdbarch_dump: fp0_regnum = %s\n",
1111                       paddr_d (current_gdbarch->fp0_regnum));
1112   fprintf_unfiltered (file,
1113                       "gdbarch_dump: gdbarch_frame_align_p() = %d\n",
1114                       gdbarch_frame_align_p (current_gdbarch));
1115   fprintf_unfiltered (file,
1116                       "gdbarch_dump: frame_align = <0x%lx>\n",
1117                       (long) current_gdbarch->frame_align);
1118 #ifdef FRAME_ARGS_SKIP
1119   fprintf_unfiltered (file,
1120                       "gdbarch_dump: FRAME_ARGS_SKIP # %s\n",
1121                       XSTRING (FRAME_ARGS_SKIP));
1122 #endif
1123   fprintf_unfiltered (file,
1124                       "gdbarch_dump: frame_args_skip = 0x%s\n",
1125                       paddr_nz (current_gdbarch->frame_args_skip));
1126 #ifdef FRAME_NUM_ARGS_P
1127   fprintf_unfiltered (file,
1128                       "gdbarch_dump: %s # %s\n",
1129                       "FRAME_NUM_ARGS_P()",
1130                       XSTRING (FRAME_NUM_ARGS_P ()));
1131 #endif
1132   fprintf_unfiltered (file,
1133                       "gdbarch_dump: gdbarch_frame_num_args_p() = %d\n",
1134                       gdbarch_frame_num_args_p (current_gdbarch));
1135 #ifdef FRAME_NUM_ARGS
1136   fprintf_unfiltered (file,
1137                       "gdbarch_dump: %s # %s\n",
1138                       "FRAME_NUM_ARGS(frame)",
1139                       XSTRING (FRAME_NUM_ARGS (frame)));
1140 #endif
1141   fprintf_unfiltered (file,
1142                       "gdbarch_dump: frame_num_args = <0x%lx>\n",
1143                       (long) current_gdbarch->frame_num_args);
1144 #ifdef FRAME_RED_ZONE_SIZE
1145   fprintf_unfiltered (file,
1146                       "gdbarch_dump: FRAME_RED_ZONE_SIZE # %s\n",
1147                       XSTRING (FRAME_RED_ZONE_SIZE));
1148 #endif
1149   fprintf_unfiltered (file,
1150                       "gdbarch_dump: frame_red_zone_size = %s\n",
1151                       paddr_d (current_gdbarch->frame_red_zone_size));
1152 #ifdef GET_LONGJMP_TARGET_P
1153   fprintf_unfiltered (file,
1154                       "gdbarch_dump: %s # %s\n",
1155                       "GET_LONGJMP_TARGET_P()",
1156                       XSTRING (GET_LONGJMP_TARGET_P ()));
1157 #endif
1158   fprintf_unfiltered (file,
1159                       "gdbarch_dump: gdbarch_get_longjmp_target_p() = %d\n",
1160                       gdbarch_get_longjmp_target_p (current_gdbarch));
1161 #ifdef GET_LONGJMP_TARGET
1162   fprintf_unfiltered (file,
1163                       "gdbarch_dump: %s # %s\n",
1164                       "GET_LONGJMP_TARGET(pc)",
1165                       XSTRING (GET_LONGJMP_TARGET (pc)));
1166 #endif
1167   fprintf_unfiltered (file,
1168                       "gdbarch_dump: get_longjmp_target = <0x%lx>\n",
1169                       (long) current_gdbarch->get_longjmp_target);
1170 #ifdef HAVE_NONSTEPPABLE_WATCHPOINT
1171   fprintf_unfiltered (file,
1172                       "gdbarch_dump: HAVE_NONSTEPPABLE_WATCHPOINT # %s\n",
1173                       XSTRING (HAVE_NONSTEPPABLE_WATCHPOINT));
1174 #endif
1175   fprintf_unfiltered (file,
1176                       "gdbarch_dump: have_nonsteppable_watchpoint = %s\n",
1177                       paddr_d (current_gdbarch->have_nonsteppable_watchpoint));
1178   fprintf_unfiltered (file,
1179                       "gdbarch_dump: in_function_epilogue_p = <0x%lx>\n",
1180                       (long) current_gdbarch->in_function_epilogue_p);
1181 #ifdef IN_SOLIB_CALL_TRAMPOLINE
1182   fprintf_unfiltered (file,
1183                       "gdbarch_dump: %s # %s\n",
1184                       "IN_SOLIB_CALL_TRAMPOLINE(pc, name)",
1185                       XSTRING (IN_SOLIB_CALL_TRAMPOLINE (pc, name)));
1186 #endif
1187   fprintf_unfiltered (file,
1188                       "gdbarch_dump: in_solib_call_trampoline = <0x%lx>\n",
1189                       (long) current_gdbarch->in_solib_call_trampoline);
1190 #ifdef IN_SOLIB_RETURN_TRAMPOLINE
1191   fprintf_unfiltered (file,
1192                       "gdbarch_dump: %s # %s\n",
1193                       "IN_SOLIB_RETURN_TRAMPOLINE(pc, name)",
1194                       XSTRING (IN_SOLIB_RETURN_TRAMPOLINE (pc, name)));
1195 #endif
1196   fprintf_unfiltered (file,
1197                       "gdbarch_dump: in_solib_return_trampoline = <0x%lx>\n",
1198                       (long) current_gdbarch->in_solib_return_trampoline);
1199 #ifdef INNER_THAN
1200   fprintf_unfiltered (file,
1201                       "gdbarch_dump: %s # %s\n",
1202                       "INNER_THAN(lhs, rhs)",
1203                       XSTRING (INNER_THAN (lhs, rhs)));
1204 #endif
1205   fprintf_unfiltered (file,
1206                       "gdbarch_dump: inner_than = <0x%lx>\n",
1207                       (long) current_gdbarch->inner_than);
1208 #ifdef TARGET_INT_BIT
1209   fprintf_unfiltered (file,
1210                       "gdbarch_dump: TARGET_INT_BIT # %s\n",
1211                       XSTRING (TARGET_INT_BIT));
1212 #endif
1213   fprintf_unfiltered (file,
1214                       "gdbarch_dump: int_bit = %s\n",
1215                       paddr_d (current_gdbarch->int_bit));
1216 #ifdef INTEGER_TO_ADDRESS_P
1217   fprintf_unfiltered (file,
1218                       "gdbarch_dump: %s # %s\n",
1219                       "INTEGER_TO_ADDRESS_P()",
1220                       XSTRING (INTEGER_TO_ADDRESS_P ()));
1221 #endif
1222   fprintf_unfiltered (file,
1223                       "gdbarch_dump: gdbarch_integer_to_address_p() = %d\n",
1224                       gdbarch_integer_to_address_p (current_gdbarch));
1225 #ifdef INTEGER_TO_ADDRESS
1226   fprintf_unfiltered (file,
1227                       "gdbarch_dump: %s # %s\n",
1228                       "INTEGER_TO_ADDRESS(type, buf)",
1229                       XSTRING (INTEGER_TO_ADDRESS (type, buf)));
1230 #endif
1231   fprintf_unfiltered (file,
1232                       "gdbarch_dump: integer_to_address = <0x%lx>\n",
1233                       (long) current_gdbarch->integer_to_address);
1234 #ifdef TARGET_LONG_BIT
1235   fprintf_unfiltered (file,
1236                       "gdbarch_dump: TARGET_LONG_BIT # %s\n",
1237                       XSTRING (TARGET_LONG_BIT));
1238 #endif
1239   fprintf_unfiltered (file,
1240                       "gdbarch_dump: long_bit = %s\n",
1241                       paddr_d (current_gdbarch->long_bit));
1242 #ifdef TARGET_LONG_DOUBLE_BIT
1243   fprintf_unfiltered (file,
1244                       "gdbarch_dump: TARGET_LONG_DOUBLE_BIT # %s\n",
1245                       XSTRING (TARGET_LONG_DOUBLE_BIT));
1246 #endif
1247   fprintf_unfiltered (file,
1248                       "gdbarch_dump: long_double_bit = %s\n",
1249                       paddr_d (current_gdbarch->long_double_bit));
1250 #ifdef TARGET_LONG_DOUBLE_FORMAT
1251   fprintf_unfiltered (file,
1252                       "gdbarch_dump: TARGET_LONG_DOUBLE_FORMAT # %s\n",
1253                       XSTRING (TARGET_LONG_DOUBLE_FORMAT));
1254 #endif
1255   fprintf_unfiltered (file,
1256                       "gdbarch_dump: long_double_format = %s\n",
1257                       pformat (current_gdbarch->long_double_format));
1258 #ifdef TARGET_LONG_LONG_BIT
1259   fprintf_unfiltered (file,
1260                       "gdbarch_dump: TARGET_LONG_LONG_BIT # %s\n",
1261                       XSTRING (TARGET_LONG_LONG_BIT));
1262 #endif
1263   fprintf_unfiltered (file,
1264                       "gdbarch_dump: long_long_bit = %s\n",
1265                       paddr_d (current_gdbarch->long_long_bit));
1266 #ifdef MEMORY_INSERT_BREAKPOINT
1267   fprintf_unfiltered (file,
1268                       "gdbarch_dump: %s # %s\n",
1269                       "MEMORY_INSERT_BREAKPOINT(addr, contents_cache)",
1270                       XSTRING (MEMORY_INSERT_BREAKPOINT (addr, contents_cache)));
1271 #endif
1272   fprintf_unfiltered (file,
1273                       "gdbarch_dump: memory_insert_breakpoint = <0x%lx>\n",
1274                       (long) current_gdbarch->memory_insert_breakpoint);
1275 #ifdef MEMORY_REMOVE_BREAKPOINT
1276   fprintf_unfiltered (file,
1277                       "gdbarch_dump: %s # %s\n",
1278                       "MEMORY_REMOVE_BREAKPOINT(addr, contents_cache)",
1279                       XSTRING (MEMORY_REMOVE_BREAKPOINT (addr, contents_cache)));
1280 #endif
1281   fprintf_unfiltered (file,
1282                       "gdbarch_dump: memory_remove_breakpoint = <0x%lx>\n",
1283                       (long) current_gdbarch->memory_remove_breakpoint);
1284 #ifdef NAME_OF_MALLOC
1285   fprintf_unfiltered (file,
1286                       "gdbarch_dump: NAME_OF_MALLOC # %s\n",
1287                       XSTRING (NAME_OF_MALLOC));
1288 #endif
1289   fprintf_unfiltered (file,
1290                       "gdbarch_dump: name_of_malloc = %s\n",
1291                       NAME_OF_MALLOC);
1292 #ifdef NUM_PSEUDO_REGS
1293   fprintf_unfiltered (file,
1294                       "gdbarch_dump: NUM_PSEUDO_REGS # %s\n",
1295                       XSTRING (NUM_PSEUDO_REGS));
1296 #endif
1297   fprintf_unfiltered (file,
1298                       "gdbarch_dump: num_pseudo_regs = %s\n",
1299                       paddr_d (current_gdbarch->num_pseudo_regs));
1300 #ifdef NUM_REGS
1301   fprintf_unfiltered (file,
1302                       "gdbarch_dump: NUM_REGS # %s\n",
1303                       XSTRING (NUM_REGS));
1304 #endif
1305   fprintf_unfiltered (file,
1306                       "gdbarch_dump: num_regs = %s\n",
1307                       paddr_d (current_gdbarch->num_regs));
1308 #ifdef TARGET_OSABI
1309   fprintf_unfiltered (file,
1310                       "gdbarch_dump: TARGET_OSABI # %s\n",
1311                       XSTRING (TARGET_OSABI));
1312 #endif
1313   fprintf_unfiltered (file,
1314                       "gdbarch_dump: osabi = %s\n",
1315                       paddr_d (current_gdbarch->osabi));
1316 #ifdef PC_REGNUM
1317   fprintf_unfiltered (file,
1318                       "gdbarch_dump: PC_REGNUM # %s\n",
1319                       XSTRING (PC_REGNUM));
1320 #endif
1321   fprintf_unfiltered (file,
1322                       "gdbarch_dump: pc_regnum = %s\n",
1323                       paddr_d (current_gdbarch->pc_regnum));
1324 #ifdef POINTER_TO_ADDRESS
1325   fprintf_unfiltered (file,
1326                       "gdbarch_dump: %s # %s\n",
1327                       "POINTER_TO_ADDRESS(type, buf)",
1328                       XSTRING (POINTER_TO_ADDRESS (type, buf)));
1329 #endif
1330   fprintf_unfiltered (file,
1331                       "gdbarch_dump: pointer_to_address = <0x%lx>\n",
1332                       (long) current_gdbarch->pointer_to_address);
1333   fprintf_unfiltered (file,
1334                       "gdbarch_dump: gdbarch_print_float_info_p() = %d\n",
1335                       gdbarch_print_float_info_p (current_gdbarch));
1336   fprintf_unfiltered (file,
1337                       "gdbarch_dump: print_float_info = <0x%lx>\n",
1338                       (long) current_gdbarch->print_float_info);
1339 #ifdef TARGET_PRINT_INSN
1340   fprintf_unfiltered (file,
1341                       "gdbarch_dump: %s # %s\n",
1342                       "TARGET_PRINT_INSN(vma, info)",
1343                       XSTRING (TARGET_PRINT_INSN (vma, info)));
1344 #endif
1345   fprintf_unfiltered (file,
1346                       "gdbarch_dump: print_insn = <0x%lx>\n",
1347                       (long) current_gdbarch->print_insn);
1348   fprintf_unfiltered (file,
1349                       "gdbarch_dump: print_registers_info = <0x%lx>\n",
1350                       (long) current_gdbarch->print_registers_info);
1351   fprintf_unfiltered (file,
1352                       "gdbarch_dump: gdbarch_print_vector_info_p() = %d\n",
1353                       gdbarch_print_vector_info_p (current_gdbarch));
1354   fprintf_unfiltered (file,
1355                       "gdbarch_dump: print_vector_info = <0x%lx>\n",
1356                       (long) current_gdbarch->print_vector_info);
1357 #ifdef PS_REGNUM
1358   fprintf_unfiltered (file,
1359                       "gdbarch_dump: PS_REGNUM # %s\n",
1360                       XSTRING (PS_REGNUM));
1361 #endif
1362   fprintf_unfiltered (file,
1363                       "gdbarch_dump: ps_regnum = %s\n",
1364                       paddr_d (current_gdbarch->ps_regnum));
1365   fprintf_unfiltered (file,
1366                       "gdbarch_dump: gdbarch_pseudo_register_read_p() = %d\n",
1367                       gdbarch_pseudo_register_read_p (current_gdbarch));
1368   fprintf_unfiltered (file,
1369                       "gdbarch_dump: pseudo_register_read = <0x%lx>\n",
1370                       (long) current_gdbarch->pseudo_register_read);
1371   fprintf_unfiltered (file,
1372                       "gdbarch_dump: gdbarch_pseudo_register_write_p() = %d\n",
1373                       gdbarch_pseudo_register_write_p (current_gdbarch));
1374   fprintf_unfiltered (file,
1375                       "gdbarch_dump: pseudo_register_write = <0x%lx>\n",
1376                       (long) current_gdbarch->pseudo_register_write);
1377 #ifdef TARGET_PTR_BIT
1378   fprintf_unfiltered (file,
1379                       "gdbarch_dump: TARGET_PTR_BIT # %s\n",
1380                       XSTRING (TARGET_PTR_BIT));
1381 #endif
1382   fprintf_unfiltered (file,
1383                       "gdbarch_dump: ptr_bit = %s\n",
1384                       paddr_d (current_gdbarch->ptr_bit));
1385   fprintf_unfiltered (file,
1386                       "gdbarch_dump: gdbarch_push_dummy_call_p() = %d\n",
1387                       gdbarch_push_dummy_call_p (current_gdbarch));
1388   fprintf_unfiltered (file,
1389                       "gdbarch_dump: push_dummy_call = <0x%lx>\n",
1390                       (long) current_gdbarch->push_dummy_call);
1391   fprintf_unfiltered (file,
1392                       "gdbarch_dump: gdbarch_push_dummy_code_p() = %d\n",
1393                       gdbarch_push_dummy_code_p (current_gdbarch));
1394   fprintf_unfiltered (file,
1395                       "gdbarch_dump: push_dummy_code = <0x%lx>\n",
1396                       (long) current_gdbarch->push_dummy_code);
1397 #ifdef TARGET_READ_PC_P
1398   fprintf_unfiltered (file,
1399                       "gdbarch_dump: %s # %s\n",
1400                       "TARGET_READ_PC_P()",
1401                       XSTRING (TARGET_READ_PC_P ()));
1402 #endif
1403   fprintf_unfiltered (file,
1404                       "gdbarch_dump: gdbarch_read_pc_p() = %d\n",
1405                       gdbarch_read_pc_p (current_gdbarch));
1406 #ifdef TARGET_READ_PC
1407   fprintf_unfiltered (file,
1408                       "gdbarch_dump: %s # %s\n",
1409                       "TARGET_READ_PC(ptid)",
1410                       XSTRING (TARGET_READ_PC (ptid)));
1411 #endif
1412   fprintf_unfiltered (file,
1413                       "gdbarch_dump: read_pc = <0x%lx>\n",
1414                       (long) current_gdbarch->read_pc);
1415 #ifdef TARGET_READ_SP_P
1416   fprintf_unfiltered (file,
1417                       "gdbarch_dump: %s # %s\n",
1418                       "TARGET_READ_SP_P()",
1419                       XSTRING (TARGET_READ_SP_P ()));
1420 #endif
1421   fprintf_unfiltered (file,
1422                       "gdbarch_dump: gdbarch_read_sp_p() = %d\n",
1423                       gdbarch_read_sp_p (current_gdbarch));
1424 #ifdef TARGET_READ_SP
1425   fprintf_unfiltered (file,
1426                       "gdbarch_dump: %s # %s\n",
1427                       "TARGET_READ_SP()",
1428                       XSTRING (TARGET_READ_SP ()));
1429 #endif
1430   fprintf_unfiltered (file,
1431                       "gdbarch_dump: read_sp = <0x%lx>\n",
1432                       (long) current_gdbarch->read_sp);
1433 #ifdef REGISTER_BYTES_OK_P
1434   fprintf_unfiltered (file,
1435                       "gdbarch_dump: %s # %s\n",
1436                       "REGISTER_BYTES_OK_P()",
1437                       XSTRING (REGISTER_BYTES_OK_P ()));
1438 #endif
1439   fprintf_unfiltered (file,
1440                       "gdbarch_dump: gdbarch_register_bytes_ok_p() = %d\n",
1441                       gdbarch_register_bytes_ok_p (current_gdbarch));
1442 #ifdef REGISTER_BYTES_OK
1443   fprintf_unfiltered (file,
1444                       "gdbarch_dump: %s # %s\n",
1445                       "REGISTER_BYTES_OK(nr_bytes)",
1446                       XSTRING (REGISTER_BYTES_OK (nr_bytes)));
1447 #endif
1448   fprintf_unfiltered (file,
1449                       "gdbarch_dump: register_bytes_ok = <0x%lx>\n",
1450                       (long) current_gdbarch->register_bytes_ok);
1451 #ifdef REGISTER_NAME
1452   fprintf_unfiltered (file,
1453                       "gdbarch_dump: %s # %s\n",
1454                       "REGISTER_NAME(regnr)",
1455                       XSTRING (REGISTER_NAME (regnr)));
1456 #endif
1457   fprintf_unfiltered (file,
1458                       "gdbarch_dump: register_name = <0x%lx>\n",
1459                       (long) current_gdbarch->register_name);
1460   fprintf_unfiltered (file,
1461                       "gdbarch_dump: register_reggroup_p = <0x%lx>\n",
1462                       (long) current_gdbarch->register_reggroup_p);
1463 #ifdef REGISTER_SIM_REGNO
1464   fprintf_unfiltered (file,
1465                       "gdbarch_dump: %s # %s\n",
1466                       "REGISTER_SIM_REGNO(reg_nr)",
1467                       XSTRING (REGISTER_SIM_REGNO (reg_nr)));
1468 #endif
1469   fprintf_unfiltered (file,
1470                       "gdbarch_dump: register_sim_regno = <0x%lx>\n",
1471                       (long) current_gdbarch->register_sim_regno);
1472 #ifdef REGISTER_TO_VALUE
1473   fprintf_unfiltered (file,
1474                       "gdbarch_dump: %s # %s\n",
1475                       "REGISTER_TO_VALUE(frame, regnum, type, buf)",
1476                       XSTRING (REGISTER_TO_VALUE (frame, regnum, type, buf)));
1477 #endif
1478   fprintf_unfiltered (file,
1479                       "gdbarch_dump: register_to_value = <0x%lx>\n",
1480                       (long) current_gdbarch->register_to_value);
1481   fprintf_unfiltered (file,
1482                       "gdbarch_dump: gdbarch_register_type_p() = %d\n",
1483                       gdbarch_register_type_p (current_gdbarch));
1484   fprintf_unfiltered (file,
1485                       "gdbarch_dump: register_type = <0x%lx>\n",
1486                       (long) current_gdbarch->register_type);
1487   fprintf_unfiltered (file,
1488                       "gdbarch_dump: gdbarch_regset_from_core_section_p() = %d\n",
1489                       gdbarch_regset_from_core_section_p (current_gdbarch));
1490   fprintf_unfiltered (file,
1491                       "gdbarch_dump: regset_from_core_section = <0x%lx>\n",
1492                       (long) current_gdbarch->regset_from_core_section);
1493   fprintf_unfiltered (file,
1494                       "gdbarch_dump: remote_translate_xfer_address = <0x%lx>\n",
1495                       (long) current_gdbarch->remote_translate_xfer_address);
1496   fprintf_unfiltered (file,
1497                       "gdbarch_dump: gdbarch_return_value_p() = %d\n",
1498                       gdbarch_return_value_p (current_gdbarch));
1499   fprintf_unfiltered (file,
1500                       "gdbarch_dump: return_value = <0x%lx>\n",
1501                       (long) current_gdbarch->return_value);
1502 #ifdef SDB_REG_TO_REGNUM
1503   fprintf_unfiltered (file,
1504                       "gdbarch_dump: %s # %s\n",
1505                       "SDB_REG_TO_REGNUM(sdb_regnr)",
1506                       XSTRING (SDB_REG_TO_REGNUM (sdb_regnr)));
1507 #endif
1508   fprintf_unfiltered (file,
1509                       "gdbarch_dump: sdb_reg_to_regnum = <0x%lx>\n",
1510                       (long) current_gdbarch->sdb_reg_to_regnum);
1511 #ifdef TARGET_SHORT_BIT
1512   fprintf_unfiltered (file,
1513                       "gdbarch_dump: TARGET_SHORT_BIT # %s\n",
1514                       XSTRING (TARGET_SHORT_BIT));
1515 #endif
1516   fprintf_unfiltered (file,
1517                       "gdbarch_dump: short_bit = %s\n",
1518                       paddr_d (current_gdbarch->short_bit));
1519 #ifdef SKIP_PROLOGUE
1520   fprintf_unfiltered (file,
1521                       "gdbarch_dump: %s # %s\n",
1522                       "SKIP_PROLOGUE(ip)",
1523                       XSTRING (SKIP_PROLOGUE (ip)));
1524 #endif
1525   fprintf_unfiltered (file,
1526                       "gdbarch_dump: skip_prologue = <0x%lx>\n",
1527                       (long) current_gdbarch->skip_prologue);
1528   fprintf_unfiltered (file,
1529                       "gdbarch_dump: skip_solib_resolver = <0x%lx>\n",
1530                       (long) current_gdbarch->skip_solib_resolver);
1531 #ifdef SKIP_TRAMPOLINE_CODE
1532   fprintf_unfiltered (file,
1533                       "gdbarch_dump: %s # %s\n",
1534                       "SKIP_TRAMPOLINE_CODE(pc)",
1535                       XSTRING (SKIP_TRAMPOLINE_CODE (pc)));
1536 #endif
1537   fprintf_unfiltered (file,
1538                       "gdbarch_dump: skip_trampoline_code = <0x%lx>\n",
1539                       (long) current_gdbarch->skip_trampoline_code);
1540 #ifdef SMASH_TEXT_ADDRESS
1541   fprintf_unfiltered (file,
1542                       "gdbarch_dump: %s # %s\n",
1543                       "SMASH_TEXT_ADDRESS(addr)",
1544                       XSTRING (SMASH_TEXT_ADDRESS (addr)));
1545 #endif
1546   fprintf_unfiltered (file,
1547                       "gdbarch_dump: smash_text_address = <0x%lx>\n",
1548                       (long) current_gdbarch->smash_text_address);
1549 #ifdef SOFTWARE_SINGLE_STEP_P
1550   fprintf_unfiltered (file,
1551                       "gdbarch_dump: %s # %s\n",
1552                       "SOFTWARE_SINGLE_STEP_P()",
1553                       XSTRING (SOFTWARE_SINGLE_STEP_P ()));
1554 #endif
1555   fprintf_unfiltered (file,
1556                       "gdbarch_dump: gdbarch_software_single_step_p() = %d\n",
1557                       gdbarch_software_single_step_p (current_gdbarch));
1558 #ifdef SOFTWARE_SINGLE_STEP
1559   fprintf_unfiltered (file,
1560                       "gdbarch_dump: %s # %s\n",
1561                       "SOFTWARE_SINGLE_STEP(sig, insert_breakpoints_p)",
1562                       XSTRING (SOFTWARE_SINGLE_STEP (sig, insert_breakpoints_p)));
1563 #endif
1564   fprintf_unfiltered (file,
1565                       "gdbarch_dump: software_single_step = <0x%lx>\n",
1566                       (long) current_gdbarch->software_single_step);
1567 #ifdef SP_REGNUM
1568   fprintf_unfiltered (file,
1569                       "gdbarch_dump: SP_REGNUM # %s\n",
1570                       XSTRING (SP_REGNUM));
1571 #endif
1572   fprintf_unfiltered (file,
1573                       "gdbarch_dump: sp_regnum = %s\n",
1574                       paddr_d (current_gdbarch->sp_regnum));
1575 #ifdef STAB_REG_TO_REGNUM
1576   fprintf_unfiltered (file,
1577                       "gdbarch_dump: %s # %s\n",
1578                       "STAB_REG_TO_REGNUM(stab_regnr)",
1579                       XSTRING (STAB_REG_TO_REGNUM (stab_regnr)));
1580 #endif
1581   fprintf_unfiltered (file,
1582                       "gdbarch_dump: stab_reg_to_regnum = <0x%lx>\n",
1583                       (long) current_gdbarch->stab_reg_to_regnum);
1584   fprintf_unfiltered (file,
1585                       "gdbarch_dump: stabs_argument_has_addr = <0x%lx>\n",
1586                       (long) current_gdbarch->stabs_argument_has_addr);
1587 #ifdef STORE_RETURN_VALUE
1588   fprintf_unfiltered (file,
1589                       "gdbarch_dump: %s # %s\n",
1590                       "STORE_RETURN_VALUE(type, regcache, valbuf)",
1591                       XSTRING (STORE_RETURN_VALUE (type, regcache, valbuf)));
1592 #endif
1593   fprintf_unfiltered (file,
1594                       "gdbarch_dump: store_return_value = <0x%lx>\n",
1595                       (long) current_gdbarch->store_return_value);
1596   fprintf_unfiltered (file,
1597                       "gdbarch_dump: gdbarch_unwind_dummy_id_p() = %d\n",
1598                       gdbarch_unwind_dummy_id_p (current_gdbarch));
1599   fprintf_unfiltered (file,
1600                       "gdbarch_dump: unwind_dummy_id = <0x%lx>\n",
1601                       (long) current_gdbarch->unwind_dummy_id);
1602   fprintf_unfiltered (file,
1603                       "gdbarch_dump: gdbarch_unwind_pc_p() = %d\n",
1604                       gdbarch_unwind_pc_p (current_gdbarch));
1605   fprintf_unfiltered (file,
1606                       "gdbarch_dump: unwind_pc = <0x%lx>\n",
1607                       (long) current_gdbarch->unwind_pc);
1608   fprintf_unfiltered (file,
1609                       "gdbarch_dump: gdbarch_unwind_sp_p() = %d\n",
1610                       gdbarch_unwind_sp_p (current_gdbarch));
1611   fprintf_unfiltered (file,
1612                       "gdbarch_dump: unwind_sp = <0x%lx>\n",
1613                       (long) current_gdbarch->unwind_sp);
1614 #ifdef VALUE_TO_REGISTER
1615   fprintf_unfiltered (file,
1616                       "gdbarch_dump: %s # %s\n",
1617                       "VALUE_TO_REGISTER(frame, regnum, type, buf)",
1618                       XSTRING (VALUE_TO_REGISTER (frame, regnum, type, buf)));
1619 #endif
1620   fprintf_unfiltered (file,
1621                       "gdbarch_dump: value_to_register = <0x%lx>\n",
1622                       (long) current_gdbarch->value_to_register);
1623 #ifdef TARGET_VIRTUAL_FRAME_POINTER
1624   fprintf_unfiltered (file,
1625                       "gdbarch_dump: %s # %s\n",
1626                       "TARGET_VIRTUAL_FRAME_POINTER(pc, frame_regnum, frame_offset)",
1627                       XSTRING (TARGET_VIRTUAL_FRAME_POINTER (pc, frame_regnum, frame_offset)));
1628 #endif
1629   fprintf_unfiltered (file,
1630                       "gdbarch_dump: virtual_frame_pointer = <0x%lx>\n",
1631                       (long) current_gdbarch->virtual_frame_pointer);
1632 #ifdef TARGET_WRITE_PC
1633   fprintf_unfiltered (file,
1634                       "gdbarch_dump: %s # %s\n",
1635                       "TARGET_WRITE_PC(val, ptid)",
1636                       XSTRING (TARGET_WRITE_PC (val, ptid)));
1637 #endif
1638   fprintf_unfiltered (file,
1639                       "gdbarch_dump: write_pc = <0x%lx>\n",
1640                       (long) current_gdbarch->write_pc);
1641   if (current_gdbarch->dump_tdep != NULL)
1642     current_gdbarch->dump_tdep (current_gdbarch, file);
1643 }
1644 
1645 struct gdbarch_tdep *
gdbarch_tdep(struct gdbarch * gdbarch)1646 gdbarch_tdep (struct gdbarch *gdbarch)
1647 {
1648   if (gdbarch_debug >= 2)
1649     fprintf_unfiltered (gdb_stdlog, "gdbarch_tdep called\n");
1650   return gdbarch->tdep;
1651 }
1652 
1653 
1654 const struct bfd_arch_info *
gdbarch_bfd_arch_info(struct gdbarch * gdbarch)1655 gdbarch_bfd_arch_info (struct gdbarch *gdbarch)
1656 {
1657   gdb_assert (gdbarch != NULL);
1658   if (gdbarch_debug >= 2)
1659     fprintf_unfiltered (gdb_stdlog, "gdbarch_bfd_arch_info called\n");
1660   return gdbarch->bfd_arch_info;
1661 }
1662 
1663 int
gdbarch_byte_order(struct gdbarch * gdbarch)1664 gdbarch_byte_order (struct gdbarch *gdbarch)
1665 {
1666   gdb_assert (gdbarch != NULL);
1667   if (gdbarch_debug >= 2)
1668     fprintf_unfiltered (gdb_stdlog, "gdbarch_byte_order called\n");
1669   return gdbarch->byte_order;
1670 }
1671 
1672 enum gdb_osabi
gdbarch_osabi(struct gdbarch * gdbarch)1673 gdbarch_osabi (struct gdbarch *gdbarch)
1674 {
1675   gdb_assert (gdbarch != NULL);
1676   if (gdbarch_debug >= 2)
1677     fprintf_unfiltered (gdb_stdlog, "gdbarch_osabi called\n");
1678   return gdbarch->osabi;
1679 }
1680 
1681 int
gdbarch_short_bit(struct gdbarch * gdbarch)1682 gdbarch_short_bit (struct gdbarch *gdbarch)
1683 {
1684   gdb_assert (gdbarch != NULL);
1685   /* Skip verify of short_bit, invalid_p == 0 */
1686   if (gdbarch_debug >= 2)
1687     fprintf_unfiltered (gdb_stdlog, "gdbarch_short_bit called\n");
1688   return gdbarch->short_bit;
1689 }
1690 
1691 void
set_gdbarch_short_bit(struct gdbarch * gdbarch,int short_bit)1692 set_gdbarch_short_bit (struct gdbarch *gdbarch,
1693                        int short_bit)
1694 {
1695   gdbarch->short_bit = short_bit;
1696 }
1697 
1698 int
gdbarch_int_bit(struct gdbarch * gdbarch)1699 gdbarch_int_bit (struct gdbarch *gdbarch)
1700 {
1701   gdb_assert (gdbarch != NULL);
1702   /* Skip verify of int_bit, invalid_p == 0 */
1703   if (gdbarch_debug >= 2)
1704     fprintf_unfiltered (gdb_stdlog, "gdbarch_int_bit called\n");
1705   return gdbarch->int_bit;
1706 }
1707 
1708 void
set_gdbarch_int_bit(struct gdbarch * gdbarch,int int_bit)1709 set_gdbarch_int_bit (struct gdbarch *gdbarch,
1710                      int int_bit)
1711 {
1712   gdbarch->int_bit = int_bit;
1713 }
1714 
1715 int
gdbarch_long_bit(struct gdbarch * gdbarch)1716 gdbarch_long_bit (struct gdbarch *gdbarch)
1717 {
1718   gdb_assert (gdbarch != NULL);
1719   /* Skip verify of long_bit, invalid_p == 0 */
1720   if (gdbarch_debug >= 2)
1721     fprintf_unfiltered (gdb_stdlog, "gdbarch_long_bit called\n");
1722   return gdbarch->long_bit;
1723 }
1724 
1725 void
set_gdbarch_long_bit(struct gdbarch * gdbarch,int long_bit)1726 set_gdbarch_long_bit (struct gdbarch *gdbarch,
1727                       int long_bit)
1728 {
1729   gdbarch->long_bit = long_bit;
1730 }
1731 
1732 int
gdbarch_long_long_bit(struct gdbarch * gdbarch)1733 gdbarch_long_long_bit (struct gdbarch *gdbarch)
1734 {
1735   gdb_assert (gdbarch != NULL);
1736   /* Skip verify of long_long_bit, invalid_p == 0 */
1737   if (gdbarch_debug >= 2)
1738     fprintf_unfiltered (gdb_stdlog, "gdbarch_long_long_bit called\n");
1739   return gdbarch->long_long_bit;
1740 }
1741 
1742 void
set_gdbarch_long_long_bit(struct gdbarch * gdbarch,int long_long_bit)1743 set_gdbarch_long_long_bit (struct gdbarch *gdbarch,
1744                            int long_long_bit)
1745 {
1746   gdbarch->long_long_bit = long_long_bit;
1747 }
1748 
1749 int
gdbarch_float_bit(struct gdbarch * gdbarch)1750 gdbarch_float_bit (struct gdbarch *gdbarch)
1751 {
1752   gdb_assert (gdbarch != NULL);
1753   /* Skip verify of float_bit, invalid_p == 0 */
1754   if (gdbarch_debug >= 2)
1755     fprintf_unfiltered (gdb_stdlog, "gdbarch_float_bit called\n");
1756   return gdbarch->float_bit;
1757 }
1758 
1759 void
set_gdbarch_float_bit(struct gdbarch * gdbarch,int float_bit)1760 set_gdbarch_float_bit (struct gdbarch *gdbarch,
1761                        int float_bit)
1762 {
1763   gdbarch->float_bit = float_bit;
1764 }
1765 
1766 const struct floatformat *
gdbarch_float_format(struct gdbarch * gdbarch)1767 gdbarch_float_format (struct gdbarch *gdbarch)
1768 {
1769   gdb_assert (gdbarch != NULL);
1770   if (gdbarch_debug >= 2)
1771     fprintf_unfiltered (gdb_stdlog, "gdbarch_float_format called\n");
1772   return gdbarch->float_format;
1773 }
1774 
1775 void
set_gdbarch_float_format(struct gdbarch * gdbarch,const struct floatformat * float_format)1776 set_gdbarch_float_format (struct gdbarch *gdbarch,
1777                           const struct floatformat * float_format)
1778 {
1779   gdbarch->float_format = float_format;
1780 }
1781 
1782 int
gdbarch_double_bit(struct gdbarch * gdbarch)1783 gdbarch_double_bit (struct gdbarch *gdbarch)
1784 {
1785   gdb_assert (gdbarch != NULL);
1786   /* Skip verify of double_bit, invalid_p == 0 */
1787   if (gdbarch_debug >= 2)
1788     fprintf_unfiltered (gdb_stdlog, "gdbarch_double_bit called\n");
1789   return gdbarch->double_bit;
1790 }
1791 
1792 void
set_gdbarch_double_bit(struct gdbarch * gdbarch,int double_bit)1793 set_gdbarch_double_bit (struct gdbarch *gdbarch,
1794                         int double_bit)
1795 {
1796   gdbarch->double_bit = double_bit;
1797 }
1798 
1799 const struct floatformat *
gdbarch_double_format(struct gdbarch * gdbarch)1800 gdbarch_double_format (struct gdbarch *gdbarch)
1801 {
1802   gdb_assert (gdbarch != NULL);
1803   if (gdbarch_debug >= 2)
1804     fprintf_unfiltered (gdb_stdlog, "gdbarch_double_format called\n");
1805   return gdbarch->double_format;
1806 }
1807 
1808 void
set_gdbarch_double_format(struct gdbarch * gdbarch,const struct floatformat * double_format)1809 set_gdbarch_double_format (struct gdbarch *gdbarch,
1810                            const struct floatformat * double_format)
1811 {
1812   gdbarch->double_format = double_format;
1813 }
1814 
1815 int
gdbarch_long_double_bit(struct gdbarch * gdbarch)1816 gdbarch_long_double_bit (struct gdbarch *gdbarch)
1817 {
1818   gdb_assert (gdbarch != NULL);
1819   /* Skip verify of long_double_bit, invalid_p == 0 */
1820   if (gdbarch_debug >= 2)
1821     fprintf_unfiltered (gdb_stdlog, "gdbarch_long_double_bit called\n");
1822   return gdbarch->long_double_bit;
1823 }
1824 
1825 void
set_gdbarch_long_double_bit(struct gdbarch * gdbarch,int long_double_bit)1826 set_gdbarch_long_double_bit (struct gdbarch *gdbarch,
1827                              int long_double_bit)
1828 {
1829   gdbarch->long_double_bit = long_double_bit;
1830 }
1831 
1832 const struct floatformat *
gdbarch_long_double_format(struct gdbarch * gdbarch)1833 gdbarch_long_double_format (struct gdbarch *gdbarch)
1834 {
1835   gdb_assert (gdbarch != NULL);
1836   if (gdbarch_debug >= 2)
1837     fprintf_unfiltered (gdb_stdlog, "gdbarch_long_double_format called\n");
1838   return gdbarch->long_double_format;
1839 }
1840 
1841 void
set_gdbarch_long_double_format(struct gdbarch * gdbarch,const struct floatformat * long_double_format)1842 set_gdbarch_long_double_format (struct gdbarch *gdbarch,
1843                                 const struct floatformat * long_double_format)
1844 {
1845   gdbarch->long_double_format = long_double_format;
1846 }
1847 
1848 int
gdbarch_ptr_bit(struct gdbarch * gdbarch)1849 gdbarch_ptr_bit (struct gdbarch *gdbarch)
1850 {
1851   gdb_assert (gdbarch != NULL);
1852   /* Skip verify of ptr_bit, invalid_p == 0 */
1853   if (gdbarch_debug >= 2)
1854     fprintf_unfiltered (gdb_stdlog, "gdbarch_ptr_bit called\n");
1855   return gdbarch->ptr_bit;
1856 }
1857 
1858 void
set_gdbarch_ptr_bit(struct gdbarch * gdbarch,int ptr_bit)1859 set_gdbarch_ptr_bit (struct gdbarch *gdbarch,
1860                      int ptr_bit)
1861 {
1862   gdbarch->ptr_bit = ptr_bit;
1863 }
1864 
1865 int
gdbarch_addr_bit(struct gdbarch * gdbarch)1866 gdbarch_addr_bit (struct gdbarch *gdbarch)
1867 {
1868   gdb_assert (gdbarch != NULL);
1869   /* Check variable changed from pre-default.  */
1870   gdb_assert (gdbarch->addr_bit != 0);
1871   if (gdbarch_debug >= 2)
1872     fprintf_unfiltered (gdb_stdlog, "gdbarch_addr_bit called\n");
1873   return gdbarch->addr_bit;
1874 }
1875 
1876 void
set_gdbarch_addr_bit(struct gdbarch * gdbarch,int addr_bit)1877 set_gdbarch_addr_bit (struct gdbarch *gdbarch,
1878                       int addr_bit)
1879 {
1880   gdbarch->addr_bit = addr_bit;
1881 }
1882 
1883 int
gdbarch_bfd_vma_bit(struct gdbarch * gdbarch)1884 gdbarch_bfd_vma_bit (struct gdbarch *gdbarch)
1885 {
1886   gdb_assert (gdbarch != NULL);
1887   /* Skip verify of bfd_vma_bit, invalid_p == 0 */
1888   if (gdbarch_debug >= 2)
1889     fprintf_unfiltered (gdb_stdlog, "gdbarch_bfd_vma_bit called\n");
1890   return gdbarch->bfd_vma_bit;
1891 }
1892 
1893 void
set_gdbarch_bfd_vma_bit(struct gdbarch * gdbarch,int bfd_vma_bit)1894 set_gdbarch_bfd_vma_bit (struct gdbarch *gdbarch,
1895                          int bfd_vma_bit)
1896 {
1897   gdbarch->bfd_vma_bit = bfd_vma_bit;
1898 }
1899 
1900 int
gdbarch_char_signed(struct gdbarch * gdbarch)1901 gdbarch_char_signed (struct gdbarch *gdbarch)
1902 {
1903   gdb_assert (gdbarch != NULL);
1904   /* Check variable changed from pre-default.  */
1905   gdb_assert (gdbarch->char_signed != -1);
1906   if (gdbarch_debug >= 2)
1907     fprintf_unfiltered (gdb_stdlog, "gdbarch_char_signed called\n");
1908   return gdbarch->char_signed;
1909 }
1910 
1911 void
set_gdbarch_char_signed(struct gdbarch * gdbarch,int char_signed)1912 set_gdbarch_char_signed (struct gdbarch *gdbarch,
1913                          int char_signed)
1914 {
1915   gdbarch->char_signed = char_signed;
1916 }
1917 
1918 int
gdbarch_read_pc_p(struct gdbarch * gdbarch)1919 gdbarch_read_pc_p (struct gdbarch *gdbarch)
1920 {
1921   gdb_assert (gdbarch != NULL);
1922   return gdbarch->read_pc != NULL;
1923 }
1924 
1925 CORE_ADDR
gdbarch_read_pc(struct gdbarch * gdbarch,ptid_t ptid)1926 gdbarch_read_pc (struct gdbarch *gdbarch, ptid_t ptid)
1927 {
1928   gdb_assert (gdbarch != NULL);
1929   gdb_assert (gdbarch->read_pc != NULL);
1930   if (gdbarch_debug >= 2)
1931     fprintf_unfiltered (gdb_stdlog, "gdbarch_read_pc called\n");
1932   return gdbarch->read_pc (ptid);
1933 }
1934 
1935 void
set_gdbarch_read_pc(struct gdbarch * gdbarch,gdbarch_read_pc_ftype read_pc)1936 set_gdbarch_read_pc (struct gdbarch *gdbarch,
1937                      gdbarch_read_pc_ftype read_pc)
1938 {
1939   gdbarch->read_pc = read_pc;
1940 }
1941 
1942 void
gdbarch_write_pc(struct gdbarch * gdbarch,CORE_ADDR val,ptid_t ptid)1943 gdbarch_write_pc (struct gdbarch *gdbarch, CORE_ADDR val, ptid_t ptid)
1944 {
1945   gdb_assert (gdbarch != NULL);
1946   gdb_assert (gdbarch->write_pc != NULL);
1947   if (gdbarch_debug >= 2)
1948     fprintf_unfiltered (gdb_stdlog, "gdbarch_write_pc called\n");
1949   gdbarch->write_pc (val, ptid);
1950 }
1951 
1952 void
set_gdbarch_write_pc(struct gdbarch * gdbarch,gdbarch_write_pc_ftype write_pc)1953 set_gdbarch_write_pc (struct gdbarch *gdbarch,
1954                       gdbarch_write_pc_ftype write_pc)
1955 {
1956   gdbarch->write_pc = write_pc;
1957 }
1958 
1959 int
gdbarch_read_sp_p(struct gdbarch * gdbarch)1960 gdbarch_read_sp_p (struct gdbarch *gdbarch)
1961 {
1962   gdb_assert (gdbarch != NULL);
1963   return gdbarch->read_sp != NULL;
1964 }
1965 
1966 CORE_ADDR
gdbarch_read_sp(struct gdbarch * gdbarch)1967 gdbarch_read_sp (struct gdbarch *gdbarch)
1968 {
1969   gdb_assert (gdbarch != NULL);
1970   gdb_assert (gdbarch->read_sp != NULL);
1971   if (gdbarch_debug >= 2)
1972     fprintf_unfiltered (gdb_stdlog, "gdbarch_read_sp called\n");
1973   return gdbarch->read_sp ();
1974 }
1975 
1976 void
set_gdbarch_read_sp(struct gdbarch * gdbarch,gdbarch_read_sp_ftype read_sp)1977 set_gdbarch_read_sp (struct gdbarch *gdbarch,
1978                      gdbarch_read_sp_ftype read_sp)
1979 {
1980   gdbarch->read_sp = read_sp;
1981 }
1982 
1983 void
gdbarch_virtual_frame_pointer(struct gdbarch * gdbarch,CORE_ADDR pc,int * frame_regnum,LONGEST * frame_offset)1984 gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset)
1985 {
1986   gdb_assert (gdbarch != NULL);
1987   gdb_assert (gdbarch->virtual_frame_pointer != NULL);
1988   if (gdbarch_debug >= 2)
1989     fprintf_unfiltered (gdb_stdlog, "gdbarch_virtual_frame_pointer called\n");
1990   gdbarch->virtual_frame_pointer (pc, frame_regnum, frame_offset);
1991 }
1992 
1993 void
set_gdbarch_virtual_frame_pointer(struct gdbarch * gdbarch,gdbarch_virtual_frame_pointer_ftype virtual_frame_pointer)1994 set_gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch,
1995                                    gdbarch_virtual_frame_pointer_ftype virtual_frame_pointer)
1996 {
1997   gdbarch->virtual_frame_pointer = virtual_frame_pointer;
1998 }
1999 
2000 int
gdbarch_pseudo_register_read_p(struct gdbarch * gdbarch)2001 gdbarch_pseudo_register_read_p (struct gdbarch *gdbarch)
2002 {
2003   gdb_assert (gdbarch != NULL);
2004   return gdbarch->pseudo_register_read != NULL;
2005 }
2006 
2007 void
gdbarch_pseudo_register_read(struct gdbarch * gdbarch,struct regcache * regcache,int cookednum,void * buf)2008 gdbarch_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, void *buf)
2009 {
2010   gdb_assert (gdbarch != NULL);
2011   gdb_assert (gdbarch->pseudo_register_read != NULL);
2012   if (gdbarch_debug >= 2)
2013     fprintf_unfiltered (gdb_stdlog, "gdbarch_pseudo_register_read called\n");
2014   gdbarch->pseudo_register_read (gdbarch, regcache, cookednum, buf);
2015 }
2016 
2017 void
set_gdbarch_pseudo_register_read(struct gdbarch * gdbarch,gdbarch_pseudo_register_read_ftype pseudo_register_read)2018 set_gdbarch_pseudo_register_read (struct gdbarch *gdbarch,
2019                                   gdbarch_pseudo_register_read_ftype pseudo_register_read)
2020 {
2021   gdbarch->pseudo_register_read = pseudo_register_read;
2022 }
2023 
2024 int
gdbarch_pseudo_register_write_p(struct gdbarch * gdbarch)2025 gdbarch_pseudo_register_write_p (struct gdbarch *gdbarch)
2026 {
2027   gdb_assert (gdbarch != NULL);
2028   return gdbarch->pseudo_register_write != NULL;
2029 }
2030 
2031 void
gdbarch_pseudo_register_write(struct gdbarch * gdbarch,struct regcache * regcache,int cookednum,const void * buf)2032 gdbarch_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, const void *buf)
2033 {
2034   gdb_assert (gdbarch != NULL);
2035   gdb_assert (gdbarch->pseudo_register_write != NULL);
2036   if (gdbarch_debug >= 2)
2037     fprintf_unfiltered (gdb_stdlog, "gdbarch_pseudo_register_write called\n");
2038   gdbarch->pseudo_register_write (gdbarch, regcache, cookednum, buf);
2039 }
2040 
2041 void
set_gdbarch_pseudo_register_write(struct gdbarch * gdbarch,gdbarch_pseudo_register_write_ftype pseudo_register_write)2042 set_gdbarch_pseudo_register_write (struct gdbarch *gdbarch,
2043                                    gdbarch_pseudo_register_write_ftype pseudo_register_write)
2044 {
2045   gdbarch->pseudo_register_write = pseudo_register_write;
2046 }
2047 
2048 int
gdbarch_num_regs(struct gdbarch * gdbarch)2049 gdbarch_num_regs (struct gdbarch *gdbarch)
2050 {
2051   gdb_assert (gdbarch != NULL);
2052   /* Check variable changed from pre-default.  */
2053   gdb_assert (gdbarch->num_regs != -1);
2054   if (gdbarch_debug >= 2)
2055     fprintf_unfiltered (gdb_stdlog, "gdbarch_num_regs called\n");
2056   return gdbarch->num_regs;
2057 }
2058 
2059 void
set_gdbarch_num_regs(struct gdbarch * gdbarch,int num_regs)2060 set_gdbarch_num_regs (struct gdbarch *gdbarch,
2061                       int num_regs)
2062 {
2063   gdbarch->num_regs = num_regs;
2064 }
2065 
2066 int
gdbarch_num_pseudo_regs(struct gdbarch * gdbarch)2067 gdbarch_num_pseudo_regs (struct gdbarch *gdbarch)
2068 {
2069   gdb_assert (gdbarch != NULL);
2070   /* Skip verify of num_pseudo_regs, invalid_p == 0 */
2071   if (gdbarch_debug >= 2)
2072     fprintf_unfiltered (gdb_stdlog, "gdbarch_num_pseudo_regs called\n");
2073   return gdbarch->num_pseudo_regs;
2074 }
2075 
2076 void
set_gdbarch_num_pseudo_regs(struct gdbarch * gdbarch,int num_pseudo_regs)2077 set_gdbarch_num_pseudo_regs (struct gdbarch *gdbarch,
2078                              int num_pseudo_regs)
2079 {
2080   gdbarch->num_pseudo_regs = num_pseudo_regs;
2081 }
2082 
2083 int
gdbarch_sp_regnum(struct gdbarch * gdbarch)2084 gdbarch_sp_regnum (struct gdbarch *gdbarch)
2085 {
2086   gdb_assert (gdbarch != NULL);
2087   /* Skip verify of sp_regnum, invalid_p == 0 */
2088   if (gdbarch_debug >= 2)
2089     fprintf_unfiltered (gdb_stdlog, "gdbarch_sp_regnum called\n");
2090   return gdbarch->sp_regnum;
2091 }
2092 
2093 void
set_gdbarch_sp_regnum(struct gdbarch * gdbarch,int sp_regnum)2094 set_gdbarch_sp_regnum (struct gdbarch *gdbarch,
2095                        int sp_regnum)
2096 {
2097   gdbarch->sp_regnum = sp_regnum;
2098 }
2099 
2100 int
gdbarch_pc_regnum(struct gdbarch * gdbarch)2101 gdbarch_pc_regnum (struct gdbarch *gdbarch)
2102 {
2103   gdb_assert (gdbarch != NULL);
2104   /* Skip verify of pc_regnum, invalid_p == 0 */
2105   if (gdbarch_debug >= 2)
2106     fprintf_unfiltered (gdb_stdlog, "gdbarch_pc_regnum called\n");
2107   return gdbarch->pc_regnum;
2108 }
2109 
2110 void
set_gdbarch_pc_regnum(struct gdbarch * gdbarch,int pc_regnum)2111 set_gdbarch_pc_regnum (struct gdbarch *gdbarch,
2112                        int pc_regnum)
2113 {
2114   gdbarch->pc_regnum = pc_regnum;
2115 }
2116 
2117 int
gdbarch_ps_regnum(struct gdbarch * gdbarch)2118 gdbarch_ps_regnum (struct gdbarch *gdbarch)
2119 {
2120   gdb_assert (gdbarch != NULL);
2121   /* Skip verify of ps_regnum, invalid_p == 0 */
2122   if (gdbarch_debug >= 2)
2123     fprintf_unfiltered (gdb_stdlog, "gdbarch_ps_regnum called\n");
2124   return gdbarch->ps_regnum;
2125 }
2126 
2127 void
set_gdbarch_ps_regnum(struct gdbarch * gdbarch,int ps_regnum)2128 set_gdbarch_ps_regnum (struct gdbarch *gdbarch,
2129                        int ps_regnum)
2130 {
2131   gdbarch->ps_regnum = ps_regnum;
2132 }
2133 
2134 int
gdbarch_fp0_regnum(struct gdbarch * gdbarch)2135 gdbarch_fp0_regnum (struct gdbarch *gdbarch)
2136 {
2137   gdb_assert (gdbarch != NULL);
2138   /* Skip verify of fp0_regnum, invalid_p == 0 */
2139   if (gdbarch_debug >= 2)
2140     fprintf_unfiltered (gdb_stdlog, "gdbarch_fp0_regnum called\n");
2141   return gdbarch->fp0_regnum;
2142 }
2143 
2144 void
set_gdbarch_fp0_regnum(struct gdbarch * gdbarch,int fp0_regnum)2145 set_gdbarch_fp0_regnum (struct gdbarch *gdbarch,
2146                         int fp0_regnum)
2147 {
2148   gdbarch->fp0_regnum = fp0_regnum;
2149 }
2150 
2151 int
gdbarch_stab_reg_to_regnum(struct gdbarch * gdbarch,int stab_regnr)2152 gdbarch_stab_reg_to_regnum (struct gdbarch *gdbarch, int stab_regnr)
2153 {
2154   gdb_assert (gdbarch != NULL);
2155   gdb_assert (gdbarch->stab_reg_to_regnum != NULL);
2156   if (gdbarch_debug >= 2)
2157     fprintf_unfiltered (gdb_stdlog, "gdbarch_stab_reg_to_regnum called\n");
2158   return gdbarch->stab_reg_to_regnum (stab_regnr);
2159 }
2160 
2161 void
set_gdbarch_stab_reg_to_regnum(struct gdbarch * gdbarch,gdbarch_stab_reg_to_regnum_ftype stab_reg_to_regnum)2162 set_gdbarch_stab_reg_to_regnum (struct gdbarch *gdbarch,
2163                                 gdbarch_stab_reg_to_regnum_ftype stab_reg_to_regnum)
2164 {
2165   gdbarch->stab_reg_to_regnum = stab_reg_to_regnum;
2166 }
2167 
2168 int
gdbarch_ecoff_reg_to_regnum(struct gdbarch * gdbarch,int ecoff_regnr)2169 gdbarch_ecoff_reg_to_regnum (struct gdbarch *gdbarch, int ecoff_regnr)
2170 {
2171   gdb_assert (gdbarch != NULL);
2172   gdb_assert (gdbarch->ecoff_reg_to_regnum != NULL);
2173   if (gdbarch_debug >= 2)
2174     fprintf_unfiltered (gdb_stdlog, "gdbarch_ecoff_reg_to_regnum called\n");
2175   return gdbarch->ecoff_reg_to_regnum (ecoff_regnr);
2176 }
2177 
2178 void
set_gdbarch_ecoff_reg_to_regnum(struct gdbarch * gdbarch,gdbarch_ecoff_reg_to_regnum_ftype ecoff_reg_to_regnum)2179 set_gdbarch_ecoff_reg_to_regnum (struct gdbarch *gdbarch,
2180                                  gdbarch_ecoff_reg_to_regnum_ftype ecoff_reg_to_regnum)
2181 {
2182   gdbarch->ecoff_reg_to_regnum = ecoff_reg_to_regnum;
2183 }
2184 
2185 int
gdbarch_dwarf_reg_to_regnum(struct gdbarch * gdbarch,int dwarf_regnr)2186 gdbarch_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int dwarf_regnr)
2187 {
2188   gdb_assert (gdbarch != NULL);
2189   gdb_assert (gdbarch->dwarf_reg_to_regnum != NULL);
2190   if (gdbarch_debug >= 2)
2191     fprintf_unfiltered (gdb_stdlog, "gdbarch_dwarf_reg_to_regnum called\n");
2192   return gdbarch->dwarf_reg_to_regnum (dwarf_regnr);
2193 }
2194 
2195 void
set_gdbarch_dwarf_reg_to_regnum(struct gdbarch * gdbarch,gdbarch_dwarf_reg_to_regnum_ftype dwarf_reg_to_regnum)2196 set_gdbarch_dwarf_reg_to_regnum (struct gdbarch *gdbarch,
2197                                  gdbarch_dwarf_reg_to_regnum_ftype dwarf_reg_to_regnum)
2198 {
2199   gdbarch->dwarf_reg_to_regnum = dwarf_reg_to_regnum;
2200 }
2201 
2202 int
gdbarch_sdb_reg_to_regnum(struct gdbarch * gdbarch,int sdb_regnr)2203 gdbarch_sdb_reg_to_regnum (struct gdbarch *gdbarch, int sdb_regnr)
2204 {
2205   gdb_assert (gdbarch != NULL);
2206   gdb_assert (gdbarch->sdb_reg_to_regnum != NULL);
2207   if (gdbarch_debug >= 2)
2208     fprintf_unfiltered (gdb_stdlog, "gdbarch_sdb_reg_to_regnum called\n");
2209   return gdbarch->sdb_reg_to_regnum (sdb_regnr);
2210 }
2211 
2212 void
set_gdbarch_sdb_reg_to_regnum(struct gdbarch * gdbarch,gdbarch_sdb_reg_to_regnum_ftype sdb_reg_to_regnum)2213 set_gdbarch_sdb_reg_to_regnum (struct gdbarch *gdbarch,
2214                                gdbarch_sdb_reg_to_regnum_ftype sdb_reg_to_regnum)
2215 {
2216   gdbarch->sdb_reg_to_regnum = sdb_reg_to_regnum;
2217 }
2218 
2219 int
gdbarch_dwarf2_reg_to_regnum(struct gdbarch * gdbarch,int dwarf2_regnr)2220 gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int dwarf2_regnr)
2221 {
2222   gdb_assert (gdbarch != NULL);
2223   gdb_assert (gdbarch->dwarf2_reg_to_regnum != NULL);
2224   if (gdbarch_debug >= 2)
2225     fprintf_unfiltered (gdb_stdlog, "gdbarch_dwarf2_reg_to_regnum called\n");
2226   return gdbarch->dwarf2_reg_to_regnum (dwarf2_regnr);
2227 }
2228 
2229 void
set_gdbarch_dwarf2_reg_to_regnum(struct gdbarch * gdbarch,gdbarch_dwarf2_reg_to_regnum_ftype dwarf2_reg_to_regnum)2230 set_gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch,
2231                                   gdbarch_dwarf2_reg_to_regnum_ftype dwarf2_reg_to_regnum)
2232 {
2233   gdbarch->dwarf2_reg_to_regnum = dwarf2_reg_to_regnum;
2234 }
2235 
2236 const char *
gdbarch_register_name(struct gdbarch * gdbarch,int regnr)2237 gdbarch_register_name (struct gdbarch *gdbarch, int regnr)
2238 {
2239   gdb_assert (gdbarch != NULL);
2240   gdb_assert (gdbarch->register_name != NULL);
2241   if (gdbarch_debug >= 2)
2242     fprintf_unfiltered (gdb_stdlog, "gdbarch_register_name called\n");
2243   return gdbarch->register_name (regnr);
2244 }
2245 
2246 void
set_gdbarch_register_name(struct gdbarch * gdbarch,gdbarch_register_name_ftype register_name)2247 set_gdbarch_register_name (struct gdbarch *gdbarch,
2248                            gdbarch_register_name_ftype register_name)
2249 {
2250   gdbarch->register_name = register_name;
2251 }
2252 
2253 int
gdbarch_register_type_p(struct gdbarch * gdbarch)2254 gdbarch_register_type_p (struct gdbarch *gdbarch)
2255 {
2256   gdb_assert (gdbarch != NULL);
2257   return gdbarch->register_type != NULL;
2258 }
2259 
2260 struct type *
gdbarch_register_type(struct gdbarch * gdbarch,int reg_nr)2261 gdbarch_register_type (struct gdbarch *gdbarch, int reg_nr)
2262 {
2263   gdb_assert (gdbarch != NULL);
2264   gdb_assert (gdbarch->register_type != NULL);
2265   if (gdbarch_debug >= 2)
2266     fprintf_unfiltered (gdb_stdlog, "gdbarch_register_type called\n");
2267   return gdbarch->register_type (gdbarch, reg_nr);
2268 }
2269 
2270 void
set_gdbarch_register_type(struct gdbarch * gdbarch,gdbarch_register_type_ftype register_type)2271 set_gdbarch_register_type (struct gdbarch *gdbarch,
2272                            gdbarch_register_type_ftype register_type)
2273 {
2274   gdbarch->register_type = register_type;
2275 }
2276 
2277 int
gdbarch_deprecated_register_byte_p(struct gdbarch * gdbarch)2278 gdbarch_deprecated_register_byte_p (struct gdbarch *gdbarch)
2279 {
2280   gdb_assert (gdbarch != NULL);
2281   return gdbarch->deprecated_register_byte != generic_register_byte;
2282 }
2283 
2284 int
gdbarch_deprecated_register_byte(struct gdbarch * gdbarch,int reg_nr)2285 gdbarch_deprecated_register_byte (struct gdbarch *gdbarch, int reg_nr)
2286 {
2287   gdb_assert (gdbarch != NULL);
2288   gdb_assert (gdbarch->deprecated_register_byte != NULL);
2289   /* Do not check predicate: gdbarch->deprecated_register_byte != generic_register_byte, allow call.  */
2290   if (gdbarch_debug >= 2)
2291     fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_register_byte called\n");
2292   return gdbarch->deprecated_register_byte (reg_nr);
2293 }
2294 
2295 void
set_gdbarch_deprecated_register_byte(struct gdbarch * gdbarch,gdbarch_deprecated_register_byte_ftype deprecated_register_byte)2296 set_gdbarch_deprecated_register_byte (struct gdbarch *gdbarch,
2297                                       gdbarch_deprecated_register_byte_ftype deprecated_register_byte)
2298 {
2299   gdbarch->deprecated_register_byte = deprecated_register_byte;
2300 }
2301 
2302 int
gdbarch_unwind_dummy_id_p(struct gdbarch * gdbarch)2303 gdbarch_unwind_dummy_id_p (struct gdbarch *gdbarch)
2304 {
2305   gdb_assert (gdbarch != NULL);
2306   return gdbarch->unwind_dummy_id != NULL;
2307 }
2308 
2309 struct frame_id
gdbarch_unwind_dummy_id(struct gdbarch * gdbarch,struct frame_info * info)2310 gdbarch_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *info)
2311 {
2312   gdb_assert (gdbarch != NULL);
2313   gdb_assert (gdbarch->unwind_dummy_id != NULL);
2314   if (gdbarch_debug >= 2)
2315     fprintf_unfiltered (gdb_stdlog, "gdbarch_unwind_dummy_id called\n");
2316   return gdbarch->unwind_dummy_id (gdbarch, info);
2317 }
2318 
2319 void
set_gdbarch_unwind_dummy_id(struct gdbarch * gdbarch,gdbarch_unwind_dummy_id_ftype unwind_dummy_id)2320 set_gdbarch_unwind_dummy_id (struct gdbarch *gdbarch,
2321                              gdbarch_unwind_dummy_id_ftype unwind_dummy_id)
2322 {
2323   gdbarch->unwind_dummy_id = unwind_dummy_id;
2324 }
2325 
2326 int
gdbarch_deprecated_fp_regnum(struct gdbarch * gdbarch)2327 gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch)
2328 {
2329   gdb_assert (gdbarch != NULL);
2330   /* Skip verify of deprecated_fp_regnum, invalid_p == 0 */
2331   if (gdbarch_debug >= 2)
2332     fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_fp_regnum called\n");
2333   return gdbarch->deprecated_fp_regnum;
2334 }
2335 
2336 void
set_gdbarch_deprecated_fp_regnum(struct gdbarch * gdbarch,int deprecated_fp_regnum)2337 set_gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch,
2338                                   int deprecated_fp_regnum)
2339 {
2340   gdbarch->deprecated_fp_regnum = deprecated_fp_regnum;
2341 }
2342 
2343 int
gdbarch_push_dummy_call_p(struct gdbarch * gdbarch)2344 gdbarch_push_dummy_call_p (struct gdbarch *gdbarch)
2345 {
2346   gdb_assert (gdbarch != NULL);
2347   return gdbarch->push_dummy_call != NULL;
2348 }
2349 
2350 CORE_ADDR
gdbarch_push_dummy_call(struct gdbarch * gdbarch,struct value * function,struct regcache * regcache,CORE_ADDR bp_addr,int nargs,struct value ** args,CORE_ADDR sp,int struct_return,CORE_ADDR struct_addr)2351 gdbarch_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
2352 {
2353   gdb_assert (gdbarch != NULL);
2354   gdb_assert (gdbarch->push_dummy_call != NULL);
2355   if (gdbarch_debug >= 2)
2356     fprintf_unfiltered (gdb_stdlog, "gdbarch_push_dummy_call called\n");
2357   return gdbarch->push_dummy_call (gdbarch, function, regcache, bp_addr, nargs, args, sp, struct_return, struct_addr);
2358 }
2359 
2360 void
set_gdbarch_push_dummy_call(struct gdbarch * gdbarch,gdbarch_push_dummy_call_ftype push_dummy_call)2361 set_gdbarch_push_dummy_call (struct gdbarch *gdbarch,
2362                              gdbarch_push_dummy_call_ftype push_dummy_call)
2363 {
2364   gdbarch->push_dummy_call = push_dummy_call;
2365 }
2366 
2367 int
gdbarch_deprecated_push_arguments_p(struct gdbarch * gdbarch)2368 gdbarch_deprecated_push_arguments_p (struct gdbarch *gdbarch)
2369 {
2370   gdb_assert (gdbarch != NULL);
2371   return gdbarch->deprecated_push_arguments != NULL;
2372 }
2373 
2374 CORE_ADDR
gdbarch_deprecated_push_arguments(struct gdbarch * gdbarch,int nargs,struct value ** args,CORE_ADDR sp,int struct_return,CORE_ADDR struct_addr)2375 gdbarch_deprecated_push_arguments (struct gdbarch *gdbarch, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
2376 {
2377   gdb_assert (gdbarch != NULL);
2378   gdb_assert (gdbarch->deprecated_push_arguments != NULL);
2379   if (gdbarch_debug >= 2)
2380     fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_push_arguments called\n");
2381   return gdbarch->deprecated_push_arguments (nargs, args, sp, struct_return, struct_addr);
2382 }
2383 
2384 void
set_gdbarch_deprecated_push_arguments(struct gdbarch * gdbarch,gdbarch_deprecated_push_arguments_ftype deprecated_push_arguments)2385 set_gdbarch_deprecated_push_arguments (struct gdbarch *gdbarch,
2386                                        gdbarch_deprecated_push_arguments_ftype deprecated_push_arguments)
2387 {
2388   gdbarch->deprecated_push_arguments = deprecated_push_arguments;
2389 }
2390 
2391 int
gdbarch_deprecated_register_size(struct gdbarch * gdbarch)2392 gdbarch_deprecated_register_size (struct gdbarch *gdbarch)
2393 {
2394   gdb_assert (gdbarch != NULL);
2395   if (gdbarch_debug >= 2)
2396     fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_register_size called\n");
2397   return gdbarch->deprecated_register_size;
2398 }
2399 
2400 void
set_gdbarch_deprecated_register_size(struct gdbarch * gdbarch,int deprecated_register_size)2401 set_gdbarch_deprecated_register_size (struct gdbarch *gdbarch,
2402                                       int deprecated_register_size)
2403 {
2404   gdbarch->deprecated_register_size = deprecated_register_size;
2405 }
2406 
2407 int
gdbarch_call_dummy_location(struct gdbarch * gdbarch)2408 gdbarch_call_dummy_location (struct gdbarch *gdbarch)
2409 {
2410   gdb_assert (gdbarch != NULL);
2411   /* Skip verify of call_dummy_location, invalid_p == 0 */
2412   if (gdbarch_debug >= 2)
2413     fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_location called\n");
2414   return gdbarch->call_dummy_location;
2415 }
2416 
2417 void
set_gdbarch_call_dummy_location(struct gdbarch * gdbarch,int call_dummy_location)2418 set_gdbarch_call_dummy_location (struct gdbarch *gdbarch,
2419                                  int call_dummy_location)
2420 {
2421   gdbarch->call_dummy_location = call_dummy_location;
2422 }
2423 
2424 int
gdbarch_push_dummy_code_p(struct gdbarch * gdbarch)2425 gdbarch_push_dummy_code_p (struct gdbarch *gdbarch)
2426 {
2427   gdb_assert (gdbarch != NULL);
2428   return gdbarch->push_dummy_code != NULL;
2429 }
2430 
2431 CORE_ADDR
gdbarch_push_dummy_code(struct gdbarch * gdbarch,CORE_ADDR sp,CORE_ADDR funaddr,int using_gcc,struct value ** args,int nargs,struct type * value_type,CORE_ADDR * real_pc,CORE_ADDR * bp_addr)2432 gdbarch_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr, int using_gcc, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr)
2433 {
2434   gdb_assert (gdbarch != NULL);
2435   gdb_assert (gdbarch->push_dummy_code != NULL);
2436   if (gdbarch_debug >= 2)
2437     fprintf_unfiltered (gdb_stdlog, "gdbarch_push_dummy_code called\n");
2438   return gdbarch->push_dummy_code (gdbarch, sp, funaddr, using_gcc, args, nargs, value_type, real_pc, bp_addr);
2439 }
2440 
2441 void
set_gdbarch_push_dummy_code(struct gdbarch * gdbarch,gdbarch_push_dummy_code_ftype push_dummy_code)2442 set_gdbarch_push_dummy_code (struct gdbarch *gdbarch,
2443                              gdbarch_push_dummy_code_ftype push_dummy_code)
2444 {
2445   gdbarch->push_dummy_code = push_dummy_code;
2446 }
2447 
2448 void
gdbarch_print_registers_info(struct gdbarch * gdbarch,struct ui_file * file,struct frame_info * frame,int regnum,int all)2449 gdbarch_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, int regnum, int all)
2450 {
2451   gdb_assert (gdbarch != NULL);
2452   gdb_assert (gdbarch->print_registers_info != NULL);
2453   if (gdbarch_debug >= 2)
2454     fprintf_unfiltered (gdb_stdlog, "gdbarch_print_registers_info called\n");
2455   gdbarch->print_registers_info (gdbarch, file, frame, regnum, all);
2456 }
2457 
2458 void
set_gdbarch_print_registers_info(struct gdbarch * gdbarch,gdbarch_print_registers_info_ftype print_registers_info)2459 set_gdbarch_print_registers_info (struct gdbarch *gdbarch,
2460                                   gdbarch_print_registers_info_ftype print_registers_info)
2461 {
2462   gdbarch->print_registers_info = print_registers_info;
2463 }
2464 
2465 int
gdbarch_print_float_info_p(struct gdbarch * gdbarch)2466 gdbarch_print_float_info_p (struct gdbarch *gdbarch)
2467 {
2468   gdb_assert (gdbarch != NULL);
2469   return gdbarch->print_float_info != NULL;
2470 }
2471 
2472 void
gdbarch_print_float_info(struct gdbarch * gdbarch,struct ui_file * file,struct frame_info * frame,const char * args)2473 gdbarch_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, const char *args)
2474 {
2475   gdb_assert (gdbarch != NULL);
2476   gdb_assert (gdbarch->print_float_info != NULL);
2477   if (gdbarch_debug >= 2)
2478     fprintf_unfiltered (gdb_stdlog, "gdbarch_print_float_info called\n");
2479   gdbarch->print_float_info (gdbarch, file, frame, args);
2480 }
2481 
2482 void
set_gdbarch_print_float_info(struct gdbarch * gdbarch,gdbarch_print_float_info_ftype print_float_info)2483 set_gdbarch_print_float_info (struct gdbarch *gdbarch,
2484                               gdbarch_print_float_info_ftype print_float_info)
2485 {
2486   gdbarch->print_float_info = print_float_info;
2487 }
2488 
2489 int
gdbarch_print_vector_info_p(struct gdbarch * gdbarch)2490 gdbarch_print_vector_info_p (struct gdbarch *gdbarch)
2491 {
2492   gdb_assert (gdbarch != NULL);
2493   return gdbarch->print_vector_info != NULL;
2494 }
2495 
2496 void
gdbarch_print_vector_info(struct gdbarch * gdbarch,struct ui_file * file,struct frame_info * frame,const char * args)2497 gdbarch_print_vector_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, const char *args)
2498 {
2499   gdb_assert (gdbarch != NULL);
2500   gdb_assert (gdbarch->print_vector_info != NULL);
2501   if (gdbarch_debug >= 2)
2502     fprintf_unfiltered (gdb_stdlog, "gdbarch_print_vector_info called\n");
2503   gdbarch->print_vector_info (gdbarch, file, frame, args);
2504 }
2505 
2506 void
set_gdbarch_print_vector_info(struct gdbarch * gdbarch,gdbarch_print_vector_info_ftype print_vector_info)2507 set_gdbarch_print_vector_info (struct gdbarch *gdbarch,
2508                                gdbarch_print_vector_info_ftype print_vector_info)
2509 {
2510   gdbarch->print_vector_info = print_vector_info;
2511 }
2512 
2513 int
gdbarch_register_sim_regno(struct gdbarch * gdbarch,int reg_nr)2514 gdbarch_register_sim_regno (struct gdbarch *gdbarch, int reg_nr)
2515 {
2516   gdb_assert (gdbarch != NULL);
2517   gdb_assert (gdbarch->register_sim_regno != NULL);
2518   if (gdbarch_debug >= 2)
2519     fprintf_unfiltered (gdb_stdlog, "gdbarch_register_sim_regno called\n");
2520   return gdbarch->register_sim_regno (reg_nr);
2521 }
2522 
2523 void
set_gdbarch_register_sim_regno(struct gdbarch * gdbarch,gdbarch_register_sim_regno_ftype register_sim_regno)2524 set_gdbarch_register_sim_regno (struct gdbarch *gdbarch,
2525                                 gdbarch_register_sim_regno_ftype register_sim_regno)
2526 {
2527   gdbarch->register_sim_regno = register_sim_regno;
2528 }
2529 
2530 int
gdbarch_register_bytes_ok_p(struct gdbarch * gdbarch)2531 gdbarch_register_bytes_ok_p (struct gdbarch *gdbarch)
2532 {
2533   gdb_assert (gdbarch != NULL);
2534   return gdbarch->register_bytes_ok != NULL;
2535 }
2536 
2537 int
gdbarch_register_bytes_ok(struct gdbarch * gdbarch,long nr_bytes)2538 gdbarch_register_bytes_ok (struct gdbarch *gdbarch, long nr_bytes)
2539 {
2540   gdb_assert (gdbarch != NULL);
2541   gdb_assert (gdbarch->register_bytes_ok != NULL);
2542   if (gdbarch_debug >= 2)
2543     fprintf_unfiltered (gdb_stdlog, "gdbarch_register_bytes_ok called\n");
2544   return gdbarch->register_bytes_ok (nr_bytes);
2545 }
2546 
2547 void
set_gdbarch_register_bytes_ok(struct gdbarch * gdbarch,gdbarch_register_bytes_ok_ftype register_bytes_ok)2548 set_gdbarch_register_bytes_ok (struct gdbarch *gdbarch,
2549                                gdbarch_register_bytes_ok_ftype register_bytes_ok)
2550 {
2551   gdbarch->register_bytes_ok = register_bytes_ok;
2552 }
2553 
2554 int
gdbarch_cannot_fetch_register(struct gdbarch * gdbarch,int regnum)2555 gdbarch_cannot_fetch_register (struct gdbarch *gdbarch, int regnum)
2556 {
2557   gdb_assert (gdbarch != NULL);
2558   gdb_assert (gdbarch->cannot_fetch_register != NULL);
2559   if (gdbarch_debug >= 2)
2560     fprintf_unfiltered (gdb_stdlog, "gdbarch_cannot_fetch_register called\n");
2561   return gdbarch->cannot_fetch_register (regnum);
2562 }
2563 
2564 void
set_gdbarch_cannot_fetch_register(struct gdbarch * gdbarch,gdbarch_cannot_fetch_register_ftype cannot_fetch_register)2565 set_gdbarch_cannot_fetch_register (struct gdbarch *gdbarch,
2566                                    gdbarch_cannot_fetch_register_ftype cannot_fetch_register)
2567 {
2568   gdbarch->cannot_fetch_register = cannot_fetch_register;
2569 }
2570 
2571 int
gdbarch_cannot_store_register(struct gdbarch * gdbarch,int regnum)2572 gdbarch_cannot_store_register (struct gdbarch *gdbarch, int regnum)
2573 {
2574   gdb_assert (gdbarch != NULL);
2575   gdb_assert (gdbarch->cannot_store_register != NULL);
2576   if (gdbarch_debug >= 2)
2577     fprintf_unfiltered (gdb_stdlog, "gdbarch_cannot_store_register called\n");
2578   return gdbarch->cannot_store_register (regnum);
2579 }
2580 
2581 void
set_gdbarch_cannot_store_register(struct gdbarch * gdbarch,gdbarch_cannot_store_register_ftype cannot_store_register)2582 set_gdbarch_cannot_store_register (struct gdbarch *gdbarch,
2583                                    gdbarch_cannot_store_register_ftype cannot_store_register)
2584 {
2585   gdbarch->cannot_store_register = cannot_store_register;
2586 }
2587 
2588 int
gdbarch_get_longjmp_target_p(struct gdbarch * gdbarch)2589 gdbarch_get_longjmp_target_p (struct gdbarch *gdbarch)
2590 {
2591   gdb_assert (gdbarch != NULL);
2592   return gdbarch->get_longjmp_target != NULL;
2593 }
2594 
2595 int
gdbarch_get_longjmp_target(struct gdbarch * gdbarch,CORE_ADDR * pc)2596 gdbarch_get_longjmp_target (struct gdbarch *gdbarch, CORE_ADDR *pc)
2597 {
2598   gdb_assert (gdbarch != NULL);
2599   gdb_assert (gdbarch->get_longjmp_target != NULL);
2600   if (gdbarch_debug >= 2)
2601     fprintf_unfiltered (gdb_stdlog, "gdbarch_get_longjmp_target called\n");
2602   return gdbarch->get_longjmp_target (pc);
2603 }
2604 
2605 void
set_gdbarch_get_longjmp_target(struct gdbarch * gdbarch,gdbarch_get_longjmp_target_ftype get_longjmp_target)2606 set_gdbarch_get_longjmp_target (struct gdbarch *gdbarch,
2607                                 gdbarch_get_longjmp_target_ftype get_longjmp_target)
2608 {
2609   gdbarch->get_longjmp_target = get_longjmp_target;
2610 }
2611 
2612 int
gdbarch_believe_pcc_promotion(struct gdbarch * gdbarch)2613 gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch)
2614 {
2615   gdb_assert (gdbarch != NULL);
2616   if (gdbarch_debug >= 2)
2617     fprintf_unfiltered (gdb_stdlog, "gdbarch_believe_pcc_promotion called\n");
2618   return gdbarch->believe_pcc_promotion;
2619 }
2620 
2621 void
set_gdbarch_believe_pcc_promotion(struct gdbarch * gdbarch,int believe_pcc_promotion)2622 set_gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch,
2623                                    int believe_pcc_promotion)
2624 {
2625   gdbarch->believe_pcc_promotion = believe_pcc_promotion;
2626 }
2627 
2628 int
gdbarch_convert_register_p(struct gdbarch * gdbarch,int regnum,struct type * type)2629 gdbarch_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type)
2630 {
2631   gdb_assert (gdbarch != NULL);
2632   gdb_assert (gdbarch->convert_register_p != NULL);
2633   if (gdbarch_debug >= 2)
2634     fprintf_unfiltered (gdb_stdlog, "gdbarch_convert_register_p called\n");
2635   return gdbarch->convert_register_p (regnum, type);
2636 }
2637 
2638 void
set_gdbarch_convert_register_p(struct gdbarch * gdbarch,gdbarch_convert_register_p_ftype convert_register_p)2639 set_gdbarch_convert_register_p (struct gdbarch *gdbarch,
2640                                 gdbarch_convert_register_p_ftype convert_register_p)
2641 {
2642   gdbarch->convert_register_p = convert_register_p;
2643 }
2644 
2645 void
gdbarch_register_to_value(struct gdbarch * gdbarch,struct frame_info * frame,int regnum,struct type * type,void * buf)2646 gdbarch_register_to_value (struct gdbarch *gdbarch, struct frame_info *frame, int regnum, struct type *type, void *buf)
2647 {
2648   gdb_assert (gdbarch != NULL);
2649   gdb_assert (gdbarch->register_to_value != NULL);
2650   if (gdbarch_debug >= 2)
2651     fprintf_unfiltered (gdb_stdlog, "gdbarch_register_to_value called\n");
2652   gdbarch->register_to_value (frame, regnum, type, buf);
2653 }
2654 
2655 void
set_gdbarch_register_to_value(struct gdbarch * gdbarch,gdbarch_register_to_value_ftype register_to_value)2656 set_gdbarch_register_to_value (struct gdbarch *gdbarch,
2657                                gdbarch_register_to_value_ftype register_to_value)
2658 {
2659   gdbarch->register_to_value = register_to_value;
2660 }
2661 
2662 void
gdbarch_value_to_register(struct gdbarch * gdbarch,struct frame_info * frame,int regnum,struct type * type,const void * buf)2663 gdbarch_value_to_register (struct gdbarch *gdbarch, struct frame_info *frame, int regnum, struct type *type, const void *buf)
2664 {
2665   gdb_assert (gdbarch != NULL);
2666   gdb_assert (gdbarch->value_to_register != NULL);
2667   if (gdbarch_debug >= 2)
2668     fprintf_unfiltered (gdb_stdlog, "gdbarch_value_to_register called\n");
2669   gdbarch->value_to_register (frame, regnum, type, buf);
2670 }
2671 
2672 void
set_gdbarch_value_to_register(struct gdbarch * gdbarch,gdbarch_value_to_register_ftype value_to_register)2673 set_gdbarch_value_to_register (struct gdbarch *gdbarch,
2674                                gdbarch_value_to_register_ftype value_to_register)
2675 {
2676   gdbarch->value_to_register = value_to_register;
2677 }
2678 
2679 CORE_ADDR
gdbarch_pointer_to_address(struct gdbarch * gdbarch,struct type * type,const void * buf)2680 gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, const void *buf)
2681 {
2682   gdb_assert (gdbarch != NULL);
2683   gdb_assert (gdbarch->pointer_to_address != NULL);
2684   if (gdbarch_debug >= 2)
2685     fprintf_unfiltered (gdb_stdlog, "gdbarch_pointer_to_address called\n");
2686   return gdbarch->pointer_to_address (type, buf);
2687 }
2688 
2689 void
set_gdbarch_pointer_to_address(struct gdbarch * gdbarch,gdbarch_pointer_to_address_ftype pointer_to_address)2690 set_gdbarch_pointer_to_address (struct gdbarch *gdbarch,
2691                                 gdbarch_pointer_to_address_ftype pointer_to_address)
2692 {
2693   gdbarch->pointer_to_address = pointer_to_address;
2694 }
2695 
2696 void
gdbarch_address_to_pointer(struct gdbarch * gdbarch,struct type * type,void * buf,CORE_ADDR addr)2697 gdbarch_address_to_pointer (struct gdbarch *gdbarch, struct type *type, void *buf, CORE_ADDR addr)
2698 {
2699   gdb_assert (gdbarch != NULL);
2700   gdb_assert (gdbarch->address_to_pointer != NULL);
2701   if (gdbarch_debug >= 2)
2702     fprintf_unfiltered (gdb_stdlog, "gdbarch_address_to_pointer called\n");
2703   gdbarch->address_to_pointer (type, buf, addr);
2704 }
2705 
2706 void
set_gdbarch_address_to_pointer(struct gdbarch * gdbarch,gdbarch_address_to_pointer_ftype address_to_pointer)2707 set_gdbarch_address_to_pointer (struct gdbarch *gdbarch,
2708                                 gdbarch_address_to_pointer_ftype address_to_pointer)
2709 {
2710   gdbarch->address_to_pointer = address_to_pointer;
2711 }
2712 
2713 int
gdbarch_integer_to_address_p(struct gdbarch * gdbarch)2714 gdbarch_integer_to_address_p (struct gdbarch *gdbarch)
2715 {
2716   gdb_assert (gdbarch != NULL);
2717   return gdbarch->integer_to_address != NULL;
2718 }
2719 
2720 CORE_ADDR
gdbarch_integer_to_address(struct gdbarch * gdbarch,struct type * type,void * buf)2721 gdbarch_integer_to_address (struct gdbarch *gdbarch, struct type *type, void *buf)
2722 {
2723   gdb_assert (gdbarch != NULL);
2724   gdb_assert (gdbarch->integer_to_address != NULL);
2725   if (gdbarch_debug >= 2)
2726     fprintf_unfiltered (gdb_stdlog, "gdbarch_integer_to_address called\n");
2727   return gdbarch->integer_to_address (type, buf);
2728 }
2729 
2730 void
set_gdbarch_integer_to_address(struct gdbarch * gdbarch,gdbarch_integer_to_address_ftype integer_to_address)2731 set_gdbarch_integer_to_address (struct gdbarch *gdbarch,
2732                                 gdbarch_integer_to_address_ftype integer_to_address)
2733 {
2734   gdbarch->integer_to_address = integer_to_address;
2735 }
2736 
2737 int
gdbarch_deprecated_store_struct_return_p(struct gdbarch * gdbarch)2738 gdbarch_deprecated_store_struct_return_p (struct gdbarch *gdbarch)
2739 {
2740   gdb_assert (gdbarch != NULL);
2741   return gdbarch->deprecated_store_struct_return != NULL;
2742 }
2743 
2744 void
gdbarch_deprecated_store_struct_return(struct gdbarch * gdbarch,CORE_ADDR addr,CORE_ADDR sp)2745 gdbarch_deprecated_store_struct_return (struct gdbarch *gdbarch, CORE_ADDR addr, CORE_ADDR sp)
2746 {
2747   gdb_assert (gdbarch != NULL);
2748   gdb_assert (gdbarch->deprecated_store_struct_return != NULL);
2749   if (gdbarch_debug >= 2)
2750     fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_store_struct_return called\n");
2751   gdbarch->deprecated_store_struct_return (addr, sp);
2752 }
2753 
2754 void
set_gdbarch_deprecated_store_struct_return(struct gdbarch * gdbarch,gdbarch_deprecated_store_struct_return_ftype deprecated_store_struct_return)2755 set_gdbarch_deprecated_store_struct_return (struct gdbarch *gdbarch,
2756                                             gdbarch_deprecated_store_struct_return_ftype deprecated_store_struct_return)
2757 {
2758   gdbarch->deprecated_store_struct_return = deprecated_store_struct_return;
2759 }
2760 
2761 int
gdbarch_return_value_p(struct gdbarch * gdbarch)2762 gdbarch_return_value_p (struct gdbarch *gdbarch)
2763 {
2764   gdb_assert (gdbarch != NULL);
2765   return gdbarch->return_value != legacy_return_value;
2766 }
2767 
2768 enum return_value_convention
gdbarch_return_value(struct gdbarch * gdbarch,struct type * valtype,struct regcache * regcache,void * readbuf,const void * writebuf)2769 gdbarch_return_value (struct gdbarch *gdbarch, struct type *valtype, struct regcache *regcache, void *readbuf, const void *writebuf)
2770 {
2771   gdb_assert (gdbarch != NULL);
2772   gdb_assert (gdbarch->return_value != NULL);
2773   /* Do not check predicate: gdbarch->return_value != legacy_return_value, allow call.  */
2774   if (gdbarch_debug >= 2)
2775     fprintf_unfiltered (gdb_stdlog, "gdbarch_return_value called\n");
2776   return gdbarch->return_value (gdbarch, valtype, regcache, readbuf, writebuf);
2777 }
2778 
2779 void
set_gdbarch_return_value(struct gdbarch * gdbarch,gdbarch_return_value_ftype return_value)2780 set_gdbarch_return_value (struct gdbarch *gdbarch,
2781                           gdbarch_return_value_ftype return_value)
2782 {
2783   gdbarch->return_value = return_value;
2784 }
2785 
2786 void
gdbarch_extract_return_value(struct gdbarch * gdbarch,struct type * type,struct regcache * regcache,void * valbuf)2787 gdbarch_extract_return_value (struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, void *valbuf)
2788 {
2789   gdb_assert (gdbarch != NULL);
2790   gdb_assert (gdbarch->extract_return_value != NULL);
2791   if (gdbarch_debug >= 2)
2792     fprintf_unfiltered (gdb_stdlog, "gdbarch_extract_return_value called\n");
2793   gdbarch->extract_return_value (type, regcache, valbuf);
2794 }
2795 
2796 void
set_gdbarch_extract_return_value(struct gdbarch * gdbarch,gdbarch_extract_return_value_ftype extract_return_value)2797 set_gdbarch_extract_return_value (struct gdbarch *gdbarch,
2798                                   gdbarch_extract_return_value_ftype extract_return_value)
2799 {
2800   gdbarch->extract_return_value = extract_return_value;
2801 }
2802 
2803 void
gdbarch_store_return_value(struct gdbarch * gdbarch,struct type * type,struct regcache * regcache,const void * valbuf)2804 gdbarch_store_return_value (struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, const void *valbuf)
2805 {
2806   gdb_assert (gdbarch != NULL);
2807   gdb_assert (gdbarch->store_return_value != NULL);
2808   if (gdbarch_debug >= 2)
2809     fprintf_unfiltered (gdb_stdlog, "gdbarch_store_return_value called\n");
2810   gdbarch->store_return_value (type, regcache, valbuf);
2811 }
2812 
2813 void
set_gdbarch_store_return_value(struct gdbarch * gdbarch,gdbarch_store_return_value_ftype store_return_value)2814 set_gdbarch_store_return_value (struct gdbarch *gdbarch,
2815                                 gdbarch_store_return_value_ftype store_return_value)
2816 {
2817   gdbarch->store_return_value = store_return_value;
2818 }
2819 
2820 void
gdbarch_deprecated_extract_return_value(struct gdbarch * gdbarch,struct type * type,char * regbuf,char * valbuf)2821 gdbarch_deprecated_extract_return_value (struct gdbarch *gdbarch, struct type *type, char *regbuf, char *valbuf)
2822 {
2823   gdb_assert (gdbarch != NULL);
2824   gdb_assert (gdbarch->deprecated_extract_return_value != NULL);
2825   if (gdbarch_debug >= 2)
2826     fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_extract_return_value called\n");
2827   gdbarch->deprecated_extract_return_value (type, regbuf, valbuf);
2828 }
2829 
2830 void
set_gdbarch_deprecated_extract_return_value(struct gdbarch * gdbarch,gdbarch_deprecated_extract_return_value_ftype deprecated_extract_return_value)2831 set_gdbarch_deprecated_extract_return_value (struct gdbarch *gdbarch,
2832                                              gdbarch_deprecated_extract_return_value_ftype deprecated_extract_return_value)
2833 {
2834   gdbarch->deprecated_extract_return_value = deprecated_extract_return_value;
2835 }
2836 
2837 void
gdbarch_deprecated_store_return_value(struct gdbarch * gdbarch,struct type * type,char * valbuf)2838 gdbarch_deprecated_store_return_value (struct gdbarch *gdbarch, struct type *type, char *valbuf)
2839 {
2840   gdb_assert (gdbarch != NULL);
2841   gdb_assert (gdbarch->deprecated_store_return_value != NULL);
2842   if (gdbarch_debug >= 2)
2843     fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_store_return_value called\n");
2844   gdbarch->deprecated_store_return_value (type, valbuf);
2845 }
2846 
2847 void
set_gdbarch_deprecated_store_return_value(struct gdbarch * gdbarch,gdbarch_deprecated_store_return_value_ftype deprecated_store_return_value)2848 set_gdbarch_deprecated_store_return_value (struct gdbarch *gdbarch,
2849                                            gdbarch_deprecated_store_return_value_ftype deprecated_store_return_value)
2850 {
2851   gdbarch->deprecated_store_return_value = deprecated_store_return_value;
2852 }
2853 
2854 int
gdbarch_deprecated_use_struct_convention(struct gdbarch * gdbarch,int gcc_p,struct type * value_type)2855 gdbarch_deprecated_use_struct_convention (struct gdbarch *gdbarch, int gcc_p, struct type *value_type)
2856 {
2857   gdb_assert (gdbarch != NULL);
2858   gdb_assert (gdbarch->deprecated_use_struct_convention != NULL);
2859   if (gdbarch_debug >= 2)
2860     fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_use_struct_convention called\n");
2861   return gdbarch->deprecated_use_struct_convention (gcc_p, value_type);
2862 }
2863 
2864 void
set_gdbarch_deprecated_use_struct_convention(struct gdbarch * gdbarch,gdbarch_deprecated_use_struct_convention_ftype deprecated_use_struct_convention)2865 set_gdbarch_deprecated_use_struct_convention (struct gdbarch *gdbarch,
2866                                               gdbarch_deprecated_use_struct_convention_ftype deprecated_use_struct_convention)
2867 {
2868   gdbarch->deprecated_use_struct_convention = deprecated_use_struct_convention;
2869 }
2870 
2871 int
gdbarch_deprecated_extract_struct_value_address_p(struct gdbarch * gdbarch)2872 gdbarch_deprecated_extract_struct_value_address_p (struct gdbarch *gdbarch)
2873 {
2874   gdb_assert (gdbarch != NULL);
2875   return gdbarch->deprecated_extract_struct_value_address != NULL;
2876 }
2877 
2878 CORE_ADDR
gdbarch_deprecated_extract_struct_value_address(struct gdbarch * gdbarch,struct regcache * regcache)2879 gdbarch_deprecated_extract_struct_value_address (struct gdbarch *gdbarch, struct regcache *regcache)
2880 {
2881   gdb_assert (gdbarch != NULL);
2882   gdb_assert (gdbarch->deprecated_extract_struct_value_address != NULL);
2883   if (gdbarch_debug >= 2)
2884     fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_extract_struct_value_address called\n");
2885   return gdbarch->deprecated_extract_struct_value_address (regcache);
2886 }
2887 
2888 void
set_gdbarch_deprecated_extract_struct_value_address(struct gdbarch * gdbarch,gdbarch_deprecated_extract_struct_value_address_ftype deprecated_extract_struct_value_address)2889 set_gdbarch_deprecated_extract_struct_value_address (struct gdbarch *gdbarch,
2890                                                      gdbarch_deprecated_extract_struct_value_address_ftype deprecated_extract_struct_value_address)
2891 {
2892   gdbarch->deprecated_extract_struct_value_address = deprecated_extract_struct_value_address;
2893 }
2894 
2895 CORE_ADDR
gdbarch_skip_prologue(struct gdbarch * gdbarch,CORE_ADDR ip)2896 gdbarch_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR ip)
2897 {
2898   gdb_assert (gdbarch != NULL);
2899   gdb_assert (gdbarch->skip_prologue != NULL);
2900   if (gdbarch_debug >= 2)
2901     fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_prologue called\n");
2902   return gdbarch->skip_prologue (ip);
2903 }
2904 
2905 void
set_gdbarch_skip_prologue(struct gdbarch * gdbarch,gdbarch_skip_prologue_ftype skip_prologue)2906 set_gdbarch_skip_prologue (struct gdbarch *gdbarch,
2907                            gdbarch_skip_prologue_ftype skip_prologue)
2908 {
2909   gdbarch->skip_prologue = skip_prologue;
2910 }
2911 
2912 int
gdbarch_inner_than(struct gdbarch * gdbarch,CORE_ADDR lhs,CORE_ADDR rhs)2913 gdbarch_inner_than (struct gdbarch *gdbarch, CORE_ADDR lhs, CORE_ADDR rhs)
2914 {
2915   gdb_assert (gdbarch != NULL);
2916   gdb_assert (gdbarch->inner_than != NULL);
2917   if (gdbarch_debug >= 2)
2918     fprintf_unfiltered (gdb_stdlog, "gdbarch_inner_than called\n");
2919   return gdbarch->inner_than (lhs, rhs);
2920 }
2921 
2922 void
set_gdbarch_inner_than(struct gdbarch * gdbarch,gdbarch_inner_than_ftype inner_than)2923 set_gdbarch_inner_than (struct gdbarch *gdbarch,
2924                         gdbarch_inner_than_ftype inner_than)
2925 {
2926   gdbarch->inner_than = inner_than;
2927 }
2928 
2929 const unsigned char *
gdbarch_breakpoint_from_pc(struct gdbarch * gdbarch,CORE_ADDR * pcptr,int * lenptr)2930 gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr)
2931 {
2932   gdb_assert (gdbarch != NULL);
2933   gdb_assert (gdbarch->breakpoint_from_pc != NULL);
2934   if (gdbarch_debug >= 2)
2935     fprintf_unfiltered (gdb_stdlog, "gdbarch_breakpoint_from_pc called\n");
2936   return gdbarch->breakpoint_from_pc (pcptr, lenptr);
2937 }
2938 
2939 void
set_gdbarch_breakpoint_from_pc(struct gdbarch * gdbarch,gdbarch_breakpoint_from_pc_ftype breakpoint_from_pc)2940 set_gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch,
2941                                 gdbarch_breakpoint_from_pc_ftype breakpoint_from_pc)
2942 {
2943   gdbarch->breakpoint_from_pc = breakpoint_from_pc;
2944 }
2945 
2946 int
gdbarch_adjust_breakpoint_address_p(struct gdbarch * gdbarch)2947 gdbarch_adjust_breakpoint_address_p (struct gdbarch *gdbarch)
2948 {
2949   gdb_assert (gdbarch != NULL);
2950   return gdbarch->adjust_breakpoint_address != NULL;
2951 }
2952 
2953 CORE_ADDR
gdbarch_adjust_breakpoint_address(struct gdbarch * gdbarch,CORE_ADDR bpaddr)2954 gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr)
2955 {
2956   gdb_assert (gdbarch != NULL);
2957   gdb_assert (gdbarch->adjust_breakpoint_address != NULL);
2958   if (gdbarch_debug >= 2)
2959     fprintf_unfiltered (gdb_stdlog, "gdbarch_adjust_breakpoint_address called\n");
2960   return gdbarch->adjust_breakpoint_address (gdbarch, bpaddr);
2961 }
2962 
2963 void
set_gdbarch_adjust_breakpoint_address(struct gdbarch * gdbarch,gdbarch_adjust_breakpoint_address_ftype adjust_breakpoint_address)2964 set_gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch,
2965                                        gdbarch_adjust_breakpoint_address_ftype adjust_breakpoint_address)
2966 {
2967   gdbarch->adjust_breakpoint_address = adjust_breakpoint_address;
2968 }
2969 
2970 int
gdbarch_memory_insert_breakpoint(struct gdbarch * gdbarch,CORE_ADDR addr,char * contents_cache)2971 gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, CORE_ADDR addr, char *contents_cache)
2972 {
2973   gdb_assert (gdbarch != NULL);
2974   gdb_assert (gdbarch->memory_insert_breakpoint != NULL);
2975   if (gdbarch_debug >= 2)
2976     fprintf_unfiltered (gdb_stdlog, "gdbarch_memory_insert_breakpoint called\n");
2977   return gdbarch->memory_insert_breakpoint (addr, contents_cache);
2978 }
2979 
2980 void
set_gdbarch_memory_insert_breakpoint(struct gdbarch * gdbarch,gdbarch_memory_insert_breakpoint_ftype memory_insert_breakpoint)2981 set_gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch,
2982                                       gdbarch_memory_insert_breakpoint_ftype memory_insert_breakpoint)
2983 {
2984   gdbarch->memory_insert_breakpoint = memory_insert_breakpoint;
2985 }
2986 
2987 int
gdbarch_memory_remove_breakpoint(struct gdbarch * gdbarch,CORE_ADDR addr,char * contents_cache)2988 gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, CORE_ADDR addr, char *contents_cache)
2989 {
2990   gdb_assert (gdbarch != NULL);
2991   gdb_assert (gdbarch->memory_remove_breakpoint != NULL);
2992   if (gdbarch_debug >= 2)
2993     fprintf_unfiltered (gdb_stdlog, "gdbarch_memory_remove_breakpoint called\n");
2994   return gdbarch->memory_remove_breakpoint (addr, contents_cache);
2995 }
2996 
2997 void
set_gdbarch_memory_remove_breakpoint(struct gdbarch * gdbarch,gdbarch_memory_remove_breakpoint_ftype memory_remove_breakpoint)2998 set_gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch,
2999                                       gdbarch_memory_remove_breakpoint_ftype memory_remove_breakpoint)
3000 {
3001   gdbarch->memory_remove_breakpoint = memory_remove_breakpoint;
3002 }
3003 
3004 CORE_ADDR
gdbarch_decr_pc_after_break(struct gdbarch * gdbarch)3005 gdbarch_decr_pc_after_break (struct gdbarch *gdbarch)
3006 {
3007   gdb_assert (gdbarch != NULL);
3008   /* Skip verify of decr_pc_after_break, invalid_p == 0 */
3009   if (gdbarch_debug >= 2)
3010     fprintf_unfiltered (gdb_stdlog, "gdbarch_decr_pc_after_break called\n");
3011   return gdbarch->decr_pc_after_break;
3012 }
3013 
3014 void
set_gdbarch_decr_pc_after_break(struct gdbarch * gdbarch,CORE_ADDR decr_pc_after_break)3015 set_gdbarch_decr_pc_after_break (struct gdbarch *gdbarch,
3016                                  CORE_ADDR decr_pc_after_break)
3017 {
3018   gdbarch->decr_pc_after_break = decr_pc_after_break;
3019 }
3020 
3021 CORE_ADDR
gdbarch_deprecated_function_start_offset(struct gdbarch * gdbarch)3022 gdbarch_deprecated_function_start_offset (struct gdbarch *gdbarch)
3023 {
3024   gdb_assert (gdbarch != NULL);
3025   /* Skip verify of deprecated_function_start_offset, invalid_p == 0 */
3026   if (gdbarch_debug >= 2)
3027     fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_function_start_offset called\n");
3028   return gdbarch->deprecated_function_start_offset;
3029 }
3030 
3031 void
set_gdbarch_deprecated_function_start_offset(struct gdbarch * gdbarch,CORE_ADDR deprecated_function_start_offset)3032 set_gdbarch_deprecated_function_start_offset (struct gdbarch *gdbarch,
3033                                               CORE_ADDR deprecated_function_start_offset)
3034 {
3035   gdbarch->deprecated_function_start_offset = deprecated_function_start_offset;
3036 }
3037 
3038 void
gdbarch_remote_translate_xfer_address(struct gdbarch * gdbarch,struct regcache * regcache,CORE_ADDR gdb_addr,int gdb_len,CORE_ADDR * rem_addr,int * rem_len)3039 gdbarch_remote_translate_xfer_address (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len)
3040 {
3041   gdb_assert (gdbarch != NULL);
3042   gdb_assert (gdbarch->remote_translate_xfer_address != NULL);
3043   if (gdbarch_debug >= 2)
3044     fprintf_unfiltered (gdb_stdlog, "gdbarch_remote_translate_xfer_address called\n");
3045   gdbarch->remote_translate_xfer_address (gdbarch, regcache, gdb_addr, gdb_len, rem_addr, rem_len);
3046 }
3047 
3048 void
set_gdbarch_remote_translate_xfer_address(struct gdbarch * gdbarch,gdbarch_remote_translate_xfer_address_ftype remote_translate_xfer_address)3049 set_gdbarch_remote_translate_xfer_address (struct gdbarch *gdbarch,
3050                                            gdbarch_remote_translate_xfer_address_ftype remote_translate_xfer_address)
3051 {
3052   gdbarch->remote_translate_xfer_address = remote_translate_xfer_address;
3053 }
3054 
3055 CORE_ADDR
gdbarch_frame_args_skip(struct gdbarch * gdbarch)3056 gdbarch_frame_args_skip (struct gdbarch *gdbarch)
3057 {
3058   gdb_assert (gdbarch != NULL);
3059   /* Skip verify of frame_args_skip, invalid_p == 0 */
3060   if (gdbarch_debug >= 2)
3061     fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_args_skip called\n");
3062   return gdbarch->frame_args_skip;
3063 }
3064 
3065 void
set_gdbarch_frame_args_skip(struct gdbarch * gdbarch,CORE_ADDR frame_args_skip)3066 set_gdbarch_frame_args_skip (struct gdbarch *gdbarch,
3067                              CORE_ADDR frame_args_skip)
3068 {
3069   gdbarch->frame_args_skip = frame_args_skip;
3070 }
3071 
3072 int
gdbarch_unwind_pc_p(struct gdbarch * gdbarch)3073 gdbarch_unwind_pc_p (struct gdbarch *gdbarch)
3074 {
3075   gdb_assert (gdbarch != NULL);
3076   return gdbarch->unwind_pc != NULL;
3077 }
3078 
3079 CORE_ADDR
gdbarch_unwind_pc(struct gdbarch * gdbarch,struct frame_info * next_frame)3080 gdbarch_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
3081 {
3082   gdb_assert (gdbarch != NULL);
3083   gdb_assert (gdbarch->unwind_pc != NULL);
3084   if (gdbarch_debug >= 2)
3085     fprintf_unfiltered (gdb_stdlog, "gdbarch_unwind_pc called\n");
3086   return gdbarch->unwind_pc (gdbarch, next_frame);
3087 }
3088 
3089 void
set_gdbarch_unwind_pc(struct gdbarch * gdbarch,gdbarch_unwind_pc_ftype unwind_pc)3090 set_gdbarch_unwind_pc (struct gdbarch *gdbarch,
3091                        gdbarch_unwind_pc_ftype unwind_pc)
3092 {
3093   gdbarch->unwind_pc = unwind_pc;
3094 }
3095 
3096 int
gdbarch_unwind_sp_p(struct gdbarch * gdbarch)3097 gdbarch_unwind_sp_p (struct gdbarch *gdbarch)
3098 {
3099   gdb_assert (gdbarch != NULL);
3100   return gdbarch->unwind_sp != NULL;
3101 }
3102 
3103 CORE_ADDR
gdbarch_unwind_sp(struct gdbarch * gdbarch,struct frame_info * next_frame)3104 gdbarch_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
3105 {
3106   gdb_assert (gdbarch != NULL);
3107   gdb_assert (gdbarch->unwind_sp != NULL);
3108   if (gdbarch_debug >= 2)
3109     fprintf_unfiltered (gdb_stdlog, "gdbarch_unwind_sp called\n");
3110   return gdbarch->unwind_sp (gdbarch, next_frame);
3111 }
3112 
3113 void
set_gdbarch_unwind_sp(struct gdbarch * gdbarch,gdbarch_unwind_sp_ftype unwind_sp)3114 set_gdbarch_unwind_sp (struct gdbarch *gdbarch,
3115                        gdbarch_unwind_sp_ftype unwind_sp)
3116 {
3117   gdbarch->unwind_sp = unwind_sp;
3118 }
3119 
3120 int
gdbarch_deprecated_saved_pc_after_call_p(struct gdbarch * gdbarch)3121 gdbarch_deprecated_saved_pc_after_call_p (struct gdbarch *gdbarch)
3122 {
3123   gdb_assert (gdbarch != NULL);
3124   return gdbarch->deprecated_saved_pc_after_call != NULL;
3125 }
3126 
3127 CORE_ADDR
gdbarch_deprecated_saved_pc_after_call(struct gdbarch * gdbarch,struct frame_info * frame)3128 gdbarch_deprecated_saved_pc_after_call (struct gdbarch *gdbarch, struct frame_info *frame)
3129 {
3130   gdb_assert (gdbarch != NULL);
3131   gdb_assert (gdbarch->deprecated_saved_pc_after_call != NULL);
3132   if (gdbarch_debug >= 2)
3133     fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_saved_pc_after_call called\n");
3134   return gdbarch->deprecated_saved_pc_after_call (frame);
3135 }
3136 
3137 void
set_gdbarch_deprecated_saved_pc_after_call(struct gdbarch * gdbarch,gdbarch_deprecated_saved_pc_after_call_ftype deprecated_saved_pc_after_call)3138 set_gdbarch_deprecated_saved_pc_after_call (struct gdbarch *gdbarch,
3139                                             gdbarch_deprecated_saved_pc_after_call_ftype deprecated_saved_pc_after_call)
3140 {
3141   gdbarch->deprecated_saved_pc_after_call = deprecated_saved_pc_after_call;
3142 }
3143 
3144 int
gdbarch_frame_num_args_p(struct gdbarch * gdbarch)3145 gdbarch_frame_num_args_p (struct gdbarch *gdbarch)
3146 {
3147   gdb_assert (gdbarch != NULL);
3148   return gdbarch->frame_num_args != NULL;
3149 }
3150 
3151 int
gdbarch_frame_num_args(struct gdbarch * gdbarch,struct frame_info * frame)3152 gdbarch_frame_num_args (struct gdbarch *gdbarch, struct frame_info *frame)
3153 {
3154   gdb_assert (gdbarch != NULL);
3155   gdb_assert (gdbarch->frame_num_args != NULL);
3156   if (gdbarch_debug >= 2)
3157     fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_num_args called\n");
3158   return gdbarch->frame_num_args (frame);
3159 }
3160 
3161 void
set_gdbarch_frame_num_args(struct gdbarch * gdbarch,gdbarch_frame_num_args_ftype frame_num_args)3162 set_gdbarch_frame_num_args (struct gdbarch *gdbarch,
3163                             gdbarch_frame_num_args_ftype frame_num_args)
3164 {
3165   gdbarch->frame_num_args = frame_num_args;
3166 }
3167 
3168 int
gdbarch_deprecated_stack_align_p(struct gdbarch * gdbarch)3169 gdbarch_deprecated_stack_align_p (struct gdbarch *gdbarch)
3170 {
3171   gdb_assert (gdbarch != NULL);
3172   return gdbarch->deprecated_stack_align != NULL;
3173 }
3174 
3175 CORE_ADDR
gdbarch_deprecated_stack_align(struct gdbarch * gdbarch,CORE_ADDR sp)3176 gdbarch_deprecated_stack_align (struct gdbarch *gdbarch, CORE_ADDR sp)
3177 {
3178   gdb_assert (gdbarch != NULL);
3179   gdb_assert (gdbarch->deprecated_stack_align != NULL);
3180   if (gdbarch_debug >= 2)
3181     fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_stack_align called\n");
3182   return gdbarch->deprecated_stack_align (sp);
3183 }
3184 
3185 void
set_gdbarch_deprecated_stack_align(struct gdbarch * gdbarch,gdbarch_deprecated_stack_align_ftype deprecated_stack_align)3186 set_gdbarch_deprecated_stack_align (struct gdbarch *gdbarch,
3187                                     gdbarch_deprecated_stack_align_ftype deprecated_stack_align)
3188 {
3189   gdbarch->deprecated_stack_align = deprecated_stack_align;
3190 }
3191 
3192 int
gdbarch_frame_align_p(struct gdbarch * gdbarch)3193 gdbarch_frame_align_p (struct gdbarch *gdbarch)
3194 {
3195   gdb_assert (gdbarch != NULL);
3196   return gdbarch->frame_align != NULL;
3197 }
3198 
3199 CORE_ADDR
gdbarch_frame_align(struct gdbarch * gdbarch,CORE_ADDR address)3200 gdbarch_frame_align (struct gdbarch *gdbarch, CORE_ADDR address)
3201 {
3202   gdb_assert (gdbarch != NULL);
3203   gdb_assert (gdbarch->frame_align != NULL);
3204   if (gdbarch_debug >= 2)
3205     fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_align called\n");
3206   return gdbarch->frame_align (gdbarch, address);
3207 }
3208 
3209 void
set_gdbarch_frame_align(struct gdbarch * gdbarch,gdbarch_frame_align_ftype frame_align)3210 set_gdbarch_frame_align (struct gdbarch *gdbarch,
3211                          gdbarch_frame_align_ftype frame_align)
3212 {
3213   gdbarch->frame_align = frame_align;
3214 }
3215 
3216 int
gdbarch_deprecated_reg_struct_has_addr_p(struct gdbarch * gdbarch)3217 gdbarch_deprecated_reg_struct_has_addr_p (struct gdbarch *gdbarch)
3218 {
3219   gdb_assert (gdbarch != NULL);
3220   return gdbarch->deprecated_reg_struct_has_addr != NULL;
3221 }
3222 
3223 int
gdbarch_deprecated_reg_struct_has_addr(struct gdbarch * gdbarch,int gcc_p,struct type * type)3224 gdbarch_deprecated_reg_struct_has_addr (struct gdbarch *gdbarch, int gcc_p, struct type *type)
3225 {
3226   gdb_assert (gdbarch != NULL);
3227   gdb_assert (gdbarch->deprecated_reg_struct_has_addr != NULL);
3228   if (gdbarch_debug >= 2)
3229     fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_reg_struct_has_addr called\n");
3230   return gdbarch->deprecated_reg_struct_has_addr (gcc_p, type);
3231 }
3232 
3233 void
set_gdbarch_deprecated_reg_struct_has_addr(struct gdbarch * gdbarch,gdbarch_deprecated_reg_struct_has_addr_ftype deprecated_reg_struct_has_addr)3234 set_gdbarch_deprecated_reg_struct_has_addr (struct gdbarch *gdbarch,
3235                                             gdbarch_deprecated_reg_struct_has_addr_ftype deprecated_reg_struct_has_addr)
3236 {
3237   gdbarch->deprecated_reg_struct_has_addr = deprecated_reg_struct_has_addr;
3238 }
3239 
3240 int
gdbarch_stabs_argument_has_addr(struct gdbarch * gdbarch,struct type * type)3241 gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type)
3242 {
3243   gdb_assert (gdbarch != NULL);
3244   gdb_assert (gdbarch->stabs_argument_has_addr != NULL);
3245   if (gdbarch_debug >= 2)
3246     fprintf_unfiltered (gdb_stdlog, "gdbarch_stabs_argument_has_addr called\n");
3247   return gdbarch->stabs_argument_has_addr (gdbarch, type);
3248 }
3249 
3250 void
set_gdbarch_stabs_argument_has_addr(struct gdbarch * gdbarch,gdbarch_stabs_argument_has_addr_ftype stabs_argument_has_addr)3251 set_gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch,
3252                                      gdbarch_stabs_argument_has_addr_ftype stabs_argument_has_addr)
3253 {
3254   gdbarch->stabs_argument_has_addr = stabs_argument_has_addr;
3255 }
3256 
3257 int
gdbarch_frame_red_zone_size(struct gdbarch * gdbarch)3258 gdbarch_frame_red_zone_size (struct gdbarch *gdbarch)
3259 {
3260   gdb_assert (gdbarch != NULL);
3261   if (gdbarch_debug >= 2)
3262     fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_red_zone_size called\n");
3263   return gdbarch->frame_red_zone_size;
3264 }
3265 
3266 void
set_gdbarch_frame_red_zone_size(struct gdbarch * gdbarch,int frame_red_zone_size)3267 set_gdbarch_frame_red_zone_size (struct gdbarch *gdbarch,
3268                                  int frame_red_zone_size)
3269 {
3270   gdbarch->frame_red_zone_size = frame_red_zone_size;
3271 }
3272 
3273 CORE_ADDR
gdbarch_convert_from_func_ptr_addr(struct gdbarch * gdbarch,CORE_ADDR addr,struct target_ops * targ)3274 gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr, struct target_ops *targ)
3275 {
3276   gdb_assert (gdbarch != NULL);
3277   gdb_assert (gdbarch->convert_from_func_ptr_addr != NULL);
3278   if (gdbarch_debug >= 2)
3279     fprintf_unfiltered (gdb_stdlog, "gdbarch_convert_from_func_ptr_addr called\n");
3280   return gdbarch->convert_from_func_ptr_addr (gdbarch, addr, targ);
3281 }
3282 
3283 void
set_gdbarch_convert_from_func_ptr_addr(struct gdbarch * gdbarch,gdbarch_convert_from_func_ptr_addr_ftype convert_from_func_ptr_addr)3284 set_gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
3285                                         gdbarch_convert_from_func_ptr_addr_ftype convert_from_func_ptr_addr)
3286 {
3287   gdbarch->convert_from_func_ptr_addr = convert_from_func_ptr_addr;
3288 }
3289 
3290 CORE_ADDR
gdbarch_addr_bits_remove(struct gdbarch * gdbarch,CORE_ADDR addr)3291 gdbarch_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr)
3292 {
3293   gdb_assert (gdbarch != NULL);
3294   gdb_assert (gdbarch->addr_bits_remove != NULL);
3295   if (gdbarch_debug >= 2)
3296     fprintf_unfiltered (gdb_stdlog, "gdbarch_addr_bits_remove called\n");
3297   return gdbarch->addr_bits_remove (addr);
3298 }
3299 
3300 void
set_gdbarch_addr_bits_remove(struct gdbarch * gdbarch,gdbarch_addr_bits_remove_ftype addr_bits_remove)3301 set_gdbarch_addr_bits_remove (struct gdbarch *gdbarch,
3302                               gdbarch_addr_bits_remove_ftype addr_bits_remove)
3303 {
3304   gdbarch->addr_bits_remove = addr_bits_remove;
3305 }
3306 
3307 CORE_ADDR
gdbarch_smash_text_address(struct gdbarch * gdbarch,CORE_ADDR addr)3308 gdbarch_smash_text_address (struct gdbarch *gdbarch, CORE_ADDR addr)
3309 {
3310   gdb_assert (gdbarch != NULL);
3311   gdb_assert (gdbarch->smash_text_address != NULL);
3312   if (gdbarch_debug >= 2)
3313     fprintf_unfiltered (gdb_stdlog, "gdbarch_smash_text_address called\n");
3314   return gdbarch->smash_text_address (addr);
3315 }
3316 
3317 void
set_gdbarch_smash_text_address(struct gdbarch * gdbarch,gdbarch_smash_text_address_ftype smash_text_address)3318 set_gdbarch_smash_text_address (struct gdbarch *gdbarch,
3319                                 gdbarch_smash_text_address_ftype smash_text_address)
3320 {
3321   gdbarch->smash_text_address = smash_text_address;
3322 }
3323 
3324 int
gdbarch_software_single_step_p(struct gdbarch * gdbarch)3325 gdbarch_software_single_step_p (struct gdbarch *gdbarch)
3326 {
3327   gdb_assert (gdbarch != NULL);
3328   return gdbarch->software_single_step != NULL;
3329 }
3330 
3331 void
gdbarch_software_single_step(struct gdbarch * gdbarch,enum target_signal sig,int insert_breakpoints_p)3332 gdbarch_software_single_step (struct gdbarch *gdbarch, enum target_signal sig, int insert_breakpoints_p)
3333 {
3334   gdb_assert (gdbarch != NULL);
3335   gdb_assert (gdbarch->software_single_step != NULL);
3336   if (gdbarch_debug >= 2)
3337     fprintf_unfiltered (gdb_stdlog, "gdbarch_software_single_step called\n");
3338   gdbarch->software_single_step (sig, insert_breakpoints_p);
3339 }
3340 
3341 void
set_gdbarch_software_single_step(struct gdbarch * gdbarch,gdbarch_software_single_step_ftype software_single_step)3342 set_gdbarch_software_single_step (struct gdbarch *gdbarch,
3343                                   gdbarch_software_single_step_ftype software_single_step)
3344 {
3345   gdbarch->software_single_step = software_single_step;
3346 }
3347 
3348 int
gdbarch_print_insn(struct gdbarch * gdbarch,bfd_vma vma,struct disassemble_info * info)3349 gdbarch_print_insn (struct gdbarch *gdbarch, bfd_vma vma, struct disassemble_info *info)
3350 {
3351   gdb_assert (gdbarch != NULL);
3352   gdb_assert (gdbarch->print_insn != NULL);
3353   if (gdbarch_debug >= 2)
3354     fprintf_unfiltered (gdb_stdlog, "gdbarch_print_insn called\n");
3355   return gdbarch->print_insn (vma, info);
3356 }
3357 
3358 void
set_gdbarch_print_insn(struct gdbarch * gdbarch,gdbarch_print_insn_ftype print_insn)3359 set_gdbarch_print_insn (struct gdbarch *gdbarch,
3360                         gdbarch_print_insn_ftype print_insn)
3361 {
3362   gdbarch->print_insn = print_insn;
3363 }
3364 
3365 CORE_ADDR
gdbarch_skip_trampoline_code(struct gdbarch * gdbarch,CORE_ADDR pc)3366 gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, CORE_ADDR pc)
3367 {
3368   gdb_assert (gdbarch != NULL);
3369   gdb_assert (gdbarch->skip_trampoline_code != NULL);
3370   if (gdbarch_debug >= 2)
3371     fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_trampoline_code called\n");
3372   return gdbarch->skip_trampoline_code (pc);
3373 }
3374 
3375 void
set_gdbarch_skip_trampoline_code(struct gdbarch * gdbarch,gdbarch_skip_trampoline_code_ftype skip_trampoline_code)3376 set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch,
3377                                   gdbarch_skip_trampoline_code_ftype skip_trampoline_code)
3378 {
3379   gdbarch->skip_trampoline_code = skip_trampoline_code;
3380 }
3381 
3382 CORE_ADDR
gdbarch_skip_solib_resolver(struct gdbarch * gdbarch,CORE_ADDR pc)3383 gdbarch_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
3384 {
3385   gdb_assert (gdbarch != NULL);
3386   gdb_assert (gdbarch->skip_solib_resolver != NULL);
3387   if (gdbarch_debug >= 2)
3388     fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_solib_resolver called\n");
3389   return gdbarch->skip_solib_resolver (gdbarch, pc);
3390 }
3391 
3392 void
set_gdbarch_skip_solib_resolver(struct gdbarch * gdbarch,gdbarch_skip_solib_resolver_ftype skip_solib_resolver)3393 set_gdbarch_skip_solib_resolver (struct gdbarch *gdbarch,
3394                                  gdbarch_skip_solib_resolver_ftype skip_solib_resolver)
3395 {
3396   gdbarch->skip_solib_resolver = skip_solib_resolver;
3397 }
3398 
3399 int
gdbarch_in_solib_call_trampoline(struct gdbarch * gdbarch,CORE_ADDR pc,char * name)3400 gdbarch_in_solib_call_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, char *name)
3401 {
3402   gdb_assert (gdbarch != NULL);
3403   gdb_assert (gdbarch->in_solib_call_trampoline != NULL);
3404   if (gdbarch_debug >= 2)
3405     fprintf_unfiltered (gdb_stdlog, "gdbarch_in_solib_call_trampoline called\n");
3406   return gdbarch->in_solib_call_trampoline (pc, name);
3407 }
3408 
3409 void
set_gdbarch_in_solib_call_trampoline(struct gdbarch * gdbarch,gdbarch_in_solib_call_trampoline_ftype in_solib_call_trampoline)3410 set_gdbarch_in_solib_call_trampoline (struct gdbarch *gdbarch,
3411                                       gdbarch_in_solib_call_trampoline_ftype in_solib_call_trampoline)
3412 {
3413   gdbarch->in_solib_call_trampoline = in_solib_call_trampoline;
3414 }
3415 
3416 int
gdbarch_in_solib_return_trampoline(struct gdbarch * gdbarch,CORE_ADDR pc,char * name)3417 gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, char *name)
3418 {
3419   gdb_assert (gdbarch != NULL);
3420   gdb_assert (gdbarch->in_solib_return_trampoline != NULL);
3421   if (gdbarch_debug >= 2)
3422     fprintf_unfiltered (gdb_stdlog, "gdbarch_in_solib_return_trampoline called\n");
3423   return gdbarch->in_solib_return_trampoline (pc, name);
3424 }
3425 
3426 void
set_gdbarch_in_solib_return_trampoline(struct gdbarch * gdbarch,gdbarch_in_solib_return_trampoline_ftype in_solib_return_trampoline)3427 set_gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch,
3428                                         gdbarch_in_solib_return_trampoline_ftype in_solib_return_trampoline)
3429 {
3430   gdbarch->in_solib_return_trampoline = in_solib_return_trampoline;
3431 }
3432 
3433 int
gdbarch_in_function_epilogue_p(struct gdbarch * gdbarch,CORE_ADDR addr)3434 gdbarch_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR addr)
3435 {
3436   gdb_assert (gdbarch != NULL);
3437   gdb_assert (gdbarch->in_function_epilogue_p != NULL);
3438   if (gdbarch_debug >= 2)
3439     fprintf_unfiltered (gdb_stdlog, "gdbarch_in_function_epilogue_p called\n");
3440   return gdbarch->in_function_epilogue_p (gdbarch, addr);
3441 }
3442 
3443 void
set_gdbarch_in_function_epilogue_p(struct gdbarch * gdbarch,gdbarch_in_function_epilogue_p_ftype in_function_epilogue_p)3444 set_gdbarch_in_function_epilogue_p (struct gdbarch *gdbarch,
3445                                     gdbarch_in_function_epilogue_p_ftype in_function_epilogue_p)
3446 {
3447   gdbarch->in_function_epilogue_p = in_function_epilogue_p;
3448 }
3449 
3450 char *
gdbarch_construct_inferior_arguments(struct gdbarch * gdbarch,int argc,char ** argv)3451 gdbarch_construct_inferior_arguments (struct gdbarch *gdbarch, int argc, char **argv)
3452 {
3453   gdb_assert (gdbarch != NULL);
3454   gdb_assert (gdbarch->construct_inferior_arguments != NULL);
3455   if (gdbarch_debug >= 2)
3456     fprintf_unfiltered (gdb_stdlog, "gdbarch_construct_inferior_arguments called\n");
3457   return gdbarch->construct_inferior_arguments (gdbarch, argc, argv);
3458 }
3459 
3460 void
set_gdbarch_construct_inferior_arguments(struct gdbarch * gdbarch,gdbarch_construct_inferior_arguments_ftype construct_inferior_arguments)3461 set_gdbarch_construct_inferior_arguments (struct gdbarch *gdbarch,
3462                                           gdbarch_construct_inferior_arguments_ftype construct_inferior_arguments)
3463 {
3464   gdbarch->construct_inferior_arguments = construct_inferior_arguments;
3465 }
3466 
3467 void
gdbarch_elf_make_msymbol_special(struct gdbarch * gdbarch,asymbol * sym,struct minimal_symbol * msym)3468 gdbarch_elf_make_msymbol_special (struct gdbarch *gdbarch, asymbol *sym, struct minimal_symbol *msym)
3469 {
3470   gdb_assert (gdbarch != NULL);
3471   gdb_assert (gdbarch->elf_make_msymbol_special != NULL);
3472   if (gdbarch_debug >= 2)
3473     fprintf_unfiltered (gdb_stdlog, "gdbarch_elf_make_msymbol_special called\n");
3474   gdbarch->elf_make_msymbol_special (sym, msym);
3475 }
3476 
3477 void
set_gdbarch_elf_make_msymbol_special(struct gdbarch * gdbarch,gdbarch_elf_make_msymbol_special_ftype elf_make_msymbol_special)3478 set_gdbarch_elf_make_msymbol_special (struct gdbarch *gdbarch,
3479                                       gdbarch_elf_make_msymbol_special_ftype elf_make_msymbol_special)
3480 {
3481   gdbarch->elf_make_msymbol_special = elf_make_msymbol_special;
3482 }
3483 
3484 void
gdbarch_coff_make_msymbol_special(struct gdbarch * gdbarch,int val,struct minimal_symbol * msym)3485 gdbarch_coff_make_msymbol_special (struct gdbarch *gdbarch, int val, struct minimal_symbol *msym)
3486 {
3487   gdb_assert (gdbarch != NULL);
3488   gdb_assert (gdbarch->coff_make_msymbol_special != NULL);
3489   if (gdbarch_debug >= 2)
3490     fprintf_unfiltered (gdb_stdlog, "gdbarch_coff_make_msymbol_special called\n");
3491   gdbarch->coff_make_msymbol_special (val, msym);
3492 }
3493 
3494 void
set_gdbarch_coff_make_msymbol_special(struct gdbarch * gdbarch,gdbarch_coff_make_msymbol_special_ftype coff_make_msymbol_special)3495 set_gdbarch_coff_make_msymbol_special (struct gdbarch *gdbarch,
3496                                        gdbarch_coff_make_msymbol_special_ftype coff_make_msymbol_special)
3497 {
3498   gdbarch->coff_make_msymbol_special = coff_make_msymbol_special;
3499 }
3500 
3501 const char *
gdbarch_name_of_malloc(struct gdbarch * gdbarch)3502 gdbarch_name_of_malloc (struct gdbarch *gdbarch)
3503 {
3504   gdb_assert (gdbarch != NULL);
3505   /* Skip verify of name_of_malloc, invalid_p == 0 */
3506   if (gdbarch_debug >= 2)
3507     fprintf_unfiltered (gdb_stdlog, "gdbarch_name_of_malloc called\n");
3508   return gdbarch->name_of_malloc;
3509 }
3510 
3511 void
set_gdbarch_name_of_malloc(struct gdbarch * gdbarch,const char * name_of_malloc)3512 set_gdbarch_name_of_malloc (struct gdbarch *gdbarch,
3513                             const char * name_of_malloc)
3514 {
3515   gdbarch->name_of_malloc = name_of_malloc;
3516 }
3517 
3518 int
gdbarch_cannot_step_breakpoint(struct gdbarch * gdbarch)3519 gdbarch_cannot_step_breakpoint (struct gdbarch *gdbarch)
3520 {
3521   gdb_assert (gdbarch != NULL);
3522   /* Skip verify of cannot_step_breakpoint, invalid_p == 0 */
3523   if (gdbarch_debug >= 2)
3524     fprintf_unfiltered (gdb_stdlog, "gdbarch_cannot_step_breakpoint called\n");
3525   return gdbarch->cannot_step_breakpoint;
3526 }
3527 
3528 void
set_gdbarch_cannot_step_breakpoint(struct gdbarch * gdbarch,int cannot_step_breakpoint)3529 set_gdbarch_cannot_step_breakpoint (struct gdbarch *gdbarch,
3530                                     int cannot_step_breakpoint)
3531 {
3532   gdbarch->cannot_step_breakpoint = cannot_step_breakpoint;
3533 }
3534 
3535 int
gdbarch_have_nonsteppable_watchpoint(struct gdbarch * gdbarch)3536 gdbarch_have_nonsteppable_watchpoint (struct gdbarch *gdbarch)
3537 {
3538   gdb_assert (gdbarch != NULL);
3539   /* Skip verify of have_nonsteppable_watchpoint, invalid_p == 0 */
3540   if (gdbarch_debug >= 2)
3541     fprintf_unfiltered (gdb_stdlog, "gdbarch_have_nonsteppable_watchpoint called\n");
3542   return gdbarch->have_nonsteppable_watchpoint;
3543 }
3544 
3545 void
set_gdbarch_have_nonsteppable_watchpoint(struct gdbarch * gdbarch,int have_nonsteppable_watchpoint)3546 set_gdbarch_have_nonsteppable_watchpoint (struct gdbarch *gdbarch,
3547                                           int have_nonsteppable_watchpoint)
3548 {
3549   gdbarch->have_nonsteppable_watchpoint = have_nonsteppable_watchpoint;
3550 }
3551 
3552 int
gdbarch_address_class_type_flags_p(struct gdbarch * gdbarch)3553 gdbarch_address_class_type_flags_p (struct gdbarch *gdbarch)
3554 {
3555   gdb_assert (gdbarch != NULL);
3556   return gdbarch->address_class_type_flags != NULL;
3557 }
3558 
3559 int
gdbarch_address_class_type_flags(struct gdbarch * gdbarch,int byte_size,int dwarf2_addr_class)3560 gdbarch_address_class_type_flags (struct gdbarch *gdbarch, int byte_size, int dwarf2_addr_class)
3561 {
3562   gdb_assert (gdbarch != NULL);
3563   gdb_assert (gdbarch->address_class_type_flags != NULL);
3564   if (gdbarch_debug >= 2)
3565     fprintf_unfiltered (gdb_stdlog, "gdbarch_address_class_type_flags called\n");
3566   return gdbarch->address_class_type_flags (byte_size, dwarf2_addr_class);
3567 }
3568 
3569 void
set_gdbarch_address_class_type_flags(struct gdbarch * gdbarch,gdbarch_address_class_type_flags_ftype address_class_type_flags)3570 set_gdbarch_address_class_type_flags (struct gdbarch *gdbarch,
3571                                       gdbarch_address_class_type_flags_ftype address_class_type_flags)
3572 {
3573   gdbarch->address_class_type_flags = address_class_type_flags;
3574 }
3575 
3576 int
gdbarch_address_class_type_flags_to_name_p(struct gdbarch * gdbarch)3577 gdbarch_address_class_type_flags_to_name_p (struct gdbarch *gdbarch)
3578 {
3579   gdb_assert (gdbarch != NULL);
3580   return gdbarch->address_class_type_flags_to_name != NULL;
3581 }
3582 
3583 const char *
gdbarch_address_class_type_flags_to_name(struct gdbarch * gdbarch,int type_flags)3584 gdbarch_address_class_type_flags_to_name (struct gdbarch *gdbarch, int type_flags)
3585 {
3586   gdb_assert (gdbarch != NULL);
3587   gdb_assert (gdbarch->address_class_type_flags_to_name != NULL);
3588   if (gdbarch_debug >= 2)
3589     fprintf_unfiltered (gdb_stdlog, "gdbarch_address_class_type_flags_to_name called\n");
3590   return gdbarch->address_class_type_flags_to_name (gdbarch, type_flags);
3591 }
3592 
3593 void
set_gdbarch_address_class_type_flags_to_name(struct gdbarch * gdbarch,gdbarch_address_class_type_flags_to_name_ftype address_class_type_flags_to_name)3594 set_gdbarch_address_class_type_flags_to_name (struct gdbarch *gdbarch,
3595                                               gdbarch_address_class_type_flags_to_name_ftype address_class_type_flags_to_name)
3596 {
3597   gdbarch->address_class_type_flags_to_name = address_class_type_flags_to_name;
3598 }
3599 
3600 int
gdbarch_address_class_name_to_type_flags_p(struct gdbarch * gdbarch)3601 gdbarch_address_class_name_to_type_flags_p (struct gdbarch *gdbarch)
3602 {
3603   gdb_assert (gdbarch != NULL);
3604   return gdbarch->address_class_name_to_type_flags != NULL;
3605 }
3606 
3607 int
gdbarch_address_class_name_to_type_flags(struct gdbarch * gdbarch,const char * name,int * type_flags_ptr)3608 gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarch, const char *name, int *type_flags_ptr)
3609 {
3610   gdb_assert (gdbarch != NULL);
3611   gdb_assert (gdbarch->address_class_name_to_type_flags != NULL);
3612   if (gdbarch_debug >= 2)
3613     fprintf_unfiltered (gdb_stdlog, "gdbarch_address_class_name_to_type_flags called\n");
3614   return gdbarch->address_class_name_to_type_flags (gdbarch, name, type_flags_ptr);
3615 }
3616 
3617 void
set_gdbarch_address_class_name_to_type_flags(struct gdbarch * gdbarch,gdbarch_address_class_name_to_type_flags_ftype address_class_name_to_type_flags)3618 set_gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarch,
3619                                               gdbarch_address_class_name_to_type_flags_ftype address_class_name_to_type_flags)
3620 {
3621   gdbarch->address_class_name_to_type_flags = address_class_name_to_type_flags;
3622 }
3623 
3624 int
gdbarch_register_reggroup_p(struct gdbarch * gdbarch,int regnum,struct reggroup * reggroup)3625 gdbarch_register_reggroup_p (struct gdbarch *gdbarch, int regnum, struct reggroup *reggroup)
3626 {
3627   gdb_assert (gdbarch != NULL);
3628   gdb_assert (gdbarch->register_reggroup_p != NULL);
3629   if (gdbarch_debug >= 2)
3630     fprintf_unfiltered (gdb_stdlog, "gdbarch_register_reggroup_p called\n");
3631   return gdbarch->register_reggroup_p (gdbarch, regnum, reggroup);
3632 }
3633 
3634 void
set_gdbarch_register_reggroup_p(struct gdbarch * gdbarch,gdbarch_register_reggroup_p_ftype register_reggroup_p)3635 set_gdbarch_register_reggroup_p (struct gdbarch *gdbarch,
3636                                  gdbarch_register_reggroup_p_ftype register_reggroup_p)
3637 {
3638   gdbarch->register_reggroup_p = register_reggroup_p;
3639 }
3640 
3641 int
gdbarch_fetch_pointer_argument_p(struct gdbarch * gdbarch)3642 gdbarch_fetch_pointer_argument_p (struct gdbarch *gdbarch)
3643 {
3644   gdb_assert (gdbarch != NULL);
3645   return gdbarch->fetch_pointer_argument != NULL;
3646 }
3647 
3648 CORE_ADDR
gdbarch_fetch_pointer_argument(struct gdbarch * gdbarch,struct frame_info * frame,int argi,struct type * type)3649 gdbarch_fetch_pointer_argument (struct gdbarch *gdbarch, struct frame_info *frame, int argi, struct type *type)
3650 {
3651   gdb_assert (gdbarch != NULL);
3652   gdb_assert (gdbarch->fetch_pointer_argument != NULL);
3653   if (gdbarch_debug >= 2)
3654     fprintf_unfiltered (gdb_stdlog, "gdbarch_fetch_pointer_argument called\n");
3655   return gdbarch->fetch_pointer_argument (frame, argi, type);
3656 }
3657 
3658 void
set_gdbarch_fetch_pointer_argument(struct gdbarch * gdbarch,gdbarch_fetch_pointer_argument_ftype fetch_pointer_argument)3659 set_gdbarch_fetch_pointer_argument (struct gdbarch *gdbarch,
3660                                     gdbarch_fetch_pointer_argument_ftype fetch_pointer_argument)
3661 {
3662   gdbarch->fetch_pointer_argument = fetch_pointer_argument;
3663 }
3664 
3665 int
gdbarch_regset_from_core_section_p(struct gdbarch * gdbarch)3666 gdbarch_regset_from_core_section_p (struct gdbarch *gdbarch)
3667 {
3668   gdb_assert (gdbarch != NULL);
3669   return gdbarch->regset_from_core_section != NULL;
3670 }
3671 
3672 const struct regset *
gdbarch_regset_from_core_section(struct gdbarch * gdbarch,const char * sect_name,size_t sect_size)3673 gdbarch_regset_from_core_section (struct gdbarch *gdbarch, const char *sect_name, size_t sect_size)
3674 {
3675   gdb_assert (gdbarch != NULL);
3676   gdb_assert (gdbarch->regset_from_core_section != NULL);
3677   if (gdbarch_debug >= 2)
3678     fprintf_unfiltered (gdb_stdlog, "gdbarch_regset_from_core_section called\n");
3679   return gdbarch->regset_from_core_section (gdbarch, sect_name, sect_size);
3680 }
3681 
3682 void
set_gdbarch_regset_from_core_section(struct gdbarch * gdbarch,gdbarch_regset_from_core_section_ftype regset_from_core_section)3683 set_gdbarch_regset_from_core_section (struct gdbarch *gdbarch,
3684                                       gdbarch_regset_from_core_section_ftype regset_from_core_section)
3685 {
3686   gdbarch->regset_from_core_section = regset_from_core_section;
3687 }
3688 
3689 
3690 /* Keep a registry of per-architecture data-pointers required by GDB
3691    modules. */
3692 
3693 struct gdbarch_data
3694 {
3695   unsigned index;
3696   int init_p;
3697   gdbarch_data_pre_init_ftype *pre_init;
3698   gdbarch_data_post_init_ftype *post_init;
3699 };
3700 
3701 struct gdbarch_data_registration
3702 {
3703   struct gdbarch_data *data;
3704   struct gdbarch_data_registration *next;
3705 };
3706 
3707 struct gdbarch_data_registry
3708 {
3709   unsigned nr;
3710   struct gdbarch_data_registration *registrations;
3711 };
3712 
3713 struct gdbarch_data_registry gdbarch_data_registry =
3714 {
3715   0, NULL,
3716 };
3717 
3718 static struct gdbarch_data *
gdbarch_data_register(gdbarch_data_pre_init_ftype * pre_init,gdbarch_data_post_init_ftype * post_init)3719 gdbarch_data_register (gdbarch_data_pre_init_ftype *pre_init,
3720 		       gdbarch_data_post_init_ftype *post_init)
3721 {
3722   struct gdbarch_data_registration **curr;
3723   /* Append the new registraration.  */
3724   for (curr = &gdbarch_data_registry.registrations;
3725        (*curr) != NULL;
3726        curr = &(*curr)->next);
3727   (*curr) = XMALLOC (struct gdbarch_data_registration);
3728   (*curr)->next = NULL;
3729   (*curr)->data = XMALLOC (struct gdbarch_data);
3730   (*curr)->data->index = gdbarch_data_registry.nr++;
3731   (*curr)->data->pre_init = pre_init;
3732   (*curr)->data->post_init = post_init;
3733   (*curr)->data->init_p = 1;
3734   return (*curr)->data;
3735 }
3736 
3737 struct gdbarch_data *
gdbarch_data_register_pre_init(gdbarch_data_pre_init_ftype * pre_init)3738 gdbarch_data_register_pre_init (gdbarch_data_pre_init_ftype *pre_init)
3739 {
3740   return gdbarch_data_register (pre_init, NULL);
3741 }
3742 
3743 struct gdbarch_data *
gdbarch_data_register_post_init(gdbarch_data_post_init_ftype * post_init)3744 gdbarch_data_register_post_init (gdbarch_data_post_init_ftype *post_init)
3745 {
3746   return gdbarch_data_register (NULL, post_init);
3747 }
3748 
3749 /* Create/delete the gdbarch data vector. */
3750 
3751 static void
alloc_gdbarch_data(struct gdbarch * gdbarch)3752 alloc_gdbarch_data (struct gdbarch *gdbarch)
3753 {
3754   gdb_assert (gdbarch->data == NULL);
3755   gdbarch->nr_data = gdbarch_data_registry.nr;
3756   gdbarch->data = GDBARCH_OBSTACK_CALLOC (gdbarch, gdbarch->nr_data, void *);
3757 }
3758 
3759 /* Initialize the current value of the specified per-architecture
3760    data-pointer. */
3761 
3762 void
deprecated_set_gdbarch_data(struct gdbarch * gdbarch,struct gdbarch_data * data,void * pointer)3763 deprecated_set_gdbarch_data (struct gdbarch *gdbarch,
3764 			     struct gdbarch_data *data,
3765 			     void *pointer)
3766 {
3767   gdb_assert (data->index < gdbarch->nr_data);
3768   gdb_assert (gdbarch->data[data->index] == NULL);
3769   gdb_assert (data->pre_init == NULL);
3770   gdbarch->data[data->index] = pointer;
3771 }
3772 
3773 /* Return the current value of the specified per-architecture
3774    data-pointer. */
3775 
3776 void *
gdbarch_data(struct gdbarch * gdbarch,struct gdbarch_data * data)3777 gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *data)
3778 {
3779   gdb_assert (data->index < gdbarch->nr_data);
3780   if (gdbarch->data[data->index] == NULL)
3781     {
3782       /* The data-pointer isn't initialized, call init() to get a
3783 	 value.  */
3784       if (data->pre_init != NULL)
3785 	/* Mid architecture creation: pass just the obstack, and not
3786 	   the entire architecture, as that way it isn't possible for
3787 	   pre-init code to refer to undefined architecture
3788 	   fields.  */
3789 	gdbarch->data[data->index] = data->pre_init (gdbarch->obstack);
3790       else if (gdbarch->initialized_p
3791 	       && data->post_init != NULL)
3792 	/* Post architecture creation: pass the entire architecture
3793 	   (as all fields are valid), but be careful to also detect
3794 	   recursive references.  */
3795 	{
3796 	  gdb_assert (data->init_p);
3797 	  data->init_p = 0;
3798 	  gdbarch->data[data->index] = data->post_init (gdbarch);
3799 	  data->init_p = 1;
3800 	}
3801       else
3802 	/* The architecture initialization hasn't completed - punt -
3803 	 hope that the caller knows what they are doing.  Once
3804 	 deprecated_set_gdbarch_data has been initialized, this can be
3805 	 changed to an internal error.  */
3806 	return NULL;
3807       gdb_assert (gdbarch->data[data->index] != NULL);
3808     }
3809   return gdbarch->data[data->index];
3810 }
3811 
3812 
3813 
3814 /* Keep a registry of swapped data required by GDB modules. */
3815 
3816 struct gdbarch_swap
3817 {
3818   void *swap;
3819   struct gdbarch_swap_registration *source;
3820   struct gdbarch_swap *next;
3821 };
3822 
3823 struct gdbarch_swap_registration
3824 {
3825   void *data;
3826   unsigned long sizeof_data;
3827   gdbarch_swap_ftype *init;
3828   struct gdbarch_swap_registration *next;
3829 };
3830 
3831 struct gdbarch_swap_registry
3832 {
3833   int nr;
3834   struct gdbarch_swap_registration *registrations;
3835 };
3836 
3837 struct gdbarch_swap_registry gdbarch_swap_registry =
3838 {
3839   0, NULL,
3840 };
3841 
3842 void
deprecated_register_gdbarch_swap(void * data,unsigned long sizeof_data,gdbarch_swap_ftype * init)3843 deprecated_register_gdbarch_swap (void *data,
3844 		                  unsigned long sizeof_data,
3845 		                  gdbarch_swap_ftype *init)
3846 {
3847   struct gdbarch_swap_registration **rego;
3848   for (rego = &gdbarch_swap_registry.registrations;
3849        (*rego) != NULL;
3850        rego = &(*rego)->next);
3851   (*rego) = XMALLOC (struct gdbarch_swap_registration);
3852   (*rego)->next = NULL;
3853   (*rego)->init = init;
3854   (*rego)->data = data;
3855   (*rego)->sizeof_data = sizeof_data;
3856 }
3857 
3858 static void
current_gdbarch_swap_init_hack(void)3859 current_gdbarch_swap_init_hack (void)
3860 {
3861   struct gdbarch_swap_registration *rego;
3862   struct gdbarch_swap **curr = &current_gdbarch->swap;
3863   for (rego = gdbarch_swap_registry.registrations;
3864        rego != NULL;
3865        rego = rego->next)
3866     {
3867       if (rego->data != NULL)
3868 	{
3869 	  (*curr) = GDBARCH_OBSTACK_ZALLOC (current_gdbarch,
3870 					    struct gdbarch_swap);
3871 	  (*curr)->source = rego;
3872 	  (*curr)->swap = gdbarch_obstack_zalloc (current_gdbarch,
3873 						  rego->sizeof_data);
3874 	  (*curr)->next = NULL;
3875 	  curr = &(*curr)->next;
3876 	}
3877       if (rego->init != NULL)
3878 	rego->init ();
3879     }
3880 }
3881 
3882 static struct gdbarch *
current_gdbarch_swap_out_hack(void)3883 current_gdbarch_swap_out_hack (void)
3884 {
3885   struct gdbarch *old_gdbarch = current_gdbarch;
3886   struct gdbarch_swap *curr;
3887 
3888   gdb_assert (old_gdbarch != NULL);
3889   for (curr = old_gdbarch->swap;
3890        curr != NULL;
3891        curr = curr->next)
3892     {
3893       memcpy (curr->swap, curr->source->data, curr->source->sizeof_data);
3894       memset (curr->source->data, 0, curr->source->sizeof_data);
3895     }
3896   current_gdbarch = NULL;
3897   return old_gdbarch;
3898 }
3899 
3900 static void
current_gdbarch_swap_in_hack(struct gdbarch * new_gdbarch)3901 current_gdbarch_swap_in_hack (struct gdbarch *new_gdbarch)
3902 {
3903   struct gdbarch_swap *curr;
3904 
3905   gdb_assert (current_gdbarch == NULL);
3906   for (curr = new_gdbarch->swap;
3907        curr != NULL;
3908        curr = curr->next)
3909     memcpy (curr->source->data, curr->swap, curr->source->sizeof_data);
3910   current_gdbarch = new_gdbarch;
3911 }
3912 
3913 
3914 /* Keep a registry of the architectures known by GDB. */
3915 
3916 struct gdbarch_registration
3917 {
3918   enum bfd_architecture bfd_architecture;
3919   gdbarch_init_ftype *init;
3920   gdbarch_dump_tdep_ftype *dump_tdep;
3921   struct gdbarch_list *arches;
3922   struct gdbarch_registration *next;
3923 };
3924 
3925 static struct gdbarch_registration *gdbarch_registry = NULL;
3926 
3927 static void
append_name(const char *** buf,int * nr,const char * name)3928 append_name (const char ***buf, int *nr, const char *name)
3929 {
3930   *buf = xrealloc (*buf, sizeof (char**) * (*nr + 1));
3931   (*buf)[*nr] = name;
3932   *nr += 1;
3933 }
3934 
3935 const char **
gdbarch_printable_names(void)3936 gdbarch_printable_names (void)
3937 {
3938   /* Accumulate a list of names based on the registed list of
3939      architectures. */
3940   enum bfd_architecture a;
3941   int nr_arches = 0;
3942   const char **arches = NULL;
3943   struct gdbarch_registration *rego;
3944   for (rego = gdbarch_registry;
3945        rego != NULL;
3946        rego = rego->next)
3947     {
3948       const struct bfd_arch_info *ap;
3949       ap = bfd_lookup_arch (rego->bfd_architecture, 0);
3950       if (ap == NULL)
3951         internal_error (__FILE__, __LINE__,
3952                         "gdbarch_architecture_names: multi-arch unknown");
3953       do
3954         {
3955           append_name (&arches, &nr_arches, ap->printable_name);
3956           ap = ap->next;
3957         }
3958       while (ap != NULL);
3959     }
3960   append_name (&arches, &nr_arches, NULL);
3961   return arches;
3962 }
3963 
3964 
3965 void
gdbarch_register(enum bfd_architecture bfd_architecture,gdbarch_init_ftype * init,gdbarch_dump_tdep_ftype * dump_tdep)3966 gdbarch_register (enum bfd_architecture bfd_architecture,
3967                   gdbarch_init_ftype *init,
3968 		  gdbarch_dump_tdep_ftype *dump_tdep)
3969 {
3970   struct gdbarch_registration **curr;
3971   const struct bfd_arch_info *bfd_arch_info;
3972   /* Check that BFD recognizes this architecture */
3973   bfd_arch_info = bfd_lookup_arch (bfd_architecture, 0);
3974   if (bfd_arch_info == NULL)
3975     {
3976       internal_error (__FILE__, __LINE__,
3977                       "gdbarch: Attempt to register unknown architecture (%d)",
3978                       bfd_architecture);
3979     }
3980   /* Check that we haven't seen this architecture before */
3981   for (curr = &gdbarch_registry;
3982        (*curr) != NULL;
3983        curr = &(*curr)->next)
3984     {
3985       if (bfd_architecture == (*curr)->bfd_architecture)
3986 	internal_error (__FILE__, __LINE__,
3987                         "gdbarch: Duplicate registraration of architecture (%s)",
3988 	                bfd_arch_info->printable_name);
3989     }
3990   /* log it */
3991   if (gdbarch_debug)
3992     fprintf_unfiltered (gdb_stdlog, "register_gdbarch_init (%s, 0x%08lx)\n",
3993 			bfd_arch_info->printable_name,
3994 			(long) init);
3995   /* Append it */
3996   (*curr) = XMALLOC (struct gdbarch_registration);
3997   (*curr)->bfd_architecture = bfd_architecture;
3998   (*curr)->init = init;
3999   (*curr)->dump_tdep = dump_tdep;
4000   (*curr)->arches = NULL;
4001   (*curr)->next = NULL;
4002 }
4003 
4004 void
register_gdbarch_init(enum bfd_architecture bfd_architecture,gdbarch_init_ftype * init)4005 register_gdbarch_init (enum bfd_architecture bfd_architecture,
4006 		       gdbarch_init_ftype *init)
4007 {
4008   gdbarch_register (bfd_architecture, init, NULL);
4009 }
4010 
4011 
4012 /* Look for an architecture using gdbarch_info.  Base search on only
4013    BFD_ARCH_INFO and BYTE_ORDER. */
4014 
4015 struct gdbarch_list *
gdbarch_list_lookup_by_info(struct gdbarch_list * arches,const struct gdbarch_info * info)4016 gdbarch_list_lookup_by_info (struct gdbarch_list *arches,
4017                              const struct gdbarch_info *info)
4018 {
4019   for (; arches != NULL; arches = arches->next)
4020     {
4021       if (info->bfd_arch_info != arches->gdbarch->bfd_arch_info)
4022 	continue;
4023       if (info->byte_order != arches->gdbarch->byte_order)
4024 	continue;
4025       if (info->osabi != arches->gdbarch->osabi)
4026 	continue;
4027       return arches;
4028     }
4029   return NULL;
4030 }
4031 
4032 
4033 /* Find an architecture that matches the specified INFO.  Create a new
4034    architecture if needed.  Return that new architecture.  Assumes
4035    that there is no current architecture.  */
4036 
4037 static struct gdbarch *
find_arch_by_info(struct gdbarch * old_gdbarch,struct gdbarch_info info)4038 find_arch_by_info (struct gdbarch *old_gdbarch, struct gdbarch_info info)
4039 {
4040   struct gdbarch *new_gdbarch;
4041   struct gdbarch_registration *rego;
4042 
4043   /* The existing architecture has been swapped out - all this code
4044      works from a clean slate.  */
4045   gdb_assert (current_gdbarch == NULL);
4046 
4047   /* Fill in missing parts of the INFO struct using a number of
4048      sources: "set ..."; INFOabfd supplied; and the existing
4049      architecture.  */
4050   gdbarch_info_fill (old_gdbarch, &info);
4051 
4052   /* Must have found some sort of architecture. */
4053   gdb_assert (info.bfd_arch_info != NULL);
4054 
4055   if (gdbarch_debug)
4056     {
4057       fprintf_unfiltered (gdb_stdlog,
4058 			  "find_arch_by_info: info.bfd_arch_info %s\n",
4059 			  (info.bfd_arch_info != NULL
4060 			   ? info.bfd_arch_info->printable_name
4061 			   : "(null)"));
4062       fprintf_unfiltered (gdb_stdlog,
4063 			  "find_arch_by_info: info.byte_order %d (%s)\n",
4064 			  info.byte_order,
4065 			  (info.byte_order == BFD_ENDIAN_BIG ? "big"
4066 			   : info.byte_order == BFD_ENDIAN_LITTLE ? "little"
4067 			   : "default"));
4068       fprintf_unfiltered (gdb_stdlog,
4069 			  "find_arch_by_info: info.osabi %d (%s)\n",
4070 			  info.osabi, gdbarch_osabi_name (info.osabi));
4071       fprintf_unfiltered (gdb_stdlog,
4072 			  "find_arch_by_info: info.abfd 0x%lx\n",
4073 			  (long) info.abfd);
4074       fprintf_unfiltered (gdb_stdlog,
4075 			  "find_arch_by_info: info.tdep_info 0x%lx\n",
4076 			  (long) info.tdep_info);
4077     }
4078 
4079   /* Find the tdep code that knows about this architecture.  */
4080   for (rego = gdbarch_registry;
4081        rego != NULL;
4082        rego = rego->next)
4083     if (rego->bfd_architecture == info.bfd_arch_info->arch)
4084       break;
4085   if (rego == NULL)
4086     {
4087       if (gdbarch_debug)
4088 	fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: "
4089 			    "No matching architecture\n");
4090       return 0;
4091     }
4092 
4093   /* Ask the tdep code for an architecture that matches "info".  */
4094   new_gdbarch = rego->init (info, rego->arches);
4095 
4096   /* Did the tdep code like it?  No.  Reject the change and revert to
4097      the old architecture.  */
4098   if (new_gdbarch == NULL)
4099     {
4100       if (gdbarch_debug)
4101 	fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: "
4102 			    "Target rejected architecture\n");
4103       return NULL;
4104     }
4105 
4106   /* Is this a pre-existing architecture (as determined by already
4107      being initialized)?  Move it to the front of the architecture
4108      list (keeping the list sorted Most Recently Used).  */
4109   if (new_gdbarch->initialized_p)
4110     {
4111       struct gdbarch_list **list;
4112       struct gdbarch_list *this;
4113       if (gdbarch_debug)
4114 	fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: "
4115 			    "Previous architecture 0x%08lx (%s) selected\n",
4116 			    (long) new_gdbarch,
4117 			    new_gdbarch->bfd_arch_info->printable_name);
4118       /* Find the existing arch in the list.  */
4119       for (list = &rego->arches;
4120 	   (*list) != NULL && (*list)->gdbarch != new_gdbarch;
4121 	   list = &(*list)->next);
4122       /* It had better be in the list of architectures.  */
4123       gdb_assert ((*list) != NULL && (*list)->gdbarch == new_gdbarch);
4124       /* Unlink THIS.  */
4125       this = (*list);
4126       (*list) = this->next;
4127       /* Insert THIS at the front.  */
4128       this->next = rego->arches;
4129       rego->arches = this;
4130       /* Return it.  */
4131       return new_gdbarch;
4132     }
4133 
4134   /* It's a new architecture.  */
4135   if (gdbarch_debug)
4136     fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: "
4137 			"New architecture 0x%08lx (%s) selected\n",
4138 			(long) new_gdbarch,
4139 			new_gdbarch->bfd_arch_info->printable_name);
4140 
4141   /* Insert the new architecture into the front of the architecture
4142      list (keep the list sorted Most Recently Used).  */
4143   {
4144     struct gdbarch_list *this = XMALLOC (struct gdbarch_list);
4145     this->next = rego->arches;
4146     this->gdbarch = new_gdbarch;
4147     rego->arches = this;
4148   }
4149 
4150   /* Check that the newly installed architecture is valid.  Plug in
4151      any post init values.  */
4152   new_gdbarch->dump_tdep = rego->dump_tdep;
4153   verify_gdbarch (new_gdbarch);
4154   new_gdbarch->initialized_p = 1;
4155 
4156   /* Initialize any per-architecture swap areas.  This phase requires
4157      a valid global CURRENT_GDBARCH.  Set it momentarially, and then
4158      swap the entire architecture out.  */
4159   current_gdbarch = new_gdbarch;
4160   current_gdbarch_swap_init_hack ();
4161   current_gdbarch_swap_out_hack ();
4162 
4163   if (gdbarch_debug)
4164     gdbarch_dump (new_gdbarch, gdb_stdlog);
4165 
4166   return new_gdbarch;
4167 }
4168 
4169 struct gdbarch *
gdbarch_find_by_info(struct gdbarch_info info)4170 gdbarch_find_by_info (struct gdbarch_info info)
4171 {
4172   /* Save the previously selected architecture, setting the global to
4173      NULL.  This stops things like gdbarch->init() trying to use the
4174      previous architecture's configuration.  The previous architecture
4175      may not even be of the same architecture family.  The most recent
4176      architecture of the same family is found at the head of the
4177      rego->arches list.  */
4178   struct gdbarch *old_gdbarch = current_gdbarch_swap_out_hack ();
4179 
4180   /* Find the specified architecture.  */
4181   struct gdbarch *new_gdbarch = find_arch_by_info (old_gdbarch, info);
4182 
4183   /* Restore the existing architecture.  */
4184   gdb_assert (current_gdbarch == NULL);
4185   current_gdbarch_swap_in_hack (old_gdbarch);
4186 
4187   return new_gdbarch;
4188 }
4189 
4190 /* Make the specified architecture current, swapping the existing one
4191    out.  */
4192 
4193 void
deprecated_current_gdbarch_select_hack(struct gdbarch * new_gdbarch)4194 deprecated_current_gdbarch_select_hack (struct gdbarch *new_gdbarch)
4195 {
4196   gdb_assert (new_gdbarch != NULL);
4197   gdb_assert (current_gdbarch != NULL);
4198   gdb_assert (new_gdbarch->initialized_p);
4199   current_gdbarch_swap_out_hack ();
4200   current_gdbarch_swap_in_hack (new_gdbarch);
4201   architecture_changed_event ();
4202 }
4203 
4204 extern void _initialize_gdbarch (void);
4205 
4206 void
_initialize_gdbarch(void)4207 _initialize_gdbarch (void)
4208 {
4209   struct cmd_list_element *c;
4210 
4211   deprecated_add_show_from_set
4212     (add_set_cmd ("arch",
4213 	          class_maintenance,
4214 		  var_zinteger,
4215 		  (char *)&gdbarch_debug,
4216 		  "Set architecture debugging.\n\
4217 When non-zero, architecture debugging is enabled.", &setdebuglist),
4218      &showdebuglist);
4219   c = add_set_cmd ("archdebug",
4220 		   class_maintenance,
4221 		   var_zinteger,
4222 		   (char *)&gdbarch_debug,
4223 		   "Set architecture debugging.\n\
4224 When non-zero, architecture debugging is enabled.", &setlist);
4225 
4226   deprecate_cmd (c, "set debug arch");
4227   deprecate_cmd (deprecated_add_show_from_set (c, &showlist), "show debug arch");
4228 }
4229