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