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