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