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