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