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