Convert SKIP_PROLOGUE_FRAMELESS_P into PROLOGUE_FRAMELESS_P.
[external/binutils.git] / gdb / gdbarch.c
1 /* *INDENT-OFF* */ /* THIS FILE IS GENERATED */
2
3 /* Dynamic architecture support for GDB, the GNU debugger.
4    Copyright 1998-1999, Free Software Foundation, Inc.
5
6    This file is part of GDB.
7
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 2 of the License, or
11    (at your option) any later version.
12
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 59 Temple Place - Suite 330,
21    Boston, MA 02111-1307, USA.  */
22
23 /* This file was created with the aid of ``gdbarch.sh''.
24
25    The bourn shell script ``gdbarch.sh'' creates the files
26    ``new-gdbarch.c'' and ``new-gdbarch.h and then compares them
27    against the existing ``gdbarch.[hc]''.  Any differences found
28    being reported.
29
30    If editing this file, please also run gdbarch.sh and merge any
31    changes into that script. Conversely, when makeing sweeping changes
32    to this file, modifying gdbarch.sh and using its output may prove
33    easier. */
34
35
36 #include "defs.h"
37 #include "arch-utils.h"
38
39 #if GDB_MULTI_ARCH
40 #include "gdbcmd.h"
41 #include "inferior.h" /* enum CALL_DUMMY_LOCATION et.al. */
42 #else
43 /* Just include everything in sight so that the every old definition
44    of macro is visible. */
45 #include "gdb_string.h"
46 #include <ctype.h>
47 #include "symtab.h"
48 #include "frame.h"
49 #include "inferior.h"
50 #include "breakpoint.h"
51 #include "gdb_wait.h"
52 #include "gdbcore.h"
53 #include "gdbcmd.h"
54 #include "target.h"
55 #include "gdbthread.h"
56 #include "annotate.h"
57 #include "symfile.h"            /* for overlay functions */
58 #endif
59 #include "symcat.h"
60
61
62 /* Static function declarations */
63
64 static void verify_gdbarch (struct gdbarch *gdbarch);
65 static void init_gdbarch_data (struct gdbarch *);
66 static void init_gdbarch_swap (struct gdbarch *);
67 static void swapout_gdbarch_swap (struct gdbarch *);
68 static void swapin_gdbarch_swap (struct gdbarch *);
69
70 /* Convenience macro for allocting typesafe memory. */
71
72 #ifndef XMALLOC
73 #define XMALLOC(TYPE) (TYPE*) xmalloc (sizeof (TYPE))
74 #endif
75
76
77 /* Non-zero if we want to trace architecture code.  */
78
79 #ifndef GDBARCH_DEBUG
80 #define GDBARCH_DEBUG 0
81 #endif
82 int gdbarch_debug = GDBARCH_DEBUG;
83
84
85 /* Maintain the struct gdbarch object */
86
87 struct gdbarch
88 {
89   /* basic architectural information */
90   const struct bfd_arch_info * bfd_arch_info;
91   int byte_order;
92
93   /* target specific vector. */
94   struct gdbarch_tdep *tdep;
95
96   /* per-architecture data-pointers */
97   int nr_data;
98   void **data;
99
100   /* per-architecture swap-regions */
101   struct gdbarch_swap *swap;
102
103   /* Multi-arch values.
104
105      When extending this structure you must:
106
107      Add the field below.
108
109      Declare set/get functions and define the corresponding
110      macro in gdbarch.h.
111
112      gdbarch_alloc(): If zero/NULL is not a suitable default,
113      initialize the new field.
114
115      verify_gdbarch(): Confirm that the target updated the field
116      correctly.
117
118      gdbarch_dump(): Add a fprintf_unfiltered call to so that the new
119      field is dumped out
120
121      ``startup_gdbarch()'': Append an initial value to the static
122      variable (base values on the host's c-type system).
123
124      get_gdbarch(): Implement the set/get functions (probably using
125      the macro's as shortcuts).
126
127      */
128
129   int bfd_vma_bit;
130   int ptr_bit;
131   int short_bit;
132   int int_bit;
133   int long_bit;
134   int long_long_bit;
135   int float_bit;
136   int double_bit;
137   int long_double_bit;
138   int ieee_float;
139   gdbarch_read_pc_ftype *read_pc;
140   gdbarch_write_pc_ftype *write_pc;
141   gdbarch_read_fp_ftype *read_fp;
142   gdbarch_write_fp_ftype *write_fp;
143   gdbarch_read_sp_ftype *read_sp;
144   gdbarch_write_sp_ftype *write_sp;
145   int num_regs;
146   int sp_regnum;
147   int fp_regnum;
148   int pc_regnum;
149   gdbarch_register_name_ftype *register_name;
150   int register_size;
151   int register_bytes;
152   gdbarch_register_byte_ftype *register_byte;
153   gdbarch_register_raw_size_ftype *register_raw_size;
154   int max_register_raw_size;
155   gdbarch_register_virtual_size_ftype *register_virtual_size;
156   int max_register_virtual_size;
157   gdbarch_register_virtual_type_ftype *register_virtual_type;
158   int use_generic_dummy_frames;
159   int call_dummy_location;
160   gdbarch_call_dummy_address_ftype *call_dummy_address;
161   CORE_ADDR call_dummy_start_offset;
162   CORE_ADDR call_dummy_breakpoint_offset;
163   int call_dummy_breakpoint_offset_p;
164   int call_dummy_length;
165   gdbarch_pc_in_call_dummy_ftype *pc_in_call_dummy;
166   int call_dummy_p;
167   LONGEST * call_dummy_words;
168   int sizeof_call_dummy_words;
169   int call_dummy_stack_adjust_p;
170   int call_dummy_stack_adjust;
171   gdbarch_fix_call_dummy_ftype *fix_call_dummy;
172   int believe_pcc_promotion;
173   int believe_pcc_promotion_type;
174   gdbarch_coerce_float_to_double_ftype *coerce_float_to_double;
175   gdbarch_get_saved_register_ftype *get_saved_register;
176   gdbarch_register_convertible_ftype *register_convertible;
177   gdbarch_register_convert_to_virtual_ftype *register_convert_to_virtual;
178   gdbarch_register_convert_to_raw_ftype *register_convert_to_raw;
179   gdbarch_pointer_to_address_ftype *pointer_to_address;
180   gdbarch_address_to_pointer_ftype *address_to_pointer;
181   gdbarch_return_value_on_stack_ftype *return_value_on_stack;
182   gdbarch_extract_return_value_ftype *extract_return_value;
183   gdbarch_push_arguments_ftype *push_arguments;
184   gdbarch_push_dummy_frame_ftype *push_dummy_frame;
185   gdbarch_push_return_address_ftype *push_return_address;
186   gdbarch_pop_frame_ftype *pop_frame;
187   gdbarch_d10v_make_daddr_ftype *d10v_make_daddr;
188   gdbarch_d10v_make_iaddr_ftype *d10v_make_iaddr;
189   gdbarch_d10v_daddr_p_ftype *d10v_daddr_p;
190   gdbarch_d10v_iaddr_p_ftype *d10v_iaddr_p;
191   gdbarch_d10v_convert_daddr_to_raw_ftype *d10v_convert_daddr_to_raw;
192   gdbarch_d10v_convert_iaddr_to_raw_ftype *d10v_convert_iaddr_to_raw;
193   gdbarch_store_struct_return_ftype *store_struct_return;
194   gdbarch_store_return_value_ftype *store_return_value;
195   gdbarch_extract_struct_value_address_ftype *extract_struct_value_address;
196   gdbarch_use_struct_convention_ftype *use_struct_convention;
197   gdbarch_frame_init_saved_regs_ftype *frame_init_saved_regs;
198   gdbarch_init_extra_frame_info_ftype *init_extra_frame_info;
199   gdbarch_skip_prologue_ftype *skip_prologue;
200   gdbarch_prologue_frameless_p_ftype *prologue_frameless_p;
201   gdbarch_inner_than_ftype *inner_than;
202   gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc;
203   gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint;
204   gdbarch_memory_remove_breakpoint_ftype *memory_remove_breakpoint;
205   CORE_ADDR decr_pc_after_break;
206   CORE_ADDR function_start_offset;
207   gdbarch_remote_translate_xfer_address_ftype *remote_translate_xfer_address;
208   CORE_ADDR frame_args_skip;
209   gdbarch_frameless_function_invocation_ftype *frameless_function_invocation;
210   gdbarch_frame_chain_ftype *frame_chain;
211   gdbarch_frame_chain_valid_ftype *frame_chain_valid;
212   gdbarch_frame_saved_pc_ftype *frame_saved_pc;
213   gdbarch_frame_args_address_ftype *frame_args_address;
214   gdbarch_frame_locals_address_ftype *frame_locals_address;
215   gdbarch_saved_pc_after_call_ftype *saved_pc_after_call;
216   gdbarch_frame_num_args_ftype *frame_num_args;
217   gdbarch_stack_align_ftype *stack_align;
218   gdbarch_reg_struct_has_addr_ftype *reg_struct_has_addr;
219 };
220
221
222 /* The default architecture uses host values (for want of a better
223    choice). */
224
225 extern const struct bfd_arch_info bfd_default_arch_struct;
226
227 struct gdbarch startup_gdbarch = {
228   /* basic architecture information */
229   &bfd_default_arch_struct,
230   BIG_ENDIAN,
231   /* target specific vector */
232   NULL,
233   /*per-architecture data-pointers and swap regions */
234   0, NULL, NULL,
235   /* Multi-arch values */
236   8 * sizeof (void*),
237   8 * sizeof (void*),
238   8 * sizeof (short),
239   8 * sizeof (int),
240   8 * sizeof (long),
241   8 * sizeof (LONGEST),
242   8 * sizeof (float),
243   8 * sizeof (double),
244   8 * sizeof (long double),
245   0,
246   0,
247   0,
248   0,
249   0,
250   0,
251   0,
252   0,
253   0,
254   0,
255   0,
256   0,
257   0,
258   0,
259   0,
260   0,
261   0,
262   0,
263   0,
264   0,
265   0,
266   0,
267   0,
268   0,
269   0,
270   0,
271   0,
272   0,
273   0,
274   0,
275   0,
276   0,
277   0,
278   0,
279   0,
280   0,
281   0,
282   generic_get_saved_register,
283   0,
284   0,
285   0,
286   0,
287   0,
288   0,
289   0,
290   0,
291   0,
292   0,
293   0,
294   0,
295   0,
296   0,
297   0,
298   0,
299   0,
300   0,
301   0,
302   0,
303   0,
304   0,
305   0,
306   0,
307   0,
308   0,
309   0,
310   0,
311   0,
312   0,
313   0,
314   0,
315   0,
316   0,
317   0,
318   0,
319   0,
320   0,
321   0,
322   0,
323   0,
324   0,
325   0,
326   /* startup_gdbarch() */
327 };
328 struct gdbarch *current_gdbarch = &startup_gdbarch;
329
330
331 /* Create a new ``struct gdbarch'' based in information provided by
332    ``struct gdbarch_info''. */
333
334 struct gdbarch *
335 gdbarch_alloc (const struct gdbarch_info *info,
336                struct gdbarch_tdep *tdep)
337 {
338   struct gdbarch *gdbarch = XMALLOC (struct gdbarch);
339   memset (gdbarch, 0, sizeof (*gdbarch));
340
341   gdbarch->tdep = tdep;
342
343   gdbarch->bfd_arch_info = info->bfd_arch_info;
344   gdbarch->byte_order = info->byte_order;
345
346   /* Force the explicit initialization of these. */
347   gdbarch->bfd_vma_bit = TARGET_ARCHITECTURE->bits_per_address;
348   gdbarch->num_regs = -1;
349   gdbarch->sp_regnum = -1;
350   gdbarch->fp_regnum = -1;
351   gdbarch->pc_regnum = -1;
352   gdbarch->register_name = legacy_register_name;
353   gdbarch->register_size = -1;
354   gdbarch->register_bytes = -1;
355   gdbarch->max_register_raw_size = -1;
356   gdbarch->max_register_virtual_size = -1;
357   gdbarch->use_generic_dummy_frames = -1;
358   gdbarch->call_dummy_start_offset = -1;
359   gdbarch->call_dummy_breakpoint_offset = -1;
360   gdbarch->call_dummy_breakpoint_offset_p = -1;
361   gdbarch->call_dummy_length = -1;
362   gdbarch->call_dummy_p = -1;
363   gdbarch->call_dummy_words = legacy_call_dummy_words;
364   gdbarch->sizeof_call_dummy_words = legacy_sizeof_call_dummy_words;
365   gdbarch->call_dummy_stack_adjust_p = -1;
366   gdbarch->coerce_float_to_double = default_coerce_float_to_double;
367   gdbarch->register_convertible = generic_register_convertible_not;
368   gdbarch->pointer_to_address = generic_pointer_to_address;
369   gdbarch->address_to_pointer = generic_address_to_pointer;
370   gdbarch->return_value_on_stack = generic_return_value_on_stack_not;
371   gdbarch->prologue_frameless_p = generic_prologue_frameless_p;
372   gdbarch->breakpoint_from_pc = legacy_breakpoint_from_pc;
373   gdbarch->memory_insert_breakpoint = default_memory_insert_breakpoint;
374   gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint;
375   gdbarch->decr_pc_after_break = -1;
376   gdbarch->function_start_offset = -1;
377   gdbarch->remote_translate_xfer_address = generic_remote_translate_xfer_address;
378   gdbarch->frame_args_skip = -1;
379   gdbarch->frameless_function_invocation = generic_frameless_function_invocation_not;
380   /* gdbarch_alloc() */
381
382   return gdbarch;
383 }
384
385
386 /* Free a gdbarch struct.  This should never happen in normal
387    operation --- once you've created a gdbarch, you keep it around.
388    However, if an architecture's init function encounters an error
389    building the structure, it may need to clean up a partially
390    constructed gdbarch.  */
391 void
392 gdbarch_free (struct gdbarch *arch)
393 {
394   /* At the moment, this is trivial.  */
395   free (arch);
396 }
397
398
399 /* Ensure that all values in a GDBARCH are reasonable. */
400
401 static void
402 verify_gdbarch (struct gdbarch *gdbarch)
403 {
404   /* Only perform sanity checks on a multi-arch target. */
405   if (GDB_MULTI_ARCH <= 0)
406     return;
407   /* fundamental */
408   if (gdbarch->byte_order == 0)
409     internal_error ("verify_gdbarch: byte-order unset");
410   if (gdbarch->bfd_arch_info == NULL)
411     internal_error ("verify_gdbarch: bfd_arch_info unset");
412   /* Check those that need to be defined for the given multi-arch level. */
413   /* Skip verify of bfd_vma_bit, invalid_p == 0 */
414   if ((GDB_MULTI_ARCH >= 1)
415       && (gdbarch->ptr_bit == 0))
416     internal_error ("gdbarch: verify_gdbarch: ptr_bit invalid");
417   if ((GDB_MULTI_ARCH >= 1)
418       && (gdbarch->short_bit == 0))
419     internal_error ("gdbarch: verify_gdbarch: short_bit invalid");
420   if ((GDB_MULTI_ARCH >= 1)
421       && (gdbarch->int_bit == 0))
422     internal_error ("gdbarch: verify_gdbarch: int_bit invalid");
423   if ((GDB_MULTI_ARCH >= 1)
424       && (gdbarch->long_bit == 0))
425     internal_error ("gdbarch: verify_gdbarch: long_bit invalid");
426   if ((GDB_MULTI_ARCH >= 1)
427       && (gdbarch->long_long_bit == 0))
428     internal_error ("gdbarch: verify_gdbarch: long_long_bit invalid");
429   if ((GDB_MULTI_ARCH >= 1)
430       && (gdbarch->float_bit == 0))
431     internal_error ("gdbarch: verify_gdbarch: float_bit invalid");
432   if ((GDB_MULTI_ARCH >= 1)
433       && (gdbarch->double_bit == 0))
434     internal_error ("gdbarch: verify_gdbarch: double_bit invalid");
435   if ((GDB_MULTI_ARCH >= 1)
436       && (gdbarch->long_double_bit == 0))
437     internal_error ("gdbarch: verify_gdbarch: long_double_bit invalid");
438   /* Skip verify of ieee_float, invalid_p == 0 */
439   if ((GDB_MULTI_ARCH >= 1)
440       && (gdbarch->read_pc == 0))
441     internal_error ("gdbarch: verify_gdbarch: read_pc invalid");
442   if ((GDB_MULTI_ARCH >= 1)
443       && (gdbarch->write_pc == 0))
444     internal_error ("gdbarch: verify_gdbarch: write_pc invalid");
445   if ((GDB_MULTI_ARCH >= 1)
446       && (gdbarch->read_fp == 0))
447     internal_error ("gdbarch: verify_gdbarch: read_fp invalid");
448   if ((GDB_MULTI_ARCH >= 1)
449       && (gdbarch->write_fp == 0))
450     internal_error ("gdbarch: verify_gdbarch: write_fp invalid");
451   if ((GDB_MULTI_ARCH >= 1)
452       && (gdbarch->read_sp == 0))
453     internal_error ("gdbarch: verify_gdbarch: read_sp invalid");
454   if ((GDB_MULTI_ARCH >= 1)
455       && (gdbarch->write_sp == 0))
456     internal_error ("gdbarch: verify_gdbarch: write_sp invalid");
457   if ((GDB_MULTI_ARCH >= 2)
458       && (gdbarch->num_regs == -1))
459     internal_error ("gdbarch: verify_gdbarch: num_regs invalid");
460   if ((GDB_MULTI_ARCH >= 2)
461       && (gdbarch->sp_regnum == -1))
462     internal_error ("gdbarch: verify_gdbarch: sp_regnum invalid");
463   if ((GDB_MULTI_ARCH >= 2)
464       && (gdbarch->fp_regnum == -1))
465     internal_error ("gdbarch: verify_gdbarch: fp_regnum invalid");
466   if ((GDB_MULTI_ARCH >= 2)
467       && (gdbarch->pc_regnum == -1))
468     internal_error ("gdbarch: verify_gdbarch: pc_regnum invalid");
469   /* Skip verify of register_name, invalid_p == 0 */
470   if ((GDB_MULTI_ARCH >= 2)
471       && (gdbarch->register_size == -1))
472     internal_error ("gdbarch: verify_gdbarch: register_size invalid");
473   if ((GDB_MULTI_ARCH >= 2)
474       && (gdbarch->register_bytes == -1))
475     internal_error ("gdbarch: verify_gdbarch: register_bytes invalid");
476   if ((GDB_MULTI_ARCH >= 2)
477       && (gdbarch->register_byte == 0))
478     internal_error ("gdbarch: verify_gdbarch: register_byte invalid");
479   if ((GDB_MULTI_ARCH >= 2)
480       && (gdbarch->register_raw_size == 0))
481     internal_error ("gdbarch: verify_gdbarch: register_raw_size invalid");
482   if ((GDB_MULTI_ARCH >= 2)
483       && (gdbarch->max_register_raw_size == -1))
484     internal_error ("gdbarch: verify_gdbarch: max_register_raw_size invalid");
485   if ((GDB_MULTI_ARCH >= 2)
486       && (gdbarch->register_virtual_size == 0))
487     internal_error ("gdbarch: verify_gdbarch: register_virtual_size invalid");
488   if ((GDB_MULTI_ARCH >= 2)
489       && (gdbarch->max_register_virtual_size == -1))
490     internal_error ("gdbarch: verify_gdbarch: max_register_virtual_size invalid");
491   if ((GDB_MULTI_ARCH >= 2)
492       && (gdbarch->register_virtual_type == 0))
493     internal_error ("gdbarch: verify_gdbarch: register_virtual_type invalid");
494   if ((GDB_MULTI_ARCH >= 1)
495       && (gdbarch->use_generic_dummy_frames == -1))
496     internal_error ("gdbarch: verify_gdbarch: use_generic_dummy_frames invalid");
497   if ((GDB_MULTI_ARCH >= 2)
498       && (gdbarch->call_dummy_location == 0))
499     internal_error ("gdbarch: verify_gdbarch: call_dummy_location invalid");
500   if ((GDB_MULTI_ARCH >= 2)
501       && (gdbarch->call_dummy_location == AT_ENTRY_POINT && gdbarch->call_dummy_address == 0))
502     internal_error ("gdbarch: verify_gdbarch: call_dummy_address invalid");
503   if ((GDB_MULTI_ARCH >= 2)
504       && (gdbarch->call_dummy_start_offset == -1))
505     internal_error ("gdbarch: verify_gdbarch: call_dummy_start_offset invalid");
506   if ((GDB_MULTI_ARCH >= 2)
507       && (gdbarch->call_dummy_breakpoint_offset == -1))
508     internal_error ("gdbarch: verify_gdbarch: call_dummy_breakpoint_offset invalid");
509   if ((GDB_MULTI_ARCH >= 1)
510       && (gdbarch->call_dummy_breakpoint_offset_p == -1))
511     internal_error ("gdbarch: verify_gdbarch: call_dummy_breakpoint_offset_p invalid");
512   if ((GDB_MULTI_ARCH >= 2)
513       && (gdbarch->call_dummy_length == -1))
514     internal_error ("gdbarch: verify_gdbarch: call_dummy_length invalid");
515   if ((GDB_MULTI_ARCH >= 2)
516       && (gdbarch->pc_in_call_dummy == 0))
517     internal_error ("gdbarch: verify_gdbarch: pc_in_call_dummy invalid");
518   if ((GDB_MULTI_ARCH >= 1)
519       && (gdbarch->call_dummy_p == -1))
520     internal_error ("gdbarch: verify_gdbarch: call_dummy_p invalid");
521   /* Skip verify of call_dummy_words, invalid_p == 0 */
522   /* Skip verify of sizeof_call_dummy_words, invalid_p == 0 */
523   if ((GDB_MULTI_ARCH >= 1)
524       && (gdbarch->call_dummy_stack_adjust_p == -1))
525     internal_error ("gdbarch: verify_gdbarch: call_dummy_stack_adjust_p invalid");
526   if ((GDB_MULTI_ARCH >= 2)
527       && (gdbarch->call_dummy_stack_adjust_p && gdbarch->call_dummy_stack_adjust == 0))
528     internal_error ("gdbarch: verify_gdbarch: call_dummy_stack_adjust invalid");
529   if ((GDB_MULTI_ARCH >= 2)
530       && (gdbarch->fix_call_dummy == 0))
531     internal_error ("gdbarch: verify_gdbarch: fix_call_dummy invalid");
532   /* Skip verify of coerce_float_to_double, invalid_p == 0 */
533   if ((GDB_MULTI_ARCH >= 1)
534       && (gdbarch->get_saved_register == 0))
535     internal_error ("gdbarch: verify_gdbarch: get_saved_register invalid");
536   /* Skip verify of register_convertible, invalid_p == 0 */
537   /* Skip verify of register_convert_to_virtual, invalid_p == 0 */
538   /* Skip verify of register_convert_to_raw, invalid_p == 0 */
539   /* Skip verify of pointer_to_address, invalid_p == 0 */
540   /* Skip verify of address_to_pointer, invalid_p == 0 */
541   /* Skip verify of return_value_on_stack, invalid_p == 0 */
542   if ((GDB_MULTI_ARCH >= 2)
543       && (gdbarch->extract_return_value == 0))
544     internal_error ("gdbarch: verify_gdbarch: extract_return_value invalid");
545   if ((GDB_MULTI_ARCH >= 1)
546       && (gdbarch->push_arguments == 0))
547     internal_error ("gdbarch: verify_gdbarch: push_arguments invalid");
548   if ((GDB_MULTI_ARCH >= 2)
549       && (gdbarch->push_dummy_frame == 0))
550     internal_error ("gdbarch: verify_gdbarch: push_dummy_frame invalid");
551   if ((GDB_MULTI_ARCH >= 1)
552       && (gdbarch->push_return_address == 0))
553     internal_error ("gdbarch: verify_gdbarch: push_return_address invalid");
554   if ((GDB_MULTI_ARCH >= 2)
555       && (gdbarch->pop_frame == 0))
556     internal_error ("gdbarch: verify_gdbarch: pop_frame invalid");
557   /* Skip verify of d10v_make_daddr, invalid_p == 0 */
558   /* Skip verify of d10v_make_iaddr, invalid_p == 0 */
559   /* Skip verify of d10v_daddr_p, invalid_p == 0 */
560   /* Skip verify of d10v_iaddr_p, invalid_p == 0 */
561   /* Skip verify of d10v_convert_daddr_to_raw, invalid_p == 0 */
562   /* Skip verify of d10v_convert_iaddr_to_raw, invalid_p == 0 */
563   if ((GDB_MULTI_ARCH >= 2)
564       && (gdbarch->store_struct_return == 0))
565     internal_error ("gdbarch: verify_gdbarch: store_struct_return invalid");
566   if ((GDB_MULTI_ARCH >= 2)
567       && (gdbarch->store_return_value == 0))
568     internal_error ("gdbarch: verify_gdbarch: store_return_value invalid");
569   if ((GDB_MULTI_ARCH >= 2)
570       && (gdbarch->extract_struct_value_address == 0))
571     internal_error ("gdbarch: verify_gdbarch: extract_struct_value_address invalid");
572   if ((GDB_MULTI_ARCH >= 2)
573       && (gdbarch->use_struct_convention == 0))
574     internal_error ("gdbarch: verify_gdbarch: use_struct_convention invalid");
575   if ((GDB_MULTI_ARCH >= 2)
576       && (gdbarch->frame_init_saved_regs == 0))
577     internal_error ("gdbarch: verify_gdbarch: frame_init_saved_regs invalid");
578   if ((GDB_MULTI_ARCH >= 2)
579       && (gdbarch->init_extra_frame_info == 0))
580     internal_error ("gdbarch: verify_gdbarch: init_extra_frame_info invalid");
581   if ((GDB_MULTI_ARCH >= 2)
582       && (gdbarch->skip_prologue == 0))
583     internal_error ("gdbarch: verify_gdbarch: skip_prologue invalid");
584   /* Skip verify of prologue_frameless_p, invalid_p == 0 */
585   if ((GDB_MULTI_ARCH >= 2)
586       && (gdbarch->inner_than == 0))
587     internal_error ("gdbarch: verify_gdbarch: inner_than invalid");
588   /* Skip verify of breakpoint_from_pc, invalid_p == 0 */
589   /* Skip verify of memory_insert_breakpoint, invalid_p == 0 */
590   /* Skip verify of memory_remove_breakpoint, invalid_p == 0 */
591   if ((GDB_MULTI_ARCH >= 2)
592       && (gdbarch->decr_pc_after_break == -1))
593     internal_error ("gdbarch: verify_gdbarch: decr_pc_after_break invalid");
594   if ((GDB_MULTI_ARCH >= 2)
595       && (gdbarch->function_start_offset == -1))
596     internal_error ("gdbarch: verify_gdbarch: function_start_offset invalid");
597   /* Skip verify of remote_translate_xfer_address, invalid_p == 0 */
598   if ((GDB_MULTI_ARCH >= 2)
599       && (gdbarch->frame_args_skip == -1))
600     internal_error ("gdbarch: verify_gdbarch: frame_args_skip invalid");
601   /* Skip verify of frameless_function_invocation, invalid_p == 0 */
602   if ((GDB_MULTI_ARCH >= 2)
603       && (gdbarch->frame_chain == 0))
604     internal_error ("gdbarch: verify_gdbarch: frame_chain invalid");
605   if ((GDB_MULTI_ARCH >= 1)
606       && (gdbarch->frame_chain_valid == 0))
607     internal_error ("gdbarch: verify_gdbarch: frame_chain_valid invalid");
608   if ((GDB_MULTI_ARCH >= 2)
609       && (gdbarch->frame_saved_pc == 0))
610     internal_error ("gdbarch: verify_gdbarch: frame_saved_pc invalid");
611   if ((GDB_MULTI_ARCH >= 2)
612       && (gdbarch->frame_args_address == 0))
613     internal_error ("gdbarch: verify_gdbarch: frame_args_address invalid");
614   if ((GDB_MULTI_ARCH >= 2)
615       && (gdbarch->frame_locals_address == 0))
616     internal_error ("gdbarch: verify_gdbarch: frame_locals_address invalid");
617   if ((GDB_MULTI_ARCH >= 2)
618       && (gdbarch->saved_pc_after_call == 0))
619     internal_error ("gdbarch: verify_gdbarch: saved_pc_after_call invalid");
620   if ((GDB_MULTI_ARCH >= 2)
621       && (gdbarch->frame_num_args == 0))
622     internal_error ("gdbarch: verify_gdbarch: frame_num_args invalid");
623   /* Skip verify of stack_align, has predicate */
624   /* Skip verify of reg_struct_has_addr, has predicate */
625 }
626
627
628 /* Print out the details of the current architecture. */
629
630 void
631 gdbarch_dump (void)
632 {
633   if (TARGET_ARCHITECTURE != NULL)
634     fprintf_unfiltered (gdb_stdlog,
635                         "gdbarch_update: TARGET_ARCHITECTURE = %s\n",
636                         TARGET_ARCHITECTURE->printable_name);
637   fprintf_unfiltered (gdb_stdlog,
638                       "gdbarch_update: TARGET_BYTE_ORDER = %ld\n",
639                       (long) TARGET_BYTE_ORDER);
640   fprintf_unfiltered (gdb_stdlog,
641                       "gdbarch_update: TARGET_BFD_VMA_BIT = %ld\n",
642                       (long) TARGET_BFD_VMA_BIT);
643   fprintf_unfiltered (gdb_stdlog,
644                       "gdbarch_update: TARGET_PTR_BIT = %ld\n",
645                       (long) TARGET_PTR_BIT);
646   fprintf_unfiltered (gdb_stdlog,
647                       "gdbarch_update: TARGET_SHORT_BIT = %ld\n",
648                       (long) TARGET_SHORT_BIT);
649   fprintf_unfiltered (gdb_stdlog,
650                       "gdbarch_update: TARGET_INT_BIT = %ld\n",
651                       (long) TARGET_INT_BIT);
652   fprintf_unfiltered (gdb_stdlog,
653                       "gdbarch_update: TARGET_LONG_BIT = %ld\n",
654                       (long) TARGET_LONG_BIT);
655   fprintf_unfiltered (gdb_stdlog,
656                       "gdbarch_update: TARGET_LONG_LONG_BIT = %ld\n",
657                       (long) TARGET_LONG_LONG_BIT);
658   fprintf_unfiltered (gdb_stdlog,
659                       "gdbarch_update: TARGET_FLOAT_BIT = %ld\n",
660                       (long) TARGET_FLOAT_BIT);
661   fprintf_unfiltered (gdb_stdlog,
662                       "gdbarch_update: TARGET_DOUBLE_BIT = %ld\n",
663                       (long) TARGET_DOUBLE_BIT);
664   fprintf_unfiltered (gdb_stdlog,
665                       "gdbarch_update: TARGET_LONG_DOUBLE_BIT = %ld\n",
666                       (long) TARGET_LONG_DOUBLE_BIT);
667   fprintf_unfiltered (gdb_stdlog,
668                       "gdbarch_update: IEEE_FLOAT = %ld\n",
669                       (long) IEEE_FLOAT);
670   fprintf_unfiltered (gdb_stdlog,
671                       "gdbarch_update: TARGET_READ_PC = 0x%08lx\n",
672                       (long) current_gdbarch->read_pc
673                       /*TARGET_READ_PC ()*/);
674   fprintf_unfiltered (gdb_stdlog,
675                       "gdbarch_update: TARGET_WRITE_PC = 0x%08lx\n",
676                       (long) current_gdbarch->write_pc
677                       /*TARGET_WRITE_PC ()*/);
678   fprintf_unfiltered (gdb_stdlog,
679                       "gdbarch_update: TARGET_READ_FP = 0x%08lx\n",
680                       (long) current_gdbarch->read_fp
681                       /*TARGET_READ_FP ()*/);
682   fprintf_unfiltered (gdb_stdlog,
683                       "gdbarch_update: TARGET_WRITE_FP = 0x%08lx\n",
684                       (long) current_gdbarch->write_fp
685                       /*TARGET_WRITE_FP ()*/);
686   fprintf_unfiltered (gdb_stdlog,
687                       "gdbarch_update: TARGET_READ_SP = 0x%08lx\n",
688                       (long) current_gdbarch->read_sp
689                       /*TARGET_READ_SP ()*/);
690   fprintf_unfiltered (gdb_stdlog,
691                       "gdbarch_update: TARGET_WRITE_SP = 0x%08lx\n",
692                       (long) current_gdbarch->write_sp
693                       /*TARGET_WRITE_SP ()*/);
694   fprintf_unfiltered (gdb_stdlog,
695                       "gdbarch_update: NUM_REGS = %ld\n",
696                       (long) NUM_REGS);
697   fprintf_unfiltered (gdb_stdlog,
698                       "gdbarch_update: SP_REGNUM = %ld\n",
699                       (long) SP_REGNUM);
700   fprintf_unfiltered (gdb_stdlog,
701                       "gdbarch_update: FP_REGNUM = %ld\n",
702                       (long) FP_REGNUM);
703   fprintf_unfiltered (gdb_stdlog,
704                       "gdbarch_update: PC_REGNUM = %ld\n",
705                       (long) PC_REGNUM);
706   fprintf_unfiltered (gdb_stdlog,
707                       "gdbarch_update: REGISTER_NAME = 0x%08lx\n",
708                       (long) current_gdbarch->register_name
709                       /*REGISTER_NAME ()*/);
710   fprintf_unfiltered (gdb_stdlog,
711                       "gdbarch_update: REGISTER_SIZE = %ld\n",
712                       (long) REGISTER_SIZE);
713   fprintf_unfiltered (gdb_stdlog,
714                       "gdbarch_update: REGISTER_BYTES = %ld\n",
715                       (long) REGISTER_BYTES);
716   fprintf_unfiltered (gdb_stdlog,
717                       "gdbarch_update: REGISTER_BYTE = 0x%08lx\n",
718                       (long) current_gdbarch->register_byte
719                       /*REGISTER_BYTE ()*/);
720   fprintf_unfiltered (gdb_stdlog,
721                       "gdbarch_update: REGISTER_RAW_SIZE = 0x%08lx\n",
722                       (long) current_gdbarch->register_raw_size
723                       /*REGISTER_RAW_SIZE ()*/);
724   fprintf_unfiltered (gdb_stdlog,
725                       "gdbarch_update: MAX_REGISTER_RAW_SIZE = %ld\n",
726                       (long) MAX_REGISTER_RAW_SIZE);
727   fprintf_unfiltered (gdb_stdlog,
728                       "gdbarch_update: REGISTER_VIRTUAL_SIZE = 0x%08lx\n",
729                       (long) current_gdbarch->register_virtual_size
730                       /*REGISTER_VIRTUAL_SIZE ()*/);
731   fprintf_unfiltered (gdb_stdlog,
732                       "gdbarch_update: MAX_REGISTER_VIRTUAL_SIZE = %ld\n",
733                       (long) MAX_REGISTER_VIRTUAL_SIZE);
734   fprintf_unfiltered (gdb_stdlog,
735                       "gdbarch_update: REGISTER_VIRTUAL_TYPE = 0x%08lx\n",
736                       (long) current_gdbarch->register_virtual_type
737                       /*REGISTER_VIRTUAL_TYPE ()*/);
738   fprintf_unfiltered (gdb_stdlog,
739                       "gdbarch_update: USE_GENERIC_DUMMY_FRAMES = %ld\n",
740                       (long) USE_GENERIC_DUMMY_FRAMES);
741   fprintf_unfiltered (gdb_stdlog,
742                       "gdbarch_update: CALL_DUMMY_LOCATION = %ld\n",
743                       (long) CALL_DUMMY_LOCATION);
744   fprintf_unfiltered (gdb_stdlog,
745                       "gdbarch_update: CALL_DUMMY_ADDRESS = 0x%08lx\n",
746                       (long) current_gdbarch->call_dummy_address
747                       /*CALL_DUMMY_ADDRESS ()*/);
748   fprintf_unfiltered (gdb_stdlog,
749                       "gdbarch_update: CALL_DUMMY_START_OFFSET = 0x%08lx\n",
750                       (long) CALL_DUMMY_START_OFFSET);
751   fprintf_unfiltered (gdb_stdlog,
752                       "gdbarch_update: CALL_DUMMY_BREAKPOINT_OFFSET = 0x%08lx\n",
753                       (long) CALL_DUMMY_BREAKPOINT_OFFSET);
754   fprintf_unfiltered (gdb_stdlog,
755                       "gdbarch_update: CALL_DUMMY_BREAKPOINT_OFFSET_P = %ld\n",
756                       (long) CALL_DUMMY_BREAKPOINT_OFFSET_P);
757   if (CALL_DUMMY_LOCATION == BEFORE_TEXT_END || CALL_DUMMY_LOCATION == AFTER_TEXT_END)
758     fprintf_unfiltered (gdb_stdlog,
759                         "gdbarch_update: CALL_DUMMY_LENGTH = %ld\n",
760                         (long) CALL_DUMMY_LENGTH);
761   fprintf_unfiltered (gdb_stdlog,
762                       "gdbarch_update: PC_IN_CALL_DUMMY = 0x%08lx\n",
763                       (long) current_gdbarch->pc_in_call_dummy
764                       /*PC_IN_CALL_DUMMY ()*/);
765   fprintf_unfiltered (gdb_stdlog,
766                       "gdbarch_update: CALL_DUMMY_P = %ld\n",
767                       (long) CALL_DUMMY_P);
768   fprintf_unfiltered (gdb_stdlog,
769                       "gdbarch_update: CALL_DUMMY_WORDS = 0x%08lx\n",
770                       (long) CALL_DUMMY_WORDS);
771   fprintf_unfiltered (gdb_stdlog,
772                       "gdbarch_update: SIZEOF_CALL_DUMMY_WORDS = 0x%08lx\n",
773                       (long) SIZEOF_CALL_DUMMY_WORDS);
774   fprintf_unfiltered (gdb_stdlog,
775                       "gdbarch_update: CALL_DUMMY_STACK_ADJUST_P = 0x%08lx\n",
776                       (long) CALL_DUMMY_STACK_ADJUST_P);
777   if (CALL_DUMMY_STACK_ADJUST_P)
778     fprintf_unfiltered (gdb_stdlog,
779                         "gdbarch_update: CALL_DUMMY_STACK_ADJUST = 0x%08lx\n",
780                         (long) CALL_DUMMY_STACK_ADJUST);
781   fprintf_unfiltered (gdb_stdlog,
782                       "gdbarch_update: FIX_CALL_DUMMY = 0x%08lx\n",
783                       (long) current_gdbarch->fix_call_dummy
784                       /*FIX_CALL_DUMMY ()*/);
785 #ifdef BELIEVE_PCC_PROMOTION
786   fprintf_unfiltered (gdb_stdlog,
787                       "gdbarch_update: BELIEVE_PCC_PROMOTION = %ld\n",
788                       (long) BELIEVE_PCC_PROMOTION);
789 #endif
790 #ifdef BELIEVE_PCC_PROMOTION_TYPE
791   fprintf_unfiltered (gdb_stdlog,
792                       "gdbarch_update: BELIEVE_PCC_PROMOTION_TYPE = %ld\n",
793                       (long) BELIEVE_PCC_PROMOTION_TYPE);
794 #endif
795   fprintf_unfiltered (gdb_stdlog,
796                       "gdbarch_update: COERCE_FLOAT_TO_DOUBLE = 0x%08lx\n",
797                       (long) current_gdbarch->coerce_float_to_double
798                       /*COERCE_FLOAT_TO_DOUBLE ()*/);
799   fprintf_unfiltered (gdb_stdlog,
800                       "gdbarch_update: GET_SAVED_REGISTER = 0x%08lx\n",
801                       (long) current_gdbarch->get_saved_register
802                       /*GET_SAVED_REGISTER ()*/);
803   fprintf_unfiltered (gdb_stdlog,
804                       "gdbarch_update: REGISTER_CONVERTIBLE = 0x%08lx\n",
805                       (long) current_gdbarch->register_convertible
806                       /*REGISTER_CONVERTIBLE ()*/);
807   fprintf_unfiltered (gdb_stdlog,
808                       "gdbarch_update: REGISTER_CONVERT_TO_VIRTUAL = 0x%08lx\n",
809                       (long) current_gdbarch->register_convert_to_virtual
810                       /*REGISTER_CONVERT_TO_VIRTUAL ()*/);
811   fprintf_unfiltered (gdb_stdlog,
812                       "gdbarch_update: REGISTER_CONVERT_TO_RAW = 0x%08lx\n",
813                       (long) current_gdbarch->register_convert_to_raw
814                       /*REGISTER_CONVERT_TO_RAW ()*/);
815   fprintf_unfiltered (gdb_stdlog,
816                       "gdbarch_update: POINTER_TO_ADDRESS = 0x%08lx\n",
817                       (long) current_gdbarch->pointer_to_address
818                       /*POINTER_TO_ADDRESS ()*/);
819   fprintf_unfiltered (gdb_stdlog,
820                       "gdbarch_update: ADDRESS_TO_POINTER = 0x%08lx\n",
821                       (long) current_gdbarch->address_to_pointer
822                       /*ADDRESS_TO_POINTER ()*/);
823   fprintf_unfiltered (gdb_stdlog,
824                       "gdbarch_update: RETURN_VALUE_ON_STACK = 0x%08lx\n",
825                       (long) current_gdbarch->return_value_on_stack
826                       /*RETURN_VALUE_ON_STACK ()*/);
827   fprintf_unfiltered (gdb_stdlog,
828                       "gdbarch_update: EXTRACT_RETURN_VALUE = 0x%08lx\n",
829                       (long) current_gdbarch->extract_return_value
830                       /*EXTRACT_RETURN_VALUE ()*/);
831   fprintf_unfiltered (gdb_stdlog,
832                       "gdbarch_update: PUSH_ARGUMENTS = 0x%08lx\n",
833                       (long) current_gdbarch->push_arguments
834                       /*PUSH_ARGUMENTS ()*/);
835   fprintf_unfiltered (gdb_stdlog,
836                       "gdbarch_update: PUSH_DUMMY_FRAME = 0x%08lx\n",
837                       (long) current_gdbarch->push_dummy_frame
838                       /*PUSH_DUMMY_FRAME ()*/);
839   fprintf_unfiltered (gdb_stdlog,
840                       "gdbarch_update: PUSH_RETURN_ADDRESS = 0x%08lx\n",
841                       (long) current_gdbarch->push_return_address
842                       /*PUSH_RETURN_ADDRESS ()*/);
843   fprintf_unfiltered (gdb_stdlog,
844                       "gdbarch_update: POP_FRAME = 0x%08lx\n",
845                       (long) current_gdbarch->pop_frame
846                       /*POP_FRAME ()*/);
847   fprintf_unfiltered (gdb_stdlog,
848                       "gdbarch_update: D10V_MAKE_DADDR = 0x%08lx\n",
849                       (long) current_gdbarch->d10v_make_daddr
850                       /*D10V_MAKE_DADDR ()*/);
851   fprintf_unfiltered (gdb_stdlog,
852                       "gdbarch_update: D10V_MAKE_IADDR = 0x%08lx\n",
853                       (long) current_gdbarch->d10v_make_iaddr
854                       /*D10V_MAKE_IADDR ()*/);
855   fprintf_unfiltered (gdb_stdlog,
856                       "gdbarch_update: D10V_DADDR_P = 0x%08lx\n",
857                       (long) current_gdbarch->d10v_daddr_p
858                       /*D10V_DADDR_P ()*/);
859   fprintf_unfiltered (gdb_stdlog,
860                       "gdbarch_update: D10V_IADDR_P = 0x%08lx\n",
861                       (long) current_gdbarch->d10v_iaddr_p
862                       /*D10V_IADDR_P ()*/);
863   fprintf_unfiltered (gdb_stdlog,
864                       "gdbarch_update: D10V_CONVERT_DADDR_TO_RAW = 0x%08lx\n",
865                       (long) current_gdbarch->d10v_convert_daddr_to_raw
866                       /*D10V_CONVERT_DADDR_TO_RAW ()*/);
867   fprintf_unfiltered (gdb_stdlog,
868                       "gdbarch_update: D10V_CONVERT_IADDR_TO_RAW = 0x%08lx\n",
869                       (long) current_gdbarch->d10v_convert_iaddr_to_raw
870                       /*D10V_CONVERT_IADDR_TO_RAW ()*/);
871   fprintf_unfiltered (gdb_stdlog,
872                       "gdbarch_update: STORE_STRUCT_RETURN = 0x%08lx\n",
873                       (long) current_gdbarch->store_struct_return
874                       /*STORE_STRUCT_RETURN ()*/);
875   fprintf_unfiltered (gdb_stdlog,
876                       "gdbarch_update: STORE_RETURN_VALUE = 0x%08lx\n",
877                       (long) current_gdbarch->store_return_value
878                       /*STORE_RETURN_VALUE ()*/);
879   fprintf_unfiltered (gdb_stdlog,
880                       "gdbarch_update: EXTRACT_STRUCT_VALUE_ADDRESS = 0x%08lx\n",
881                       (long) current_gdbarch->extract_struct_value_address
882                       /*EXTRACT_STRUCT_VALUE_ADDRESS ()*/);
883   fprintf_unfiltered (gdb_stdlog,
884                       "gdbarch_update: USE_STRUCT_CONVENTION = 0x%08lx\n",
885                       (long) current_gdbarch->use_struct_convention
886                       /*USE_STRUCT_CONVENTION ()*/);
887   fprintf_unfiltered (gdb_stdlog,
888                       "gdbarch_update: FRAME_INIT_SAVED_REGS = 0x%08lx\n",
889                       (long) current_gdbarch->frame_init_saved_regs
890                       /*FRAME_INIT_SAVED_REGS ()*/);
891   fprintf_unfiltered (gdb_stdlog,
892                       "gdbarch_update: INIT_EXTRA_FRAME_INFO = 0x%08lx\n",
893                       (long) current_gdbarch->init_extra_frame_info
894                       /*INIT_EXTRA_FRAME_INFO ()*/);
895   fprintf_unfiltered (gdb_stdlog,
896                       "gdbarch_update: SKIP_PROLOGUE = 0x%08lx\n",
897                       (long) current_gdbarch->skip_prologue
898                       /*SKIP_PROLOGUE ()*/);
899   fprintf_unfiltered (gdb_stdlog,
900                       "gdbarch_update: PROLOGUE_FRAMELESS_P = 0x%08lx\n",
901                       (long) current_gdbarch->prologue_frameless_p
902                       /*PROLOGUE_FRAMELESS_P ()*/);
903   fprintf_unfiltered (gdb_stdlog,
904                       "gdbarch_update: INNER_THAN = 0x%08lx\n",
905                       (long) current_gdbarch->inner_than
906                       /*INNER_THAN ()*/);
907   fprintf_unfiltered (gdb_stdlog,
908                       "gdbarch_update: BREAKPOINT_FROM_PC = 0x%08lx\n",
909                       (long) current_gdbarch->breakpoint_from_pc
910                       /*BREAKPOINT_FROM_PC ()*/);
911   fprintf_unfiltered (gdb_stdlog,
912                       "gdbarch_update: MEMORY_INSERT_BREAKPOINT = 0x%08lx\n",
913                       (long) current_gdbarch->memory_insert_breakpoint
914                       /*MEMORY_INSERT_BREAKPOINT ()*/);
915   fprintf_unfiltered (gdb_stdlog,
916                       "gdbarch_update: MEMORY_REMOVE_BREAKPOINT = 0x%08lx\n",
917                       (long) current_gdbarch->memory_remove_breakpoint
918                       /*MEMORY_REMOVE_BREAKPOINT ()*/);
919   fprintf_unfiltered (gdb_stdlog,
920                       "gdbarch_update: DECR_PC_AFTER_BREAK = %ld\n",
921                       (long) DECR_PC_AFTER_BREAK);
922   fprintf_unfiltered (gdb_stdlog,
923                       "gdbarch_update: FUNCTION_START_OFFSET = %ld\n",
924                       (long) FUNCTION_START_OFFSET);
925   fprintf_unfiltered (gdb_stdlog,
926                       "gdbarch_update: REMOTE_TRANSLATE_XFER_ADDRESS = 0x%08lx\n",
927                       (long) current_gdbarch->remote_translate_xfer_address
928                       /*REMOTE_TRANSLATE_XFER_ADDRESS ()*/);
929   fprintf_unfiltered (gdb_stdlog,
930                       "gdbarch_update: FRAME_ARGS_SKIP = %ld\n",
931                       (long) FRAME_ARGS_SKIP);
932   fprintf_unfiltered (gdb_stdlog,
933                       "gdbarch_update: FRAMELESS_FUNCTION_INVOCATION = 0x%08lx\n",
934                       (long) current_gdbarch->frameless_function_invocation
935                       /*FRAMELESS_FUNCTION_INVOCATION ()*/);
936   fprintf_unfiltered (gdb_stdlog,
937                       "gdbarch_update: FRAME_CHAIN = 0x%08lx\n",
938                       (long) current_gdbarch->frame_chain
939                       /*FRAME_CHAIN ()*/);
940   fprintf_unfiltered (gdb_stdlog,
941                       "gdbarch_update: FRAME_CHAIN_VALID = 0x%08lx\n",
942                       (long) current_gdbarch->frame_chain_valid
943                       /*FRAME_CHAIN_VALID ()*/);
944   fprintf_unfiltered (gdb_stdlog,
945                       "gdbarch_update: FRAME_SAVED_PC = 0x%08lx\n",
946                       (long) current_gdbarch->frame_saved_pc
947                       /*FRAME_SAVED_PC ()*/);
948   fprintf_unfiltered (gdb_stdlog,
949                       "gdbarch_update: FRAME_ARGS_ADDRESS = 0x%08lx\n",
950                       (long) current_gdbarch->frame_args_address
951                       /*FRAME_ARGS_ADDRESS ()*/);
952   fprintf_unfiltered (gdb_stdlog,
953                       "gdbarch_update: FRAME_LOCALS_ADDRESS = 0x%08lx\n",
954                       (long) current_gdbarch->frame_locals_address
955                       /*FRAME_LOCALS_ADDRESS ()*/);
956   fprintf_unfiltered (gdb_stdlog,
957                       "gdbarch_update: SAVED_PC_AFTER_CALL = 0x%08lx\n",
958                       (long) current_gdbarch->saved_pc_after_call
959                       /*SAVED_PC_AFTER_CALL ()*/);
960   fprintf_unfiltered (gdb_stdlog,
961                       "gdbarch_update: FRAME_NUM_ARGS = 0x%08lx\n",
962                       (long) current_gdbarch->frame_num_args
963                       /*FRAME_NUM_ARGS ()*/);
964   fprintf_unfiltered (gdb_stdlog,
965                       "gdbarch_update: STACK_ALIGN = 0x%08lx\n",
966                       (long) current_gdbarch->stack_align
967                       /*STACK_ALIGN ()*/);
968   fprintf_unfiltered (gdb_stdlog,
969                       "gdbarch_update: REG_STRUCT_HAS_ADDR = 0x%08lx\n",
970                       (long) current_gdbarch->reg_struct_has_addr
971                       /*REG_STRUCT_HAS_ADDR ()*/);
972 }
973
974 struct gdbarch_tdep *
975 gdbarch_tdep (struct gdbarch *gdbarch)
976 {
977   if (gdbarch_debug >= 2)
978     fprintf_unfiltered (gdb_stdlog, "gdbarch_tdep called\n");
979   return gdbarch->tdep;
980 }
981
982
983 const struct bfd_arch_info *
984 gdbarch_bfd_arch_info (struct gdbarch *gdbarch)
985 {
986   if (gdbarch_debug >= 2)
987     fprintf_unfiltered (gdb_stdlog, "gdbarch_bfd_arch_info called\n");
988   return gdbarch->bfd_arch_info;
989 }
990
991 int
992 gdbarch_byte_order (struct gdbarch *gdbarch)
993 {
994   if (gdbarch_debug >= 2)
995     fprintf_unfiltered (gdb_stdlog, "gdbarch_byte_order called\n");
996   return gdbarch->byte_order;
997 }
998
999 int
1000 gdbarch_bfd_vma_bit (struct gdbarch *gdbarch)
1001 {
1002   if (GDB_MULTI_ARCH == 0)
1003     return TARGET_ARCHITECTURE->bits_per_address;
1004   /* Skip verify of bfd_vma_bit, invalid_p == 0 */
1005   if (gdbarch_debug >= 2)
1006     fprintf_unfiltered (gdb_stdlog, "gdbarch_bfd_vma_bit called\n");
1007   return gdbarch->bfd_vma_bit;
1008 }
1009
1010 void
1011 set_gdbarch_bfd_vma_bit (struct gdbarch *gdbarch,
1012                          int bfd_vma_bit)
1013 {
1014   gdbarch->bfd_vma_bit = bfd_vma_bit;
1015 }
1016
1017 int
1018 gdbarch_ptr_bit (struct gdbarch *gdbarch)
1019 {
1020   if (gdbarch->ptr_bit == 0)
1021     internal_error ("gdbarch: gdbarch_ptr_bit invalid");
1022   if (gdbarch_debug >= 2)
1023     fprintf_unfiltered (gdb_stdlog, "gdbarch_ptr_bit called\n");
1024   return gdbarch->ptr_bit;
1025 }
1026
1027 void
1028 set_gdbarch_ptr_bit (struct gdbarch *gdbarch,
1029                      int ptr_bit)
1030 {
1031   gdbarch->ptr_bit = ptr_bit;
1032 }
1033
1034 int
1035 gdbarch_short_bit (struct gdbarch *gdbarch)
1036 {
1037   if (gdbarch->short_bit == 0)
1038     internal_error ("gdbarch: gdbarch_short_bit invalid");
1039   if (gdbarch_debug >= 2)
1040     fprintf_unfiltered (gdb_stdlog, "gdbarch_short_bit called\n");
1041   return gdbarch->short_bit;
1042 }
1043
1044 void
1045 set_gdbarch_short_bit (struct gdbarch *gdbarch,
1046                        int short_bit)
1047 {
1048   gdbarch->short_bit = short_bit;
1049 }
1050
1051 int
1052 gdbarch_int_bit (struct gdbarch *gdbarch)
1053 {
1054   if (gdbarch->int_bit == 0)
1055     internal_error ("gdbarch: gdbarch_int_bit invalid");
1056   if (gdbarch_debug >= 2)
1057     fprintf_unfiltered (gdb_stdlog, "gdbarch_int_bit called\n");
1058   return gdbarch->int_bit;
1059 }
1060
1061 void
1062 set_gdbarch_int_bit (struct gdbarch *gdbarch,
1063                      int int_bit)
1064 {
1065   gdbarch->int_bit = int_bit;
1066 }
1067
1068 int
1069 gdbarch_long_bit (struct gdbarch *gdbarch)
1070 {
1071   if (gdbarch->long_bit == 0)
1072     internal_error ("gdbarch: gdbarch_long_bit invalid");
1073   if (gdbarch_debug >= 2)
1074     fprintf_unfiltered (gdb_stdlog, "gdbarch_long_bit called\n");
1075   return gdbarch->long_bit;
1076 }
1077
1078 void
1079 set_gdbarch_long_bit (struct gdbarch *gdbarch,
1080                       int long_bit)
1081 {
1082   gdbarch->long_bit = long_bit;
1083 }
1084
1085 int
1086 gdbarch_long_long_bit (struct gdbarch *gdbarch)
1087 {
1088   if (gdbarch->long_long_bit == 0)
1089     internal_error ("gdbarch: gdbarch_long_long_bit invalid");
1090   if (gdbarch_debug >= 2)
1091     fprintf_unfiltered (gdb_stdlog, "gdbarch_long_long_bit called\n");
1092   return gdbarch->long_long_bit;
1093 }
1094
1095 void
1096 set_gdbarch_long_long_bit (struct gdbarch *gdbarch,
1097                            int long_long_bit)
1098 {
1099   gdbarch->long_long_bit = long_long_bit;
1100 }
1101
1102 int
1103 gdbarch_float_bit (struct gdbarch *gdbarch)
1104 {
1105   if (gdbarch->float_bit == 0)
1106     internal_error ("gdbarch: gdbarch_float_bit invalid");
1107   if (gdbarch_debug >= 2)
1108     fprintf_unfiltered (gdb_stdlog, "gdbarch_float_bit called\n");
1109   return gdbarch->float_bit;
1110 }
1111
1112 void
1113 set_gdbarch_float_bit (struct gdbarch *gdbarch,
1114                        int float_bit)
1115 {
1116   gdbarch->float_bit = float_bit;
1117 }
1118
1119 int
1120 gdbarch_double_bit (struct gdbarch *gdbarch)
1121 {
1122   if (gdbarch->double_bit == 0)
1123     internal_error ("gdbarch: gdbarch_double_bit invalid");
1124   if (gdbarch_debug >= 2)
1125     fprintf_unfiltered (gdb_stdlog, "gdbarch_double_bit called\n");
1126   return gdbarch->double_bit;
1127 }
1128
1129 void
1130 set_gdbarch_double_bit (struct gdbarch *gdbarch,
1131                         int double_bit)
1132 {
1133   gdbarch->double_bit = double_bit;
1134 }
1135
1136 int
1137 gdbarch_long_double_bit (struct gdbarch *gdbarch)
1138 {
1139   if (gdbarch->long_double_bit == 0)
1140     internal_error ("gdbarch: gdbarch_long_double_bit invalid");
1141   if (gdbarch_debug >= 2)
1142     fprintf_unfiltered (gdb_stdlog, "gdbarch_long_double_bit called\n");
1143   return gdbarch->long_double_bit;
1144 }
1145
1146 void
1147 set_gdbarch_long_double_bit (struct gdbarch *gdbarch,
1148                              int long_double_bit)
1149 {
1150   gdbarch->long_double_bit = long_double_bit;
1151 }
1152
1153 int
1154 gdbarch_ieee_float (struct gdbarch *gdbarch)
1155 {
1156   /* Skip verify of ieee_float, invalid_p == 0 */
1157   if (gdbarch_debug >= 2)
1158     fprintf_unfiltered (gdb_stdlog, "gdbarch_ieee_float called\n");
1159   return gdbarch->ieee_float;
1160 }
1161
1162 void
1163 set_gdbarch_ieee_float (struct gdbarch *gdbarch,
1164                         int ieee_float)
1165 {
1166   gdbarch->ieee_float = ieee_float;
1167 }
1168
1169 CORE_ADDR
1170 gdbarch_read_pc (struct gdbarch *gdbarch, int pid)
1171 {
1172   if (gdbarch->read_pc == 0)
1173     internal_error ("gdbarch: gdbarch_read_pc invalid");
1174   if (gdbarch_debug >= 2)
1175     fprintf_unfiltered (gdb_stdlog, "gdbarch_read_pc called\n");
1176   return gdbarch->read_pc (pid);
1177 }
1178
1179 void
1180 set_gdbarch_read_pc (struct gdbarch *gdbarch,
1181                      gdbarch_read_pc_ftype read_pc)
1182 {
1183   gdbarch->read_pc = read_pc;
1184 }
1185
1186 void
1187 gdbarch_write_pc (struct gdbarch *gdbarch, CORE_ADDR val, int pid)
1188 {
1189   if (gdbarch->write_pc == 0)
1190     internal_error ("gdbarch: gdbarch_write_pc invalid");
1191   if (gdbarch_debug >= 2)
1192     fprintf_unfiltered (gdb_stdlog, "gdbarch_write_pc called\n");
1193   gdbarch->write_pc (val, pid);
1194 }
1195
1196 void
1197 set_gdbarch_write_pc (struct gdbarch *gdbarch,
1198                       gdbarch_write_pc_ftype write_pc)
1199 {
1200   gdbarch->write_pc = write_pc;
1201 }
1202
1203 CORE_ADDR
1204 gdbarch_read_fp (struct gdbarch *gdbarch)
1205 {
1206   if (gdbarch->read_fp == 0)
1207     internal_error ("gdbarch: gdbarch_read_fp invalid");
1208   if (gdbarch_debug >= 2)
1209     fprintf_unfiltered (gdb_stdlog, "gdbarch_read_fp called\n");
1210   return gdbarch->read_fp ();
1211 }
1212
1213 void
1214 set_gdbarch_read_fp (struct gdbarch *gdbarch,
1215                      gdbarch_read_fp_ftype read_fp)
1216 {
1217   gdbarch->read_fp = read_fp;
1218 }
1219
1220 void
1221 gdbarch_write_fp (struct gdbarch *gdbarch, CORE_ADDR val)
1222 {
1223   if (gdbarch->write_fp == 0)
1224     internal_error ("gdbarch: gdbarch_write_fp invalid");
1225   if (gdbarch_debug >= 2)
1226     fprintf_unfiltered (gdb_stdlog, "gdbarch_write_fp called\n");
1227   gdbarch->write_fp (val);
1228 }
1229
1230 void
1231 set_gdbarch_write_fp (struct gdbarch *gdbarch,
1232                       gdbarch_write_fp_ftype write_fp)
1233 {
1234   gdbarch->write_fp = write_fp;
1235 }
1236
1237 CORE_ADDR
1238 gdbarch_read_sp (struct gdbarch *gdbarch)
1239 {
1240   if (gdbarch->read_sp == 0)
1241     internal_error ("gdbarch: gdbarch_read_sp invalid");
1242   if (gdbarch_debug >= 2)
1243     fprintf_unfiltered (gdb_stdlog, "gdbarch_read_sp called\n");
1244   return gdbarch->read_sp ();
1245 }
1246
1247 void
1248 set_gdbarch_read_sp (struct gdbarch *gdbarch,
1249                      gdbarch_read_sp_ftype read_sp)
1250 {
1251   gdbarch->read_sp = read_sp;
1252 }
1253
1254 void
1255 gdbarch_write_sp (struct gdbarch *gdbarch, CORE_ADDR val)
1256 {
1257   if (gdbarch->write_sp == 0)
1258     internal_error ("gdbarch: gdbarch_write_sp invalid");
1259   if (gdbarch_debug >= 2)
1260     fprintf_unfiltered (gdb_stdlog, "gdbarch_write_sp called\n");
1261   gdbarch->write_sp (val);
1262 }
1263
1264 void
1265 set_gdbarch_write_sp (struct gdbarch *gdbarch,
1266                       gdbarch_write_sp_ftype write_sp)
1267 {
1268   gdbarch->write_sp = write_sp;
1269 }
1270
1271 int
1272 gdbarch_num_regs (struct gdbarch *gdbarch)
1273 {
1274   if (gdbarch->num_regs == -1)
1275     internal_error ("gdbarch: gdbarch_num_regs invalid");
1276   if (gdbarch_debug >= 2)
1277     fprintf_unfiltered (gdb_stdlog, "gdbarch_num_regs called\n");
1278   return gdbarch->num_regs;
1279 }
1280
1281 void
1282 set_gdbarch_num_regs (struct gdbarch *gdbarch,
1283                       int num_regs)
1284 {
1285   gdbarch->num_regs = num_regs;
1286 }
1287
1288 int
1289 gdbarch_sp_regnum (struct gdbarch *gdbarch)
1290 {
1291   if (gdbarch->sp_regnum == -1)
1292     internal_error ("gdbarch: gdbarch_sp_regnum invalid");
1293   if (gdbarch_debug >= 2)
1294     fprintf_unfiltered (gdb_stdlog, "gdbarch_sp_regnum called\n");
1295   return gdbarch->sp_regnum;
1296 }
1297
1298 void
1299 set_gdbarch_sp_regnum (struct gdbarch *gdbarch,
1300                        int sp_regnum)
1301 {
1302   gdbarch->sp_regnum = sp_regnum;
1303 }
1304
1305 int
1306 gdbarch_fp_regnum (struct gdbarch *gdbarch)
1307 {
1308   if (gdbarch->fp_regnum == -1)
1309     internal_error ("gdbarch: gdbarch_fp_regnum invalid");
1310   if (gdbarch_debug >= 2)
1311     fprintf_unfiltered (gdb_stdlog, "gdbarch_fp_regnum called\n");
1312   return gdbarch->fp_regnum;
1313 }
1314
1315 void
1316 set_gdbarch_fp_regnum (struct gdbarch *gdbarch,
1317                        int fp_regnum)
1318 {
1319   gdbarch->fp_regnum = fp_regnum;
1320 }
1321
1322 int
1323 gdbarch_pc_regnum (struct gdbarch *gdbarch)
1324 {
1325   if (gdbarch->pc_regnum == -1)
1326     internal_error ("gdbarch: gdbarch_pc_regnum invalid");
1327   if (gdbarch_debug >= 2)
1328     fprintf_unfiltered (gdb_stdlog, "gdbarch_pc_regnum called\n");
1329   return gdbarch->pc_regnum;
1330 }
1331
1332 void
1333 set_gdbarch_pc_regnum (struct gdbarch *gdbarch,
1334                        int pc_regnum)
1335 {
1336   gdbarch->pc_regnum = pc_regnum;
1337 }
1338
1339 char *
1340 gdbarch_register_name (struct gdbarch *gdbarch, int regnr)
1341 {
1342   if (GDB_MULTI_ARCH == 0)
1343     return legacy_register_name (regnr);
1344   if (gdbarch->register_name == 0)
1345     internal_error ("gdbarch: gdbarch_register_name invalid");
1346   if (gdbarch_debug >= 2)
1347     fprintf_unfiltered (gdb_stdlog, "gdbarch_register_name called\n");
1348   return gdbarch->register_name (regnr);
1349 }
1350
1351 void
1352 set_gdbarch_register_name (struct gdbarch *gdbarch,
1353                            gdbarch_register_name_ftype register_name)
1354 {
1355   gdbarch->register_name = register_name;
1356 }
1357
1358 int
1359 gdbarch_register_size (struct gdbarch *gdbarch)
1360 {
1361   if (gdbarch->register_size == -1)
1362     internal_error ("gdbarch: gdbarch_register_size invalid");
1363   if (gdbarch_debug >= 2)
1364     fprintf_unfiltered (gdb_stdlog, "gdbarch_register_size called\n");
1365   return gdbarch->register_size;
1366 }
1367
1368 void
1369 set_gdbarch_register_size (struct gdbarch *gdbarch,
1370                            int register_size)
1371 {
1372   gdbarch->register_size = register_size;
1373 }
1374
1375 int
1376 gdbarch_register_bytes (struct gdbarch *gdbarch)
1377 {
1378   if (gdbarch->register_bytes == -1)
1379     internal_error ("gdbarch: gdbarch_register_bytes invalid");
1380   if (gdbarch_debug >= 2)
1381     fprintf_unfiltered (gdb_stdlog, "gdbarch_register_bytes called\n");
1382   return gdbarch->register_bytes;
1383 }
1384
1385 void
1386 set_gdbarch_register_bytes (struct gdbarch *gdbarch,
1387                             int register_bytes)
1388 {
1389   gdbarch->register_bytes = register_bytes;
1390 }
1391
1392 int
1393 gdbarch_register_byte (struct gdbarch *gdbarch, int reg_nr)
1394 {
1395   if (gdbarch->register_byte == 0)
1396     internal_error ("gdbarch: gdbarch_register_byte invalid");
1397   if (gdbarch_debug >= 2)
1398     fprintf_unfiltered (gdb_stdlog, "gdbarch_register_byte called\n");
1399   return gdbarch->register_byte (reg_nr);
1400 }
1401
1402 void
1403 set_gdbarch_register_byte (struct gdbarch *gdbarch,
1404                            gdbarch_register_byte_ftype register_byte)
1405 {
1406   gdbarch->register_byte = register_byte;
1407 }
1408
1409 int
1410 gdbarch_register_raw_size (struct gdbarch *gdbarch, int reg_nr)
1411 {
1412   if (gdbarch->register_raw_size == 0)
1413     internal_error ("gdbarch: gdbarch_register_raw_size invalid");
1414   if (gdbarch_debug >= 2)
1415     fprintf_unfiltered (gdb_stdlog, "gdbarch_register_raw_size called\n");
1416   return gdbarch->register_raw_size (reg_nr);
1417 }
1418
1419 void
1420 set_gdbarch_register_raw_size (struct gdbarch *gdbarch,
1421                                gdbarch_register_raw_size_ftype register_raw_size)
1422 {
1423   gdbarch->register_raw_size = register_raw_size;
1424 }
1425
1426 int
1427 gdbarch_max_register_raw_size (struct gdbarch *gdbarch)
1428 {
1429   if (gdbarch->max_register_raw_size == -1)
1430     internal_error ("gdbarch: gdbarch_max_register_raw_size invalid");
1431   if (gdbarch_debug >= 2)
1432     fprintf_unfiltered (gdb_stdlog, "gdbarch_max_register_raw_size called\n");
1433   return gdbarch->max_register_raw_size;
1434 }
1435
1436 void
1437 set_gdbarch_max_register_raw_size (struct gdbarch *gdbarch,
1438                                    int max_register_raw_size)
1439 {
1440   gdbarch->max_register_raw_size = max_register_raw_size;
1441 }
1442
1443 int
1444 gdbarch_register_virtual_size (struct gdbarch *gdbarch, int reg_nr)
1445 {
1446   if (gdbarch->register_virtual_size == 0)
1447     internal_error ("gdbarch: gdbarch_register_virtual_size invalid");
1448   if (gdbarch_debug >= 2)
1449     fprintf_unfiltered (gdb_stdlog, "gdbarch_register_virtual_size called\n");
1450   return gdbarch->register_virtual_size (reg_nr);
1451 }
1452
1453 void
1454 set_gdbarch_register_virtual_size (struct gdbarch *gdbarch,
1455                                    gdbarch_register_virtual_size_ftype register_virtual_size)
1456 {
1457   gdbarch->register_virtual_size = register_virtual_size;
1458 }
1459
1460 int
1461 gdbarch_max_register_virtual_size (struct gdbarch *gdbarch)
1462 {
1463   if (gdbarch->max_register_virtual_size == -1)
1464     internal_error ("gdbarch: gdbarch_max_register_virtual_size invalid");
1465   if (gdbarch_debug >= 2)
1466     fprintf_unfiltered (gdb_stdlog, "gdbarch_max_register_virtual_size called\n");
1467   return gdbarch->max_register_virtual_size;
1468 }
1469
1470 void
1471 set_gdbarch_max_register_virtual_size (struct gdbarch *gdbarch,
1472                                        int max_register_virtual_size)
1473 {
1474   gdbarch->max_register_virtual_size = max_register_virtual_size;
1475 }
1476
1477 struct type *
1478 gdbarch_register_virtual_type (struct gdbarch *gdbarch, int reg_nr)
1479 {
1480   if (gdbarch->register_virtual_type == 0)
1481     internal_error ("gdbarch: gdbarch_register_virtual_type invalid");
1482   if (gdbarch_debug >= 2)
1483     fprintf_unfiltered (gdb_stdlog, "gdbarch_register_virtual_type called\n");
1484   return gdbarch->register_virtual_type (reg_nr);
1485 }
1486
1487 void
1488 set_gdbarch_register_virtual_type (struct gdbarch *gdbarch,
1489                                    gdbarch_register_virtual_type_ftype register_virtual_type)
1490 {
1491   gdbarch->register_virtual_type = register_virtual_type;
1492 }
1493
1494 int
1495 gdbarch_use_generic_dummy_frames (struct gdbarch *gdbarch)
1496 {
1497   if (gdbarch->use_generic_dummy_frames == -1)
1498     internal_error ("gdbarch: gdbarch_use_generic_dummy_frames invalid");
1499   if (gdbarch_debug >= 2)
1500     fprintf_unfiltered (gdb_stdlog, "gdbarch_use_generic_dummy_frames called\n");
1501   return gdbarch->use_generic_dummy_frames;
1502 }
1503
1504 void
1505 set_gdbarch_use_generic_dummy_frames (struct gdbarch *gdbarch,
1506                                       int use_generic_dummy_frames)
1507 {
1508   gdbarch->use_generic_dummy_frames = use_generic_dummy_frames;
1509 }
1510
1511 int
1512 gdbarch_call_dummy_location (struct gdbarch *gdbarch)
1513 {
1514   if (gdbarch->call_dummy_location == 0)
1515     internal_error ("gdbarch: gdbarch_call_dummy_location invalid");
1516   if (gdbarch_debug >= 2)
1517     fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_location called\n");
1518   return gdbarch->call_dummy_location;
1519 }
1520
1521 void
1522 set_gdbarch_call_dummy_location (struct gdbarch *gdbarch,
1523                                  int call_dummy_location)
1524 {
1525   gdbarch->call_dummy_location = call_dummy_location;
1526 }
1527
1528 CORE_ADDR
1529 gdbarch_call_dummy_address (struct gdbarch *gdbarch)
1530 {
1531   if (gdbarch->call_dummy_address == 0)
1532     internal_error ("gdbarch: gdbarch_call_dummy_address invalid");
1533   if (gdbarch_debug >= 2)
1534     fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_address called\n");
1535   return gdbarch->call_dummy_address ();
1536 }
1537
1538 void
1539 set_gdbarch_call_dummy_address (struct gdbarch *gdbarch,
1540                                 gdbarch_call_dummy_address_ftype call_dummy_address)
1541 {
1542   gdbarch->call_dummy_address = call_dummy_address;
1543 }
1544
1545 CORE_ADDR
1546 gdbarch_call_dummy_start_offset (struct gdbarch *gdbarch)
1547 {
1548   if (gdbarch->call_dummy_start_offset == -1)
1549     internal_error ("gdbarch: gdbarch_call_dummy_start_offset invalid");
1550   if (gdbarch_debug >= 2)
1551     fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_start_offset called\n");
1552   return gdbarch->call_dummy_start_offset;
1553 }
1554
1555 void
1556 set_gdbarch_call_dummy_start_offset (struct gdbarch *gdbarch,
1557                                      CORE_ADDR call_dummy_start_offset)
1558 {
1559   gdbarch->call_dummy_start_offset = call_dummy_start_offset;
1560 }
1561
1562 CORE_ADDR
1563 gdbarch_call_dummy_breakpoint_offset (struct gdbarch *gdbarch)
1564 {
1565   if (gdbarch->call_dummy_breakpoint_offset == -1)
1566     internal_error ("gdbarch: gdbarch_call_dummy_breakpoint_offset invalid");
1567   if (gdbarch_debug >= 2)
1568     fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_breakpoint_offset called\n");
1569   return gdbarch->call_dummy_breakpoint_offset;
1570 }
1571
1572 void
1573 set_gdbarch_call_dummy_breakpoint_offset (struct gdbarch *gdbarch,
1574                                           CORE_ADDR call_dummy_breakpoint_offset)
1575 {
1576   gdbarch->call_dummy_breakpoint_offset = call_dummy_breakpoint_offset;
1577 }
1578
1579 int
1580 gdbarch_call_dummy_breakpoint_offset_p (struct gdbarch *gdbarch)
1581 {
1582   if (gdbarch->call_dummy_breakpoint_offset_p == -1)
1583     internal_error ("gdbarch: gdbarch_call_dummy_breakpoint_offset_p invalid");
1584   if (gdbarch_debug >= 2)
1585     fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_breakpoint_offset_p called\n");
1586   return gdbarch->call_dummy_breakpoint_offset_p;
1587 }
1588
1589 void
1590 set_gdbarch_call_dummy_breakpoint_offset_p (struct gdbarch *gdbarch,
1591                                             int call_dummy_breakpoint_offset_p)
1592 {
1593   gdbarch->call_dummy_breakpoint_offset_p = call_dummy_breakpoint_offset_p;
1594 }
1595
1596 int
1597 gdbarch_call_dummy_length (struct gdbarch *gdbarch)
1598 {
1599   if (gdbarch->call_dummy_length == -1)
1600     internal_error ("gdbarch: gdbarch_call_dummy_length invalid");
1601   if (gdbarch_debug >= 2)
1602     fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_length called\n");
1603   return gdbarch->call_dummy_length;
1604 }
1605
1606 void
1607 set_gdbarch_call_dummy_length (struct gdbarch *gdbarch,
1608                                int call_dummy_length)
1609 {
1610   gdbarch->call_dummy_length = call_dummy_length;
1611 }
1612
1613 int
1614 gdbarch_pc_in_call_dummy (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address)
1615 {
1616   if (gdbarch->pc_in_call_dummy == 0)
1617     internal_error ("gdbarch: gdbarch_pc_in_call_dummy invalid");
1618   if (gdbarch_debug >= 2)
1619     fprintf_unfiltered (gdb_stdlog, "gdbarch_pc_in_call_dummy called\n");
1620   return gdbarch->pc_in_call_dummy (pc, sp, frame_address);
1621 }
1622
1623 void
1624 set_gdbarch_pc_in_call_dummy (struct gdbarch *gdbarch,
1625                               gdbarch_pc_in_call_dummy_ftype pc_in_call_dummy)
1626 {
1627   gdbarch->pc_in_call_dummy = pc_in_call_dummy;
1628 }
1629
1630 int
1631 gdbarch_call_dummy_p (struct gdbarch *gdbarch)
1632 {
1633   if (gdbarch->call_dummy_p == -1)
1634     internal_error ("gdbarch: gdbarch_call_dummy_p invalid");
1635   if (gdbarch_debug >= 2)
1636     fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_p called\n");
1637   return gdbarch->call_dummy_p;
1638 }
1639
1640 void
1641 set_gdbarch_call_dummy_p (struct gdbarch *gdbarch,
1642                           int call_dummy_p)
1643 {
1644   gdbarch->call_dummy_p = call_dummy_p;
1645 }
1646
1647 LONGEST *
1648 gdbarch_call_dummy_words (struct gdbarch *gdbarch)
1649 {
1650   if (GDB_MULTI_ARCH == 0)
1651     return legacy_call_dummy_words;
1652   /* Skip verify of call_dummy_words, invalid_p == 0 */
1653   if (gdbarch_debug >= 2)
1654     fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_words called\n");
1655   return gdbarch->call_dummy_words;
1656 }
1657
1658 void
1659 set_gdbarch_call_dummy_words (struct gdbarch *gdbarch,
1660                               LONGEST * call_dummy_words)
1661 {
1662   gdbarch->call_dummy_words = call_dummy_words;
1663 }
1664
1665 int
1666 gdbarch_sizeof_call_dummy_words (struct gdbarch *gdbarch)
1667 {
1668   if (GDB_MULTI_ARCH == 0)
1669     return legacy_sizeof_call_dummy_words;
1670   /* Skip verify of sizeof_call_dummy_words, invalid_p == 0 */
1671   if (gdbarch_debug >= 2)
1672     fprintf_unfiltered (gdb_stdlog, "gdbarch_sizeof_call_dummy_words called\n");
1673   return gdbarch->sizeof_call_dummy_words;
1674 }
1675
1676 void
1677 set_gdbarch_sizeof_call_dummy_words (struct gdbarch *gdbarch,
1678                                      int sizeof_call_dummy_words)
1679 {
1680   gdbarch->sizeof_call_dummy_words = sizeof_call_dummy_words;
1681 }
1682
1683 int
1684 gdbarch_call_dummy_stack_adjust_p (struct gdbarch *gdbarch)
1685 {
1686   if (gdbarch->call_dummy_stack_adjust_p == -1)
1687     internal_error ("gdbarch: gdbarch_call_dummy_stack_adjust_p invalid");
1688   if (gdbarch_debug >= 2)
1689     fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_stack_adjust_p called\n");
1690   return gdbarch->call_dummy_stack_adjust_p;
1691 }
1692
1693 void
1694 set_gdbarch_call_dummy_stack_adjust_p (struct gdbarch *gdbarch,
1695                                        int call_dummy_stack_adjust_p)
1696 {
1697   gdbarch->call_dummy_stack_adjust_p = call_dummy_stack_adjust_p;
1698 }
1699
1700 int
1701 gdbarch_call_dummy_stack_adjust (struct gdbarch *gdbarch)
1702 {
1703   if (gdbarch->call_dummy_stack_adjust_p && gdbarch->call_dummy_stack_adjust == 0)
1704     internal_error ("gdbarch: gdbarch_call_dummy_stack_adjust invalid");
1705   if (gdbarch_debug >= 2)
1706     fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_stack_adjust called\n");
1707   return gdbarch->call_dummy_stack_adjust;
1708 }
1709
1710 void
1711 set_gdbarch_call_dummy_stack_adjust (struct gdbarch *gdbarch,
1712                                      int call_dummy_stack_adjust)
1713 {
1714   gdbarch->call_dummy_stack_adjust = call_dummy_stack_adjust;
1715 }
1716
1717 void
1718 gdbarch_fix_call_dummy (struct gdbarch *gdbarch, char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p)
1719 {
1720   if (gdbarch->fix_call_dummy == 0)
1721     internal_error ("gdbarch: gdbarch_fix_call_dummy invalid");
1722   if (gdbarch_debug >= 2)
1723     fprintf_unfiltered (gdb_stdlog, "gdbarch_fix_call_dummy called\n");
1724   gdbarch->fix_call_dummy (dummy, pc, fun, nargs, args, type, gcc_p);
1725 }
1726
1727 void
1728 set_gdbarch_fix_call_dummy (struct gdbarch *gdbarch,
1729                             gdbarch_fix_call_dummy_ftype fix_call_dummy)
1730 {
1731   gdbarch->fix_call_dummy = fix_call_dummy;
1732 }
1733
1734 int
1735 gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch)
1736 {
1737   if (gdbarch_debug >= 2)
1738     fprintf_unfiltered (gdb_stdlog, "gdbarch_believe_pcc_promotion called\n");
1739   return gdbarch->believe_pcc_promotion;
1740 }
1741
1742 void
1743 set_gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch,
1744                                    int believe_pcc_promotion)
1745 {
1746   gdbarch->believe_pcc_promotion = believe_pcc_promotion;
1747 }
1748
1749 int
1750 gdbarch_believe_pcc_promotion_type (struct gdbarch *gdbarch)
1751 {
1752   if (gdbarch_debug >= 2)
1753     fprintf_unfiltered (gdb_stdlog, "gdbarch_believe_pcc_promotion_type called\n");
1754   return gdbarch->believe_pcc_promotion_type;
1755 }
1756
1757 void
1758 set_gdbarch_believe_pcc_promotion_type (struct gdbarch *gdbarch,
1759                                         int believe_pcc_promotion_type)
1760 {
1761   gdbarch->believe_pcc_promotion_type = believe_pcc_promotion_type;
1762 }
1763
1764 int
1765 gdbarch_coerce_float_to_double (struct gdbarch *gdbarch, struct type *formal, struct type *actual)
1766 {
1767   if (GDB_MULTI_ARCH == 0)
1768     return default_coerce_float_to_double (formal, actual);
1769   if (gdbarch->coerce_float_to_double == 0)
1770     internal_error ("gdbarch: gdbarch_coerce_float_to_double invalid");
1771   if (gdbarch_debug >= 2)
1772     fprintf_unfiltered (gdb_stdlog, "gdbarch_coerce_float_to_double called\n");
1773   return gdbarch->coerce_float_to_double (formal, actual);
1774 }
1775
1776 void
1777 set_gdbarch_coerce_float_to_double (struct gdbarch *gdbarch,
1778                                     gdbarch_coerce_float_to_double_ftype coerce_float_to_double)
1779 {
1780   gdbarch->coerce_float_to_double = coerce_float_to_double;
1781 }
1782
1783 void
1784 gdbarch_get_saved_register (struct gdbarch *gdbarch, char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval)
1785 {
1786   if (gdbarch->get_saved_register == 0)
1787     internal_error ("gdbarch: gdbarch_get_saved_register invalid");
1788   if (gdbarch_debug >= 2)
1789     fprintf_unfiltered (gdb_stdlog, "gdbarch_get_saved_register called\n");
1790   gdbarch->get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval);
1791 }
1792
1793 void
1794 set_gdbarch_get_saved_register (struct gdbarch *gdbarch,
1795                                 gdbarch_get_saved_register_ftype get_saved_register)
1796 {
1797   gdbarch->get_saved_register = get_saved_register;
1798 }
1799
1800 int
1801 gdbarch_register_convertible (struct gdbarch *gdbarch, int nr)
1802 {
1803   if (GDB_MULTI_ARCH == 0)
1804     return generic_register_convertible_not (nr);
1805   if (gdbarch->register_convertible == 0)
1806     internal_error ("gdbarch: gdbarch_register_convertible invalid");
1807   if (gdbarch_debug >= 2)
1808     fprintf_unfiltered (gdb_stdlog, "gdbarch_register_convertible called\n");
1809   return gdbarch->register_convertible (nr);
1810 }
1811
1812 void
1813 set_gdbarch_register_convertible (struct gdbarch *gdbarch,
1814                                   gdbarch_register_convertible_ftype register_convertible)
1815 {
1816   gdbarch->register_convertible = register_convertible;
1817 }
1818
1819 void
1820 gdbarch_register_convert_to_virtual (struct gdbarch *gdbarch, int regnum, struct type *type, char *from, char *to)
1821 {
1822   if (gdbarch->register_convert_to_virtual == 0)
1823     internal_error ("gdbarch: gdbarch_register_convert_to_virtual invalid");
1824   if (gdbarch_debug >= 2)
1825     fprintf_unfiltered (gdb_stdlog, "gdbarch_register_convert_to_virtual called\n");
1826   gdbarch->register_convert_to_virtual (regnum, type, from, to);
1827 }
1828
1829 void
1830 set_gdbarch_register_convert_to_virtual (struct gdbarch *gdbarch,
1831                                          gdbarch_register_convert_to_virtual_ftype register_convert_to_virtual)
1832 {
1833   gdbarch->register_convert_to_virtual = register_convert_to_virtual;
1834 }
1835
1836 void
1837 gdbarch_register_convert_to_raw (struct gdbarch *gdbarch, struct type *type, int regnum, char *from, char *to)
1838 {
1839   if (gdbarch->register_convert_to_raw == 0)
1840     internal_error ("gdbarch: gdbarch_register_convert_to_raw invalid");
1841   if (gdbarch_debug >= 2)
1842     fprintf_unfiltered (gdb_stdlog, "gdbarch_register_convert_to_raw called\n");
1843   gdbarch->register_convert_to_raw (type, regnum, from, to);
1844 }
1845
1846 void
1847 set_gdbarch_register_convert_to_raw (struct gdbarch *gdbarch,
1848                                      gdbarch_register_convert_to_raw_ftype register_convert_to_raw)
1849 {
1850   gdbarch->register_convert_to_raw = register_convert_to_raw;
1851 }
1852
1853 CORE_ADDR
1854 gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, char *buf)
1855 {
1856   if (GDB_MULTI_ARCH == 0)
1857     return generic_pointer_to_address (type, buf);
1858   if (gdbarch->pointer_to_address == 0)
1859     internal_error ("gdbarch: gdbarch_pointer_to_address invalid");
1860   if (gdbarch_debug >= 2)
1861     fprintf_unfiltered (gdb_stdlog, "gdbarch_pointer_to_address called\n");
1862   return gdbarch->pointer_to_address (type, buf);
1863 }
1864
1865 void
1866 set_gdbarch_pointer_to_address (struct gdbarch *gdbarch,
1867                                 gdbarch_pointer_to_address_ftype pointer_to_address)
1868 {
1869   gdbarch->pointer_to_address = pointer_to_address;
1870 }
1871
1872 void
1873 gdbarch_address_to_pointer (struct gdbarch *gdbarch, struct type *type, char *buf, CORE_ADDR addr)
1874 {
1875   if (GDB_MULTI_ARCH == 0)
1876     {
1877       generic_address_to_pointer (type, buf, addr);
1878       return;
1879     }
1880   if (gdbarch->address_to_pointer == 0)
1881     internal_error ("gdbarch: gdbarch_address_to_pointer invalid");
1882   if (gdbarch_debug >= 2)
1883     fprintf_unfiltered (gdb_stdlog, "gdbarch_address_to_pointer called\n");
1884   gdbarch->address_to_pointer (type, buf, addr);
1885 }
1886
1887 void
1888 set_gdbarch_address_to_pointer (struct gdbarch *gdbarch,
1889                                 gdbarch_address_to_pointer_ftype address_to_pointer)
1890 {
1891   gdbarch->address_to_pointer = address_to_pointer;
1892 }
1893
1894 int
1895 gdbarch_return_value_on_stack (struct gdbarch *gdbarch, struct type *type)
1896 {
1897   if (GDB_MULTI_ARCH == 0)
1898     return generic_return_value_on_stack_not (type);
1899   if (gdbarch->return_value_on_stack == 0)
1900     internal_error ("gdbarch: gdbarch_return_value_on_stack invalid");
1901   if (gdbarch_debug >= 2)
1902     fprintf_unfiltered (gdb_stdlog, "gdbarch_return_value_on_stack called\n");
1903   return gdbarch->return_value_on_stack (type);
1904 }
1905
1906 void
1907 set_gdbarch_return_value_on_stack (struct gdbarch *gdbarch,
1908                                    gdbarch_return_value_on_stack_ftype return_value_on_stack)
1909 {
1910   gdbarch->return_value_on_stack = return_value_on_stack;
1911 }
1912
1913 void
1914 gdbarch_extract_return_value (struct gdbarch *gdbarch, struct type *type, char *regbuf, char *valbuf)
1915 {
1916   if (gdbarch->extract_return_value == 0)
1917     internal_error ("gdbarch: gdbarch_extract_return_value invalid");
1918   if (gdbarch_debug >= 2)
1919     fprintf_unfiltered (gdb_stdlog, "gdbarch_extract_return_value called\n");
1920   gdbarch->extract_return_value (type, regbuf, valbuf);
1921 }
1922
1923 void
1924 set_gdbarch_extract_return_value (struct gdbarch *gdbarch,
1925                                   gdbarch_extract_return_value_ftype extract_return_value)
1926 {
1927   gdbarch->extract_return_value = extract_return_value;
1928 }
1929
1930 CORE_ADDR
1931 gdbarch_push_arguments (struct gdbarch *gdbarch, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
1932 {
1933   if (gdbarch->push_arguments == 0)
1934     internal_error ("gdbarch: gdbarch_push_arguments invalid");
1935   if (gdbarch_debug >= 2)
1936     fprintf_unfiltered (gdb_stdlog, "gdbarch_push_arguments called\n");
1937   return gdbarch->push_arguments (nargs, args, sp, struct_return, struct_addr);
1938 }
1939
1940 void
1941 set_gdbarch_push_arguments (struct gdbarch *gdbarch,
1942                             gdbarch_push_arguments_ftype push_arguments)
1943 {
1944   gdbarch->push_arguments = push_arguments;
1945 }
1946
1947 void
1948 gdbarch_push_dummy_frame (struct gdbarch *gdbarch)
1949 {
1950   if (gdbarch->push_dummy_frame == 0)
1951     internal_error ("gdbarch: gdbarch_push_dummy_frame invalid");
1952   if (gdbarch_debug >= 2)
1953     fprintf_unfiltered (gdb_stdlog, "gdbarch_push_dummy_frame called\n");
1954   gdbarch->push_dummy_frame ();
1955 }
1956
1957 void
1958 set_gdbarch_push_dummy_frame (struct gdbarch *gdbarch,
1959                               gdbarch_push_dummy_frame_ftype push_dummy_frame)
1960 {
1961   gdbarch->push_dummy_frame = push_dummy_frame;
1962 }
1963
1964 CORE_ADDR
1965 gdbarch_push_return_address (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp)
1966 {
1967   if (gdbarch->push_return_address == 0)
1968     internal_error ("gdbarch: gdbarch_push_return_address invalid");
1969   if (gdbarch_debug >= 2)
1970     fprintf_unfiltered (gdb_stdlog, "gdbarch_push_return_address called\n");
1971   return gdbarch->push_return_address (pc, sp);
1972 }
1973
1974 void
1975 set_gdbarch_push_return_address (struct gdbarch *gdbarch,
1976                                  gdbarch_push_return_address_ftype push_return_address)
1977 {
1978   gdbarch->push_return_address = push_return_address;
1979 }
1980
1981 void
1982 gdbarch_pop_frame (struct gdbarch *gdbarch)
1983 {
1984   if (gdbarch->pop_frame == 0)
1985     internal_error ("gdbarch: gdbarch_pop_frame invalid");
1986   if (gdbarch_debug >= 2)
1987     fprintf_unfiltered (gdb_stdlog, "gdbarch_pop_frame called\n");
1988   gdbarch->pop_frame ();
1989 }
1990
1991 void
1992 set_gdbarch_pop_frame (struct gdbarch *gdbarch,
1993                        gdbarch_pop_frame_ftype pop_frame)
1994 {
1995   gdbarch->pop_frame = pop_frame;
1996 }
1997
1998 CORE_ADDR
1999 gdbarch_d10v_make_daddr (struct gdbarch *gdbarch, CORE_ADDR x)
2000 {
2001   if (gdbarch->d10v_make_daddr == 0)
2002     internal_error ("gdbarch: gdbarch_d10v_make_daddr invalid");
2003   if (gdbarch_debug >= 2)
2004     fprintf_unfiltered (gdb_stdlog, "gdbarch_d10v_make_daddr called\n");
2005   return gdbarch->d10v_make_daddr (x);
2006 }
2007
2008 void
2009 set_gdbarch_d10v_make_daddr (struct gdbarch *gdbarch,
2010                              gdbarch_d10v_make_daddr_ftype d10v_make_daddr)
2011 {
2012   gdbarch->d10v_make_daddr = d10v_make_daddr;
2013 }
2014
2015 CORE_ADDR
2016 gdbarch_d10v_make_iaddr (struct gdbarch *gdbarch, CORE_ADDR x)
2017 {
2018   if (gdbarch->d10v_make_iaddr == 0)
2019     internal_error ("gdbarch: gdbarch_d10v_make_iaddr invalid");
2020   if (gdbarch_debug >= 2)
2021     fprintf_unfiltered (gdb_stdlog, "gdbarch_d10v_make_iaddr called\n");
2022   return gdbarch->d10v_make_iaddr (x);
2023 }
2024
2025 void
2026 set_gdbarch_d10v_make_iaddr (struct gdbarch *gdbarch,
2027                              gdbarch_d10v_make_iaddr_ftype d10v_make_iaddr)
2028 {
2029   gdbarch->d10v_make_iaddr = d10v_make_iaddr;
2030 }
2031
2032 int
2033 gdbarch_d10v_daddr_p (struct gdbarch *gdbarch, CORE_ADDR x)
2034 {
2035   if (gdbarch->d10v_daddr_p == 0)
2036     internal_error ("gdbarch: gdbarch_d10v_daddr_p invalid");
2037   if (gdbarch_debug >= 2)
2038     fprintf_unfiltered (gdb_stdlog, "gdbarch_d10v_daddr_p called\n");
2039   return gdbarch->d10v_daddr_p (x);
2040 }
2041
2042 void
2043 set_gdbarch_d10v_daddr_p (struct gdbarch *gdbarch,
2044                           gdbarch_d10v_daddr_p_ftype d10v_daddr_p)
2045 {
2046   gdbarch->d10v_daddr_p = d10v_daddr_p;
2047 }
2048
2049 int
2050 gdbarch_d10v_iaddr_p (struct gdbarch *gdbarch, CORE_ADDR x)
2051 {
2052   if (gdbarch->d10v_iaddr_p == 0)
2053     internal_error ("gdbarch: gdbarch_d10v_iaddr_p invalid");
2054   if (gdbarch_debug >= 2)
2055     fprintf_unfiltered (gdb_stdlog, "gdbarch_d10v_iaddr_p called\n");
2056   return gdbarch->d10v_iaddr_p (x);
2057 }
2058
2059 void
2060 set_gdbarch_d10v_iaddr_p (struct gdbarch *gdbarch,
2061                           gdbarch_d10v_iaddr_p_ftype d10v_iaddr_p)
2062 {
2063   gdbarch->d10v_iaddr_p = d10v_iaddr_p;
2064 }
2065
2066 CORE_ADDR
2067 gdbarch_d10v_convert_daddr_to_raw (struct gdbarch *gdbarch, CORE_ADDR x)
2068 {
2069   if (gdbarch->d10v_convert_daddr_to_raw == 0)
2070     internal_error ("gdbarch: gdbarch_d10v_convert_daddr_to_raw invalid");
2071   if (gdbarch_debug >= 2)
2072     fprintf_unfiltered (gdb_stdlog, "gdbarch_d10v_convert_daddr_to_raw called\n");
2073   return gdbarch->d10v_convert_daddr_to_raw (x);
2074 }
2075
2076 void
2077 set_gdbarch_d10v_convert_daddr_to_raw (struct gdbarch *gdbarch,
2078                                        gdbarch_d10v_convert_daddr_to_raw_ftype d10v_convert_daddr_to_raw)
2079 {
2080   gdbarch->d10v_convert_daddr_to_raw = d10v_convert_daddr_to_raw;
2081 }
2082
2083 CORE_ADDR
2084 gdbarch_d10v_convert_iaddr_to_raw (struct gdbarch *gdbarch, CORE_ADDR x)
2085 {
2086   if (gdbarch->d10v_convert_iaddr_to_raw == 0)
2087     internal_error ("gdbarch: gdbarch_d10v_convert_iaddr_to_raw invalid");
2088   if (gdbarch_debug >= 2)
2089     fprintf_unfiltered (gdb_stdlog, "gdbarch_d10v_convert_iaddr_to_raw called\n");
2090   return gdbarch->d10v_convert_iaddr_to_raw (x);
2091 }
2092
2093 void
2094 set_gdbarch_d10v_convert_iaddr_to_raw (struct gdbarch *gdbarch,
2095                                        gdbarch_d10v_convert_iaddr_to_raw_ftype d10v_convert_iaddr_to_raw)
2096 {
2097   gdbarch->d10v_convert_iaddr_to_raw = d10v_convert_iaddr_to_raw;
2098 }
2099
2100 void
2101 gdbarch_store_struct_return (struct gdbarch *gdbarch, CORE_ADDR addr, CORE_ADDR sp)
2102 {
2103   if (gdbarch->store_struct_return == 0)
2104     internal_error ("gdbarch: gdbarch_store_struct_return invalid");
2105   if (gdbarch_debug >= 2)
2106     fprintf_unfiltered (gdb_stdlog, "gdbarch_store_struct_return called\n");
2107   gdbarch->store_struct_return (addr, sp);
2108 }
2109
2110 void
2111 set_gdbarch_store_struct_return (struct gdbarch *gdbarch,
2112                                  gdbarch_store_struct_return_ftype store_struct_return)
2113 {
2114   gdbarch->store_struct_return = store_struct_return;
2115 }
2116
2117 void
2118 gdbarch_store_return_value (struct gdbarch *gdbarch, struct type *type, char *valbuf)
2119 {
2120   if (gdbarch->store_return_value == 0)
2121     internal_error ("gdbarch: gdbarch_store_return_value invalid");
2122   if (gdbarch_debug >= 2)
2123     fprintf_unfiltered (gdb_stdlog, "gdbarch_store_return_value called\n");
2124   gdbarch->store_return_value (type, valbuf);
2125 }
2126
2127 void
2128 set_gdbarch_store_return_value (struct gdbarch *gdbarch,
2129                                 gdbarch_store_return_value_ftype store_return_value)
2130 {
2131   gdbarch->store_return_value = store_return_value;
2132 }
2133
2134 CORE_ADDR
2135 gdbarch_extract_struct_value_address (struct gdbarch *gdbarch, char *regbuf)
2136 {
2137   if (gdbarch->extract_struct_value_address == 0)
2138     internal_error ("gdbarch: gdbarch_extract_struct_value_address invalid");
2139   if (gdbarch_debug >= 2)
2140     fprintf_unfiltered (gdb_stdlog, "gdbarch_extract_struct_value_address called\n");
2141   return gdbarch->extract_struct_value_address (regbuf);
2142 }
2143
2144 void
2145 set_gdbarch_extract_struct_value_address (struct gdbarch *gdbarch,
2146                                           gdbarch_extract_struct_value_address_ftype extract_struct_value_address)
2147 {
2148   gdbarch->extract_struct_value_address = extract_struct_value_address;
2149 }
2150
2151 int
2152 gdbarch_use_struct_convention (struct gdbarch *gdbarch, int gcc_p, struct type *value_type)
2153 {
2154   if (gdbarch->use_struct_convention == 0)
2155     internal_error ("gdbarch: gdbarch_use_struct_convention invalid");
2156   if (gdbarch_debug >= 2)
2157     fprintf_unfiltered (gdb_stdlog, "gdbarch_use_struct_convention called\n");
2158   return gdbarch->use_struct_convention (gcc_p, value_type);
2159 }
2160
2161 void
2162 set_gdbarch_use_struct_convention (struct gdbarch *gdbarch,
2163                                    gdbarch_use_struct_convention_ftype use_struct_convention)
2164 {
2165   gdbarch->use_struct_convention = use_struct_convention;
2166 }
2167
2168 void
2169 gdbarch_frame_init_saved_regs (struct gdbarch *gdbarch, struct frame_info *frame)
2170 {
2171   if (gdbarch->frame_init_saved_regs == 0)
2172     internal_error ("gdbarch: gdbarch_frame_init_saved_regs invalid");
2173   if (gdbarch_debug >= 2)
2174     fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_init_saved_regs called\n");
2175   gdbarch->frame_init_saved_regs (frame);
2176 }
2177
2178 void
2179 set_gdbarch_frame_init_saved_regs (struct gdbarch *gdbarch,
2180                                    gdbarch_frame_init_saved_regs_ftype frame_init_saved_regs)
2181 {
2182   gdbarch->frame_init_saved_regs = frame_init_saved_regs;
2183 }
2184
2185 void
2186 gdbarch_init_extra_frame_info (struct gdbarch *gdbarch, int fromleaf, struct frame_info *frame)
2187 {
2188   if (gdbarch->init_extra_frame_info == 0)
2189     internal_error ("gdbarch: gdbarch_init_extra_frame_info invalid");
2190   if (gdbarch_debug >= 2)
2191     fprintf_unfiltered (gdb_stdlog, "gdbarch_init_extra_frame_info called\n");
2192   gdbarch->init_extra_frame_info (fromleaf, frame);
2193 }
2194
2195 void
2196 set_gdbarch_init_extra_frame_info (struct gdbarch *gdbarch,
2197                                    gdbarch_init_extra_frame_info_ftype init_extra_frame_info)
2198 {
2199   gdbarch->init_extra_frame_info = init_extra_frame_info;
2200 }
2201
2202 CORE_ADDR
2203 gdbarch_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR ip)
2204 {
2205   if (gdbarch->skip_prologue == 0)
2206     internal_error ("gdbarch: gdbarch_skip_prologue invalid");
2207   if (gdbarch_debug >= 2)
2208     fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_prologue called\n");
2209   return gdbarch->skip_prologue (ip);
2210 }
2211
2212 void
2213 set_gdbarch_skip_prologue (struct gdbarch *gdbarch,
2214                            gdbarch_skip_prologue_ftype skip_prologue)
2215 {
2216   gdbarch->skip_prologue = skip_prologue;
2217 }
2218
2219 int
2220 gdbarch_prologue_frameless_p (struct gdbarch *gdbarch, CORE_ADDR ip)
2221 {
2222   if (GDB_MULTI_ARCH == 0)
2223     return generic_prologue_frameless_p (ip);
2224   if (gdbarch->prologue_frameless_p == 0)
2225     internal_error ("gdbarch: gdbarch_prologue_frameless_p invalid");
2226   if (gdbarch_debug >= 2)
2227     fprintf_unfiltered (gdb_stdlog, "gdbarch_prologue_frameless_p called\n");
2228   return gdbarch->prologue_frameless_p (ip);
2229 }
2230
2231 void
2232 set_gdbarch_prologue_frameless_p (struct gdbarch *gdbarch,
2233                                   gdbarch_prologue_frameless_p_ftype prologue_frameless_p)
2234 {
2235   gdbarch->prologue_frameless_p = prologue_frameless_p;
2236 }
2237
2238 int
2239 gdbarch_inner_than (struct gdbarch *gdbarch, CORE_ADDR lhs, CORE_ADDR rhs)
2240 {
2241   if (gdbarch->inner_than == 0)
2242     internal_error ("gdbarch: gdbarch_inner_than invalid");
2243   if (gdbarch_debug >= 2)
2244     fprintf_unfiltered (gdb_stdlog, "gdbarch_inner_than called\n");
2245   return gdbarch->inner_than (lhs, rhs);
2246 }
2247
2248 void
2249 set_gdbarch_inner_than (struct gdbarch *gdbarch,
2250                         gdbarch_inner_than_ftype inner_than)
2251 {
2252   gdbarch->inner_than = inner_than;
2253 }
2254
2255 unsigned char *
2256 gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr)
2257 {
2258   if (GDB_MULTI_ARCH == 0)
2259     return legacy_breakpoint_from_pc (pcptr, lenptr);
2260   if (gdbarch->breakpoint_from_pc == 0)
2261     internal_error ("gdbarch: gdbarch_breakpoint_from_pc invalid");
2262   if (gdbarch_debug >= 2)
2263     fprintf_unfiltered (gdb_stdlog, "gdbarch_breakpoint_from_pc called\n");
2264   return gdbarch->breakpoint_from_pc (pcptr, lenptr);
2265 }
2266
2267 void
2268 set_gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch,
2269                                 gdbarch_breakpoint_from_pc_ftype breakpoint_from_pc)
2270 {
2271   gdbarch->breakpoint_from_pc = breakpoint_from_pc;
2272 }
2273
2274 int
2275 gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, CORE_ADDR addr, char *contents_cache)
2276 {
2277   if (GDB_MULTI_ARCH == 0)
2278     return default_memory_insert_breakpoint (addr, contents_cache);
2279   if (gdbarch->memory_insert_breakpoint == 0)
2280     internal_error ("gdbarch: gdbarch_memory_insert_breakpoint invalid");
2281   if (gdbarch_debug >= 2)
2282     fprintf_unfiltered (gdb_stdlog, "gdbarch_memory_insert_breakpoint called\n");
2283   return gdbarch->memory_insert_breakpoint (addr, contents_cache);
2284 }
2285
2286 void
2287 set_gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch,
2288                                       gdbarch_memory_insert_breakpoint_ftype memory_insert_breakpoint)
2289 {
2290   gdbarch->memory_insert_breakpoint = memory_insert_breakpoint;
2291 }
2292
2293 int
2294 gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, CORE_ADDR addr, char *contents_cache)
2295 {
2296   if (GDB_MULTI_ARCH == 0)
2297     return default_memory_remove_breakpoint (addr, contents_cache);
2298   if (gdbarch->memory_remove_breakpoint == 0)
2299     internal_error ("gdbarch: gdbarch_memory_remove_breakpoint invalid");
2300   if (gdbarch_debug >= 2)
2301     fprintf_unfiltered (gdb_stdlog, "gdbarch_memory_remove_breakpoint called\n");
2302   return gdbarch->memory_remove_breakpoint (addr, contents_cache);
2303 }
2304
2305 void
2306 set_gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch,
2307                                       gdbarch_memory_remove_breakpoint_ftype memory_remove_breakpoint)
2308 {
2309   gdbarch->memory_remove_breakpoint = memory_remove_breakpoint;
2310 }
2311
2312 CORE_ADDR
2313 gdbarch_decr_pc_after_break (struct gdbarch *gdbarch)
2314 {
2315   if (gdbarch->decr_pc_after_break == -1)
2316     internal_error ("gdbarch: gdbarch_decr_pc_after_break invalid");
2317   if (gdbarch_debug >= 2)
2318     fprintf_unfiltered (gdb_stdlog, "gdbarch_decr_pc_after_break called\n");
2319   return gdbarch->decr_pc_after_break;
2320 }
2321
2322 void
2323 set_gdbarch_decr_pc_after_break (struct gdbarch *gdbarch,
2324                                  CORE_ADDR decr_pc_after_break)
2325 {
2326   gdbarch->decr_pc_after_break = decr_pc_after_break;
2327 }
2328
2329 CORE_ADDR
2330 gdbarch_function_start_offset (struct gdbarch *gdbarch)
2331 {
2332   if (gdbarch->function_start_offset == -1)
2333     internal_error ("gdbarch: gdbarch_function_start_offset invalid");
2334   if (gdbarch_debug >= 2)
2335     fprintf_unfiltered (gdb_stdlog, "gdbarch_function_start_offset called\n");
2336   return gdbarch->function_start_offset;
2337 }
2338
2339 void
2340 set_gdbarch_function_start_offset (struct gdbarch *gdbarch,
2341                                    CORE_ADDR function_start_offset)
2342 {
2343   gdbarch->function_start_offset = function_start_offset;
2344 }
2345
2346 void
2347 gdbarch_remote_translate_xfer_address (struct gdbarch *gdbarch, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len)
2348 {
2349   if (GDB_MULTI_ARCH == 0)
2350     {
2351       generic_remote_translate_xfer_address (gdb_addr, gdb_len, rem_addr, rem_len);
2352       return;
2353     }
2354   if (gdbarch->remote_translate_xfer_address == 0)
2355     internal_error ("gdbarch: gdbarch_remote_translate_xfer_address invalid");
2356   if (gdbarch_debug >= 2)
2357     fprintf_unfiltered (gdb_stdlog, "gdbarch_remote_translate_xfer_address called\n");
2358   gdbarch->remote_translate_xfer_address (gdb_addr, gdb_len, rem_addr, rem_len);
2359 }
2360
2361 void
2362 set_gdbarch_remote_translate_xfer_address (struct gdbarch *gdbarch,
2363                                            gdbarch_remote_translate_xfer_address_ftype remote_translate_xfer_address)
2364 {
2365   gdbarch->remote_translate_xfer_address = remote_translate_xfer_address;
2366 }
2367
2368 CORE_ADDR
2369 gdbarch_frame_args_skip (struct gdbarch *gdbarch)
2370 {
2371   if (gdbarch->frame_args_skip == -1)
2372     internal_error ("gdbarch: gdbarch_frame_args_skip invalid");
2373   if (gdbarch_debug >= 2)
2374     fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_args_skip called\n");
2375   return gdbarch->frame_args_skip;
2376 }
2377
2378 void
2379 set_gdbarch_frame_args_skip (struct gdbarch *gdbarch,
2380                              CORE_ADDR frame_args_skip)
2381 {
2382   gdbarch->frame_args_skip = frame_args_skip;
2383 }
2384
2385 int
2386 gdbarch_frameless_function_invocation (struct gdbarch *gdbarch, struct frame_info *fi)
2387 {
2388   if (GDB_MULTI_ARCH == 0)
2389     return generic_frameless_function_invocation_not (fi);
2390   if (gdbarch->frameless_function_invocation == 0)
2391     internal_error ("gdbarch: gdbarch_frameless_function_invocation invalid");
2392   if (gdbarch_debug >= 2)
2393     fprintf_unfiltered (gdb_stdlog, "gdbarch_frameless_function_invocation called\n");
2394   return gdbarch->frameless_function_invocation (fi);
2395 }
2396
2397 void
2398 set_gdbarch_frameless_function_invocation (struct gdbarch *gdbarch,
2399                                            gdbarch_frameless_function_invocation_ftype frameless_function_invocation)
2400 {
2401   gdbarch->frameless_function_invocation = frameless_function_invocation;
2402 }
2403
2404 CORE_ADDR
2405 gdbarch_frame_chain (struct gdbarch *gdbarch, struct frame_info *frame)
2406 {
2407   if (gdbarch->frame_chain == 0)
2408     internal_error ("gdbarch: gdbarch_frame_chain invalid");
2409   if (gdbarch_debug >= 2)
2410     fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_chain called\n");
2411   return gdbarch->frame_chain (frame);
2412 }
2413
2414 void
2415 set_gdbarch_frame_chain (struct gdbarch *gdbarch,
2416                          gdbarch_frame_chain_ftype frame_chain)
2417 {
2418   gdbarch->frame_chain = frame_chain;
2419 }
2420
2421 int
2422 gdbarch_frame_chain_valid (struct gdbarch *gdbarch, CORE_ADDR chain, struct frame_info *thisframe)
2423 {
2424   if (gdbarch->frame_chain_valid == 0)
2425     internal_error ("gdbarch: gdbarch_frame_chain_valid invalid");
2426   if (gdbarch_debug >= 2)
2427     fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_chain_valid called\n");
2428   return gdbarch->frame_chain_valid (chain, thisframe);
2429 }
2430
2431 void
2432 set_gdbarch_frame_chain_valid (struct gdbarch *gdbarch,
2433                                gdbarch_frame_chain_valid_ftype frame_chain_valid)
2434 {
2435   gdbarch->frame_chain_valid = frame_chain_valid;
2436 }
2437
2438 CORE_ADDR
2439 gdbarch_frame_saved_pc (struct gdbarch *gdbarch, struct frame_info *fi)
2440 {
2441   if (gdbarch->frame_saved_pc == 0)
2442     internal_error ("gdbarch: gdbarch_frame_saved_pc invalid");
2443   if (gdbarch_debug >= 2)
2444     fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_saved_pc called\n");
2445   return gdbarch->frame_saved_pc (fi);
2446 }
2447
2448 void
2449 set_gdbarch_frame_saved_pc (struct gdbarch *gdbarch,
2450                             gdbarch_frame_saved_pc_ftype frame_saved_pc)
2451 {
2452   gdbarch->frame_saved_pc = frame_saved_pc;
2453 }
2454
2455 CORE_ADDR
2456 gdbarch_frame_args_address (struct gdbarch *gdbarch, struct frame_info *fi)
2457 {
2458   if (gdbarch->frame_args_address == 0)
2459     internal_error ("gdbarch: gdbarch_frame_args_address invalid");
2460   if (gdbarch_debug >= 2)
2461     fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_args_address called\n");
2462   return gdbarch->frame_args_address (fi);
2463 }
2464
2465 void
2466 set_gdbarch_frame_args_address (struct gdbarch *gdbarch,
2467                                 gdbarch_frame_args_address_ftype frame_args_address)
2468 {
2469   gdbarch->frame_args_address = frame_args_address;
2470 }
2471
2472 CORE_ADDR
2473 gdbarch_frame_locals_address (struct gdbarch *gdbarch, struct frame_info *fi)
2474 {
2475   if (gdbarch->frame_locals_address == 0)
2476     internal_error ("gdbarch: gdbarch_frame_locals_address invalid");
2477   if (gdbarch_debug >= 2)
2478     fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_locals_address called\n");
2479   return gdbarch->frame_locals_address (fi);
2480 }
2481
2482 void
2483 set_gdbarch_frame_locals_address (struct gdbarch *gdbarch,
2484                                   gdbarch_frame_locals_address_ftype frame_locals_address)
2485 {
2486   gdbarch->frame_locals_address = frame_locals_address;
2487 }
2488
2489 CORE_ADDR
2490 gdbarch_saved_pc_after_call (struct gdbarch *gdbarch, struct frame_info *frame)
2491 {
2492   if (gdbarch->saved_pc_after_call == 0)
2493     internal_error ("gdbarch: gdbarch_saved_pc_after_call invalid");
2494   if (gdbarch_debug >= 2)
2495     fprintf_unfiltered (gdb_stdlog, "gdbarch_saved_pc_after_call called\n");
2496   return gdbarch->saved_pc_after_call (frame);
2497 }
2498
2499 void
2500 set_gdbarch_saved_pc_after_call (struct gdbarch *gdbarch,
2501                                  gdbarch_saved_pc_after_call_ftype saved_pc_after_call)
2502 {
2503   gdbarch->saved_pc_after_call = saved_pc_after_call;
2504 }
2505
2506 int
2507 gdbarch_frame_num_args (struct gdbarch *gdbarch, struct frame_info *frame)
2508 {
2509   if (gdbarch->frame_num_args == 0)
2510     internal_error ("gdbarch: gdbarch_frame_num_args invalid");
2511   if (gdbarch_debug >= 2)
2512     fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_num_args called\n");
2513   return gdbarch->frame_num_args (frame);
2514 }
2515
2516 void
2517 set_gdbarch_frame_num_args (struct gdbarch *gdbarch,
2518                             gdbarch_frame_num_args_ftype frame_num_args)
2519 {
2520   gdbarch->frame_num_args = frame_num_args;
2521 }
2522
2523 int
2524 gdbarch_stack_align_p (struct gdbarch *gdbarch)
2525 {
2526   return gdbarch->stack_align != 0;
2527 }
2528
2529 CORE_ADDR
2530 gdbarch_stack_align (struct gdbarch *gdbarch, CORE_ADDR sp)
2531 {
2532   if (gdbarch->stack_align == 0)
2533     internal_error ("gdbarch: gdbarch_stack_align invalid");
2534   if (gdbarch_debug >= 2)
2535     fprintf_unfiltered (gdb_stdlog, "gdbarch_stack_align called\n");
2536   return gdbarch->stack_align (sp);
2537 }
2538
2539 void
2540 set_gdbarch_stack_align (struct gdbarch *gdbarch,
2541                          gdbarch_stack_align_ftype stack_align)
2542 {
2543   gdbarch->stack_align = stack_align;
2544 }
2545
2546 int
2547 gdbarch_reg_struct_has_addr_p (struct gdbarch *gdbarch)
2548 {
2549   return gdbarch->reg_struct_has_addr != 0;
2550 }
2551
2552 int
2553 gdbarch_reg_struct_has_addr (struct gdbarch *gdbarch, int gcc_p, struct type *type)
2554 {
2555   if (gdbarch->reg_struct_has_addr == 0)
2556     internal_error ("gdbarch: gdbarch_reg_struct_has_addr invalid");
2557   if (gdbarch_debug >= 2)
2558     fprintf_unfiltered (gdb_stdlog, "gdbarch_reg_struct_has_addr called\n");
2559   return gdbarch->reg_struct_has_addr (gcc_p, type);
2560 }
2561
2562 void
2563 set_gdbarch_reg_struct_has_addr (struct gdbarch *gdbarch,
2564                                  gdbarch_reg_struct_has_addr_ftype reg_struct_has_addr)
2565 {
2566   gdbarch->reg_struct_has_addr = reg_struct_has_addr;
2567 }
2568
2569
2570 /* Keep a registrary of per-architecture data-pointers required by GDB
2571    modules. */
2572
2573 struct gdbarch_data
2574 {
2575   int index;
2576 };
2577
2578 struct gdbarch_data_registration
2579 {
2580   gdbarch_data_ftype *init;
2581   struct gdbarch_data *data;
2582   struct gdbarch_data_registration *next;
2583 };
2584
2585 struct gdbarch_data_registrary
2586 {
2587   int nr;
2588   struct gdbarch_data_registration *registrations;
2589 };
2590
2591 struct gdbarch_data_registrary gdbarch_data_registrary =
2592 {
2593   0, NULL,
2594 };
2595
2596 struct gdbarch_data *
2597 register_gdbarch_data (gdbarch_data_ftype *init)
2598 {
2599   struct gdbarch_data_registration **curr;
2600   for (curr = &gdbarch_data_registrary.registrations;
2601        (*curr) != NULL;
2602        curr = &(*curr)->next);
2603   (*curr) = XMALLOC (struct gdbarch_data_registration);
2604   (*curr)->next = NULL;
2605   (*curr)->init = init;
2606   (*curr)->data = XMALLOC (struct gdbarch_data);
2607   (*curr)->data->index = gdbarch_data_registrary.nr++;
2608   return (*curr)->data;
2609 }
2610
2611
2612 /* Walk through all the registered users initializing each in turn. */
2613
2614 static void
2615 init_gdbarch_data (struct gdbarch *gdbarch)
2616 {
2617   struct gdbarch_data_registration *rego;
2618   gdbarch->nr_data = gdbarch_data_registrary.nr + 1;
2619   gdbarch->data = xmalloc (sizeof (void*) * gdbarch->nr_data);
2620   for (rego = gdbarch_data_registrary.registrations;
2621        rego != NULL;
2622        rego = rego->next)
2623     {
2624       if (rego->data->index < gdbarch->nr_data)
2625         gdbarch->data[rego->data->index] = rego->init ();
2626     }
2627 }
2628
2629
2630 /* Return the current value of the specified per-architecture
2631    data-pointer. */
2632
2633 void *
2634 gdbarch_data (data)
2635      struct gdbarch_data *data;
2636 {
2637   if (data->index >= current_gdbarch->nr_data)
2638     internal_error ("gdbarch_data: request for non-existant data.");
2639   return current_gdbarch->data[data->index];
2640 }
2641
2642
2643
2644 /* Keep a registrary of swaped data required by GDB modules. */
2645
2646 struct gdbarch_swap
2647 {
2648   void *swap;
2649   struct gdbarch_swap_registration *source;
2650   struct gdbarch_swap *next;
2651 };
2652
2653 struct gdbarch_swap_registration
2654 {
2655   void *data;
2656   unsigned long sizeof_data;
2657   gdbarch_swap_ftype *init;
2658   struct gdbarch_swap_registration *next;
2659 };
2660
2661 struct gdbarch_swap_registrary
2662 {
2663   int nr;
2664   struct gdbarch_swap_registration *registrations;
2665 };
2666
2667 struct gdbarch_swap_registrary gdbarch_swap_registrary = 
2668 {
2669   0, NULL,
2670 };
2671
2672 void
2673 register_gdbarch_swap (void *data,
2674                        unsigned long sizeof_data,
2675                        gdbarch_swap_ftype *init)
2676 {
2677   struct gdbarch_swap_registration **rego;
2678   for (rego = &gdbarch_swap_registrary.registrations;
2679        (*rego) != NULL;
2680        rego = &(*rego)->next);
2681   (*rego) = XMALLOC (struct gdbarch_swap_registration);
2682   (*rego)->next = NULL;
2683   (*rego)->init = init;
2684   (*rego)->data = data;
2685   (*rego)->sizeof_data = sizeof_data;
2686 }
2687
2688
2689 static void
2690 init_gdbarch_swap (struct gdbarch *gdbarch)
2691 {
2692   struct gdbarch_swap_registration *rego;
2693   struct gdbarch_swap **curr = &gdbarch->swap;
2694   for (rego = gdbarch_swap_registrary.registrations;
2695        rego != NULL;
2696        rego = rego->next)
2697     {
2698       if (rego->data != NULL)
2699         {
2700           (*curr) = XMALLOC (struct gdbarch_swap);
2701           (*curr)->source = rego;
2702           (*curr)->swap = xmalloc (rego->sizeof_data);
2703           (*curr)->next = NULL;
2704           memset (rego->data, 0, rego->sizeof_data);
2705           curr = &(*curr)->next;
2706         }
2707       if (rego->init != NULL)
2708         rego->init ();
2709     }
2710 }
2711
2712 static void
2713 swapout_gdbarch_swap (struct gdbarch *gdbarch)
2714 {
2715   struct gdbarch_swap *curr;
2716   for (curr = gdbarch->swap;
2717        curr != NULL;
2718        curr = curr->next)
2719     memcpy (curr->swap, curr->source->data, curr->source->sizeof_data);
2720 }
2721
2722 static void
2723 swapin_gdbarch_swap (struct gdbarch *gdbarch)
2724 {
2725   struct gdbarch_swap *curr;
2726   for (curr = gdbarch->swap;
2727        curr != NULL;
2728        curr = curr->next)
2729     memcpy (curr->source->data, curr->swap, curr->source->sizeof_data);
2730 }
2731
2732
2733 /* Keep a registrary of the architectures known by GDB. */
2734
2735 struct gdbarch_init_registration
2736 {
2737   enum bfd_architecture bfd_architecture;
2738   gdbarch_init_ftype *init;
2739   struct gdbarch_list *arches;
2740   struct gdbarch_init_registration *next;
2741 };
2742
2743 static struct gdbarch_init_registration *gdbarch_init_registrary = NULL;
2744
2745 void
2746 register_gdbarch_init (enum bfd_architecture bfd_architecture,
2747                        gdbarch_init_ftype *init)
2748 {
2749   struct gdbarch_init_registration **curr;
2750   const struct bfd_arch_info *bfd_arch_info;
2751   /* Check that BFD reconizes this architecture */
2752   bfd_arch_info = bfd_lookup_arch (bfd_architecture, 0);
2753   if (bfd_arch_info == NULL)
2754     {
2755       internal_error ("gdbarch: Attempt to register unknown architecture (%d)", bfd_architecture);
2756     }
2757   /* Check that we haven't seen this architecture before */
2758   for (curr = &gdbarch_init_registrary;
2759        (*curr) != NULL;
2760        curr = &(*curr)->next)
2761     {
2762       if (bfd_architecture == (*curr)->bfd_architecture)
2763         internal_error ("gdbarch: Duplicate registraration of architecture (%s)",
2764                bfd_arch_info->printable_name);
2765     }
2766   /* log it */
2767   if (gdbarch_debug)
2768     fprintf_unfiltered (gdb_stdlog, "register_gdbarch_init (%s, 0x%08lx)\n",
2769                         bfd_arch_info->printable_name,
2770                         (long) init);
2771   /* Append it */
2772   (*curr) = XMALLOC (struct gdbarch_init_registration);
2773   (*curr)->bfd_architecture = bfd_architecture;
2774   (*curr)->init = init;
2775   (*curr)->arches = NULL;
2776   (*curr)->next = NULL;
2777 }
2778   
2779
2780
2781 /* Look for an architecture using gdbarch_info.  Base search on only
2782    BFD_ARCH_INFO and BYTE_ORDER. */
2783
2784 struct gdbarch_list *
2785 gdbarch_list_lookup_by_info (struct gdbarch_list *arches,
2786                              const struct gdbarch_info *info)
2787 {
2788   for (; arches != NULL; arches = arches->next)
2789     {
2790       if (info->bfd_arch_info != arches->gdbarch->bfd_arch_info)
2791         continue;
2792       if (info->byte_order != arches->gdbarch->byte_order)
2793         continue;
2794       return arches;
2795     }
2796   return NULL;
2797 }
2798
2799
2800 /* Update the current architecture. Return ZERO if the update request
2801    failed. */
2802
2803 int
2804 gdbarch_update (struct gdbarch_info info)
2805 {
2806   struct gdbarch *new_gdbarch;
2807   struct gdbarch_list **list;
2808   struct gdbarch_init_registration *rego;
2809
2810   /* Fill in any missing bits. Most important is the bfd_architecture
2811      which is used to select the target architecture. */
2812   if (info.bfd_architecture == bfd_arch_unknown)
2813     {
2814       if (info.bfd_arch_info != NULL)
2815         info.bfd_architecture = info.bfd_arch_info->arch;
2816       else if (info.abfd != NULL)
2817         info.bfd_architecture = bfd_get_arch (info.abfd);
2818       /* FIXME - should query BFD for its default architecture. */
2819       else
2820         info.bfd_architecture = current_gdbarch->bfd_arch_info->arch;
2821     }
2822   if (info.bfd_arch_info == NULL)
2823     {
2824       if (target_architecture_auto && info.abfd != NULL)
2825         info.bfd_arch_info = bfd_get_arch_info (info.abfd);
2826       else
2827         info.bfd_arch_info = current_gdbarch->bfd_arch_info;
2828     }
2829   if (info.byte_order == 0)
2830     {
2831       if (target_byte_order_auto && info.abfd != NULL)
2832         info.byte_order = (bfd_big_endian (info.abfd) ? BIG_ENDIAN
2833                            : bfd_little_endian (info.abfd) ? LITTLE_ENDIAN
2834                            : 0);
2835       else
2836         info.byte_order = current_gdbarch->byte_order;
2837       /* FIXME - should query BFD for its default byte-order. */
2838     }
2839   /* A default for abfd? */
2840
2841   /* Find the target that knows about this architecture. */
2842   for (rego = gdbarch_init_registrary;
2843        rego != NULL && rego->bfd_architecture != info.bfd_architecture;
2844        rego = rego->next);
2845   if (rego == NULL)
2846     {
2847       if (gdbarch_debug)
2848         fprintf_unfiltered (gdb_stdlog, "gdbarch_update: No matching architecture\n");
2849       return 0;
2850     }
2851
2852   if (gdbarch_debug)
2853     {
2854       fprintf_unfiltered (gdb_stdlog,
2855                           "gdbarch_update: info.bfd_architecture %d (%s)\n",
2856                           info.bfd_architecture,
2857                           bfd_lookup_arch (info.bfd_architecture, 0)->printable_name);
2858       fprintf_unfiltered (gdb_stdlog,
2859                           "gdbarch_update: info.bfd_arch_info %s\n",
2860                           (info.bfd_arch_info != NULL
2861                            ? info.bfd_arch_info->printable_name
2862                            : "(null)"));
2863       fprintf_unfiltered (gdb_stdlog,
2864                           "gdbarch_update: info.byte_order %d (%s)\n",
2865                           info.byte_order,
2866                           (info.byte_order == BIG_ENDIAN ? "big"
2867                            : info.byte_order == LITTLE_ENDIAN ? "little"
2868                            : "default"));
2869       fprintf_unfiltered (gdb_stdlog,
2870                           "gdbarch_update: info.abfd 0x%lx\n",
2871                           (long) info.abfd);
2872       fprintf_unfiltered (gdb_stdlog,
2873                           "gdbarch_update: info.tdep_info 0x%lx\n",
2874                           (long) info.tdep_info);
2875     }
2876
2877   /* Ask the target for a replacement architecture. */
2878   new_gdbarch = rego->init (info, rego->arches);
2879
2880   /* Did the target like it?  No. Reject the change. */
2881   if (new_gdbarch == NULL)
2882     {
2883       if (gdbarch_debug)
2884         fprintf_unfiltered (gdb_stdlog, "gdbarch_update: Target rejected architecture\n");
2885       return 0;
2886     }
2887
2888   /* Did the architecture change?  No. Do nothing. */
2889   if (current_gdbarch == new_gdbarch)
2890     {
2891       if (gdbarch_debug)
2892         fprintf_unfiltered (gdb_stdlog, "gdbarch_update: Architecture 0x%08lx (%s) unchanged\n",
2893                             (long) new_gdbarch,
2894                             new_gdbarch->bfd_arch_info->printable_name);
2895       return 1;
2896     }
2897
2898   /* Swap all data belonging to the old target out */
2899   swapout_gdbarch_swap (current_gdbarch);
2900
2901   /* Is this a pre-existing architecture?  Yes. Swap it in.  */
2902   for (list = &rego->arches;
2903        (*list) != NULL;
2904        list = &(*list)->next)
2905     {
2906       if ((*list)->gdbarch == new_gdbarch)
2907         {
2908           if (gdbarch_debug)
2909             fprintf_unfiltered (gdb_stdlog, "gdbarch_update: Previous architecture 0x%08lx (%s) selected\n",
2910                                 (long) new_gdbarch,
2911                                 new_gdbarch->bfd_arch_info->printable_name);
2912           current_gdbarch = new_gdbarch;
2913           swapin_gdbarch_swap (new_gdbarch);
2914           return 1;
2915         }
2916     }
2917     
2918   /* Append this new architecture to this targets list. */
2919   (*list) = XMALLOC (struct gdbarch_list);
2920   (*list)->next = NULL;
2921   (*list)->gdbarch = new_gdbarch;
2922
2923   /* Switch to this new architecture.  Dump it out. */
2924   current_gdbarch = new_gdbarch;
2925   if (gdbarch_debug)
2926     {
2927       fprintf_unfiltered (gdb_stdlog,
2928                           "gdbarch_update: New architecture 0x%08lx (%s) selected\n",
2929                           (long) new_gdbarch,
2930                           new_gdbarch->bfd_arch_info->printable_name);
2931       gdbarch_dump ();
2932     }
2933   
2934   /* Check that the newly installed architecture is valid.  */
2935   verify_gdbarch (new_gdbarch);
2936
2937   /* Initialize the per-architecture memory (swap) areas.
2938      CURRENT_GDBARCH must be update before these modules are
2939      called. */
2940   init_gdbarch_swap (new_gdbarch);
2941   
2942   /* Initialize the per-architecture data-pointer of all parties that
2943      registered an interest in this architecture.  CURRENT_GDBARCH
2944      must be updated before these modules are called. */
2945   init_gdbarch_data (new_gdbarch);
2946   
2947   return 1;
2948 }
2949
2950
2951
2952 /* Functions to manipulate the endianness of the target.  */
2953
2954 #ifdef TARGET_BYTE_ORDER_SELECTABLE
2955 /* compat - Catch old targets that expect a selectable byte-order to
2956    default to BIG_ENDIAN */
2957 #ifndef TARGET_BYTE_ORDER_DEFAULT
2958 #define TARGET_BYTE_ORDER_DEFAULT BIG_ENDIAN
2959 #endif
2960 #endif
2961 #if !TARGET_BYTE_ORDER_SELECTABLE_P
2962 #ifndef TARGET_BYTE_ORDER_DEFAULT
2963 /* compat - Catch old non byte-order selectable targets that do not
2964    define TARGET_BYTE_ORDER_DEFAULT and instead expect
2965    TARGET_BYTE_ORDER to be used as the default.  For targets that
2966    defined neither TARGET_BYTE_ORDER nor TARGET_BYTE_ORDER_DEFAULT the
2967    below will get a strange compiler warning. */
2968 #define TARGET_BYTE_ORDER_DEFAULT TARGET_BYTE_ORDER
2969 #endif
2970 #endif
2971 #ifndef TARGET_BYTE_ORDER_DEFAULT
2972 #define TARGET_BYTE_ORDER_DEFAULT BIG_ENDIAN /* arbitrary */
2973 #endif
2974 int target_byte_order = TARGET_BYTE_ORDER_DEFAULT;
2975 int target_byte_order_auto = 1;
2976
2977 /* Chain containing the \"set endian\" commands.  */
2978 static struct cmd_list_element *endianlist = NULL;
2979
2980 /* Called by ``show endian''.  */
2981 static void
2982 show_endian (char *args, int from_tty)
2983 {
2984   char *msg =
2985     (TARGET_BYTE_ORDER_AUTO
2986      ? "The target endianness is set automatically (currently %s endian)\n"
2987      : "The target is assumed to be %s endian\n");
2988   printf_unfiltered (msg, (TARGET_BYTE_ORDER == BIG_ENDIAN ? "big" : "little"));
2989 }
2990
2991 /* Called if the user enters ``set endian'' without an argument.  */
2992 static void
2993 set_endian (char *args, int from_tty)
2994 {
2995   printf_unfiltered ("\"set endian\" must be followed by \"auto\", \"big\" or \"little\".\n");
2996   show_endian (args, from_tty);
2997 }
2998
2999 /* Called by ``set endian big''.  */
3000 static void
3001 set_endian_big (char *args, int from_tty)
3002 {
3003   if (TARGET_BYTE_ORDER_SELECTABLE_P)
3004     {
3005       target_byte_order = BIG_ENDIAN;
3006       target_byte_order_auto = 0;
3007       if (GDB_MULTI_ARCH)
3008         {
3009           struct gdbarch_info info;
3010           memset (&info, 0, sizeof info);
3011           info.byte_order = BIG_ENDIAN;
3012           gdbarch_update (info);
3013         }
3014     }
3015   else
3016     {
3017       printf_unfiltered ("Byte order is not selectable.");
3018       show_endian (args, from_tty);
3019     }
3020 }
3021
3022 /* Called by ``set endian little''.  */
3023 static void
3024 set_endian_little (char *args, int from_tty)
3025 {
3026   if (TARGET_BYTE_ORDER_SELECTABLE_P)
3027     {
3028       target_byte_order = LITTLE_ENDIAN;
3029       target_byte_order_auto = 0;
3030       if (GDB_MULTI_ARCH)
3031         {
3032           struct gdbarch_info info;
3033           memset (&info, 0, sizeof info);
3034           info.byte_order = LITTLE_ENDIAN;
3035           gdbarch_update (info);
3036         }
3037     }
3038   else
3039     {
3040       printf_unfiltered ("Byte order is not selectable.");
3041       show_endian (args, from_tty);
3042     }
3043 }
3044
3045 /* Called by ``set endian auto''.  */
3046 static void
3047 set_endian_auto (char *args, int from_tty)
3048 {
3049   if (TARGET_BYTE_ORDER_SELECTABLE_P)
3050     {
3051       target_byte_order_auto = 1;
3052     }
3053   else
3054     {
3055       printf_unfiltered ("Byte order is not selectable.");
3056       show_endian (args, from_tty);
3057     }
3058 }
3059
3060 /* Set the endianness from a BFD.  */
3061 static void
3062 set_endian_from_file (bfd *abfd)
3063 {
3064   if (TARGET_BYTE_ORDER_SELECTABLE_P)
3065     {
3066       int want;
3067       
3068       if (bfd_big_endian (abfd))
3069         want = BIG_ENDIAN;
3070       else
3071         want = LITTLE_ENDIAN;
3072       if (TARGET_BYTE_ORDER_AUTO)
3073         target_byte_order = want;
3074       else if (TARGET_BYTE_ORDER != want)
3075         warning ("%s endian file does not match %s endian target.",
3076                  want == BIG_ENDIAN ? "big" : "little",
3077                  TARGET_BYTE_ORDER == BIG_ENDIAN ? "big" : "little");
3078     }
3079   else
3080     {
3081       if (bfd_big_endian (abfd)
3082           ? TARGET_BYTE_ORDER != BIG_ENDIAN
3083           : TARGET_BYTE_ORDER == BIG_ENDIAN)
3084         warning ("%s endian file does not match %s endian target.",
3085                  bfd_big_endian (abfd) ? "big" : "little",
3086                  TARGET_BYTE_ORDER == BIG_ENDIAN ? "big" : "little");
3087     }
3088 }
3089
3090
3091
3092 /* Functions to manipulate the architecture of the target */
3093
3094 enum set_arch { set_arch_auto, set_arch_manual };
3095
3096 int target_architecture_auto = 1;
3097 extern const struct bfd_arch_info bfd_default_arch_struct;
3098 const struct bfd_arch_info *target_architecture = &bfd_default_arch_struct;
3099 int (*target_architecture_hook) (const struct bfd_arch_info *ap);
3100
3101 static void show_endian (char *, int);
3102 static void set_endian (char *, int);
3103 static void set_endian_big (char *, int);
3104 static void set_endian_little (char *, int);
3105 static void set_endian_auto (char *, int);
3106 static void set_endian_from_file (bfd *);
3107 static int arch_ok (const struct bfd_arch_info *arch);
3108 static void set_arch (const struct bfd_arch_info *arch, enum set_arch type);
3109 static void show_architecture (char *, int);
3110 static void set_architecture (char *, int);
3111 static void info_architecture (char *, int);
3112 static void set_architecture_from_file (bfd *);
3113
3114 /* Do the real work of changing the current architecture */
3115
3116 static int
3117 arch_ok (const struct bfd_arch_info *arch)
3118 {
3119   /* Should be performing the more basic check that the binary is
3120      compatible with GDB. */
3121   /* Check with the target that the architecture is valid. */
3122   return (target_architecture_hook == NULL
3123           || target_architecture_hook (arch));
3124 }
3125
3126 static void
3127 set_arch (const struct bfd_arch_info *arch,
3128           enum set_arch type)
3129 {
3130   switch (type)
3131     {
3132     case set_arch_auto:
3133       if (!arch_ok (arch))
3134         warning ("Target may not support %s architecture",
3135                  arch->printable_name);
3136       target_architecture = arch;
3137       break;
3138     case set_arch_manual:
3139       if (!arch_ok (arch))
3140         {
3141           printf_unfiltered ("Target does not support `%s' architecture.\n",
3142                              arch->printable_name);
3143         }
3144       else
3145         {
3146           target_architecture_auto = 0;
3147           target_architecture = arch;
3148         }
3149       break;
3150     }
3151   if (gdbarch_debug)
3152     gdbarch_dump ();
3153 }
3154
3155 /* Called if the user enters ``show architecture'' without an argument. */
3156 static void
3157 show_architecture (char *args, int from_tty)
3158 {
3159   const char *arch;
3160   arch = TARGET_ARCHITECTURE->printable_name;
3161   if (target_architecture_auto)
3162     printf_filtered ("The target architecture is set automatically (currently %s)\n", arch);
3163   else
3164     printf_filtered ("The target architecture is assumed to be %s\n", arch);
3165 }
3166
3167 /* Called if the user enters ``set architecture'' with or without an
3168    argument. */
3169 static void
3170 set_architecture (char *args, int from_tty)
3171 {
3172   if (args == NULL)
3173     {
3174       printf_unfiltered ("\"set architecture\" must be followed by \"auto\" or an architecture name.\n");
3175     }
3176   else if (strcmp (args, "auto") == 0)
3177     {
3178       target_architecture_auto = 1;
3179     }
3180   else if (GDB_MULTI_ARCH)
3181     {
3182       const struct bfd_arch_info *arch = bfd_scan_arch (args);
3183       if (arch == NULL)
3184         printf_unfiltered ("Architecture `%s' not reconized.\n", args);
3185       else
3186         {
3187           struct gdbarch_info info;
3188           memset (&info, 0, sizeof info);
3189           info.bfd_arch_info = arch;
3190           if (gdbarch_update (info))
3191             target_architecture_auto = 0;
3192           else
3193             printf_unfiltered ("Architecture `%s' not reconized.\n", args);
3194         }
3195     }
3196   else
3197     {
3198       const struct bfd_arch_info *arch = bfd_scan_arch (args);
3199       if (arch != NULL)
3200         set_arch (arch, set_arch_manual);
3201       else
3202         printf_unfiltered ("Architecture `%s' not reconized.\n", args);
3203     }
3204 }
3205
3206 /* Called if the user enters ``info architecture'' without an argument. */
3207 static void
3208 info_architecture (char *args, int from_tty)
3209 {
3210   enum bfd_architecture a;
3211   if (GDB_MULTI_ARCH)
3212     {
3213       if (gdbarch_init_registrary != NULL)
3214         {
3215           struct gdbarch_init_registration *rego;
3216           printf_filtered ("Available architectures are:\n");
3217           for (rego = gdbarch_init_registrary;
3218                rego != NULL;
3219                rego = rego->next)
3220             {
3221               const struct bfd_arch_info *ap;
3222               ap = bfd_lookup_arch (rego->bfd_architecture, 0);
3223               if (ap != NULL)
3224                 {
3225                   do
3226                     {
3227                       printf_filtered (" %s", ap->printable_name);
3228                       ap = ap->next;
3229                     }
3230                   while (ap != NULL);
3231                   printf_filtered ("\n");
3232                 }
3233             }
3234         }
3235       else
3236         {
3237           printf_filtered ("There are no available architectures.\n");
3238         }
3239       return;
3240     }
3241   printf_filtered ("Available architectures are:\n");
3242   for (a = bfd_arch_obscure + 1; a < bfd_arch_last; a++)
3243     {
3244       const struct bfd_arch_info *ap = bfd_lookup_arch (a, 0);
3245       if (ap != NULL)
3246         {
3247           do
3248             {
3249               printf_filtered (" %s", ap->printable_name);
3250               ap = ap->next;
3251             }
3252           while (ap != NULL);
3253           printf_filtered ("\n");
3254         }
3255     }
3256 }
3257
3258 /* Set the architecture from arch/machine */
3259 void
3260 set_architecture_from_arch_mach (arch, mach)
3261      enum bfd_architecture arch;
3262      unsigned long mach;
3263 {
3264   const struct bfd_arch_info *wanted = bfd_lookup_arch (arch, mach);
3265   if (wanted != NULL)
3266     set_arch (wanted, set_arch_manual);
3267   else
3268     internal_error ("gdbarch: hardwired architecture/machine not reconized");
3269 }
3270
3271 /* Set the architecture from a BFD */
3272 static void
3273 set_architecture_from_file (bfd *abfd)
3274 {
3275   const struct bfd_arch_info *wanted = bfd_get_arch_info (abfd);
3276   if (target_architecture_auto)
3277     {
3278       set_arch (wanted, set_arch_auto);
3279     }
3280   else if (wanted != target_architecture)
3281     {
3282       warning ("%s architecture file may be incompatible with %s target.",
3283                wanted->printable_name,
3284                target_architecture->printable_name);
3285     }
3286 }
3287
3288
3289 /* Misc helper functions for targets. */
3290
3291 int
3292 frame_num_args_unknown (fi)
3293      struct frame_info *fi;
3294 {
3295   return -1;
3296 }
3297
3298
3299 int
3300 generic_register_convertible_not (num)
3301      int num;
3302 {
3303   return 0;
3304 }
3305   
3306
3307 /* Disassembler */
3308
3309 /* Pointer to the target-dependent disassembly function.  */
3310 int (*tm_print_insn) (bfd_vma, disassemble_info *);
3311 disassemble_info tm_print_insn_info;
3312
3313
3314
3315 /* Set the dynamic target-system-dependant parameters (architecture,
3316    byte-order) using information found in the BFD */
3317
3318 void
3319 set_gdbarch_from_file (abfd)
3320      bfd *abfd;
3321 {
3322   if (GDB_MULTI_ARCH)
3323     {
3324       struct gdbarch_info info;
3325       memset (&info, 0, sizeof info);
3326       info.abfd = abfd;
3327       gdbarch_update (info);
3328       return;
3329     }
3330   set_architecture_from_file (abfd);
3331   set_endian_from_file (abfd);
3332 }
3333
3334
3335 /* Initialize the current architecture.  */
3336 void
3337 initialize_current_architecture ()
3338 {
3339   if (GDB_MULTI_ARCH)
3340     {
3341       struct gdbarch_init_registration *rego;
3342       const struct bfd_arch_info *chosen = NULL;
3343       for (rego = gdbarch_init_registrary; rego != NULL; rego = rego->next)
3344         {
3345           const struct bfd_arch_info *ap
3346             = bfd_lookup_arch (rego->bfd_architecture, 0);
3347
3348           /* Choose the first architecture alphabetically.  */
3349           if (chosen == NULL
3350               || strcmp (ap->printable_name, chosen->printable_name) < 0)
3351             chosen = ap;
3352         }
3353
3354       if (chosen != NULL)
3355         {
3356           struct gdbarch_info info;
3357           memset (&info, 0, sizeof info);
3358           info.bfd_arch_info = chosen;
3359           gdbarch_update (info);
3360         }
3361     }
3362 }
3363
3364 extern void _initialize_gdbarch (void);
3365 void
3366 _initialize_gdbarch ()
3367 {
3368   struct cmd_list_element *c;
3369
3370   add_prefix_cmd ("endian", class_support, set_endian,
3371                   "Set endianness of target.",
3372                   &endianlist, "set endian ", 0, &setlist);
3373   add_cmd ("big", class_support, set_endian_big,
3374            "Set target as being big endian.", &endianlist);
3375   add_cmd ("little", class_support, set_endian_little,
3376            "Set target as being little endian.", &endianlist);
3377   add_cmd ("auto", class_support, set_endian_auto,
3378            "Select target endianness automatically.", &endianlist);
3379   add_cmd ("endian", class_support, show_endian,
3380            "Show endianness of target.", &showlist);
3381
3382   add_cmd ("architecture", class_support, set_architecture,
3383            "Set architecture of target.", &setlist);
3384   add_alias_cmd ("processor", "architecture", class_support, 1, &setlist);
3385   add_cmd ("architecture", class_support, show_architecture,
3386            "Show architecture of target.", &showlist);
3387   add_cmd ("architecture", class_support, info_architecture,
3388            "List supported target architectures", &infolist);
3389
3390   INIT_DISASSEMBLE_INFO_NO_ARCH (tm_print_insn_info, gdb_stdout, (fprintf_ftype)fprintf_filtered);
3391   tm_print_insn_info.flavour = bfd_target_unknown_flavour;
3392   tm_print_insn_info.read_memory_func = dis_asm_read_memory;
3393   tm_print_insn_info.memory_error_func = dis_asm_memory_error;
3394   tm_print_insn_info.print_address_func = dis_asm_print_address;
3395
3396   add_show_from_set (add_set_cmd ("arch",
3397                                   class_maintenance,
3398                                   var_zinteger,
3399                                   (char *)&gdbarch_debug,
3400                                   "Set architecture debugging.\n\
3401 When non-zero, architecture debugging is enabled.", &setdebuglist),
3402                      &showdebuglist);
3403   c = add_set_cmd ("archdebug",
3404                    class_maintenance,
3405                    var_zinteger,
3406                    (char *)&gdbarch_debug,
3407                    "Set architecture debugging.\n\
3408 When non-zero, architecture debugging is enabled.", &setlist);
3409
3410   deprecate_cmd (c, "set debug arch");
3411   deprecate_cmd (add_show_from_set (c, &showlist), "show debug arch");
3412 }