OSDN Git Service

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