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