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