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