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