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