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