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