1 /* Dynamic architecture support for GDB, the GNU debugger.
2 Copyright 1998-1999, Free Software Foundation, Inc.
4 This file is part of GDB.
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.
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.
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. */
21 /* *INDENT-OFF* */ /* ``typedef (f)();'' confuses indent */
23 /* This file was created with the aid of ``gdbarch.sh''.
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
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
40 #include "inferior.h" /* enum CALL_DUMMY_LOCATION et.al. */
42 /* Just include everything in sight so that the every old definition
43 of macro is visible. */
44 #include "gdb_string.h"
49 #include "breakpoint.h"
54 #include "gdbthread.h"
56 #include "symfile.h" /* for overlay functions */
61 /* Static function declarations */
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
*);
69 /* Convenience macro for allocting typesafe memory. */
72 #define XMALLOC(TYPE) (TYPE*) xmalloc (sizeof (TYPE))
76 /* Non-zero if we want to trace architecture code. */
79 #define GDBARCH_DEBUG 0
81 int gdbarch_debug
= GDBARCH_DEBUG
;
84 /* Maintain the struct gdbarch object */
88 /* basic architectural information */
89 const struct bfd_arch_info
* bfd_arch_info
;
92 /* target specific vector. */
93 struct gdbarch_tdep
*tdep
;
95 /* per-architecture data-pointers */
99 /* per-architecture swap-regions */
100 struct gdbarch_swap
*swap
;
102 /* Multi-arch values.
104 When extending this structure you must:
108 Declare set/get functions and define the corresponding
111 gdbarch_alloc(): If zero/NULL is not a suitable default,
112 initialize the new field.
114 verify_gdbarch(): Confirm that the target updated the field
117 gdbarch_dump(): Add a fprintf_unfiltered call to so that the new
120 ``default_gdbarch()'': Append an initial value to the static
121 variable (base values on the host's c-type system).
123 get_gdbarch(): Implement the set/get functions (probably using
124 the macro's as shortcuts).
137 gdbarch_read_pc_ftype
*read_pc
;
138 gdbarch_write_pc_ftype
*write_pc
;
139 gdbarch_read_fp_ftype
*read_fp
;
140 gdbarch_write_fp_ftype
*write_fp
;
141 gdbarch_read_sp_ftype
*read_sp
;
142 gdbarch_write_sp_ftype
*write_sp
;
147 gdbarch_register_name_ftype
*register_name
;
150 gdbarch_register_byte_ftype
*register_byte
;
151 gdbarch_register_raw_size_ftype
*register_raw_size
;
152 int max_register_raw_size
;
153 gdbarch_register_virtual_size_ftype
*register_virtual_size
;
154 int max_register_virtual_size
;
155 gdbarch_register_virtual_type_ftype
*register_virtual_type
;
156 int use_generic_dummy_frames
;
157 int call_dummy_location
;
158 gdbarch_call_dummy_address_ftype
*call_dummy_address
;
159 CORE_ADDR call_dummy_start_offset
;
160 CORE_ADDR call_dummy_breakpoint_offset
;
161 int call_dummy_breakpoint_offset_p
;
162 int call_dummy_length
;
163 gdbarch_pc_in_call_dummy_ftype
*pc_in_call_dummy
;
165 LONGEST
* call_dummy_words
;
166 int sizeof_call_dummy_words
;
167 int call_dummy_stack_adjust_p
;
168 int call_dummy_stack_adjust
;
169 gdbarch_fix_call_dummy_ftype
*fix_call_dummy
;
170 int believe_pcc_promotion
;
171 int believe_pcc_promotion_type
;
172 gdbarch_get_saved_register_ftype
*get_saved_register
;
173 gdbarch_register_convertible_ftype
*register_convertible
;
174 gdbarch_register_convert_to_virtual_ftype
*register_convert_to_virtual
;
175 gdbarch_register_convert_to_raw_ftype
*register_convert_to_raw
;
176 gdbarch_extract_return_value_ftype
*extract_return_value
;
177 gdbarch_push_arguments_ftype
*push_arguments
;
178 gdbarch_push_dummy_frame_ftype
*push_dummy_frame
;
179 gdbarch_push_return_address_ftype
*push_return_address
;
180 gdbarch_pop_frame_ftype
*pop_frame
;
181 gdbarch_d10v_make_daddr_ftype
*d10v_make_daddr
;
182 gdbarch_d10v_make_iaddr_ftype
*d10v_make_iaddr
;
183 gdbarch_d10v_daddr_p_ftype
*d10v_daddr_p
;
184 gdbarch_d10v_iaddr_p_ftype
*d10v_iaddr_p
;
185 gdbarch_d10v_convert_daddr_to_raw_ftype
*d10v_convert_daddr_to_raw
;
186 gdbarch_d10v_convert_iaddr_to_raw_ftype
*d10v_convert_iaddr_to_raw
;
187 gdbarch_store_struct_return_ftype
*store_struct_return
;
188 gdbarch_store_return_value_ftype
*store_return_value
;
189 gdbarch_extract_struct_value_address_ftype
*extract_struct_value_address
;
190 gdbarch_use_struct_convention_ftype
*use_struct_convention
;
191 gdbarch_frame_init_saved_regs_ftype
*frame_init_saved_regs
;
192 gdbarch_init_extra_frame_info_ftype
*init_extra_frame_info
;
193 gdbarch_skip_prologue_ftype
*skip_prologue
;
194 gdbarch_inner_than_ftype
*inner_than
;
195 gdbarch_breakpoint_from_pc_ftype
*breakpoint_from_pc
;
196 gdbarch_memory_insert_breakpoint_ftype
*memory_insert_breakpoint
;
197 gdbarch_memory_remove_breakpoint_ftype
*memory_remove_breakpoint
;
198 CORE_ADDR decr_pc_after_break
;
199 CORE_ADDR function_start_offset
;
200 gdbarch_remote_translate_xfer_address_ftype
*remote_translate_xfer_address
;
201 CORE_ADDR frame_args_skip
;
202 gdbarch_frameless_function_invocation_ftype
*frameless_function_invocation
;
203 gdbarch_frame_chain_ftype
*frame_chain
;
204 gdbarch_frame_chain_valid_ftype
*frame_chain_valid
;
205 gdbarch_frame_saved_pc_ftype
*frame_saved_pc
;
206 gdbarch_frame_args_address_ftype
*frame_args_address
;
207 gdbarch_frame_locals_address_ftype
*frame_locals_address
;
208 gdbarch_saved_pc_after_call_ftype
*saved_pc_after_call
;
209 gdbarch_frame_num_args_ftype
*frame_num_args
;
213 /* The default architecture uses host values (for want of a better
216 extern const struct bfd_arch_info bfd_default_arch_struct
;
218 struct gdbarch default_gdbarch
= {
219 /* basic architecture information */
220 &bfd_default_arch_struct
,
222 /* target specific vector */
224 /*per-architecture data-pointers and swap regions */
226 /* Multi-arch values */
232 8 * sizeof (LONGEST
),
235 8 * sizeof (long double),
271 generic_get_saved_register
,
309 /* default_gdbarch() */
311 struct gdbarch
*current_gdbarch
= &default_gdbarch
;
314 /* Create a new ``struct gdbarch'' based in information provided by
315 ``struct gdbarch_info''. */
318 gdbarch_alloc (const struct gdbarch_info
*info
,
319 struct gdbarch_tdep
*tdep
)
321 struct gdbarch
*gdbarch
= XMALLOC (struct gdbarch
);
322 memset (gdbarch
, 0, sizeof (*gdbarch
));
324 gdbarch
->tdep
= tdep
;
326 gdbarch
->bfd_arch_info
= info
->bfd_arch_info
;
327 gdbarch
->byte_order
= info
->byte_order
;
329 /* Force the explicit initialization of these. */
330 gdbarch
->bfd_vma_bit
= TARGET_ARCHITECTURE
->bits_per_address
;
331 gdbarch
->num_regs
= -1;
332 gdbarch
->sp_regnum
= -1;
333 gdbarch
->fp_regnum
= -1;
334 gdbarch
->pc_regnum
= -1;
335 gdbarch
->register_size
= -1;
336 gdbarch
->register_bytes
= -1;
337 gdbarch
->max_register_raw_size
= -1;
338 gdbarch
->max_register_virtual_size
= -1;
339 gdbarch
->use_generic_dummy_frames
= -1;
340 gdbarch
->call_dummy_start_offset
= -1;
341 gdbarch
->call_dummy_breakpoint_offset
= -1;
342 gdbarch
->call_dummy_breakpoint_offset_p
= -1;
343 gdbarch
->call_dummy_length
= -1;
344 gdbarch
->call_dummy_p
= -1;
345 gdbarch
->call_dummy_stack_adjust_p
= -1;
346 gdbarch
->memory_insert_breakpoint
= default_memory_insert_breakpoint
;
347 gdbarch
->memory_remove_breakpoint
= default_memory_remove_breakpoint
;
348 gdbarch
->decr_pc_after_break
= -1;
349 gdbarch
->function_start_offset
= -1;
350 gdbarch
->frame_args_skip
= -1;
351 /* gdbarch_alloc() */
357 /* Ensure that all values in a GDBARCH are reasonable. */
360 verify_gdbarch (struct gdbarch
*gdbarch
)
362 /* Only perform sanity checks on a multi-arch target. */
363 if (GDB_MULTI_ARCH
<= 0)
366 if (gdbarch
->byte_order
== 0)
367 internal_error ("verify_gdbarch: byte-order unset");
368 if (gdbarch
->bfd_arch_info
== NULL
)
369 internal_error ("verify_gdbarch: bfd_arch_info unset");
370 /* Check those that need to be defined for the given multi-arch level. */
371 if ((GDB_MULTI_ARCH
>= 1)
373 internal_error ("gdbarch: verify_gdbarch: bfd_vma_bit invalid");
374 if ((GDB_MULTI_ARCH
>= 1)
375 && (gdbarch
->ptr_bit
== 0))
376 internal_error ("gdbarch: verify_gdbarch: ptr_bit invalid");
377 if ((GDB_MULTI_ARCH
>= 1)
378 && (gdbarch
->short_bit
== 0))
379 internal_error ("gdbarch: verify_gdbarch: short_bit invalid");
380 if ((GDB_MULTI_ARCH
>= 1)
381 && (gdbarch
->int_bit
== 0))
382 internal_error ("gdbarch: verify_gdbarch: int_bit invalid");
383 if ((GDB_MULTI_ARCH
>= 1)
384 && (gdbarch
->long_bit
== 0))
385 internal_error ("gdbarch: verify_gdbarch: long_bit invalid");
386 if ((GDB_MULTI_ARCH
>= 1)
387 && (gdbarch
->long_long_bit
== 0))
388 internal_error ("gdbarch: verify_gdbarch: long_long_bit invalid");
389 if ((GDB_MULTI_ARCH
>= 1)
390 && (gdbarch
->float_bit
== 0))
391 internal_error ("gdbarch: verify_gdbarch: float_bit invalid");
392 if ((GDB_MULTI_ARCH
>= 1)
393 && (gdbarch
->double_bit
== 0))
394 internal_error ("gdbarch: verify_gdbarch: double_bit invalid");
395 if ((GDB_MULTI_ARCH
>= 1)
396 && (gdbarch
->long_double_bit
== 0))
397 internal_error ("gdbarch: verify_gdbarch: long_double_bit invalid");
398 if ((GDB_MULTI_ARCH
>= 1)
399 && (gdbarch
->read_pc
== 0))
400 internal_error ("gdbarch: verify_gdbarch: read_pc invalid");
401 if ((GDB_MULTI_ARCH
>= 1)
402 && (gdbarch
->write_pc
== 0))
403 internal_error ("gdbarch: verify_gdbarch: write_pc invalid");
404 if ((GDB_MULTI_ARCH
>= 1)
405 && (gdbarch
->read_fp
== 0))
406 internal_error ("gdbarch: verify_gdbarch: read_fp invalid");
407 if ((GDB_MULTI_ARCH
>= 1)
408 && (gdbarch
->write_fp
== 0))
409 internal_error ("gdbarch: verify_gdbarch: write_fp invalid");
410 if ((GDB_MULTI_ARCH
>= 1)
411 && (gdbarch
->read_sp
== 0))
412 internal_error ("gdbarch: verify_gdbarch: read_sp invalid");
413 if ((GDB_MULTI_ARCH
>= 1)
414 && (gdbarch
->write_sp
== 0))
415 internal_error ("gdbarch: verify_gdbarch: write_sp invalid");
416 if ((GDB_MULTI_ARCH
>= 2)
417 && (gdbarch
->num_regs
== -1))
418 internal_error ("gdbarch: verify_gdbarch: num_regs invalid");
419 if ((GDB_MULTI_ARCH
>= 2)
420 && (gdbarch
->sp_regnum
== -1))
421 internal_error ("gdbarch: verify_gdbarch: sp_regnum invalid");
422 if ((GDB_MULTI_ARCH
>= 2)
423 && (gdbarch
->fp_regnum
== -1))
424 internal_error ("gdbarch: verify_gdbarch: fp_regnum invalid");
425 if ((GDB_MULTI_ARCH
>= 2)
426 && (gdbarch
->pc_regnum
== -1))
427 internal_error ("gdbarch: verify_gdbarch: pc_regnum invalid");
428 if ((GDB_MULTI_ARCH
>= 2)
429 && (gdbarch
->register_name
== 0))
430 internal_error ("gdbarch: verify_gdbarch: register_name invalid");
431 if ((GDB_MULTI_ARCH
>= 2)
432 && (gdbarch
->register_size
== -1))
433 internal_error ("gdbarch: verify_gdbarch: register_size invalid");
434 if ((GDB_MULTI_ARCH
>= 2)
435 && (gdbarch
->register_bytes
== -1))
436 internal_error ("gdbarch: verify_gdbarch: register_bytes invalid");
437 if ((GDB_MULTI_ARCH
>= 2)
438 && (gdbarch
->register_byte
== 0))
439 internal_error ("gdbarch: verify_gdbarch: register_byte invalid");
440 if ((GDB_MULTI_ARCH
>= 2)
441 && (gdbarch
->register_raw_size
== 0))
442 internal_error ("gdbarch: verify_gdbarch: register_raw_size invalid");
443 if ((GDB_MULTI_ARCH
>= 2)
444 && (gdbarch
->max_register_raw_size
== -1))
445 internal_error ("gdbarch: verify_gdbarch: max_register_raw_size invalid");
446 if ((GDB_MULTI_ARCH
>= 2)
447 && (gdbarch
->register_virtual_size
== 0))
448 internal_error ("gdbarch: verify_gdbarch: register_virtual_size invalid");
449 if ((GDB_MULTI_ARCH
>= 2)
450 && (gdbarch
->max_register_virtual_size
== -1))
451 internal_error ("gdbarch: verify_gdbarch: max_register_virtual_size invalid");
452 if ((GDB_MULTI_ARCH
>= 2)
453 && (gdbarch
->register_virtual_type
== 0))
454 internal_error ("gdbarch: verify_gdbarch: register_virtual_type invalid");
455 if ((GDB_MULTI_ARCH
>= 1)
456 && (gdbarch
->use_generic_dummy_frames
== -1))
457 internal_error ("gdbarch: verify_gdbarch: use_generic_dummy_frames invalid");
458 if ((GDB_MULTI_ARCH
>= 2)
459 && (gdbarch
->call_dummy_location
== 0))
460 internal_error ("gdbarch: verify_gdbarch: call_dummy_location invalid");
461 if ((GDB_MULTI_ARCH
>= 2)
462 && (gdbarch
->call_dummy_location
== AT_ENTRY_POINT
&& gdbarch
->call_dummy_address
== 0))
463 internal_error ("gdbarch: verify_gdbarch: call_dummy_address invalid");
464 if ((GDB_MULTI_ARCH
>= 2)
465 && (gdbarch
->call_dummy_start_offset
== -1))
466 internal_error ("gdbarch: verify_gdbarch: call_dummy_start_offset invalid");
467 if ((GDB_MULTI_ARCH
>= 2)
468 && (gdbarch
->call_dummy_breakpoint_offset
== -1))
469 internal_error ("gdbarch: verify_gdbarch: call_dummy_breakpoint_offset invalid");
470 if ((GDB_MULTI_ARCH
>= 1)
471 && (gdbarch
->call_dummy_breakpoint_offset_p
== -1))
472 internal_error ("gdbarch: verify_gdbarch: call_dummy_breakpoint_offset_p invalid");
473 if ((GDB_MULTI_ARCH
>= 2)
474 && (gdbarch
->call_dummy_length
== -1))
475 internal_error ("gdbarch: verify_gdbarch: call_dummy_length invalid");
476 if ((GDB_MULTI_ARCH
>= 2)
477 && (gdbarch
->pc_in_call_dummy
== 0))
478 internal_error ("gdbarch: verify_gdbarch: pc_in_call_dummy invalid");
479 if ((GDB_MULTI_ARCH
>= 1)
480 && (gdbarch
->call_dummy_p
== -1))
481 internal_error ("gdbarch: verify_gdbarch: call_dummy_p invalid");
482 if ((GDB_MULTI_ARCH
>= 1)
483 && (gdbarch
->call_dummy_stack_adjust_p
== -1))
484 internal_error ("gdbarch: verify_gdbarch: call_dummy_stack_adjust_p invalid");
485 if ((GDB_MULTI_ARCH
>= 2)
486 && (gdbarch
->call_dummy_stack_adjust_p
&& gdbarch
->call_dummy_stack_adjust
== 0))
487 internal_error ("gdbarch: verify_gdbarch: call_dummy_stack_adjust invalid");
488 if ((GDB_MULTI_ARCH
>= 2)
489 && (gdbarch
->fix_call_dummy
== 0))
490 internal_error ("gdbarch: verify_gdbarch: fix_call_dummy invalid");
491 if ((GDB_MULTI_ARCH
>= 1)
492 && (gdbarch
->get_saved_register
== 0))
493 internal_error ("gdbarch: verify_gdbarch: get_saved_register invalid");
494 if ((GDB_MULTI_ARCH
>= 1)
495 && (gdbarch
->register_convertible
== 0))
496 internal_error ("gdbarch: verify_gdbarch: register_convertible invalid");
497 if ((GDB_MULTI_ARCH
>= 2)
498 && (gdbarch
->register_convert_to_virtual
== 0))
499 internal_error ("gdbarch: verify_gdbarch: register_convert_to_virtual invalid");
500 if ((GDB_MULTI_ARCH
>= 2)
501 && (gdbarch
->register_convert_to_raw
== 0))
502 internal_error ("gdbarch: verify_gdbarch: register_convert_to_raw invalid");
503 if ((GDB_MULTI_ARCH
>= 2)
504 && (gdbarch
->extract_return_value
== 0))
505 internal_error ("gdbarch: verify_gdbarch: extract_return_value invalid");
506 if ((GDB_MULTI_ARCH
>= 1)
507 && (gdbarch
->push_arguments
== 0))
508 internal_error ("gdbarch: verify_gdbarch: push_arguments invalid");
509 if ((GDB_MULTI_ARCH
>= 2)
510 && (gdbarch
->push_dummy_frame
== 0))
511 internal_error ("gdbarch: verify_gdbarch: push_dummy_frame invalid");
512 if ((GDB_MULTI_ARCH
>= 1)
513 && (gdbarch
->push_return_address
== 0))
514 internal_error ("gdbarch: verify_gdbarch: push_return_address invalid");
515 if ((GDB_MULTI_ARCH
>= 2)
516 && (gdbarch
->pop_frame
== 0))
517 internal_error ("gdbarch: verify_gdbarch: pop_frame invalid");
518 if ((GDB_MULTI_ARCH
>= 2)
519 && (gdbarch
->d10v_make_daddr
== 0))
520 internal_error ("gdbarch: verify_gdbarch: d10v_make_daddr invalid");
521 if ((GDB_MULTI_ARCH
>= 2)
522 && (gdbarch
->d10v_make_iaddr
== 0))
523 internal_error ("gdbarch: verify_gdbarch: d10v_make_iaddr invalid");
524 if ((GDB_MULTI_ARCH
>= 2)
525 && (gdbarch
->d10v_daddr_p
== 0))
526 internal_error ("gdbarch: verify_gdbarch: d10v_daddr_p invalid");
527 if ((GDB_MULTI_ARCH
>= 2)
528 && (gdbarch
->d10v_iaddr_p
== 0))
529 internal_error ("gdbarch: verify_gdbarch: d10v_iaddr_p invalid");
530 if ((GDB_MULTI_ARCH
>= 2)
531 && (gdbarch
->d10v_convert_daddr_to_raw
== 0))
532 internal_error ("gdbarch: verify_gdbarch: d10v_convert_daddr_to_raw invalid");
533 if ((GDB_MULTI_ARCH
>= 2)
534 && (gdbarch
->d10v_convert_iaddr_to_raw
== 0))
535 internal_error ("gdbarch: verify_gdbarch: d10v_convert_iaddr_to_raw invalid");
536 if ((GDB_MULTI_ARCH
>= 2)
537 && (gdbarch
->store_struct_return
== 0))
538 internal_error ("gdbarch: verify_gdbarch: store_struct_return invalid");
539 if ((GDB_MULTI_ARCH
>= 2)
540 && (gdbarch
->store_return_value
== 0))
541 internal_error ("gdbarch: verify_gdbarch: store_return_value invalid");
542 if ((GDB_MULTI_ARCH
>= 2)
543 && (gdbarch
->extract_struct_value_address
== 0))
544 internal_error ("gdbarch: verify_gdbarch: extract_struct_value_address invalid");
545 if ((GDB_MULTI_ARCH
>= 2)
546 && (gdbarch
->use_struct_convention
== 0))
547 internal_error ("gdbarch: verify_gdbarch: use_struct_convention invalid");
548 if ((GDB_MULTI_ARCH
>= 2)
549 && (gdbarch
->frame_init_saved_regs
== 0))
550 internal_error ("gdbarch: verify_gdbarch: frame_init_saved_regs invalid");
551 if ((GDB_MULTI_ARCH
>= 2)
552 && (gdbarch
->init_extra_frame_info
== 0))
553 internal_error ("gdbarch: verify_gdbarch: init_extra_frame_info invalid");
554 if ((GDB_MULTI_ARCH
>= 2)
555 && (gdbarch
->skip_prologue
== 0))
556 internal_error ("gdbarch: verify_gdbarch: skip_prologue invalid");
557 if ((GDB_MULTI_ARCH
>= 2)
558 && (gdbarch
->inner_than
== 0))
559 internal_error ("gdbarch: verify_gdbarch: inner_than invalid");
560 if ((GDB_MULTI_ARCH
>= 2)
561 && (gdbarch
->breakpoint_from_pc
== 0))
562 internal_error ("gdbarch: verify_gdbarch: breakpoint_from_pc invalid");
563 if ((GDB_MULTI_ARCH
>= 2)
565 internal_error ("gdbarch: verify_gdbarch: memory_insert_breakpoint invalid");
566 if ((GDB_MULTI_ARCH
>= 2)
568 internal_error ("gdbarch: verify_gdbarch: memory_remove_breakpoint invalid");
569 if ((GDB_MULTI_ARCH
>= 2)
570 && (gdbarch
->decr_pc_after_break
== -1))
571 internal_error ("gdbarch: verify_gdbarch: decr_pc_after_break invalid");
572 if ((GDB_MULTI_ARCH
>= 2)
573 && (gdbarch
->function_start_offset
== -1))
574 internal_error ("gdbarch: verify_gdbarch: function_start_offset invalid");
575 if ((GDB_MULTI_ARCH
>= 2)
576 && (gdbarch
->remote_translate_xfer_address
== 0))
577 internal_error ("gdbarch: verify_gdbarch: remote_translate_xfer_address invalid");
578 if ((GDB_MULTI_ARCH
>= 2)
579 && (gdbarch
->frame_args_skip
== -1))
580 internal_error ("gdbarch: verify_gdbarch: frame_args_skip invalid");
581 if ((GDB_MULTI_ARCH
>= 2)
582 && (gdbarch
->frameless_function_invocation
== 0))
583 internal_error ("gdbarch: verify_gdbarch: frameless_function_invocation invalid");
584 if ((GDB_MULTI_ARCH
>= 2)
585 && (gdbarch
->frame_chain
== 0))
586 internal_error ("gdbarch: verify_gdbarch: frame_chain invalid");
587 if ((GDB_MULTI_ARCH
>= 1)
588 && (gdbarch
->frame_chain_valid
== 0))
589 internal_error ("gdbarch: verify_gdbarch: frame_chain_valid invalid");
590 if ((GDB_MULTI_ARCH
>= 2)
591 && (gdbarch
->frame_saved_pc
== 0))
592 internal_error ("gdbarch: verify_gdbarch: frame_saved_pc invalid");
593 if ((GDB_MULTI_ARCH
>= 2)
594 && (gdbarch
->frame_args_address
== 0))
595 internal_error ("gdbarch: verify_gdbarch: frame_args_address invalid");
596 if ((GDB_MULTI_ARCH
>= 2)
597 && (gdbarch
->frame_locals_address
== 0))
598 internal_error ("gdbarch: verify_gdbarch: frame_locals_address invalid");
599 if ((GDB_MULTI_ARCH
>= 2)
600 && (gdbarch
->saved_pc_after_call
== 0))
601 internal_error ("gdbarch: verify_gdbarch: saved_pc_after_call invalid");
602 if ((GDB_MULTI_ARCH
>= 2)
603 && (gdbarch
->frame_num_args
== 0))
604 internal_error ("gdbarch: verify_gdbarch: frame_num_args invalid");
608 /* Print out the details of the current architecture. */
613 if (TARGET_ARCHITECTURE
!= NULL
)
614 fprintf_unfiltered (gdb_stdlog
,
615 "gdbarch_update: TARGET_ARCHITECTURE = %s\n",
616 TARGET_ARCHITECTURE
->printable_name
);
617 fprintf_unfiltered (gdb_stdlog
,
618 "gdbarch_update: TARGET_BYTE_ORDER = %ld\n",
619 (long) TARGET_BYTE_ORDER
);
620 fprintf_unfiltered (gdb_stdlog
,
621 "gdbarch_update: TARGET_BFD_VMA_BIT = %ld\n",
622 (long) TARGET_BFD_VMA_BIT
);
623 fprintf_unfiltered (gdb_stdlog
,
624 "gdbarch_update: TARGET_PTR_BIT = %ld\n",
625 (long) TARGET_PTR_BIT
);
626 fprintf_unfiltered (gdb_stdlog
,
627 "gdbarch_update: TARGET_SHORT_BIT = %ld\n",
628 (long) TARGET_SHORT_BIT
);
629 fprintf_unfiltered (gdb_stdlog
,
630 "gdbarch_update: TARGET_INT_BIT = %ld\n",
631 (long) TARGET_INT_BIT
);
632 fprintf_unfiltered (gdb_stdlog
,
633 "gdbarch_update: TARGET_LONG_BIT = %ld\n",
634 (long) TARGET_LONG_BIT
);
635 fprintf_unfiltered (gdb_stdlog
,
636 "gdbarch_update: TARGET_LONG_LONG_BIT = %ld\n",
637 (long) TARGET_LONG_LONG_BIT
);
638 fprintf_unfiltered (gdb_stdlog
,
639 "gdbarch_update: TARGET_FLOAT_BIT = %ld\n",
640 (long) TARGET_FLOAT_BIT
);
641 fprintf_unfiltered (gdb_stdlog
,
642 "gdbarch_update: TARGET_DOUBLE_BIT = %ld\n",
643 (long) TARGET_DOUBLE_BIT
);
644 fprintf_unfiltered (gdb_stdlog
,
645 "gdbarch_update: TARGET_LONG_DOUBLE_BIT = %ld\n",
646 (long) TARGET_LONG_DOUBLE_BIT
);
647 fprintf_unfiltered (gdb_stdlog
,
648 "gdbarch_update: TARGET_READ_PC = 0x%08lx\n",
649 (long) current_gdbarch
->read_pc
650 /*TARGET_READ_PC ()*/);
651 fprintf_unfiltered (gdb_stdlog
,
652 "gdbarch_update: TARGET_WRITE_PC = 0x%08lx\n",
653 (long) current_gdbarch
->write_pc
654 /*TARGET_WRITE_PC ()*/);
655 fprintf_unfiltered (gdb_stdlog
,
656 "gdbarch_update: TARGET_READ_FP = 0x%08lx\n",
657 (long) current_gdbarch
->read_fp
658 /*TARGET_READ_FP ()*/);
659 fprintf_unfiltered (gdb_stdlog
,
660 "gdbarch_update: TARGET_WRITE_FP = 0x%08lx\n",
661 (long) current_gdbarch
->write_fp
662 /*TARGET_WRITE_FP ()*/);
663 fprintf_unfiltered (gdb_stdlog
,
664 "gdbarch_update: TARGET_READ_SP = 0x%08lx\n",
665 (long) current_gdbarch
->read_sp
666 /*TARGET_READ_SP ()*/);
667 fprintf_unfiltered (gdb_stdlog
,
668 "gdbarch_update: TARGET_WRITE_SP = 0x%08lx\n",
669 (long) current_gdbarch
->write_sp
670 /*TARGET_WRITE_SP ()*/);
671 fprintf_unfiltered (gdb_stdlog
,
672 "gdbarch_update: NUM_REGS = %ld\n",
674 fprintf_unfiltered (gdb_stdlog
,
675 "gdbarch_update: SP_REGNUM = %ld\n",
677 fprintf_unfiltered (gdb_stdlog
,
678 "gdbarch_update: FP_REGNUM = %ld\n",
680 fprintf_unfiltered (gdb_stdlog
,
681 "gdbarch_update: PC_REGNUM = %ld\n",
683 fprintf_unfiltered (gdb_stdlog
,
684 "gdbarch_update: REGISTER_NAME = 0x%08lx\n",
685 (long) current_gdbarch
->register_name
686 /*REGISTER_NAME ()*/);
687 fprintf_unfiltered (gdb_stdlog
,
688 "gdbarch_update: REGISTER_SIZE = %ld\n",
689 (long) REGISTER_SIZE
);
690 fprintf_unfiltered (gdb_stdlog
,
691 "gdbarch_update: REGISTER_BYTES = %ld\n",
692 (long) REGISTER_BYTES
);
693 fprintf_unfiltered (gdb_stdlog
,
694 "gdbarch_update: REGISTER_BYTE = 0x%08lx\n",
695 (long) current_gdbarch
->register_byte
696 /*REGISTER_BYTE ()*/);
697 fprintf_unfiltered (gdb_stdlog
,
698 "gdbarch_update: REGISTER_RAW_SIZE = 0x%08lx\n",
699 (long) current_gdbarch
->register_raw_size
700 /*REGISTER_RAW_SIZE ()*/);
701 fprintf_unfiltered (gdb_stdlog
,
702 "gdbarch_update: MAX_REGISTER_RAW_SIZE = %ld\n",
703 (long) MAX_REGISTER_RAW_SIZE
);
704 fprintf_unfiltered (gdb_stdlog
,
705 "gdbarch_update: REGISTER_VIRTUAL_SIZE = 0x%08lx\n",
706 (long) current_gdbarch
->register_virtual_size
707 /*REGISTER_VIRTUAL_SIZE ()*/);
708 fprintf_unfiltered (gdb_stdlog
,
709 "gdbarch_update: MAX_REGISTER_VIRTUAL_SIZE = %ld\n",
710 (long) MAX_REGISTER_VIRTUAL_SIZE
);
711 fprintf_unfiltered (gdb_stdlog
,
712 "gdbarch_update: REGISTER_VIRTUAL_TYPE = 0x%08lx\n",
713 (long) current_gdbarch
->register_virtual_type
714 /*REGISTER_VIRTUAL_TYPE ()*/);
715 fprintf_unfiltered (gdb_stdlog
,
716 "gdbarch_update: USE_GENERIC_DUMMY_FRAMES = %ld\n",
717 (long) USE_GENERIC_DUMMY_FRAMES
);
718 fprintf_unfiltered (gdb_stdlog
,
719 "gdbarch_update: CALL_DUMMY_LOCATION = %ld\n",
720 (long) CALL_DUMMY_LOCATION
);
721 fprintf_unfiltered (gdb_stdlog
,
722 "gdbarch_update: CALL_DUMMY_ADDRESS = 0x%08lx\n",
723 (long) current_gdbarch
->call_dummy_address
724 /*CALL_DUMMY_ADDRESS ()*/);
725 fprintf_unfiltered (gdb_stdlog
,
726 "gdbarch_update: CALL_DUMMY_START_OFFSET = 0x%08lx\n",
727 (long) CALL_DUMMY_START_OFFSET
);
728 fprintf_unfiltered (gdb_stdlog
,
729 "gdbarch_update: CALL_DUMMY_BREAKPOINT_OFFSET = 0x%08lx\n",
730 (long) CALL_DUMMY_BREAKPOINT_OFFSET
);
731 fprintf_unfiltered (gdb_stdlog
,
732 "gdbarch_update: CALL_DUMMY_BREAKPOINT_OFFSET_P = %ld\n",
733 (long) CALL_DUMMY_BREAKPOINT_OFFSET_P
);
734 if (CALL_DUMMY_LOCATION
== BEFORE_TEXT_END
|| CALL_DUMMY_LOCATION
== AFTER_TEXT_END
)
735 fprintf_unfiltered (gdb_stdlog
,
736 "gdbarch_update: CALL_DUMMY_LENGTH = %ld\n",
737 (long) CALL_DUMMY_LENGTH
);
738 fprintf_unfiltered (gdb_stdlog
,
739 "gdbarch_update: PC_IN_CALL_DUMMY = 0x%08lx\n",
740 (long) current_gdbarch
->pc_in_call_dummy
741 /*PC_IN_CALL_DUMMY ()*/);
742 fprintf_unfiltered (gdb_stdlog
,
743 "gdbarch_update: CALL_DUMMY_P = %ld\n",
744 (long) CALL_DUMMY_P
);
745 fprintf_unfiltered (gdb_stdlog
,
746 "gdbarch_update: CALL_DUMMY_WORDS = 0x%08lx\n",
747 (long) CALL_DUMMY_WORDS
);
748 fprintf_unfiltered (gdb_stdlog
,
749 "gdbarch_update: SIZEOF_CALL_DUMMY_WORDS = 0x%08lx\n",
750 (long) SIZEOF_CALL_DUMMY_WORDS
);
751 fprintf_unfiltered (gdb_stdlog
,
752 "gdbarch_update: CALL_DUMMY_STACK_ADJUST_P = 0x%08lx\n",
753 (long) CALL_DUMMY_STACK_ADJUST_P
);
754 if (CALL_DUMMY_STACK_ADJUST_P
)
755 fprintf_unfiltered (gdb_stdlog
,
756 "gdbarch_update: CALL_DUMMY_STACK_ADJUST = 0x%08lx\n",
757 (long) CALL_DUMMY_STACK_ADJUST
);
758 fprintf_unfiltered (gdb_stdlog
,
759 "gdbarch_update: FIX_CALL_DUMMY = 0x%08lx\n",
760 (long) current_gdbarch
->fix_call_dummy
761 /*FIX_CALL_DUMMY ()*/);
762 #ifdef BELIEVE_PCC_PROMOTION
763 fprintf_unfiltered (gdb_stdlog
,
764 "gdbarch_update: BELIEVE_PCC_PROMOTION = %ld\n",
765 (long) BELIEVE_PCC_PROMOTION
);
767 #ifdef BELIEVE_PCC_PROMOTION_TYPE
768 fprintf_unfiltered (gdb_stdlog
,
769 "gdbarch_update: BELIEVE_PCC_PROMOTION_TYPE = %ld\n",
770 (long) BELIEVE_PCC_PROMOTION_TYPE
);
772 fprintf_unfiltered (gdb_stdlog
,
773 "gdbarch_update: GET_SAVED_REGISTER = 0x%08lx\n",
774 (long) current_gdbarch
->get_saved_register
775 /*GET_SAVED_REGISTER ()*/);
776 fprintf_unfiltered (gdb_stdlog
,
777 "gdbarch_update: REGISTER_CONVERTIBLE = 0x%08lx\n",
778 (long) current_gdbarch
->register_convertible
779 /*REGISTER_CONVERTIBLE ()*/);
780 fprintf_unfiltered (gdb_stdlog
,
781 "gdbarch_update: REGISTER_CONVERT_TO_VIRTUAL = 0x%08lx\n",
782 (long) current_gdbarch
->register_convert_to_virtual
783 /*REGISTER_CONVERT_TO_VIRTUAL ()*/);
784 fprintf_unfiltered (gdb_stdlog
,
785 "gdbarch_update: REGISTER_CONVERT_TO_RAW = 0x%08lx\n",
786 (long) current_gdbarch
->register_convert_to_raw
787 /*REGISTER_CONVERT_TO_RAW ()*/);
788 fprintf_unfiltered (gdb_stdlog
,
789 "gdbarch_update: EXTRACT_RETURN_VALUE = 0x%08lx\n",
790 (long) current_gdbarch
->extract_return_value
791 /*EXTRACT_RETURN_VALUE ()*/);
792 fprintf_unfiltered (gdb_stdlog
,
793 "gdbarch_update: PUSH_ARGUMENTS = 0x%08lx\n",
794 (long) current_gdbarch
->push_arguments
795 /*PUSH_ARGUMENTS ()*/);
796 fprintf_unfiltered (gdb_stdlog
,
797 "gdbarch_update: PUSH_DUMMY_FRAME = 0x%08lx\n",
798 (long) current_gdbarch
->push_dummy_frame
799 /*PUSH_DUMMY_FRAME ()*/);
800 fprintf_unfiltered (gdb_stdlog
,
801 "gdbarch_update: PUSH_RETURN_ADDRESS = 0x%08lx\n",
802 (long) current_gdbarch
->push_return_address
803 /*PUSH_RETURN_ADDRESS ()*/);
804 fprintf_unfiltered (gdb_stdlog
,
805 "gdbarch_update: POP_FRAME = 0x%08lx\n",
806 (long) current_gdbarch
->pop_frame
808 fprintf_unfiltered (gdb_stdlog
,
809 "gdbarch_update: D10V_MAKE_DADDR = 0x%08lx\n",
810 (long) current_gdbarch
->d10v_make_daddr
811 /*D10V_MAKE_DADDR ()*/);
812 fprintf_unfiltered (gdb_stdlog
,
813 "gdbarch_update: D10V_MAKE_IADDR = 0x%08lx\n",
814 (long) current_gdbarch
->d10v_make_iaddr
815 /*D10V_MAKE_IADDR ()*/);
816 fprintf_unfiltered (gdb_stdlog
,
817 "gdbarch_update: D10V_DADDR_P = 0x%08lx\n",
818 (long) current_gdbarch
->d10v_daddr_p
819 /*D10V_DADDR_P ()*/);
820 fprintf_unfiltered (gdb_stdlog
,
821 "gdbarch_update: D10V_IADDR_P = 0x%08lx\n",
822 (long) current_gdbarch
->d10v_iaddr_p
823 /*D10V_IADDR_P ()*/);
824 fprintf_unfiltered (gdb_stdlog
,
825 "gdbarch_update: D10V_CONVERT_DADDR_TO_RAW = 0x%08lx\n",
826 (long) current_gdbarch
->d10v_convert_daddr_to_raw
827 /*D10V_CONVERT_DADDR_TO_RAW ()*/);
828 fprintf_unfiltered (gdb_stdlog
,
829 "gdbarch_update: D10V_CONVERT_IADDR_TO_RAW = 0x%08lx\n",
830 (long) current_gdbarch
->d10v_convert_iaddr_to_raw
831 /*D10V_CONVERT_IADDR_TO_RAW ()*/);
832 fprintf_unfiltered (gdb_stdlog
,
833 "gdbarch_update: STORE_STRUCT_RETURN = 0x%08lx\n",
834 (long) current_gdbarch
->store_struct_return
835 /*STORE_STRUCT_RETURN ()*/);
836 fprintf_unfiltered (gdb_stdlog
,
837 "gdbarch_update: STORE_RETURN_VALUE = 0x%08lx\n",
838 (long) current_gdbarch
->store_return_value
839 /*STORE_RETURN_VALUE ()*/);
840 fprintf_unfiltered (gdb_stdlog
,
841 "gdbarch_update: EXTRACT_STRUCT_VALUE_ADDRESS = 0x%08lx\n",
842 (long) current_gdbarch
->extract_struct_value_address
843 /*EXTRACT_STRUCT_VALUE_ADDRESS ()*/);
844 fprintf_unfiltered (gdb_stdlog
,
845 "gdbarch_update: USE_STRUCT_CONVENTION = 0x%08lx\n",
846 (long) current_gdbarch
->use_struct_convention
847 /*USE_STRUCT_CONVENTION ()*/);
848 fprintf_unfiltered (gdb_stdlog
,
849 "gdbarch_update: FRAME_INIT_SAVED_REGS = 0x%08lx\n",
850 (long) current_gdbarch
->frame_init_saved_regs
851 /*FRAME_INIT_SAVED_REGS ()*/);
852 fprintf_unfiltered (gdb_stdlog
,
853 "gdbarch_update: INIT_EXTRA_FRAME_INFO = 0x%08lx\n",
854 (long) current_gdbarch
->init_extra_frame_info
855 /*INIT_EXTRA_FRAME_INFO ()*/);
856 fprintf_unfiltered (gdb_stdlog
,
857 "gdbarch_update: SKIP_PROLOGUE = 0x%08lx\n",
858 (long) current_gdbarch
->skip_prologue
859 /*SKIP_PROLOGUE ()*/);
860 fprintf_unfiltered (gdb_stdlog
,
861 "gdbarch_update: INNER_THAN = 0x%08lx\n",
862 (long) current_gdbarch
->inner_than
864 fprintf_unfiltered (gdb_stdlog
,
865 "gdbarch_update: BREAKPOINT_FROM_PC = 0x%08lx\n",
866 (long) current_gdbarch
->breakpoint_from_pc
867 /*BREAKPOINT_FROM_PC ()*/);
868 fprintf_unfiltered (gdb_stdlog
,
869 "gdbarch_update: MEMORY_INSERT_BREAKPOINT = 0x%08lx\n",
870 (long) current_gdbarch
->memory_insert_breakpoint
871 /*MEMORY_INSERT_BREAKPOINT ()*/);
872 fprintf_unfiltered (gdb_stdlog
,
873 "gdbarch_update: MEMORY_REMOVE_BREAKPOINT = 0x%08lx\n",
874 (long) current_gdbarch
->memory_remove_breakpoint
875 /*MEMORY_REMOVE_BREAKPOINT ()*/);
876 fprintf_unfiltered (gdb_stdlog
,
877 "gdbarch_update: DECR_PC_AFTER_BREAK = %ld\n",
878 (long) DECR_PC_AFTER_BREAK
);
879 fprintf_unfiltered (gdb_stdlog
,
880 "gdbarch_update: FUNCTION_START_OFFSET = %ld\n",
881 (long) FUNCTION_START_OFFSET
);
882 fprintf_unfiltered (gdb_stdlog
,
883 "gdbarch_update: REMOTE_TRANSLATE_XFER_ADDRESS = 0x%08lx\n",
884 (long) current_gdbarch
->remote_translate_xfer_address
885 /*REMOTE_TRANSLATE_XFER_ADDRESS ()*/);
886 fprintf_unfiltered (gdb_stdlog
,
887 "gdbarch_update: FRAME_ARGS_SKIP = %ld\n",
888 (long) FRAME_ARGS_SKIP
);
889 fprintf_unfiltered (gdb_stdlog
,
890 "gdbarch_update: FRAMELESS_FUNCTION_INVOCATION = 0x%08lx\n",
891 (long) current_gdbarch
->frameless_function_invocation
892 /*FRAMELESS_FUNCTION_INVOCATION ()*/);
893 fprintf_unfiltered (gdb_stdlog
,
894 "gdbarch_update: FRAME_CHAIN = 0x%08lx\n",
895 (long) current_gdbarch
->frame_chain
897 fprintf_unfiltered (gdb_stdlog
,
898 "gdbarch_update: FRAME_CHAIN_VALID = 0x%08lx\n",
899 (long) current_gdbarch
->frame_chain_valid
900 /*FRAME_CHAIN_VALID ()*/);
901 fprintf_unfiltered (gdb_stdlog
,
902 "gdbarch_update: FRAME_SAVED_PC = 0x%08lx\n",
903 (long) current_gdbarch
->frame_saved_pc
904 /*FRAME_SAVED_PC ()*/);
905 fprintf_unfiltered (gdb_stdlog
,
906 "gdbarch_update: FRAME_ARGS_ADDRESS = 0x%08lx\n",
907 (long) current_gdbarch
->frame_args_address
908 /*FRAME_ARGS_ADDRESS ()*/);
909 fprintf_unfiltered (gdb_stdlog
,
910 "gdbarch_update: FRAME_LOCALS_ADDRESS = 0x%08lx\n",
911 (long) current_gdbarch
->frame_locals_address
912 /*FRAME_LOCALS_ADDRESS ()*/);
913 fprintf_unfiltered (gdb_stdlog
,
914 "gdbarch_update: SAVED_PC_AFTER_CALL = 0x%08lx\n",
915 (long) current_gdbarch
->saved_pc_after_call
916 /*SAVED_PC_AFTER_CALL ()*/);
917 fprintf_unfiltered (gdb_stdlog
,
918 "gdbarch_update: FRAME_NUM_ARGS = 0x%08lx\n",
919 (long) current_gdbarch
->frame_num_args
920 /*FRAME_NUM_ARGS ()*/);
923 struct gdbarch_tdep
*
924 gdbarch_tdep (struct gdbarch
*gdbarch
)
926 if (gdbarch_debug
>= 2)
927 /* FIXME: gdb_std??? */
928 fprintf_unfiltered (gdb_stdlog
, "gdbarch_tdep called\n");
929 return gdbarch
->tdep
;
933 const struct bfd_arch_info
*
934 gdbarch_bfd_arch_info (struct gdbarch
*gdbarch
)
936 if (gdbarch_debug
>= 2)
937 /* FIXME: gdb_std??? */
938 fprintf_unfiltered (gdb_stdlog
, "gdbarch_bfd_arch_info called\n");
939 return gdbarch
->bfd_arch_info
;
943 gdbarch_byte_order (struct gdbarch
*gdbarch
)
945 if (gdbarch_debug
>= 2)
946 /* FIXME: gdb_std??? */
947 fprintf_unfiltered (gdb_stdlog
, "gdbarch_byte_order called\n");
948 return gdbarch
->byte_order
;
952 gdbarch_bfd_vma_bit (struct gdbarch
*gdbarch
)
955 internal_error ("gdbarch: gdbarch_bfd_vma_bit invalid");
956 if (gdbarch_debug
>= 2)
957 /* FIXME: gdb_std??? */
958 fprintf_unfiltered (gdb_stdlog
, "gdbarch_bfd_vma_bit called\n");
959 return gdbarch
->bfd_vma_bit
;
963 set_gdbarch_bfd_vma_bit (struct gdbarch
*gdbarch
,
966 gdbarch
->bfd_vma_bit
= bfd_vma_bit
;
970 gdbarch_ptr_bit (struct gdbarch
*gdbarch
)
972 if (gdbarch
->ptr_bit
== 0)
973 internal_error ("gdbarch: gdbarch_ptr_bit invalid");
974 if (gdbarch_debug
>= 2)
975 /* FIXME: gdb_std??? */
976 fprintf_unfiltered (gdb_stdlog
, "gdbarch_ptr_bit called\n");
977 return gdbarch
->ptr_bit
;
981 set_gdbarch_ptr_bit (struct gdbarch
*gdbarch
,
984 gdbarch
->ptr_bit
= ptr_bit
;
988 gdbarch_short_bit (struct gdbarch
*gdbarch
)
990 if (gdbarch
->short_bit
== 0)
991 internal_error ("gdbarch: gdbarch_short_bit invalid");
992 if (gdbarch_debug
>= 2)
993 /* FIXME: gdb_std??? */
994 fprintf_unfiltered (gdb_stdlog
, "gdbarch_short_bit called\n");
995 return gdbarch
->short_bit
;
999 set_gdbarch_short_bit (struct gdbarch
*gdbarch
,
1002 gdbarch
->short_bit
= short_bit
;
1006 gdbarch_int_bit (struct gdbarch
*gdbarch
)
1008 if (gdbarch
->int_bit
== 0)
1009 internal_error ("gdbarch: gdbarch_int_bit invalid");
1010 if (gdbarch_debug
>= 2)
1011 /* FIXME: gdb_std??? */
1012 fprintf_unfiltered (gdb_stdlog
, "gdbarch_int_bit called\n");
1013 return gdbarch
->int_bit
;
1017 set_gdbarch_int_bit (struct gdbarch
*gdbarch
,
1020 gdbarch
->int_bit
= int_bit
;
1024 gdbarch_long_bit (struct gdbarch
*gdbarch
)
1026 if (gdbarch
->long_bit
== 0)
1027 internal_error ("gdbarch: gdbarch_long_bit invalid");
1028 if (gdbarch_debug
>= 2)
1029 /* FIXME: gdb_std??? */
1030 fprintf_unfiltered (gdb_stdlog
, "gdbarch_long_bit called\n");
1031 return gdbarch
->long_bit
;
1035 set_gdbarch_long_bit (struct gdbarch
*gdbarch
,
1038 gdbarch
->long_bit
= long_bit
;
1042 gdbarch_long_long_bit (struct gdbarch
*gdbarch
)
1044 if (gdbarch
->long_long_bit
== 0)
1045 internal_error ("gdbarch: gdbarch_long_long_bit invalid");
1046 if (gdbarch_debug
>= 2)
1047 /* FIXME: gdb_std??? */
1048 fprintf_unfiltered (gdb_stdlog
, "gdbarch_long_long_bit called\n");
1049 return gdbarch
->long_long_bit
;
1053 set_gdbarch_long_long_bit (struct gdbarch
*gdbarch
,
1056 gdbarch
->long_long_bit
= long_long_bit
;
1060 gdbarch_float_bit (struct gdbarch
*gdbarch
)
1062 if (gdbarch
->float_bit
== 0)
1063 internal_error ("gdbarch: gdbarch_float_bit invalid");
1064 if (gdbarch_debug
>= 2)
1065 /* FIXME: gdb_std??? */
1066 fprintf_unfiltered (gdb_stdlog
, "gdbarch_float_bit called\n");
1067 return gdbarch
->float_bit
;
1071 set_gdbarch_float_bit (struct gdbarch
*gdbarch
,
1074 gdbarch
->float_bit
= float_bit
;
1078 gdbarch_double_bit (struct gdbarch
*gdbarch
)
1080 if (gdbarch
->double_bit
== 0)
1081 internal_error ("gdbarch: gdbarch_double_bit invalid");
1082 if (gdbarch_debug
>= 2)
1083 /* FIXME: gdb_std??? */
1084 fprintf_unfiltered (gdb_stdlog
, "gdbarch_double_bit called\n");
1085 return gdbarch
->double_bit
;
1089 set_gdbarch_double_bit (struct gdbarch
*gdbarch
,
1092 gdbarch
->double_bit
= double_bit
;
1096 gdbarch_long_double_bit (struct gdbarch
*gdbarch
)
1098 if (gdbarch
->long_double_bit
== 0)
1099 internal_error ("gdbarch: gdbarch_long_double_bit invalid");
1100 if (gdbarch_debug
>= 2)
1101 /* FIXME: gdb_std??? */
1102 fprintf_unfiltered (gdb_stdlog
, "gdbarch_long_double_bit called\n");
1103 return gdbarch
->long_double_bit
;
1107 set_gdbarch_long_double_bit (struct gdbarch
*gdbarch
,
1108 int long_double_bit
)
1110 gdbarch
->long_double_bit
= long_double_bit
;
1114 gdbarch_read_pc (struct gdbarch
*gdbarch
, int pid
)
1116 if (gdbarch
->read_pc
== 0)
1117 internal_error ("gdbarch: gdbarch_read_pc invalid");
1118 if (gdbarch_debug
>= 2)
1119 /* FIXME: gdb_std??? */
1120 fprintf_unfiltered (gdb_stdlog
, "gdbarch_read_pc called\n");
1121 return gdbarch
->read_pc (pid
);
1125 set_gdbarch_read_pc (struct gdbarch
*gdbarch
,
1126 gdbarch_read_pc_ftype read_pc
)
1128 gdbarch
->read_pc
= read_pc
;
1132 gdbarch_write_pc (struct gdbarch
*gdbarch
, CORE_ADDR val
, int pid
)
1134 if (gdbarch
->write_pc
== 0)
1135 internal_error ("gdbarch: gdbarch_write_pc invalid");
1136 if (gdbarch_debug
>= 2)
1137 /* FIXME: gdb_std??? */
1138 fprintf_unfiltered (gdb_stdlog
, "gdbarch_write_pc called\n");
1139 gdbarch
->write_pc (val
, pid
);
1143 set_gdbarch_write_pc (struct gdbarch
*gdbarch
,
1144 gdbarch_write_pc_ftype write_pc
)
1146 gdbarch
->write_pc
= write_pc
;
1150 gdbarch_read_fp (struct gdbarch
*gdbarch
)
1152 if (gdbarch
->read_fp
== 0)
1153 internal_error ("gdbarch: gdbarch_read_fp invalid");
1154 if (gdbarch_debug
>= 2)
1155 /* FIXME: gdb_std??? */
1156 fprintf_unfiltered (gdb_stdlog
, "gdbarch_read_fp called\n");
1157 return gdbarch
->read_fp ();
1161 set_gdbarch_read_fp (struct gdbarch
*gdbarch
,
1162 gdbarch_read_fp_ftype read_fp
)
1164 gdbarch
->read_fp
= read_fp
;
1168 gdbarch_write_fp (struct gdbarch
*gdbarch
, CORE_ADDR val
)
1170 if (gdbarch
->write_fp
== 0)
1171 internal_error ("gdbarch: gdbarch_write_fp invalid");
1172 if (gdbarch_debug
>= 2)
1173 /* FIXME: gdb_std??? */
1174 fprintf_unfiltered (gdb_stdlog
, "gdbarch_write_fp called\n");
1175 gdbarch
->write_fp (val
);
1179 set_gdbarch_write_fp (struct gdbarch
*gdbarch
,
1180 gdbarch_write_fp_ftype write_fp
)
1182 gdbarch
->write_fp
= write_fp
;
1186 gdbarch_read_sp (struct gdbarch
*gdbarch
)
1188 if (gdbarch
->read_sp
== 0)
1189 internal_error ("gdbarch: gdbarch_read_sp invalid");
1190 if (gdbarch_debug
>= 2)
1191 /* FIXME: gdb_std??? */
1192 fprintf_unfiltered (gdb_stdlog
, "gdbarch_read_sp called\n");
1193 return gdbarch
->read_sp ();
1197 set_gdbarch_read_sp (struct gdbarch
*gdbarch
,
1198 gdbarch_read_sp_ftype read_sp
)
1200 gdbarch
->read_sp
= read_sp
;
1204 gdbarch_write_sp (struct gdbarch
*gdbarch
, CORE_ADDR val
)
1206 if (gdbarch
->write_sp
== 0)
1207 internal_error ("gdbarch: gdbarch_write_sp invalid");
1208 if (gdbarch_debug
>= 2)
1209 /* FIXME: gdb_std??? */
1210 fprintf_unfiltered (gdb_stdlog
, "gdbarch_write_sp called\n");
1211 gdbarch
->write_sp (val
);
1215 set_gdbarch_write_sp (struct gdbarch
*gdbarch
,
1216 gdbarch_write_sp_ftype write_sp
)
1218 gdbarch
->write_sp
= write_sp
;
1222 gdbarch_num_regs (struct gdbarch
*gdbarch
)
1224 if (gdbarch
->num_regs
== -1)
1225 internal_error ("gdbarch: gdbarch_num_regs invalid");
1226 if (gdbarch_debug
>= 2)
1227 /* FIXME: gdb_std??? */
1228 fprintf_unfiltered (gdb_stdlog
, "gdbarch_num_regs called\n");
1229 return gdbarch
->num_regs
;
1233 set_gdbarch_num_regs (struct gdbarch
*gdbarch
,
1236 gdbarch
->num_regs
= num_regs
;
1240 gdbarch_sp_regnum (struct gdbarch
*gdbarch
)
1242 if (gdbarch
->sp_regnum
== -1)
1243 internal_error ("gdbarch: gdbarch_sp_regnum invalid");
1244 if (gdbarch_debug
>= 2)
1245 /* FIXME: gdb_std??? */
1246 fprintf_unfiltered (gdb_stdlog
, "gdbarch_sp_regnum called\n");
1247 return gdbarch
->sp_regnum
;
1251 set_gdbarch_sp_regnum (struct gdbarch
*gdbarch
,
1254 gdbarch
->sp_regnum
= sp_regnum
;
1258 gdbarch_fp_regnum (struct gdbarch
*gdbarch
)
1260 if (gdbarch
->fp_regnum
== -1)
1261 internal_error ("gdbarch: gdbarch_fp_regnum invalid");
1262 if (gdbarch_debug
>= 2)
1263 /* FIXME: gdb_std??? */
1264 fprintf_unfiltered (gdb_stdlog
, "gdbarch_fp_regnum called\n");
1265 return gdbarch
->fp_regnum
;
1269 set_gdbarch_fp_regnum (struct gdbarch
*gdbarch
,
1272 gdbarch
->fp_regnum
= fp_regnum
;
1276 gdbarch_pc_regnum (struct gdbarch
*gdbarch
)
1278 if (gdbarch
->pc_regnum
== -1)
1279 internal_error ("gdbarch: gdbarch_pc_regnum invalid");
1280 if (gdbarch_debug
>= 2)
1281 /* FIXME: gdb_std??? */
1282 fprintf_unfiltered (gdb_stdlog
, "gdbarch_pc_regnum called\n");
1283 return gdbarch
->pc_regnum
;
1287 set_gdbarch_pc_regnum (struct gdbarch
*gdbarch
,
1290 gdbarch
->pc_regnum
= pc_regnum
;
1294 gdbarch_register_name (struct gdbarch
*gdbarch
, int regnr
)
1296 if (gdbarch
->register_name
== 0)
1297 internal_error ("gdbarch: gdbarch_register_name invalid");
1298 if (gdbarch_debug
>= 2)
1299 /* FIXME: gdb_std??? */
1300 fprintf_unfiltered (gdb_stdlog
, "gdbarch_register_name called\n");
1301 return gdbarch
->register_name (regnr
);
1305 set_gdbarch_register_name (struct gdbarch
*gdbarch
,
1306 gdbarch_register_name_ftype register_name
)
1308 gdbarch
->register_name
= register_name
;
1312 gdbarch_register_size (struct gdbarch
*gdbarch
)
1314 if (gdbarch
->register_size
== -1)
1315 internal_error ("gdbarch: gdbarch_register_size invalid");
1316 if (gdbarch_debug
>= 2)
1317 /* FIXME: gdb_std??? */
1318 fprintf_unfiltered (gdb_stdlog
, "gdbarch_register_size called\n");
1319 return gdbarch
->register_size
;
1323 set_gdbarch_register_size (struct gdbarch
*gdbarch
,
1326 gdbarch
->register_size
= register_size
;
1330 gdbarch_register_bytes (struct gdbarch
*gdbarch
)
1332 if (gdbarch
->register_bytes
== -1)
1333 internal_error ("gdbarch: gdbarch_register_bytes invalid");
1334 if (gdbarch_debug
>= 2)
1335 /* FIXME: gdb_std??? */
1336 fprintf_unfiltered (gdb_stdlog
, "gdbarch_register_bytes called\n");
1337 return gdbarch
->register_bytes
;
1341 set_gdbarch_register_bytes (struct gdbarch
*gdbarch
,
1344 gdbarch
->register_bytes
= register_bytes
;
1348 gdbarch_register_byte (struct gdbarch
*gdbarch
, int reg_nr
)
1350 if (gdbarch
->register_byte
== 0)
1351 internal_error ("gdbarch: gdbarch_register_byte invalid");
1352 if (gdbarch_debug
>= 2)
1353 /* FIXME: gdb_std??? */
1354 fprintf_unfiltered (gdb_stdlog
, "gdbarch_register_byte called\n");
1355 return gdbarch
->register_byte (reg_nr
);
1359 set_gdbarch_register_byte (struct gdbarch
*gdbarch
,
1360 gdbarch_register_byte_ftype register_byte
)
1362 gdbarch
->register_byte
= register_byte
;
1366 gdbarch_register_raw_size (struct gdbarch
*gdbarch
, int reg_nr
)
1368 if (gdbarch
->register_raw_size
== 0)
1369 internal_error ("gdbarch: gdbarch_register_raw_size invalid");
1370 if (gdbarch_debug
>= 2)
1371 /* FIXME: gdb_std??? */
1372 fprintf_unfiltered (gdb_stdlog
, "gdbarch_register_raw_size called\n");
1373 return gdbarch
->register_raw_size (reg_nr
);
1377 set_gdbarch_register_raw_size (struct gdbarch
*gdbarch
,
1378 gdbarch_register_raw_size_ftype register_raw_size
)
1380 gdbarch
->register_raw_size
= register_raw_size
;
1384 gdbarch_max_register_raw_size (struct gdbarch
*gdbarch
)
1386 if (gdbarch
->max_register_raw_size
== -1)
1387 internal_error ("gdbarch: gdbarch_max_register_raw_size invalid");
1388 if (gdbarch_debug
>= 2)
1389 /* FIXME: gdb_std??? */
1390 fprintf_unfiltered (gdb_stdlog
, "gdbarch_max_register_raw_size called\n");
1391 return gdbarch
->max_register_raw_size
;
1395 set_gdbarch_max_register_raw_size (struct gdbarch
*gdbarch
,
1396 int max_register_raw_size
)
1398 gdbarch
->max_register_raw_size
= max_register_raw_size
;
1402 gdbarch_register_virtual_size (struct gdbarch
*gdbarch
, int reg_nr
)
1404 if (gdbarch
->register_virtual_size
== 0)
1405 internal_error ("gdbarch: gdbarch_register_virtual_size invalid");
1406 if (gdbarch_debug
>= 2)
1407 /* FIXME: gdb_std??? */
1408 fprintf_unfiltered (gdb_stdlog
, "gdbarch_register_virtual_size called\n");
1409 return gdbarch
->register_virtual_size (reg_nr
);
1413 set_gdbarch_register_virtual_size (struct gdbarch
*gdbarch
,
1414 gdbarch_register_virtual_size_ftype register_virtual_size
)
1416 gdbarch
->register_virtual_size
= register_virtual_size
;
1420 gdbarch_max_register_virtual_size (struct gdbarch
*gdbarch
)
1422 if (gdbarch
->max_register_virtual_size
== -1)
1423 internal_error ("gdbarch: gdbarch_max_register_virtual_size invalid");
1424 if (gdbarch_debug
>= 2)
1425 /* FIXME: gdb_std??? */
1426 fprintf_unfiltered (gdb_stdlog
, "gdbarch_max_register_virtual_size called\n");
1427 return gdbarch
->max_register_virtual_size
;
1431 set_gdbarch_max_register_virtual_size (struct gdbarch
*gdbarch
,
1432 int max_register_virtual_size
)
1434 gdbarch
->max_register_virtual_size
= max_register_virtual_size
;
1438 gdbarch_register_virtual_type (struct gdbarch
*gdbarch
, int reg_nr
)
1440 if (gdbarch
->register_virtual_type
== 0)
1441 internal_error ("gdbarch: gdbarch_register_virtual_type invalid");
1442 if (gdbarch_debug
>= 2)
1443 /* FIXME: gdb_std??? */
1444 fprintf_unfiltered (gdb_stdlog
, "gdbarch_register_virtual_type called\n");
1445 return gdbarch
->register_virtual_type (reg_nr
);
1449 set_gdbarch_register_virtual_type (struct gdbarch
*gdbarch
,
1450 gdbarch_register_virtual_type_ftype register_virtual_type
)
1452 gdbarch
->register_virtual_type
= register_virtual_type
;
1456 gdbarch_use_generic_dummy_frames (struct gdbarch
*gdbarch
)
1458 if (gdbarch
->use_generic_dummy_frames
== -1)
1459 internal_error ("gdbarch: gdbarch_use_generic_dummy_frames invalid");
1460 if (gdbarch_debug
>= 2)
1461 /* FIXME: gdb_std??? */
1462 fprintf_unfiltered (gdb_stdlog
, "gdbarch_use_generic_dummy_frames called\n");
1463 return gdbarch
->use_generic_dummy_frames
;
1467 set_gdbarch_use_generic_dummy_frames (struct gdbarch
*gdbarch
,
1468 int use_generic_dummy_frames
)
1470 gdbarch
->use_generic_dummy_frames
= use_generic_dummy_frames
;
1474 gdbarch_call_dummy_location (struct gdbarch
*gdbarch
)
1476 if (gdbarch
->call_dummy_location
== 0)
1477 internal_error ("gdbarch: gdbarch_call_dummy_location invalid");
1478 if (gdbarch_debug
>= 2)
1479 /* FIXME: gdb_std??? */
1480 fprintf_unfiltered (gdb_stdlog
, "gdbarch_call_dummy_location called\n");
1481 return gdbarch
->call_dummy_location
;
1485 set_gdbarch_call_dummy_location (struct gdbarch
*gdbarch
,
1486 int call_dummy_location
)
1488 gdbarch
->call_dummy_location
= call_dummy_location
;
1492 gdbarch_call_dummy_address (struct gdbarch
*gdbarch
)
1494 if (gdbarch
->call_dummy_address
== 0)
1495 internal_error ("gdbarch: gdbarch_call_dummy_address invalid");
1496 if (gdbarch_debug
>= 2)
1497 /* FIXME: gdb_std??? */
1498 fprintf_unfiltered (gdb_stdlog
, "gdbarch_call_dummy_address called\n");
1499 return gdbarch
->call_dummy_address ();
1503 set_gdbarch_call_dummy_address (struct gdbarch
*gdbarch
,
1504 gdbarch_call_dummy_address_ftype call_dummy_address
)
1506 gdbarch
->call_dummy_address
= call_dummy_address
;
1510 gdbarch_call_dummy_start_offset (struct gdbarch
*gdbarch
)
1512 if (gdbarch
->call_dummy_start_offset
== -1)
1513 internal_error ("gdbarch: gdbarch_call_dummy_start_offset invalid");
1514 if (gdbarch_debug
>= 2)
1515 /* FIXME: gdb_std??? */
1516 fprintf_unfiltered (gdb_stdlog
, "gdbarch_call_dummy_start_offset called\n");
1517 return gdbarch
->call_dummy_start_offset
;
1521 set_gdbarch_call_dummy_start_offset (struct gdbarch
*gdbarch
,
1522 CORE_ADDR call_dummy_start_offset
)
1524 gdbarch
->call_dummy_start_offset
= call_dummy_start_offset
;
1528 gdbarch_call_dummy_breakpoint_offset (struct gdbarch
*gdbarch
)
1530 if (gdbarch
->call_dummy_breakpoint_offset
== -1)
1531 internal_error ("gdbarch: gdbarch_call_dummy_breakpoint_offset invalid");
1532 if (gdbarch_debug
>= 2)
1533 /* FIXME: gdb_std??? */
1534 fprintf_unfiltered (gdb_stdlog
, "gdbarch_call_dummy_breakpoint_offset called\n");
1535 return gdbarch
->call_dummy_breakpoint_offset
;
1539 set_gdbarch_call_dummy_breakpoint_offset (struct gdbarch
*gdbarch
,
1540 CORE_ADDR call_dummy_breakpoint_offset
)
1542 gdbarch
->call_dummy_breakpoint_offset
= call_dummy_breakpoint_offset
;
1546 gdbarch_call_dummy_breakpoint_offset_p (struct gdbarch
*gdbarch
)
1548 if (gdbarch
->call_dummy_breakpoint_offset_p
== -1)
1549 internal_error ("gdbarch: gdbarch_call_dummy_breakpoint_offset_p invalid");
1550 if (gdbarch_debug
>= 2)
1551 /* FIXME: gdb_std??? */
1552 fprintf_unfiltered (gdb_stdlog
, "gdbarch_call_dummy_breakpoint_offset_p called\n");
1553 return gdbarch
->call_dummy_breakpoint_offset_p
;
1557 set_gdbarch_call_dummy_breakpoint_offset_p (struct gdbarch
*gdbarch
,
1558 int call_dummy_breakpoint_offset_p
)
1560 gdbarch
->call_dummy_breakpoint_offset_p
= call_dummy_breakpoint_offset_p
;
1564 gdbarch_call_dummy_length (struct gdbarch
*gdbarch
)
1566 if (gdbarch
->call_dummy_length
== -1)
1567 internal_error ("gdbarch: gdbarch_call_dummy_length invalid");
1568 if (gdbarch_debug
>= 2)
1569 /* FIXME: gdb_std??? */
1570 fprintf_unfiltered (gdb_stdlog
, "gdbarch_call_dummy_length called\n");
1571 return gdbarch
->call_dummy_length
;
1575 set_gdbarch_call_dummy_length (struct gdbarch
*gdbarch
,
1576 int call_dummy_length
)
1578 gdbarch
->call_dummy_length
= call_dummy_length
;
1582 gdbarch_pc_in_call_dummy (struct gdbarch
*gdbarch
, CORE_ADDR pc
, CORE_ADDR sp
, CORE_ADDR frame_address
)
1584 if (gdbarch
->pc_in_call_dummy
== 0)
1585 internal_error ("gdbarch: gdbarch_pc_in_call_dummy invalid");
1586 if (gdbarch_debug
>= 2)
1587 /* FIXME: gdb_std??? */
1588 fprintf_unfiltered (gdb_stdlog
, "gdbarch_pc_in_call_dummy called\n");
1589 return gdbarch
->pc_in_call_dummy (pc
, sp
, frame_address
);
1593 set_gdbarch_pc_in_call_dummy (struct gdbarch
*gdbarch
,
1594 gdbarch_pc_in_call_dummy_ftype pc_in_call_dummy
)
1596 gdbarch
->pc_in_call_dummy
= pc_in_call_dummy
;
1600 gdbarch_call_dummy_p (struct gdbarch
*gdbarch
)
1602 if (gdbarch
->call_dummy_p
== -1)
1603 internal_error ("gdbarch: gdbarch_call_dummy_p invalid");
1604 if (gdbarch_debug
>= 2)
1605 /* FIXME: gdb_std??? */
1606 fprintf_unfiltered (gdb_stdlog
, "gdbarch_call_dummy_p called\n");
1607 return gdbarch
->call_dummy_p
;
1611 set_gdbarch_call_dummy_p (struct gdbarch
*gdbarch
,
1614 gdbarch
->call_dummy_p
= call_dummy_p
;
1618 gdbarch_call_dummy_words (struct gdbarch
*gdbarch
)
1620 if (gdbarch_debug
>= 2)
1621 /* FIXME: gdb_std??? */
1622 fprintf_unfiltered (gdb_stdlog
, "gdbarch_call_dummy_words called\n");
1623 return gdbarch
->call_dummy_words
;
1627 set_gdbarch_call_dummy_words (struct gdbarch
*gdbarch
,
1628 LONGEST
* call_dummy_words
)
1630 gdbarch
->call_dummy_words
= call_dummy_words
;
1634 gdbarch_sizeof_call_dummy_words (struct gdbarch
*gdbarch
)
1636 if (gdbarch_debug
>= 2)
1637 /* FIXME: gdb_std??? */
1638 fprintf_unfiltered (gdb_stdlog
, "gdbarch_sizeof_call_dummy_words called\n");
1639 return gdbarch
->sizeof_call_dummy_words
;
1643 set_gdbarch_sizeof_call_dummy_words (struct gdbarch
*gdbarch
,
1644 int sizeof_call_dummy_words
)
1646 gdbarch
->sizeof_call_dummy_words
= sizeof_call_dummy_words
;
1650 gdbarch_call_dummy_stack_adjust_p (struct gdbarch
*gdbarch
)
1652 if (gdbarch
->call_dummy_stack_adjust_p
== -1)
1653 internal_error ("gdbarch: gdbarch_call_dummy_stack_adjust_p invalid");
1654 if (gdbarch_debug
>= 2)
1655 /* FIXME: gdb_std??? */
1656 fprintf_unfiltered (gdb_stdlog
, "gdbarch_call_dummy_stack_adjust_p called\n");
1657 return gdbarch
->call_dummy_stack_adjust_p
;
1661 set_gdbarch_call_dummy_stack_adjust_p (struct gdbarch
*gdbarch
,
1662 int call_dummy_stack_adjust_p
)
1664 gdbarch
->call_dummy_stack_adjust_p
= call_dummy_stack_adjust_p
;
1668 gdbarch_call_dummy_stack_adjust (struct gdbarch
*gdbarch
)
1670 if (gdbarch
->call_dummy_stack_adjust_p
&& gdbarch
->call_dummy_stack_adjust
== 0)
1671 internal_error ("gdbarch: gdbarch_call_dummy_stack_adjust invalid");
1672 if (gdbarch_debug
>= 2)
1673 /* FIXME: gdb_std??? */
1674 fprintf_unfiltered (gdb_stdlog
, "gdbarch_call_dummy_stack_adjust called\n");
1675 return gdbarch
->call_dummy_stack_adjust
;
1679 set_gdbarch_call_dummy_stack_adjust (struct gdbarch
*gdbarch
,
1680 int call_dummy_stack_adjust
)
1682 gdbarch
->call_dummy_stack_adjust
= call_dummy_stack_adjust
;
1686 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
)
1688 if (gdbarch
->fix_call_dummy
== 0)
1689 internal_error ("gdbarch: gdbarch_fix_call_dummy invalid");
1690 if (gdbarch_debug
>= 2)
1691 /* FIXME: gdb_std??? */
1692 fprintf_unfiltered (gdb_stdlog
, "gdbarch_fix_call_dummy called\n");
1693 gdbarch
->fix_call_dummy (dummy
, pc
, fun
, nargs
, args
, type
, gcc_p
);
1697 set_gdbarch_fix_call_dummy (struct gdbarch
*gdbarch
,
1698 gdbarch_fix_call_dummy_ftype fix_call_dummy
)
1700 gdbarch
->fix_call_dummy
= fix_call_dummy
;
1704 gdbarch_believe_pcc_promotion (struct gdbarch
*gdbarch
)
1706 if (gdbarch_debug
>= 2)
1707 /* FIXME: gdb_std??? */
1708 fprintf_unfiltered (gdb_stdlog
, "gdbarch_believe_pcc_promotion called\n");
1709 return gdbarch
->believe_pcc_promotion
;
1713 set_gdbarch_believe_pcc_promotion (struct gdbarch
*gdbarch
,
1714 int believe_pcc_promotion
)
1716 gdbarch
->believe_pcc_promotion
= believe_pcc_promotion
;
1720 gdbarch_believe_pcc_promotion_type (struct gdbarch
*gdbarch
)
1722 if (gdbarch_debug
>= 2)
1723 /* FIXME: gdb_std??? */
1724 fprintf_unfiltered (gdb_stdlog
, "gdbarch_believe_pcc_promotion_type called\n");
1725 return gdbarch
->believe_pcc_promotion_type
;
1729 set_gdbarch_believe_pcc_promotion_type (struct gdbarch
*gdbarch
,
1730 int believe_pcc_promotion_type
)
1732 gdbarch
->believe_pcc_promotion_type
= believe_pcc_promotion_type
;
1736 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
)
1738 if (gdbarch
->get_saved_register
== 0)
1739 internal_error ("gdbarch: gdbarch_get_saved_register invalid");
1740 if (gdbarch_debug
>= 2)
1741 /* FIXME: gdb_std??? */
1742 fprintf_unfiltered (gdb_stdlog
, "gdbarch_get_saved_register called\n");
1743 gdbarch
->get_saved_register (raw_buffer
, optimized
, addrp
, frame
, regnum
, lval
);
1747 set_gdbarch_get_saved_register (struct gdbarch
*gdbarch
,
1748 gdbarch_get_saved_register_ftype get_saved_register
)
1750 gdbarch
->get_saved_register
= get_saved_register
;
1754 gdbarch_register_convertible (struct gdbarch
*gdbarch
, int nr
)
1756 if (gdbarch
->register_convertible
== 0)
1757 internal_error ("gdbarch: gdbarch_register_convertible invalid");
1758 if (gdbarch_debug
>= 2)
1759 /* FIXME: gdb_std??? */
1760 fprintf_unfiltered (gdb_stdlog
, "gdbarch_register_convertible called\n");
1761 return gdbarch
->register_convertible (nr
);
1765 set_gdbarch_register_convertible (struct gdbarch
*gdbarch
,
1766 gdbarch_register_convertible_ftype register_convertible
)
1768 gdbarch
->register_convertible
= register_convertible
;
1772 gdbarch_register_convert_to_virtual (struct gdbarch
*gdbarch
, int regnum
, struct type
*type
, char *from
, char *to
)
1774 if (gdbarch
->register_convert_to_virtual
== 0)
1775 internal_error ("gdbarch: gdbarch_register_convert_to_virtual invalid");
1776 if (gdbarch_debug
>= 2)
1777 /* FIXME: gdb_std??? */
1778 fprintf_unfiltered (gdb_stdlog
, "gdbarch_register_convert_to_virtual called\n");
1779 gdbarch
->register_convert_to_virtual (regnum
, type
, from
, to
);
1783 set_gdbarch_register_convert_to_virtual (struct gdbarch
*gdbarch
,
1784 gdbarch_register_convert_to_virtual_ftype register_convert_to_virtual
)
1786 gdbarch
->register_convert_to_virtual
= register_convert_to_virtual
;
1790 gdbarch_register_convert_to_raw (struct gdbarch
*gdbarch
, struct type
*type
, int regnum
, char *from
, char *to
)
1792 if (gdbarch
->register_convert_to_raw
== 0)
1793 internal_error ("gdbarch: gdbarch_register_convert_to_raw invalid");
1794 if (gdbarch_debug
>= 2)
1795 /* FIXME: gdb_std??? */
1796 fprintf_unfiltered (gdb_stdlog
, "gdbarch_register_convert_to_raw called\n");
1797 gdbarch
->register_convert_to_raw (type
, regnum
, from
, to
);
1801 set_gdbarch_register_convert_to_raw (struct gdbarch
*gdbarch
,
1802 gdbarch_register_convert_to_raw_ftype register_convert_to_raw
)
1804 gdbarch
->register_convert_to_raw
= register_convert_to_raw
;
1808 gdbarch_extract_return_value (struct gdbarch
*gdbarch
, struct type
*type
, char *regbuf
, char *valbuf
)
1810 if (gdbarch
->extract_return_value
== 0)
1811 internal_error ("gdbarch: gdbarch_extract_return_value invalid");
1812 if (gdbarch_debug
>= 2)
1813 /* FIXME: gdb_std??? */
1814 fprintf_unfiltered (gdb_stdlog
, "gdbarch_extract_return_value called\n");
1815 gdbarch
->extract_return_value (type
, regbuf
, valbuf
);
1819 set_gdbarch_extract_return_value (struct gdbarch
*gdbarch
,
1820 gdbarch_extract_return_value_ftype extract_return_value
)
1822 gdbarch
->extract_return_value
= extract_return_value
;
1826 gdbarch_push_arguments (struct gdbarch
*gdbarch
, int nargs
, struct value
**args
, CORE_ADDR sp
, int struct_return
, CORE_ADDR struct_addr
)
1828 if (gdbarch
->push_arguments
== 0)
1829 internal_error ("gdbarch: gdbarch_push_arguments invalid");
1830 if (gdbarch_debug
>= 2)
1831 /* FIXME: gdb_std??? */
1832 fprintf_unfiltered (gdb_stdlog
, "gdbarch_push_arguments called\n");
1833 return gdbarch
->push_arguments (nargs
, args
, sp
, struct_return
, struct_addr
);
1837 set_gdbarch_push_arguments (struct gdbarch
*gdbarch
,
1838 gdbarch_push_arguments_ftype push_arguments
)
1840 gdbarch
->push_arguments
= push_arguments
;
1844 gdbarch_push_dummy_frame (struct gdbarch
*gdbarch
)
1846 if (gdbarch
->push_dummy_frame
== 0)
1847 internal_error ("gdbarch: gdbarch_push_dummy_frame invalid");
1848 if (gdbarch_debug
>= 2)
1849 /* FIXME: gdb_std??? */
1850 fprintf_unfiltered (gdb_stdlog
, "gdbarch_push_dummy_frame called\n");
1851 gdbarch
->push_dummy_frame ();
1855 set_gdbarch_push_dummy_frame (struct gdbarch
*gdbarch
,
1856 gdbarch_push_dummy_frame_ftype push_dummy_frame
)
1858 gdbarch
->push_dummy_frame
= push_dummy_frame
;
1862 gdbarch_push_return_address (struct gdbarch
*gdbarch
, CORE_ADDR pc
, CORE_ADDR sp
)
1864 if (gdbarch
->push_return_address
== 0)
1865 internal_error ("gdbarch: gdbarch_push_return_address invalid");
1866 if (gdbarch_debug
>= 2)
1867 /* FIXME: gdb_std??? */
1868 fprintf_unfiltered (gdb_stdlog
, "gdbarch_push_return_address called\n");
1869 return gdbarch
->push_return_address (pc
, sp
);
1873 set_gdbarch_push_return_address (struct gdbarch
*gdbarch
,
1874 gdbarch_push_return_address_ftype push_return_address
)
1876 gdbarch
->push_return_address
= push_return_address
;
1880 gdbarch_pop_frame (struct gdbarch
*gdbarch
)
1882 if (gdbarch
->pop_frame
== 0)
1883 internal_error ("gdbarch: gdbarch_pop_frame invalid");
1884 if (gdbarch_debug
>= 2)
1885 /* FIXME: gdb_std??? */
1886 fprintf_unfiltered (gdb_stdlog
, "gdbarch_pop_frame called\n");
1887 gdbarch
->pop_frame ();
1891 set_gdbarch_pop_frame (struct gdbarch
*gdbarch
,
1892 gdbarch_pop_frame_ftype pop_frame
)
1894 gdbarch
->pop_frame
= pop_frame
;
1898 gdbarch_d10v_make_daddr (struct gdbarch
*gdbarch
, CORE_ADDR x
)
1900 if (gdbarch
->d10v_make_daddr
== 0)
1901 internal_error ("gdbarch: gdbarch_d10v_make_daddr invalid");
1902 if (gdbarch_debug
>= 2)
1903 /* FIXME: gdb_std??? */
1904 fprintf_unfiltered (gdb_stdlog
, "gdbarch_d10v_make_daddr called\n");
1905 return gdbarch
->d10v_make_daddr (x
);
1909 set_gdbarch_d10v_make_daddr (struct gdbarch
*gdbarch
,
1910 gdbarch_d10v_make_daddr_ftype d10v_make_daddr
)
1912 gdbarch
->d10v_make_daddr
= d10v_make_daddr
;
1916 gdbarch_d10v_make_iaddr (struct gdbarch
*gdbarch
, CORE_ADDR x
)
1918 if (gdbarch
->d10v_make_iaddr
== 0)
1919 internal_error ("gdbarch: gdbarch_d10v_make_iaddr invalid");
1920 if (gdbarch_debug
>= 2)
1921 /* FIXME: gdb_std??? */
1922 fprintf_unfiltered (gdb_stdlog
, "gdbarch_d10v_make_iaddr called\n");
1923 return gdbarch
->d10v_make_iaddr (x
);
1927 set_gdbarch_d10v_make_iaddr (struct gdbarch
*gdbarch
,
1928 gdbarch_d10v_make_iaddr_ftype d10v_make_iaddr
)
1930 gdbarch
->d10v_make_iaddr
= d10v_make_iaddr
;
1934 gdbarch_d10v_daddr_p (struct gdbarch
*gdbarch
, CORE_ADDR x
)
1936 if (gdbarch
->d10v_daddr_p
== 0)
1937 internal_error ("gdbarch: gdbarch_d10v_daddr_p invalid");
1938 if (gdbarch_debug
>= 2)
1939 /* FIXME: gdb_std??? */
1940 fprintf_unfiltered (gdb_stdlog
, "gdbarch_d10v_daddr_p called\n");
1941 return gdbarch
->d10v_daddr_p (x
);
1945 set_gdbarch_d10v_daddr_p (struct gdbarch
*gdbarch
,
1946 gdbarch_d10v_daddr_p_ftype d10v_daddr_p
)
1948 gdbarch
->d10v_daddr_p
= d10v_daddr_p
;
1952 gdbarch_d10v_iaddr_p (struct gdbarch
*gdbarch
, CORE_ADDR x
)
1954 if (gdbarch
->d10v_iaddr_p
== 0)
1955 internal_error ("gdbarch: gdbarch_d10v_iaddr_p invalid");
1956 if (gdbarch_debug
>= 2)
1957 /* FIXME: gdb_std??? */
1958 fprintf_unfiltered (gdb_stdlog
, "gdbarch_d10v_iaddr_p called\n");
1959 return gdbarch
->d10v_iaddr_p (x
);
1963 set_gdbarch_d10v_iaddr_p (struct gdbarch
*gdbarch
,
1964 gdbarch_d10v_iaddr_p_ftype d10v_iaddr_p
)
1966 gdbarch
->d10v_iaddr_p
= d10v_iaddr_p
;
1970 gdbarch_d10v_convert_daddr_to_raw (struct gdbarch
*gdbarch
, CORE_ADDR x
)
1972 if (gdbarch
->d10v_convert_daddr_to_raw
== 0)
1973 internal_error ("gdbarch: gdbarch_d10v_convert_daddr_to_raw invalid");
1974 if (gdbarch_debug
>= 2)
1975 /* FIXME: gdb_std??? */
1976 fprintf_unfiltered (gdb_stdlog
, "gdbarch_d10v_convert_daddr_to_raw called\n");
1977 return gdbarch
->d10v_convert_daddr_to_raw (x
);
1981 set_gdbarch_d10v_convert_daddr_to_raw (struct gdbarch
*gdbarch
,
1982 gdbarch_d10v_convert_daddr_to_raw_ftype d10v_convert_daddr_to_raw
)
1984 gdbarch
->d10v_convert_daddr_to_raw
= d10v_convert_daddr_to_raw
;
1988 gdbarch_d10v_convert_iaddr_to_raw (struct gdbarch
*gdbarch
, CORE_ADDR x
)
1990 if (gdbarch
->d10v_convert_iaddr_to_raw
== 0)
1991 internal_error ("gdbarch: gdbarch_d10v_convert_iaddr_to_raw invalid");
1992 if (gdbarch_debug
>= 2)
1993 /* FIXME: gdb_std??? */
1994 fprintf_unfiltered (gdb_stdlog
, "gdbarch_d10v_convert_iaddr_to_raw called\n");
1995 return gdbarch
->d10v_convert_iaddr_to_raw (x
);
1999 set_gdbarch_d10v_convert_iaddr_to_raw (struct gdbarch
*gdbarch
,
2000 gdbarch_d10v_convert_iaddr_to_raw_ftype d10v_convert_iaddr_to_raw
)
2002 gdbarch
->d10v_convert_iaddr_to_raw
= d10v_convert_iaddr_to_raw
;
2006 gdbarch_store_struct_return (struct gdbarch
*gdbarch
, CORE_ADDR addr
, CORE_ADDR sp
)
2008 if (gdbarch
->store_struct_return
== 0)
2009 internal_error ("gdbarch: gdbarch_store_struct_return invalid");
2010 if (gdbarch_debug
>= 2)
2011 /* FIXME: gdb_std??? */
2012 fprintf_unfiltered (gdb_stdlog
, "gdbarch_store_struct_return called\n");
2013 gdbarch
->store_struct_return (addr
, sp
);
2017 set_gdbarch_store_struct_return (struct gdbarch
*gdbarch
,
2018 gdbarch_store_struct_return_ftype store_struct_return
)
2020 gdbarch
->store_struct_return
= store_struct_return
;
2024 gdbarch_store_return_value (struct gdbarch
*gdbarch
, struct type
*type
, char *valbuf
)
2026 if (gdbarch
->store_return_value
== 0)
2027 internal_error ("gdbarch: gdbarch_store_return_value invalid");
2028 if (gdbarch_debug
>= 2)
2029 /* FIXME: gdb_std??? */
2030 fprintf_unfiltered (gdb_stdlog
, "gdbarch_store_return_value called\n");
2031 gdbarch
->store_return_value (type
, valbuf
);
2035 set_gdbarch_store_return_value (struct gdbarch
*gdbarch
,
2036 gdbarch_store_return_value_ftype store_return_value
)
2038 gdbarch
->store_return_value
= store_return_value
;
2042 gdbarch_extract_struct_value_address (struct gdbarch
*gdbarch
, char *regbuf
)
2044 if (gdbarch
->extract_struct_value_address
== 0)
2045 internal_error ("gdbarch: gdbarch_extract_struct_value_address invalid");
2046 if (gdbarch_debug
>= 2)
2047 /* FIXME: gdb_std??? */
2048 fprintf_unfiltered (gdb_stdlog
, "gdbarch_extract_struct_value_address called\n");
2049 return gdbarch
->extract_struct_value_address (regbuf
);
2053 set_gdbarch_extract_struct_value_address (struct gdbarch
*gdbarch
,
2054 gdbarch_extract_struct_value_address_ftype extract_struct_value_address
)
2056 gdbarch
->extract_struct_value_address
= extract_struct_value_address
;
2060 gdbarch_use_struct_convention (struct gdbarch
*gdbarch
, int gcc_p
, struct type
*value_type
)
2062 if (gdbarch
->use_struct_convention
== 0)
2063 internal_error ("gdbarch: gdbarch_use_struct_convention invalid");
2064 if (gdbarch_debug
>= 2)
2065 /* FIXME: gdb_std??? */
2066 fprintf_unfiltered (gdb_stdlog
, "gdbarch_use_struct_convention called\n");
2067 return gdbarch
->use_struct_convention (gcc_p
, value_type
);
2071 set_gdbarch_use_struct_convention (struct gdbarch
*gdbarch
,
2072 gdbarch_use_struct_convention_ftype use_struct_convention
)
2074 gdbarch
->use_struct_convention
= use_struct_convention
;
2078 gdbarch_frame_init_saved_regs (struct gdbarch
*gdbarch
, struct frame_info
*frame
)
2080 if (gdbarch
->frame_init_saved_regs
== 0)
2081 internal_error ("gdbarch: gdbarch_frame_init_saved_regs invalid");
2082 if (gdbarch_debug
>= 2)
2083 /* FIXME: gdb_std??? */
2084 fprintf_unfiltered (gdb_stdlog
, "gdbarch_frame_init_saved_regs called\n");
2085 gdbarch
->frame_init_saved_regs (frame
);
2089 set_gdbarch_frame_init_saved_regs (struct gdbarch
*gdbarch
,
2090 gdbarch_frame_init_saved_regs_ftype frame_init_saved_regs
)
2092 gdbarch
->frame_init_saved_regs
= frame_init_saved_regs
;
2096 gdbarch_init_extra_frame_info (struct gdbarch
*gdbarch
, int fromleaf
, struct frame_info
*frame
)
2098 if (gdbarch
->init_extra_frame_info
== 0)
2099 internal_error ("gdbarch: gdbarch_init_extra_frame_info invalid");
2100 if (gdbarch_debug
>= 2)
2101 /* FIXME: gdb_std??? */
2102 fprintf_unfiltered (gdb_stdlog
, "gdbarch_init_extra_frame_info called\n");
2103 gdbarch
->init_extra_frame_info (fromleaf
, frame
);
2107 set_gdbarch_init_extra_frame_info (struct gdbarch
*gdbarch
,
2108 gdbarch_init_extra_frame_info_ftype init_extra_frame_info
)
2110 gdbarch
->init_extra_frame_info
= init_extra_frame_info
;
2114 gdbarch_skip_prologue (struct gdbarch
*gdbarch
, CORE_ADDR ip
)
2116 if (gdbarch
->skip_prologue
== 0)
2117 internal_error ("gdbarch: gdbarch_skip_prologue invalid");
2118 if (gdbarch_debug
>= 2)
2119 /* FIXME: gdb_std??? */
2120 fprintf_unfiltered (gdb_stdlog
, "gdbarch_skip_prologue called\n");
2121 return gdbarch
->skip_prologue (ip
);
2125 set_gdbarch_skip_prologue (struct gdbarch
*gdbarch
,
2126 gdbarch_skip_prologue_ftype skip_prologue
)
2128 gdbarch
->skip_prologue
= skip_prologue
;
2132 gdbarch_inner_than (struct gdbarch
*gdbarch
, CORE_ADDR lhs
, CORE_ADDR rhs
)
2134 if (gdbarch
->inner_than
== 0)
2135 internal_error ("gdbarch: gdbarch_inner_than invalid");
2136 if (gdbarch_debug
>= 2)
2137 /* FIXME: gdb_std??? */
2138 fprintf_unfiltered (gdb_stdlog
, "gdbarch_inner_than called\n");
2139 return gdbarch
->inner_than (lhs
, rhs
);
2143 set_gdbarch_inner_than (struct gdbarch
*gdbarch
,
2144 gdbarch_inner_than_ftype inner_than
)
2146 gdbarch
->inner_than
= inner_than
;
2150 gdbarch_breakpoint_from_pc (struct gdbarch
*gdbarch
, CORE_ADDR
*pcptr
, int *lenptr
)
2152 if (gdbarch
->breakpoint_from_pc
== 0)
2153 internal_error ("gdbarch: gdbarch_breakpoint_from_pc invalid");
2154 if (gdbarch_debug
>= 2)
2155 /* FIXME: gdb_std??? */
2156 fprintf_unfiltered (gdb_stdlog
, "gdbarch_breakpoint_from_pc called\n");
2157 return gdbarch
->breakpoint_from_pc (pcptr
, lenptr
);
2161 set_gdbarch_breakpoint_from_pc (struct gdbarch
*gdbarch
,
2162 gdbarch_breakpoint_from_pc_ftype breakpoint_from_pc
)
2164 gdbarch
->breakpoint_from_pc
= breakpoint_from_pc
;
2168 gdbarch_memory_insert_breakpoint (struct gdbarch
*gdbarch
, CORE_ADDR addr
, char *contents_cache
)
2170 if (gdbarch
->memory_insert_breakpoint
== 0)
2171 internal_error ("gdbarch: gdbarch_memory_insert_breakpoint invalid");
2172 if (gdbarch_debug
>= 2)
2173 /* FIXME: gdb_std??? */
2174 fprintf_unfiltered (gdb_stdlog
, "gdbarch_memory_insert_breakpoint called\n");
2175 return gdbarch
->memory_insert_breakpoint (addr
, contents_cache
);
2179 set_gdbarch_memory_insert_breakpoint (struct gdbarch
*gdbarch
,
2180 gdbarch_memory_insert_breakpoint_ftype memory_insert_breakpoint
)
2182 gdbarch
->memory_insert_breakpoint
= memory_insert_breakpoint
;
2186 gdbarch_memory_remove_breakpoint (struct gdbarch
*gdbarch
, CORE_ADDR addr
, char *contents_cache
)
2188 if (gdbarch
->memory_remove_breakpoint
== 0)
2189 internal_error ("gdbarch: gdbarch_memory_remove_breakpoint invalid");
2190 if (gdbarch_debug
>= 2)
2191 /* FIXME: gdb_std??? */
2192 fprintf_unfiltered (gdb_stdlog
, "gdbarch_memory_remove_breakpoint called\n");
2193 return gdbarch
->memory_remove_breakpoint (addr
, contents_cache
);
2197 set_gdbarch_memory_remove_breakpoint (struct gdbarch
*gdbarch
,
2198 gdbarch_memory_remove_breakpoint_ftype memory_remove_breakpoint
)
2200 gdbarch
->memory_remove_breakpoint
= memory_remove_breakpoint
;
2204 gdbarch_decr_pc_after_break (struct gdbarch
*gdbarch
)
2206 if (gdbarch
->decr_pc_after_break
== -1)
2207 internal_error ("gdbarch: gdbarch_decr_pc_after_break invalid");
2208 if (gdbarch_debug
>= 2)
2209 /* FIXME: gdb_std??? */
2210 fprintf_unfiltered (gdb_stdlog
, "gdbarch_decr_pc_after_break called\n");
2211 return gdbarch
->decr_pc_after_break
;
2215 set_gdbarch_decr_pc_after_break (struct gdbarch
*gdbarch
,
2216 CORE_ADDR decr_pc_after_break
)
2218 gdbarch
->decr_pc_after_break
= decr_pc_after_break
;
2222 gdbarch_function_start_offset (struct gdbarch
*gdbarch
)
2224 if (gdbarch
->function_start_offset
== -1)
2225 internal_error ("gdbarch: gdbarch_function_start_offset invalid");
2226 if (gdbarch_debug
>= 2)
2227 /* FIXME: gdb_std??? */
2228 fprintf_unfiltered (gdb_stdlog
, "gdbarch_function_start_offset called\n");
2229 return gdbarch
->function_start_offset
;
2233 set_gdbarch_function_start_offset (struct gdbarch
*gdbarch
,
2234 CORE_ADDR function_start_offset
)
2236 gdbarch
->function_start_offset
= function_start_offset
;
2240 gdbarch_remote_translate_xfer_address (struct gdbarch
*gdbarch
, CORE_ADDR gdb_addr
, int gdb_len
, CORE_ADDR
*rem_addr
, int *rem_len
)
2242 if (gdbarch
->remote_translate_xfer_address
== 0)
2243 internal_error ("gdbarch: gdbarch_remote_translate_xfer_address invalid");
2244 if (gdbarch_debug
>= 2)
2245 /* FIXME: gdb_std??? */
2246 fprintf_unfiltered (gdb_stdlog
, "gdbarch_remote_translate_xfer_address called\n");
2247 gdbarch
->remote_translate_xfer_address (gdb_addr
, gdb_len
, rem_addr
, rem_len
);
2251 set_gdbarch_remote_translate_xfer_address (struct gdbarch
*gdbarch
,
2252 gdbarch_remote_translate_xfer_address_ftype remote_translate_xfer_address
)
2254 gdbarch
->remote_translate_xfer_address
= remote_translate_xfer_address
;
2258 gdbarch_frame_args_skip (struct gdbarch
*gdbarch
)
2260 if (gdbarch
->frame_args_skip
== -1)
2261 internal_error ("gdbarch: gdbarch_frame_args_skip invalid");
2262 if (gdbarch_debug
>= 2)
2263 /* FIXME: gdb_std??? */
2264 fprintf_unfiltered (gdb_stdlog
, "gdbarch_frame_args_skip called\n");
2265 return gdbarch
->frame_args_skip
;
2269 set_gdbarch_frame_args_skip (struct gdbarch
*gdbarch
,
2270 CORE_ADDR frame_args_skip
)
2272 gdbarch
->frame_args_skip
= frame_args_skip
;
2276 gdbarch_frameless_function_invocation (struct gdbarch
*gdbarch
, struct frame_info
*fi
)
2278 if (gdbarch
->frameless_function_invocation
== 0)
2279 internal_error ("gdbarch: gdbarch_frameless_function_invocation invalid");
2280 if (gdbarch_debug
>= 2)
2281 /* FIXME: gdb_std??? */
2282 fprintf_unfiltered (gdb_stdlog
, "gdbarch_frameless_function_invocation called\n");
2283 return gdbarch
->frameless_function_invocation (fi
);
2287 set_gdbarch_frameless_function_invocation (struct gdbarch
*gdbarch
,
2288 gdbarch_frameless_function_invocation_ftype frameless_function_invocation
)
2290 gdbarch
->frameless_function_invocation
= frameless_function_invocation
;
2294 gdbarch_frame_chain (struct gdbarch
*gdbarch
, struct frame_info
*frame
)
2296 if (gdbarch
->frame_chain
== 0)
2297 internal_error ("gdbarch: gdbarch_frame_chain invalid");
2298 if (gdbarch_debug
>= 2)
2299 /* FIXME: gdb_std??? */
2300 fprintf_unfiltered (gdb_stdlog
, "gdbarch_frame_chain called\n");
2301 return gdbarch
->frame_chain (frame
);
2305 set_gdbarch_frame_chain (struct gdbarch
*gdbarch
,
2306 gdbarch_frame_chain_ftype frame_chain
)
2308 gdbarch
->frame_chain
= frame_chain
;
2312 gdbarch_frame_chain_valid (struct gdbarch
*gdbarch
, CORE_ADDR chain
, struct frame_info
*thisframe
)
2314 if (gdbarch
->frame_chain_valid
== 0)
2315 internal_error ("gdbarch: gdbarch_frame_chain_valid invalid");
2316 if (gdbarch_debug
>= 2)
2317 /* FIXME: gdb_std??? */
2318 fprintf_unfiltered (gdb_stdlog
, "gdbarch_frame_chain_valid called\n");
2319 return gdbarch
->frame_chain_valid (chain
, thisframe
);
2323 set_gdbarch_frame_chain_valid (struct gdbarch
*gdbarch
,
2324 gdbarch_frame_chain_valid_ftype frame_chain_valid
)
2326 gdbarch
->frame_chain_valid
= frame_chain_valid
;
2330 gdbarch_frame_saved_pc (struct gdbarch
*gdbarch
, struct frame_info
*fi
)
2332 if (gdbarch
->frame_saved_pc
== 0)
2333 internal_error ("gdbarch: gdbarch_frame_saved_pc invalid");
2334 if (gdbarch_debug
>= 2)
2335 /* FIXME: gdb_std??? */
2336 fprintf_unfiltered (gdb_stdlog
, "gdbarch_frame_saved_pc called\n");
2337 return gdbarch
->frame_saved_pc (fi
);
2341 set_gdbarch_frame_saved_pc (struct gdbarch
*gdbarch
,
2342 gdbarch_frame_saved_pc_ftype frame_saved_pc
)
2344 gdbarch
->frame_saved_pc
= frame_saved_pc
;
2348 gdbarch_frame_args_address (struct gdbarch
*gdbarch
, struct frame_info
*fi
)
2350 if (gdbarch
->frame_args_address
== 0)
2351 internal_error ("gdbarch: gdbarch_frame_args_address invalid");
2352 if (gdbarch_debug
>= 2)
2353 /* FIXME: gdb_std??? */
2354 fprintf_unfiltered (gdb_stdlog
, "gdbarch_frame_args_address called\n");
2355 return gdbarch
->frame_args_address (fi
);
2359 set_gdbarch_frame_args_address (struct gdbarch
*gdbarch
,
2360 gdbarch_frame_args_address_ftype frame_args_address
)
2362 gdbarch
->frame_args_address
= frame_args_address
;
2366 gdbarch_frame_locals_address (struct gdbarch
*gdbarch
, struct frame_info
*fi
)
2368 if (gdbarch
->frame_locals_address
== 0)
2369 internal_error ("gdbarch: gdbarch_frame_locals_address invalid");
2370 if (gdbarch_debug
>= 2)
2371 /* FIXME: gdb_std??? */
2372 fprintf_unfiltered (gdb_stdlog
, "gdbarch_frame_locals_address called\n");
2373 return gdbarch
->frame_locals_address (fi
);
2377 set_gdbarch_frame_locals_address (struct gdbarch
*gdbarch
,
2378 gdbarch_frame_locals_address_ftype frame_locals_address
)
2380 gdbarch
->frame_locals_address
= frame_locals_address
;
2384 gdbarch_saved_pc_after_call (struct gdbarch
*gdbarch
, struct frame_info
*frame
)
2386 if (gdbarch
->saved_pc_after_call
== 0)
2387 internal_error ("gdbarch: gdbarch_saved_pc_after_call invalid");
2388 if (gdbarch_debug
>= 2)
2389 /* FIXME: gdb_std??? */
2390 fprintf_unfiltered (gdb_stdlog
, "gdbarch_saved_pc_after_call called\n");
2391 return gdbarch
->saved_pc_after_call (frame
);
2395 set_gdbarch_saved_pc_after_call (struct gdbarch
*gdbarch
,
2396 gdbarch_saved_pc_after_call_ftype saved_pc_after_call
)
2398 gdbarch
->saved_pc_after_call
= saved_pc_after_call
;
2402 gdbarch_frame_num_args (struct gdbarch
*gdbarch
, struct frame_info
*frame
)
2404 if (gdbarch
->frame_num_args
== 0)
2405 internal_error ("gdbarch: gdbarch_frame_num_args invalid");
2406 if (gdbarch_debug
>= 2)
2407 /* FIXME: gdb_std??? */
2408 fprintf_unfiltered (gdb_stdlog
, "gdbarch_frame_num_args called\n");
2409 return gdbarch
->frame_num_args (frame
);
2413 set_gdbarch_frame_num_args (struct gdbarch
*gdbarch
,
2414 gdbarch_frame_num_args_ftype frame_num_args
)
2416 gdbarch
->frame_num_args
= frame_num_args
;
2420 /* Keep a registrary of per-architecture data-pointers required by GDB
2428 struct gdbarch_data_registration
2430 gdbarch_data_ftype
*init
;
2431 struct gdbarch_data
*data
;
2432 struct gdbarch_data_registration
*next
;
2435 struct gdbarch_data_registrary
2438 struct gdbarch_data_registration
*registrations
;
2441 struct gdbarch_data_registrary gdbarch_data_registrary
=
2446 struct gdbarch_data
*
2447 register_gdbarch_data (gdbarch_data_ftype
*init
)
2449 struct gdbarch_data_registration
**curr
;
2450 for (curr
= &gdbarch_data_registrary
.registrations
;
2452 curr
= &(*curr
)->next
);
2453 (*curr
) = XMALLOC (struct gdbarch_data_registration
);
2454 (*curr
)->next
= NULL
;
2455 (*curr
)->init
= init
;
2456 (*curr
)->data
= XMALLOC (struct gdbarch_data
);
2457 (*curr
)->data
->index
= gdbarch_data_registrary
.nr
++;
2458 return (*curr
)->data
;
2462 /* Walk through all the registered users initializing each in turn. */
2465 init_gdbarch_data (struct gdbarch
*gdbarch
)
2467 struct gdbarch_data_registration
*rego
;
2468 gdbarch
->nr_data
= gdbarch_data_registrary
.nr
+ 1;
2469 gdbarch
->data
= xmalloc (sizeof (void*) * gdbarch
->nr_data
);
2470 for (rego
= gdbarch_data_registrary
.registrations
;
2474 if (rego
->data
->index
< gdbarch
->nr_data
)
2475 gdbarch
->data
[rego
->data
->index
] = rego
->init ();
2480 /* Return the current value of the specified per-architecture
2485 struct gdbarch_data
*data
;
2487 if (data
->index
>= current_gdbarch
->nr_data
)
2488 internal_error ("gdbarch_data: request for non-existant data.");
2489 return current_gdbarch
->data
[data
->index
];
2494 /* Keep a registrary of swaped data required by GDB modules. */
2499 struct gdbarch_swap_registration
*source
;
2500 struct gdbarch_swap
*next
;
2503 struct gdbarch_swap_registration
2506 unsigned long sizeof_data
;
2507 gdbarch_swap_ftype
*init
;
2508 struct gdbarch_swap_registration
*next
;
2511 struct gdbarch_swap_registrary
2514 struct gdbarch_swap_registration
*registrations
;
2517 struct gdbarch_swap_registrary gdbarch_swap_registrary
=
2523 register_gdbarch_swap (void *data
,
2524 unsigned long sizeof_data
,
2525 gdbarch_swap_ftype
*init
)
2527 struct gdbarch_swap_registration
**rego
;
2528 for (rego
= &gdbarch_swap_registrary
.registrations
;
2530 rego
= &(*rego
)->next
);
2531 (*rego
) = XMALLOC (struct gdbarch_swap_registration
);
2532 (*rego
)->next
= NULL
;
2533 (*rego
)->init
= init
;
2534 (*rego
)->data
= data
;
2535 (*rego
)->sizeof_data
= sizeof_data
;
2540 init_gdbarch_swap (struct gdbarch
*gdbarch
)
2542 struct gdbarch_swap_registration
*rego
;
2543 struct gdbarch_swap
**curr
= &gdbarch
->swap
;
2544 for (rego
= gdbarch_swap_registrary
.registrations
;
2548 if (rego
->data
!= NULL
)
2550 (*curr
) = XMALLOC (struct gdbarch_swap
);
2551 (*curr
)->source
= rego
;
2552 (*curr
)->swap
= xmalloc (rego
->sizeof_data
);
2553 (*curr
)->next
= NULL
;
2554 memset (rego
->data
, 0, rego
->sizeof_data
);
2555 curr
= &(*curr
)->next
;
2557 if (rego
->init
!= NULL
)
2563 swapout_gdbarch_swap (struct gdbarch
*gdbarch
)
2565 struct gdbarch_swap
*curr
;
2566 for (curr
= gdbarch
->swap
;
2569 memcpy (curr
->swap
, curr
->source
->data
, curr
->source
->sizeof_data
);
2573 swapin_gdbarch_swap (struct gdbarch
*gdbarch
)
2575 struct gdbarch_swap
*curr
;
2576 for (curr
= gdbarch
->swap
;
2579 memcpy (curr
->source
->data
, curr
->swap
, curr
->source
->sizeof_data
);
2583 /* Keep a registrary of the architectures known by GDB. */
2585 struct gdbarch_init_registration
2587 enum bfd_architecture bfd_architecture
;
2588 gdbarch_init_ftype
*init
;
2589 struct gdbarch_list
*arches
;
2590 struct gdbarch_init_registration
*next
;
2593 static struct gdbarch_init_registration
*gdbarch_init_registrary
= NULL
;
2596 register_gdbarch_init (enum bfd_architecture bfd_architecture
,
2597 gdbarch_init_ftype
*init
)
2599 struct gdbarch_init_registration
**curr
;
2600 const struct bfd_arch_info
*bfd_arch_info
;
2601 /* Check that BFD reconizes this architecture */
2602 bfd_arch_info
= bfd_lookup_arch (bfd_architecture
, 0);
2603 if (bfd_arch_info
== NULL
)
2605 internal_error ("gdbarch: Attempt to register unknown architecture (%d)", bfd_architecture
);
2607 /* Check that we haven't seen this architecture before */
2608 for (curr
= &gdbarch_init_registrary
;
2610 curr
= &(*curr
)->next
)
2612 if (bfd_architecture
== (*curr
)->bfd_architecture
)
2613 internal_error ("gdbarch: Duplicate registraration of architecture (%s)",
2614 bfd_arch_info
->printable_name
);
2618 fprintf_unfiltered (gdb_stdlog
, "register_gdbarch_init (%s, 0x%08lx)\n",
2619 bfd_arch_info
->printable_name
,
2622 (*curr
) = XMALLOC (struct gdbarch_init_registration
);
2623 (*curr
)->bfd_architecture
= bfd_architecture
;
2624 (*curr
)->init
= init
;
2625 (*curr
)->arches
= NULL
;
2626 (*curr
)->next
= NULL
;
2631 /* Look for an architecture using gdbarch_info. Base search on only
2632 BFD_ARCH_INFO and BYTE_ORDER. */
2634 struct gdbarch_list
*
2635 gdbarch_list_lookup_by_info (struct gdbarch_list
*arches
,
2636 const struct gdbarch_info
*info
)
2638 for (; arches
!= NULL
; arches
= arches
->next
)
2640 if (info
->bfd_arch_info
!= arches
->gdbarch
->bfd_arch_info
)
2642 if (info
->byte_order
!= arches
->gdbarch
->byte_order
)
2650 /* Update the current architecture. Return ZERO if the update request
2654 gdbarch_update (struct gdbarch_info info
)
2656 struct gdbarch
*new_gdbarch
;
2657 struct gdbarch_list
**list
;
2658 struct gdbarch_init_registration
*rego
;
2660 /* Fill in any missing bits. Most important is the bfd_architecture
2661 which is used to select the target architecture. */
2662 if (info
.bfd_architecture
== bfd_arch_unknown
)
2664 if (info
.bfd_arch_info
!= NULL
)
2665 info
.bfd_architecture
= info
.bfd_arch_info
->arch
;
2666 else if (info
.abfd
!= NULL
)
2667 info
.bfd_architecture
= bfd_get_arch (info
.abfd
);
2668 /* FIXME - should query BFD for its default architecture. */
2670 info
.bfd_architecture
= current_gdbarch
->bfd_arch_info
->arch
;
2672 if (info
.bfd_arch_info
== NULL
)
2674 if (target_architecture_auto
&& info
.abfd
!= NULL
)
2675 info
.bfd_arch_info
= bfd_get_arch_info (info
.abfd
);
2677 info
.bfd_arch_info
= current_gdbarch
->bfd_arch_info
;
2679 if (info
.byte_order
== 0)
2681 if (target_byte_order_auto
&& info
.abfd
!= NULL
)
2682 info
.byte_order
= (bfd_big_endian (info
.abfd
) ? BIG_ENDIAN
2683 : bfd_little_endian (info
.abfd
) ? LITTLE_ENDIAN
2686 info
.byte_order
= current_gdbarch
->byte_order
;
2687 /* FIXME - should query BFD for its default byte-order. */
2689 /* A default for abfd? */
2691 /* Find the target that knows about this architecture. */
2692 for (rego
= gdbarch_init_registrary
;
2693 rego
!= NULL
&& rego
->bfd_architecture
!= info
.bfd_architecture
;
2698 fprintf_unfiltered (gdb_stdlog
, "gdbarch_update: No matching architecture\n");
2704 fprintf_unfiltered (gdb_stdlog
,
2705 "gdbarch_update: info.bfd_architecture %d (%s)\n",
2706 info
.bfd_architecture
,
2707 bfd_lookup_arch (info
.bfd_architecture
, 0)->printable_name
);
2708 fprintf_unfiltered (gdb_stdlog
,
2709 "gdbarch_update: info.bfd_arch_info %s\n",
2710 (info
.bfd_arch_info
!= NULL
2711 ? info
.bfd_arch_info
->printable_name
2713 fprintf_unfiltered (gdb_stdlog
,
2714 "gdbarch_update: info.byte_order %d (%s)\n",
2716 (info
.byte_order
== BIG_ENDIAN
? "big"
2717 : info
.byte_order
== LITTLE_ENDIAN
? "little"
2719 fprintf_unfiltered (gdb_stdlog
,
2720 "gdbarch_update: info.abfd 0x%lx\n",
2722 fprintf_unfiltered (gdb_stdlog
,
2723 "gdbarch_update: info.tdep_info 0x%lx\n",
2724 (long) info
.tdep_info
);
2727 /* Ask the target for a replacement architecture. */
2728 new_gdbarch
= rego
->init (info
, rego
->arches
);
2730 /* Did the target like it? No. Reject the change. */
2731 if (new_gdbarch
== NULL
)
2734 fprintf_unfiltered (gdb_stdlog
, "gdbarch_update: Target rejected architecture\n");
2738 /* Did the architecture change? No. Do nothing. */
2739 if (current_gdbarch
== new_gdbarch
)
2742 fprintf_unfiltered (gdb_stdlog
, "gdbarch_update: Architecture 0x%08lx (%s) unchanged\n",
2744 new_gdbarch
->bfd_arch_info
->printable_name
);
2748 /* Swap all data belonging to the old target out */
2749 swapout_gdbarch_swap (current_gdbarch
);
2751 /* Is this a pre-existing architecture? Yes. Swap it in. */
2752 for (list
= ®o
->arches
;
2754 list
= &(*list
)->next
)
2756 if ((*list
)->gdbarch
== new_gdbarch
)
2759 fprintf_unfiltered (gdb_stdlog
, "gdbarch_update: Previous architecture 0x%08lx (%s) selected\n",
2761 new_gdbarch
->bfd_arch_info
->printable_name
);
2762 current_gdbarch
= new_gdbarch
;
2763 swapin_gdbarch_swap (new_gdbarch
);
2768 /* Append this new architecture to this targets list. */
2769 (*list
) = XMALLOC (struct gdbarch_list
);
2770 (*list
)->next
= NULL
;
2771 (*list
)->gdbarch
= new_gdbarch
;
2773 /* Switch to this new architecture. Dump it out. */
2774 current_gdbarch
= new_gdbarch
;
2777 fprintf_unfiltered (gdb_stdlog
,
2778 "gdbarch_update: New architecture 0x%08lx (%s) selected\n",
2780 new_gdbarch
->bfd_arch_info
->printable_name
);
2784 /* Check that the newly installed architecture is valid. */
2785 verify_gdbarch (new_gdbarch
);
2787 /* Initialize the per-architecture memory (swap) areas.
2788 CURRENT_GDBARCH must be update before these modules are
2790 init_gdbarch_swap (new_gdbarch
);
2792 /* Initialize the per-architecture data-pointer of all parties that
2793 registered an interest in this architecture. CURRENT_GDBARCH
2794 must be updated before these modules are called. */
2795 init_gdbarch_data (new_gdbarch
);
2802 /* Functions to manipulate the endianness of the target. */
2804 #ifdef TARGET_BYTE_ORDER_SELECTABLE
2805 /* compat - Catch old targets that expect a selectable byte-order to
2806 default to BIG_ENDIAN */
2807 #ifndef TARGET_BYTE_ORDER_DEFAULT
2808 #define TARGET_BYTE_ORDER_DEFAULT BIG_ENDIAN
2811 #if !TARGET_BYTE_ORDER_SELECTABLE_P
2812 #ifndef TARGET_BYTE_ORDER_DEFAULT
2813 /* compat - Catch old non byte-order selectable targets that do not
2814 define TARGET_BYTE_ORDER_DEFAULT and instead expect
2815 TARGET_BYTE_ORDER to be used as the default. For targets that
2816 defined neither TARGET_BYTE_ORDER nor TARGET_BYTE_ORDER_DEFAULT the
2817 below will get a strange compiler warning. */
2818 #define TARGET_BYTE_ORDER_DEFAULT TARGET_BYTE_ORDER
2821 #ifndef TARGET_BYTE_ORDER_DEFAULT
2822 #define TARGET_BYTE_ORDER_DEFAULT BIG_ENDIAN /* arbitrary */
2824 int target_byte_order
= TARGET_BYTE_ORDER_DEFAULT
;
2825 int target_byte_order_auto
= 1;
2827 /* Chain containing the \"set endian\" commands. */
2828 static struct cmd_list_element
*endianlist
= NULL
;
2830 /* Called by ``show endian''. */
2832 show_endian (char *args
, int from_tty
)
2835 (TARGET_BYTE_ORDER_AUTO
2836 ? "The target endianness is set automatically (currently %s endian)\n"
2837 : "The target is assumed to be %s endian\n");
2838 printf_unfiltered (msg
, (TARGET_BYTE_ORDER
== BIG_ENDIAN
? "big" : "little"));
2841 /* Called if the user enters ``set endian'' without an argument. */
2843 set_endian (char *args
, int from_tty
)
2845 printf_unfiltered ("\"set endian\" must be followed by \"auto\", \"big\" or \"little\".\n");
2846 show_endian (args
, from_tty
);
2849 /* Called by ``set endian big''. */
2851 set_endian_big (char *args
, int from_tty
)
2853 if (TARGET_BYTE_ORDER_SELECTABLE_P
)
2855 target_byte_order
= BIG_ENDIAN
;
2856 target_byte_order_auto
= 0;
2859 struct gdbarch_info info
;
2860 memset (&info
, 0, sizeof info
);
2861 info
.byte_order
= BIG_ENDIAN
;
2862 gdbarch_update (info
);
2867 printf_unfiltered ("Byte order is not selectable.");
2868 show_endian (args
, from_tty
);
2872 /* Called by ``set endian little''. */
2874 set_endian_little (char *args
, int from_tty
)
2876 if (TARGET_BYTE_ORDER_SELECTABLE_P
)
2878 target_byte_order
= LITTLE_ENDIAN
;
2879 target_byte_order_auto
= 0;
2882 struct gdbarch_info info
;
2883 memset (&info
, 0, sizeof info
);
2884 info
.byte_order
= LITTLE_ENDIAN
;
2885 gdbarch_update (info
);
2890 printf_unfiltered ("Byte order is not selectable.");
2891 show_endian (args
, from_tty
);
2895 /* Called by ``set endian auto''. */
2897 set_endian_auto (char *args
, int from_tty
)
2899 if (TARGET_BYTE_ORDER_SELECTABLE_P
)
2901 target_byte_order_auto
= 1;
2905 printf_unfiltered ("Byte order is not selectable.");
2906 show_endian (args
, from_tty
);
2910 /* Set the endianness from a BFD. */
2912 set_endian_from_file (bfd
*abfd
)
2914 if (TARGET_BYTE_ORDER_SELECTABLE_P
)
2918 if (bfd_big_endian (abfd
))
2921 want
= LITTLE_ENDIAN
;
2922 if (TARGET_BYTE_ORDER_AUTO
)
2923 target_byte_order
= want
;
2924 else if (TARGET_BYTE_ORDER
!= want
)
2925 warning ("%s endian file does not match %s endian target.",
2926 want
== BIG_ENDIAN
? "big" : "little",
2927 TARGET_BYTE_ORDER
== BIG_ENDIAN
? "big" : "little");
2931 if (bfd_big_endian (abfd
)
2932 ? TARGET_BYTE_ORDER
!= BIG_ENDIAN
2933 : TARGET_BYTE_ORDER
== BIG_ENDIAN
)
2934 warning ("%s endian file does not match %s endian target.",
2935 bfd_big_endian (abfd
) ? "big" : "little",
2936 TARGET_BYTE_ORDER
== BIG_ENDIAN
? "big" : "little");
2942 /* Functions to manipulate the architecture of the target */
2944 enum set_arch
{ set_arch_auto
, set_arch_manual
};
2946 int target_architecture_auto
= 1;
2947 extern const struct bfd_arch_info bfd_default_arch_struct
;
2948 const struct bfd_arch_info
*target_architecture
= &bfd_default_arch_struct
;
2949 int (*target_architecture_hook
) (const struct bfd_arch_info
*ap
);
2951 static void show_endian (char *, int);
2952 static void set_endian (char *, int);
2953 static void set_endian_big (char *, int);
2954 static void set_endian_little (char *, int);
2955 static void set_endian_auto (char *, int);
2956 static void set_endian_from_file (bfd
*);
2957 static int arch_ok (const struct bfd_arch_info
*arch
);
2958 static void set_arch (const struct bfd_arch_info
*arch
, enum set_arch type
);
2959 static void show_architecture (char *, int);
2960 static void set_architecture (char *, int);
2961 static void info_architecture (char *, int);
2962 static void set_architecture_from_file (bfd
*);
2964 /* Do the real work of changing the current architecture */
2967 arch_ok (const struct bfd_arch_info
*arch
)
2969 /* Should be performing the more basic check that the binary is
2970 compatible with GDB. */
2971 /* Check with the target that the architecture is valid. */
2972 return (target_architecture_hook
== NULL
2973 || target_architecture_hook (arch
));
2977 set_arch (const struct bfd_arch_info
*arch
,
2983 if (!arch_ok (arch
))
2984 warning ("Target may not support %s architecture",
2985 arch
->printable_name
);
2986 target_architecture
= arch
;
2988 case set_arch_manual
:
2989 if (!arch_ok (arch
))
2991 printf_unfiltered ("Target does not support `%s' architecture.\n",
2992 arch
->printable_name
);
2996 target_architecture_auto
= 0;
2997 target_architecture
= arch
;
3005 /* Called if the user enters ``show architecture'' without an argument. */
3007 show_architecture (char *args
, int from_tty
)
3010 arch
= TARGET_ARCHITECTURE
->printable_name
;
3011 if (target_architecture_auto
)
3012 printf_filtered ("The target architecture is set automatically (currently %s)\n", arch
);
3014 printf_filtered ("The target architecture is assumed to be %s\n", arch
);
3017 /* Called if the user enters ``set architecture'' with or without an
3020 set_architecture (char *args
, int from_tty
)
3024 printf_unfiltered ("\"set architecture\" must be followed by \"auto\" or an architecture name.\n");
3026 else if (strcmp (args
, "auto") == 0)
3028 target_architecture_auto
= 1;
3030 else if (GDB_MULTI_ARCH
)
3032 const struct bfd_arch_info
*arch
= bfd_scan_arch (args
);
3034 printf_unfiltered ("Architecture `%s' not reconized.\n", args
);
3037 struct gdbarch_info info
;
3038 memset (&info
, 0, sizeof info
);
3039 info
.bfd_arch_info
= arch
;
3040 if (gdbarch_update (info
))
3041 target_architecture_auto
= 0;
3043 printf_unfiltered ("Architecture `%s' not reconized.\n", args
);
3048 const struct bfd_arch_info
*arch
= bfd_scan_arch (args
);
3050 set_arch (arch
, set_arch_manual
);
3052 printf_unfiltered ("Architecture `%s' not reconized.\n", args
);
3056 /* Called if the user enters ``info architecture'' without an argument. */
3058 info_architecture (char *args
, int from_tty
)
3060 enum bfd_architecture a
;
3063 if (gdbarch_init_registrary
!= NULL
)
3065 struct gdbarch_init_registration
*rego
;
3066 printf_filtered ("Available architectures are:\n");
3067 for (rego
= gdbarch_init_registrary
;
3071 const struct bfd_arch_info
*ap
;
3072 ap
= bfd_lookup_arch (rego
->bfd_architecture
, 0);
3077 printf_filtered (" %s", ap
->printable_name
);
3081 printf_filtered ("\n");
3087 printf_filtered ("There are no available architectures.\n");
3091 printf_filtered ("Available architectures are:\n");
3092 for (a
= bfd_arch_obscure
+ 1; a
< bfd_arch_last
; a
++)
3094 const struct bfd_arch_info
*ap
= bfd_lookup_arch (a
, 0);
3099 printf_filtered (" %s", ap
->printable_name
);
3103 printf_filtered ("\n");
3108 /* Set the architecture from arch/machine */
3110 set_architecture_from_arch_mach (arch
, mach
)
3111 enum bfd_architecture arch
;
3114 const struct bfd_arch_info
*wanted
= bfd_lookup_arch (arch
, mach
);
3116 set_arch (wanted
, set_arch_manual
);
3118 internal_error ("gdbarch: hardwired architecture/machine not reconized");
3121 /* Set the architecture from a BFD */
3123 set_architecture_from_file (bfd
*abfd
)
3125 const struct bfd_arch_info
*wanted
= bfd_get_arch_info (abfd
);
3126 if (target_architecture_auto
)
3128 set_arch (wanted
, set_arch_auto
);
3130 else if (wanted
!= target_architecture
)
3132 warning ("%s architecture file may be incompatible with %s target.",
3133 wanted
->printable_name
,
3134 target_architecture
->printable_name
);
3139 /* Misc helper functions for targets. */
3142 frame_num_args_unknown (fi
)
3143 struct frame_info
*fi
;
3150 generic_register_convertible_not (num
)
3158 /* Pointer to the target-dependent disassembly function. */
3159 int (*tm_print_insn
) (bfd_vma
, disassemble_info
*);
3160 disassemble_info tm_print_insn_info
;
3164 /* Set the dynamic target-system-dependant parameters (architecture,
3165 byte-order) using information found in the BFD */
3168 set_gdbarch_from_file (abfd
)
3173 struct gdbarch_info info
;
3174 memset (&info
, 0, sizeof info
);
3176 gdbarch_update (info
);
3179 set_architecture_from_file (abfd
);
3180 set_endian_from_file (abfd
);
3184 #if defined (CALL_DUMMY)
3185 /* FIXME - this should go away */
3186 LONGEST call_dummy_words
[] = CALL_DUMMY
;
3187 int sizeof_call_dummy_words
= sizeof (call_dummy_words
);
3191 /* Initialize the current architecture. */
3193 initialize_current_architecture ()
3197 struct gdbarch_init_registration
*rego
;
3198 const struct bfd_arch_info
*chosen
= NULL
;
3199 for (rego
= gdbarch_init_registrary
; rego
!= NULL
; rego
= rego
->next
)
3201 const struct bfd_arch_info
*ap
3202 = bfd_lookup_arch (rego
->bfd_architecture
, 0);
3204 /* Choose the first architecture alphabetically. */
3206 || strcmp (ap
->printable_name
, chosen
->printable_name
) < 0)
3212 struct gdbarch_info info
;
3213 memset (&info
, 0, sizeof info
);
3214 info
.bfd_arch_info
= chosen
;
3215 gdbarch_update (info
);
3220 extern void _initialize_gdbarch (void);
3222 _initialize_gdbarch ()
3224 add_prefix_cmd ("endian", class_support
, set_endian
,
3225 "Set endianness of target.",
3226 &endianlist
, "set endian ", 0, &setlist
);
3227 add_cmd ("big", class_support
, set_endian_big
,
3228 "Set target as being big endian.", &endianlist
);
3229 add_cmd ("little", class_support
, set_endian_little
,
3230 "Set target as being little endian.", &endianlist
);
3231 add_cmd ("auto", class_support
, set_endian_auto
,
3232 "Select target endianness automatically.", &endianlist
);
3233 add_cmd ("endian", class_support
, show_endian
,
3234 "Show endianness of target.", &showlist
);
3236 add_cmd ("architecture", class_support
, set_architecture
,
3237 "Set architecture of target.", &setlist
);
3238 add_alias_cmd ("processor", "architecture", class_support
, 1, &setlist
);
3239 add_cmd ("architecture", class_support
, show_architecture
,
3240 "Show architecture of target.", &showlist
);
3241 add_cmd ("architecture", class_support
, info_architecture
,
3242 "List supported target architectures", &infolist
);
3244 INIT_DISASSEMBLE_INFO_NO_ARCH (tm_print_insn_info
, gdb_stdout
, (fprintf_ftype
)fprintf_filtered
);
3245 tm_print_insn_info
.flavour
= bfd_target_unknown_flavour
;
3246 tm_print_insn_info
.read_memory_func
= dis_asm_read_memory
;
3247 tm_print_insn_info
.memory_error_func
= dis_asm_memory_error
;
3248 tm_print_insn_info
.print_address_func
= dis_asm_print_address
;
3250 add_show_from_set (add_set_cmd ("archdebug",
3253 (char *)&gdbarch_debug
,
3254 "Set architecture debugging.\n\
3255 When non-zero, architecture debugging is enabled.", &setlist
),