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