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