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