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