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