OSDN Git Service

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