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