OSDN Git Service

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