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