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