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