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