OSDN Git Service

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