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