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