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