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