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