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