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