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