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