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