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