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