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