fc70f753e4f48c0a45d86596934a67f01b925de7
[deliverable/binutils-gdb.git] / gdb / gdbarch.c
1 /* *INDENT-OFF* */ /* THIS FILE IS GENERATED */
2
3 /* Dynamic architecture support for GDB, the GNU debugger.
4
5 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
7
8 This file is part of GDB.
9
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 Boston, MA 02110-1301, USA. */
24
25 /* This file was created with the aid of ``gdbarch.sh''.
26
27 The Bourne shell script ``gdbarch.sh'' creates the files
28 ``new-gdbarch.c'' and ``new-gdbarch.h and then compares them
29 against the existing ``gdbarch.[hc]''. Any differences found
30 being reported.
31
32 If editing this file, please also run gdbarch.sh and merge any
33 changes into that script. Conversely, when making sweeping changes
34 to this file, modifying gdbarch.sh and using its output may prove
35 easier. */
36
37
38 #include "defs.h"
39 #include "arch-utils.h"
40
41 #include "gdbcmd.h"
42 #include "inferior.h" /* enum CALL_DUMMY_LOCATION et.al. */
43 #include "symcat.h"
44
45 #include "floatformat.h"
46
47 #include "gdb_assert.h"
48 #include "gdb_string.h"
49 #include "gdb-events.h"
50 #include "reggroups.h"
51 #include "osabi.h"
52 #include "gdb_obstack.h"
53
54 /* Static function declarations */
55
56 static void alloc_gdbarch_data (struct gdbarch *);
57
58 /* Non-zero if we want to trace architecture code. */
59
60 #ifndef GDBARCH_DEBUG
61 #define GDBARCH_DEBUG 0
62 #endif
63 int gdbarch_debug = GDBARCH_DEBUG;
64 static void
65 show_gdbarch_debug (struct ui_file *file, int from_tty,
66 struct cmd_list_element *c, const char *value)
67 {
68 fprintf_filtered (file, _("Architecture debugging is %s.\n"), value);
69 }
70
71 static const char *
72 pformat (const struct floatformat **format)
73 {
74 if (format == NULL)
75 return "(null)";
76 else
77 /* Just print out one of them - this is only for diagnostics. */
78 return format[0]->name;
79 }
80
81
82 /* Maintain the struct gdbarch object */
83
84 struct gdbarch
85 {
86 /* Has this architecture been fully initialized? */
87 int initialized_p;
88
89 /* An obstack bound to the lifetime of the architecture. */
90 struct obstack *obstack;
91
92 /* basic architectural information */
93 const struct bfd_arch_info * bfd_arch_info;
94 int byte_order;
95 enum gdb_osabi osabi;
96 const struct target_desc * target_desc;
97
98 /* target specific vector. */
99 struct gdbarch_tdep *tdep;
100 gdbarch_dump_tdep_ftype *dump_tdep;
101
102 /* per-architecture data-pointers */
103 unsigned nr_data;
104 void **data;
105
106 /* per-architecture swap-regions */
107 struct gdbarch_swap *swap;
108
109 /* Multi-arch values.
110
111 When extending this structure you must:
112
113 Add the field below.
114
115 Declare set/get functions and define the corresponding
116 macro in gdbarch.h.
117
118 gdbarch_alloc(): If zero/NULL is not a suitable default,
119 initialize the new field.
120
121 verify_gdbarch(): Confirm that the target updated the field
122 correctly.
123
124 gdbarch_dump(): Add a fprintf_unfiltered call so that the new
125 field is dumped out
126
127 ``startup_gdbarch()'': Append an initial value to the static
128 variable (base values on the host's c-type system).
129
130 get_gdbarch(): Implement the set/get functions (probably using
131 the macro's as shortcuts).
132
133 */
134
135 int short_bit;
136 int int_bit;
137 int long_bit;
138 int long_long_bit;
139 int float_bit;
140 const struct floatformat ** float_format;
141 int double_bit;
142 const struct floatformat ** double_format;
143 int long_double_bit;
144 const struct floatformat ** long_double_format;
145 int ptr_bit;
146 int addr_bit;
147 int bfd_vma_bit;
148 int char_signed;
149 gdbarch_read_pc_ftype *read_pc;
150 gdbarch_write_pc_ftype *write_pc;
151 gdbarch_read_sp_ftype *read_sp;
152 gdbarch_virtual_frame_pointer_ftype *virtual_frame_pointer;
153 gdbarch_pseudo_register_read_ftype *pseudo_register_read;
154 gdbarch_pseudo_register_write_ftype *pseudo_register_write;
155 int num_regs;
156 int num_pseudo_regs;
157 int sp_regnum;
158 int pc_regnum;
159 int ps_regnum;
160 int fp0_regnum;
161 gdbarch_stab_reg_to_regnum_ftype *stab_reg_to_regnum;
162 gdbarch_ecoff_reg_to_regnum_ftype *ecoff_reg_to_regnum;
163 gdbarch_dwarf_reg_to_regnum_ftype *dwarf_reg_to_regnum;
164 gdbarch_sdb_reg_to_regnum_ftype *sdb_reg_to_regnum;
165 gdbarch_dwarf2_reg_to_regnum_ftype *dwarf2_reg_to_regnum;
166 gdbarch_register_name_ftype *register_name;
167 gdbarch_register_type_ftype *register_type;
168 gdbarch_unwind_dummy_id_ftype *unwind_dummy_id;
169 int deprecated_fp_regnum;
170 gdbarch_push_dummy_call_ftype *push_dummy_call;
171 int deprecated_register_size;
172 int call_dummy_location;
173 gdbarch_push_dummy_code_ftype *push_dummy_code;
174 gdbarch_print_registers_info_ftype *print_registers_info;
175 gdbarch_print_float_info_ftype *print_float_info;
176 gdbarch_print_vector_info_ftype *print_vector_info;
177 gdbarch_register_sim_regno_ftype *register_sim_regno;
178 gdbarch_register_bytes_ok_ftype *register_bytes_ok;
179 gdbarch_cannot_fetch_register_ftype *cannot_fetch_register;
180 gdbarch_cannot_store_register_ftype *cannot_store_register;
181 gdbarch_get_longjmp_target_ftype *get_longjmp_target;
182 int believe_pcc_promotion;
183 gdbarch_convert_register_p_ftype *convert_register_p;
184 gdbarch_register_to_value_ftype *register_to_value;
185 gdbarch_value_to_register_ftype *value_to_register;
186 gdbarch_value_from_register_ftype *value_from_register;
187 gdbarch_pointer_to_address_ftype *pointer_to_address;
188 gdbarch_address_to_pointer_ftype *address_to_pointer;
189 gdbarch_integer_to_address_ftype *integer_to_address;
190 gdbarch_return_value_ftype *return_value;
191 gdbarch_extract_return_value_ftype *extract_return_value;
192 gdbarch_store_return_value_ftype *store_return_value;
193 gdbarch_deprecated_use_struct_convention_ftype *deprecated_use_struct_convention;
194 gdbarch_deprecated_extract_struct_value_address_ftype *deprecated_extract_struct_value_address;
195 gdbarch_skip_prologue_ftype *skip_prologue;
196 gdbarch_inner_than_ftype *inner_than;
197 gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc;
198 gdbarch_adjust_breakpoint_address_ftype *adjust_breakpoint_address;
199 gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint;
200 gdbarch_memory_remove_breakpoint_ftype *memory_remove_breakpoint;
201 CORE_ADDR decr_pc_after_break;
202 CORE_ADDR deprecated_function_start_offset;
203 gdbarch_remote_translate_xfer_address_ftype *remote_translate_xfer_address;
204 gdbarch_remote_register_number_ftype *remote_register_number;
205 gdbarch_fetch_tls_load_module_address_ftype *fetch_tls_load_module_address;
206 CORE_ADDR frame_args_skip;
207 gdbarch_unwind_pc_ftype *unwind_pc;
208 gdbarch_unwind_sp_ftype *unwind_sp;
209 gdbarch_frame_num_args_ftype *frame_num_args;
210 gdbarch_deprecated_stack_align_ftype *deprecated_stack_align;
211 gdbarch_frame_align_ftype *frame_align;
212 gdbarch_deprecated_reg_struct_has_addr_ftype *deprecated_reg_struct_has_addr;
213 gdbarch_stabs_argument_has_addr_ftype *stabs_argument_has_addr;
214 int frame_red_zone_size;
215 gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr;
216 gdbarch_addr_bits_remove_ftype *addr_bits_remove;
217 gdbarch_smash_text_address_ftype *smash_text_address;
218 gdbarch_software_single_step_ftype *software_single_step;
219 gdbarch_single_step_through_delay_ftype *single_step_through_delay;
220 gdbarch_print_insn_ftype *print_insn;
221 gdbarch_skip_trampoline_code_ftype *skip_trampoline_code;
222 gdbarch_skip_solib_resolver_ftype *skip_solib_resolver;
223 gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline;
224 gdbarch_in_function_epilogue_p_ftype *in_function_epilogue_p;
225 gdbarch_construct_inferior_arguments_ftype *construct_inferior_arguments;
226 gdbarch_elf_make_msymbol_special_ftype *elf_make_msymbol_special;
227 gdbarch_coff_make_msymbol_special_ftype *coff_make_msymbol_special;
228 const char * name_of_malloc;
229 int cannot_step_breakpoint;
230 int have_nonsteppable_watchpoint;
231 gdbarch_address_class_type_flags_ftype *address_class_type_flags;
232 gdbarch_address_class_type_flags_to_name_ftype *address_class_type_flags_to_name;
233 gdbarch_address_class_name_to_type_flags_ftype *address_class_name_to_type_flags;
234 gdbarch_register_reggroup_p_ftype *register_reggroup_p;
235 gdbarch_fetch_pointer_argument_ftype *fetch_pointer_argument;
236 gdbarch_regset_from_core_section_ftype *regset_from_core_section;
237 int vtable_function_descriptors;
238 int vbit_in_delta;
239 gdbarch_skip_permanent_breakpoint_ftype *skip_permanent_breakpoint;
240 };
241
242
243 /* The default architecture uses host values (for want of a better
244 choice). */
245
246 extern const struct bfd_arch_info bfd_default_arch_struct;
247
248 struct gdbarch startup_gdbarch =
249 {
250 1, /* Always initialized. */
251 NULL, /* The obstack. */
252 /* basic architecture information */
253 &bfd_default_arch_struct, /* bfd_arch_info */
254 BFD_ENDIAN_BIG, /* byte_order */
255 GDB_OSABI_UNKNOWN, /* osabi */
256 0, /* target_desc */
257 /* target specific vector and its dump routine */
258 NULL, NULL,
259 /*per-architecture data-pointers and swap regions */
260 0, NULL, NULL,
261 /* Multi-arch values */
262 8 * sizeof (short), /* short_bit */
263 8 * sizeof (int), /* int_bit */
264 8 * sizeof (long), /* long_bit */
265 8 * sizeof (LONGEST), /* long_long_bit */
266 8 * sizeof (float), /* float_bit */
267 0, /* float_format */
268 8 * sizeof (double), /* double_bit */
269 0, /* double_format */
270 8 * sizeof (long double), /* long_double_bit */
271 0, /* long_double_format */
272 8 * sizeof (void*), /* ptr_bit */
273 8 * sizeof (void*), /* addr_bit */
274 8 * sizeof (void*), /* bfd_vma_bit */
275 1, /* char_signed */
276 0, /* read_pc */
277 0, /* write_pc */
278 0, /* read_sp */
279 0, /* virtual_frame_pointer */
280 0, /* pseudo_register_read */
281 0, /* pseudo_register_write */
282 0, /* num_regs */
283 0, /* num_pseudo_regs */
284 -1, /* sp_regnum */
285 -1, /* pc_regnum */
286 -1, /* ps_regnum */
287 0, /* fp0_regnum */
288 0, /* stab_reg_to_regnum */
289 0, /* ecoff_reg_to_regnum */
290 0, /* dwarf_reg_to_regnum */
291 0, /* sdb_reg_to_regnum */
292 0, /* dwarf2_reg_to_regnum */
293 0, /* register_name */
294 0, /* register_type */
295 0, /* unwind_dummy_id */
296 -1, /* deprecated_fp_regnum */
297 0, /* push_dummy_call */
298 0, /* deprecated_register_size */
299 0, /* call_dummy_location */
300 0, /* push_dummy_code */
301 default_print_registers_info, /* print_registers_info */
302 0, /* print_float_info */
303 0, /* print_vector_info */
304 0, /* register_sim_regno */
305 0, /* register_bytes_ok */
306 0, /* cannot_fetch_register */
307 0, /* cannot_store_register */
308 0, /* get_longjmp_target */
309 0, /* believe_pcc_promotion */
310 0, /* convert_register_p */
311 0, /* register_to_value */
312 0, /* value_to_register */
313 0, /* value_from_register */
314 0, /* pointer_to_address */
315 0, /* address_to_pointer */
316 0, /* integer_to_address */
317 0, /* return_value */
318 0, /* extract_return_value */
319 0, /* store_return_value */
320 0, /* deprecated_use_struct_convention */
321 0, /* deprecated_extract_struct_value_address */
322 0, /* skip_prologue */
323 0, /* inner_than */
324 0, /* breakpoint_from_pc */
325 0, /* adjust_breakpoint_address */
326 0, /* memory_insert_breakpoint */
327 0, /* memory_remove_breakpoint */
328 0, /* decr_pc_after_break */
329 0, /* deprecated_function_start_offset */
330 generic_remote_translate_xfer_address, /* remote_translate_xfer_address */
331 default_remote_register_number, /* remote_register_number */
332 0, /* fetch_tls_load_module_address */
333 0, /* frame_args_skip */
334 0, /* unwind_pc */
335 0, /* unwind_sp */
336 0, /* frame_num_args */
337 0, /* deprecated_stack_align */
338 0, /* frame_align */
339 0, /* deprecated_reg_struct_has_addr */
340 default_stabs_argument_has_addr, /* stabs_argument_has_addr */
341 0, /* frame_red_zone_size */
342 convert_from_func_ptr_addr_identity, /* convert_from_func_ptr_addr */
343 0, /* addr_bits_remove */
344 0, /* smash_text_address */
345 0, /* software_single_step */
346 0, /* single_step_through_delay */
347 0, /* print_insn */
348 0, /* skip_trampoline_code */
349 generic_skip_solib_resolver, /* skip_solib_resolver */
350 0, /* in_solib_return_trampoline */
351 generic_in_function_epilogue_p, /* in_function_epilogue_p */
352 construct_inferior_arguments, /* construct_inferior_arguments */
353 0, /* elf_make_msymbol_special */
354 0, /* coff_make_msymbol_special */
355 "malloc", /* name_of_malloc */
356 0, /* cannot_step_breakpoint */
357 0, /* have_nonsteppable_watchpoint */
358 0, /* address_class_type_flags */
359 0, /* address_class_type_flags_to_name */
360 0, /* address_class_name_to_type_flags */
361 default_register_reggroup_p, /* register_reggroup_p */
362 0, /* fetch_pointer_argument */
363 0, /* regset_from_core_section */
364 0, /* vtable_function_descriptors */
365 0, /* vbit_in_delta */
366 0, /* skip_permanent_breakpoint */
367 /* startup_gdbarch() */
368 };
369
370 struct gdbarch *current_gdbarch = &startup_gdbarch;
371
372 /* Create a new ``struct gdbarch'' based on information provided by
373 ``struct gdbarch_info''. */
374
375 struct gdbarch *
376 gdbarch_alloc (const struct gdbarch_info *info,
377 struct gdbarch_tdep *tdep)
378 {
379 /* NOTE: The new architecture variable is named ``current_gdbarch''
380 so that macros such as TARGET_DOUBLE_BIT, when expanded, refer to
381 the current local architecture and not the previous global
382 architecture. This ensures that the new architectures initial
383 values are not influenced by the previous architecture. Once
384 everything is parameterised with gdbarch, this will go away. */
385 struct gdbarch *current_gdbarch;
386
387 /* Create an obstack for allocating all the per-architecture memory,
388 then use that to allocate the architecture vector. */
389 struct obstack *obstack = XMALLOC (struct obstack);
390 obstack_init (obstack);
391 current_gdbarch = obstack_alloc (obstack, sizeof (*current_gdbarch));
392 memset (current_gdbarch, 0, sizeof (*current_gdbarch));
393 current_gdbarch->obstack = obstack;
394
395 alloc_gdbarch_data (current_gdbarch);
396
397 current_gdbarch->tdep = tdep;
398
399 current_gdbarch->bfd_arch_info = info->bfd_arch_info;
400 current_gdbarch->byte_order = info->byte_order;
401 current_gdbarch->osabi = info->osabi;
402 current_gdbarch->target_desc = info->target_desc;
403
404 /* Force the explicit initialization of these. */
405 current_gdbarch->short_bit = 2*TARGET_CHAR_BIT;
406 current_gdbarch->int_bit = 4*TARGET_CHAR_BIT;
407 current_gdbarch->long_bit = 4*TARGET_CHAR_BIT;
408 current_gdbarch->long_long_bit = 2*TARGET_LONG_BIT;
409 current_gdbarch->float_bit = 4*TARGET_CHAR_BIT;
410 current_gdbarch->double_bit = 8*TARGET_CHAR_BIT;
411 current_gdbarch->long_double_bit = 8*TARGET_CHAR_BIT;
412 current_gdbarch->ptr_bit = TARGET_INT_BIT;
413 current_gdbarch->bfd_vma_bit = TARGET_ARCHITECTURE->bits_per_address;
414 current_gdbarch->char_signed = -1;
415 current_gdbarch->write_pc = generic_target_write_pc;
416 current_gdbarch->virtual_frame_pointer = legacy_virtual_frame_pointer;
417 current_gdbarch->num_regs = -1;
418 current_gdbarch->sp_regnum = -1;
419 current_gdbarch->pc_regnum = -1;
420 current_gdbarch->ps_regnum = -1;
421 current_gdbarch->fp0_regnum = -1;
422 current_gdbarch->stab_reg_to_regnum = no_op_reg_to_regnum;
423 current_gdbarch->ecoff_reg_to_regnum = no_op_reg_to_regnum;
424 current_gdbarch->dwarf_reg_to_regnum = no_op_reg_to_regnum;
425 current_gdbarch->sdb_reg_to_regnum = no_op_reg_to_regnum;
426 current_gdbarch->dwarf2_reg_to_regnum = no_op_reg_to_regnum;
427 current_gdbarch->deprecated_fp_regnum = -1;
428 current_gdbarch->call_dummy_location = AT_ENTRY_POINT;
429 current_gdbarch->print_registers_info = default_print_registers_info;
430 current_gdbarch->register_sim_regno = legacy_register_sim_regno;
431 current_gdbarch->cannot_fetch_register = cannot_register_not;
432 current_gdbarch->cannot_store_register = cannot_register_not;
433 current_gdbarch->convert_register_p = generic_convert_register_p;
434 current_gdbarch->value_from_register = default_value_from_register;
435 current_gdbarch->pointer_to_address = unsigned_pointer_to_address;
436 current_gdbarch->address_to_pointer = unsigned_address_to_pointer;
437 current_gdbarch->return_value = legacy_return_value;
438 current_gdbarch->deprecated_use_struct_convention = generic_use_struct_convention;
439 current_gdbarch->memory_insert_breakpoint = default_memory_insert_breakpoint;
440 current_gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint;
441 current_gdbarch->remote_translate_xfer_address = generic_remote_translate_xfer_address;
442 current_gdbarch->remote_register_number = default_remote_register_number;
443 current_gdbarch->stabs_argument_has_addr = default_stabs_argument_has_addr;
444 current_gdbarch->convert_from_func_ptr_addr = convert_from_func_ptr_addr_identity;
445 current_gdbarch->addr_bits_remove = core_addr_identity;
446 current_gdbarch->smash_text_address = core_addr_identity;
447 current_gdbarch->skip_trampoline_code = generic_skip_trampoline_code;
448 current_gdbarch->skip_solib_resolver = generic_skip_solib_resolver;
449 current_gdbarch->in_solib_return_trampoline = generic_in_solib_return_trampoline;
450 current_gdbarch->in_function_epilogue_p = generic_in_function_epilogue_p;
451 current_gdbarch->construct_inferior_arguments = construct_inferior_arguments;
452 current_gdbarch->elf_make_msymbol_special = default_elf_make_msymbol_special;
453 current_gdbarch->coff_make_msymbol_special = default_coff_make_msymbol_special;
454 current_gdbarch->name_of_malloc = "malloc";
455 current_gdbarch->register_reggroup_p = default_register_reggroup_p;
456 /* gdbarch_alloc() */
457
458 return current_gdbarch;
459 }
460
461
462 /* Allocate extra space using the per-architecture obstack. */
463
464 void *
465 gdbarch_obstack_zalloc (struct gdbarch *arch, long size)
466 {
467 void *data = obstack_alloc (arch->obstack, size);
468 memset (data, 0, size);
469 return data;
470 }
471
472
473 /* Free a gdbarch struct. This should never happen in normal
474 operation --- once you've created a gdbarch, you keep it around.
475 However, if an architecture's init function encounters an error
476 building the structure, it may need to clean up a partially
477 constructed gdbarch. */
478
479 void
480 gdbarch_free (struct gdbarch *arch)
481 {
482 struct obstack *obstack;
483 gdb_assert (arch != NULL);
484 gdb_assert (!arch->initialized_p);
485 obstack = arch->obstack;
486 obstack_free (obstack, 0); /* Includes the ARCH. */
487 xfree (obstack);
488 }
489
490
491 /* Ensure that all values in a GDBARCH are reasonable. */
492
493 /* NOTE/WARNING: The parameter is called ``current_gdbarch'' so that it
494 just happens to match the global variable ``current_gdbarch''. That
495 way macros refering to that variable get the local and not the global
496 version - ulgh. Once everything is parameterised with gdbarch, this
497 will go away. */
498
499 static void
500 verify_gdbarch (struct gdbarch *current_gdbarch)
501 {
502 struct ui_file *log;
503 struct cleanup *cleanups;
504 long dummy;
505 char *buf;
506 log = mem_fileopen ();
507 cleanups = make_cleanup_ui_file_delete (log);
508 /* fundamental */
509 if (current_gdbarch->byte_order == BFD_ENDIAN_UNKNOWN)
510 fprintf_unfiltered (log, "\n\tbyte-order");
511 if (current_gdbarch->bfd_arch_info == NULL)
512 fprintf_unfiltered (log, "\n\tbfd_arch_info");
513 /* Check those that need to be defined for the given multi-arch level. */
514 /* Skip verify of short_bit, invalid_p == 0 */
515 /* Skip verify of int_bit, invalid_p == 0 */
516 /* Skip verify of long_bit, invalid_p == 0 */
517 /* Skip verify of long_long_bit, invalid_p == 0 */
518 /* Skip verify of float_bit, invalid_p == 0 */
519 if (current_gdbarch->float_format == 0)
520 current_gdbarch->float_format = floatformats_ieee_single;
521 /* Skip verify of double_bit, invalid_p == 0 */
522 if (current_gdbarch->double_format == 0)
523 current_gdbarch->double_format = floatformats_ieee_double;
524 /* Skip verify of long_double_bit, invalid_p == 0 */
525 if (current_gdbarch->long_double_format == 0)
526 current_gdbarch->long_double_format = floatformats_ieee_double;
527 /* Skip verify of ptr_bit, invalid_p == 0 */
528 if (current_gdbarch->addr_bit == 0)
529 current_gdbarch->addr_bit = TARGET_PTR_BIT;
530 /* Skip verify of bfd_vma_bit, invalid_p == 0 */
531 if (current_gdbarch->char_signed == -1)
532 current_gdbarch->char_signed = 1;
533 /* Skip verify of read_pc, has predicate */
534 /* Skip verify of write_pc, invalid_p == 0 */
535 /* Skip verify of read_sp, has predicate */
536 /* Skip verify of virtual_frame_pointer, invalid_p == 0 */
537 /* Skip verify of pseudo_register_read, has predicate */
538 /* Skip verify of pseudo_register_write, has predicate */
539 if (current_gdbarch->num_regs == -1)
540 fprintf_unfiltered (log, "\n\tnum_regs");
541 /* Skip verify of num_pseudo_regs, invalid_p == 0 */
542 /* Skip verify of sp_regnum, invalid_p == 0 */
543 /* Skip verify of pc_regnum, invalid_p == 0 */
544 /* Skip verify of ps_regnum, invalid_p == 0 */
545 /* Skip verify of fp0_regnum, invalid_p == 0 */
546 /* Skip verify of stab_reg_to_regnum, invalid_p == 0 */
547 /* Skip verify of ecoff_reg_to_regnum, invalid_p == 0 */
548 /* Skip verify of dwarf_reg_to_regnum, invalid_p == 0 */
549 /* Skip verify of sdb_reg_to_regnum, invalid_p == 0 */
550 /* Skip verify of dwarf2_reg_to_regnum, invalid_p == 0 */
551 /* Skip verify of register_type, has predicate */
552 /* Skip verify of unwind_dummy_id, has predicate */
553 /* Skip verify of deprecated_fp_regnum, invalid_p == 0 */
554 /* Skip verify of push_dummy_call, has predicate */
555 /* Skip verify of call_dummy_location, invalid_p == 0 */
556 /* Skip verify of push_dummy_code, has predicate */
557 /* Skip verify of print_registers_info, invalid_p == 0 */
558 /* Skip verify of print_float_info, has predicate */
559 /* Skip verify of print_vector_info, has predicate */
560 /* Skip verify of register_sim_regno, invalid_p == 0 */
561 /* Skip verify of register_bytes_ok, has predicate */
562 /* Skip verify of cannot_fetch_register, invalid_p == 0 */
563 /* Skip verify of cannot_store_register, invalid_p == 0 */
564 /* Skip verify of get_longjmp_target, has predicate */
565 /* Skip verify of convert_register_p, invalid_p == 0 */
566 /* Skip verify of value_from_register, invalid_p == 0 */
567 /* Skip verify of pointer_to_address, invalid_p == 0 */
568 /* Skip verify of address_to_pointer, invalid_p == 0 */
569 /* Skip verify of integer_to_address, has predicate */
570 /* Skip verify of return_value, has predicate */
571 /* Skip verify of deprecated_use_struct_convention, invalid_p == 0 */
572 /* Skip verify of deprecated_extract_struct_value_address, has predicate */
573 if (current_gdbarch->skip_prologue == 0)
574 fprintf_unfiltered (log, "\n\tskip_prologue");
575 if (current_gdbarch->inner_than == 0)
576 fprintf_unfiltered (log, "\n\tinner_than");
577 if (current_gdbarch->breakpoint_from_pc == 0)
578 fprintf_unfiltered (log, "\n\tbreakpoint_from_pc");
579 /* Skip verify of adjust_breakpoint_address, has predicate */
580 /* Skip verify of memory_insert_breakpoint, invalid_p == 0 */
581 /* Skip verify of memory_remove_breakpoint, invalid_p == 0 */
582 /* Skip verify of decr_pc_after_break, invalid_p == 0 */
583 /* Skip verify of deprecated_function_start_offset, invalid_p == 0 */
584 /* Skip verify of remote_translate_xfer_address, invalid_p == 0 */
585 /* Skip verify of remote_register_number, invalid_p == 0 */
586 /* Skip verify of fetch_tls_load_module_address, has predicate */
587 /* Skip verify of frame_args_skip, invalid_p == 0 */
588 /* Skip verify of unwind_pc, has predicate */
589 /* Skip verify of unwind_sp, has predicate */
590 /* Skip verify of frame_num_args, has predicate */
591 /* Skip verify of deprecated_stack_align, has predicate */
592 /* Skip verify of frame_align, has predicate */
593 /* Skip verify of deprecated_reg_struct_has_addr, has predicate */
594 /* Skip verify of stabs_argument_has_addr, invalid_p == 0 */
595 /* Skip verify of convert_from_func_ptr_addr, invalid_p == 0 */
596 /* Skip verify of addr_bits_remove, invalid_p == 0 */
597 /* Skip verify of smash_text_address, invalid_p == 0 */
598 /* Skip verify of software_single_step, has predicate */
599 /* Skip verify of single_step_through_delay, has predicate */
600 if (current_gdbarch->print_insn == 0)
601 fprintf_unfiltered (log, "\n\tprint_insn");
602 /* Skip verify of skip_trampoline_code, invalid_p == 0 */
603 /* Skip verify of skip_solib_resolver, invalid_p == 0 */
604 /* Skip verify of in_solib_return_trampoline, invalid_p == 0 */
605 /* Skip verify of in_function_epilogue_p, invalid_p == 0 */
606 /* Skip verify of construct_inferior_arguments, invalid_p == 0 */
607 /* Skip verify of elf_make_msymbol_special, invalid_p == 0 */
608 /* Skip verify of coff_make_msymbol_special, invalid_p == 0 */
609 /* Skip verify of name_of_malloc, invalid_p == 0 */
610 /* Skip verify of cannot_step_breakpoint, invalid_p == 0 */
611 /* Skip verify of have_nonsteppable_watchpoint, invalid_p == 0 */
612 /* Skip verify of address_class_type_flags, has predicate */
613 /* Skip verify of address_class_type_flags_to_name, has predicate */
614 /* Skip verify of address_class_name_to_type_flags, has predicate */
615 /* Skip verify of register_reggroup_p, invalid_p == 0 */
616 /* Skip verify of fetch_pointer_argument, has predicate */
617 /* Skip verify of regset_from_core_section, has predicate */
618 /* Skip verify of vtable_function_descriptors, invalid_p == 0 */
619 /* Skip verify of vbit_in_delta, invalid_p == 0 */
620 /* Skip verify of skip_permanent_breakpoint, has predicate */
621 buf = ui_file_xstrdup (log, &dummy);
622 make_cleanup (xfree, buf);
623 if (strlen (buf) > 0)
624 internal_error (__FILE__, __LINE__,
625 _("verify_gdbarch: the following are invalid ...%s"),
626 buf);
627 do_cleanups (cleanups);
628 }
629
630
631 /* Print out the details of the current architecture. */
632
633 /* NOTE/WARNING: The parameter is called ``current_gdbarch'' so that it
634 just happens to match the global variable ``current_gdbarch''. That
635 way macros refering to that variable get the local and not the global
636 version - ulgh. Once everything is parameterised with gdbarch, this
637 will go away. */
638
639 void
640 gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file)
641 {
642 const char *gdb_xm_file = "<not-defined>";
643 const char *gdb_nm_file = "<not-defined>";
644 const char *gdb_tm_file = "<not-defined>";
645 #if defined (GDB_XM_FILE)
646 gdb_xm_file = GDB_XM_FILE;
647 #endif
648 fprintf_unfiltered (file,
649 "gdbarch_dump: GDB_XM_FILE = %s\n",
650 gdb_xm_file);
651 #if defined (GDB_NM_FILE)
652 gdb_nm_file = GDB_NM_FILE;
653 #endif
654 fprintf_unfiltered (file,
655 "gdbarch_dump: GDB_NM_FILE = %s\n",
656 gdb_nm_file);
657 #if defined (GDB_TM_FILE)
658 gdb_tm_file = GDB_TM_FILE;
659 #endif
660 fprintf_unfiltered (file,
661 "gdbarch_dump: GDB_TM_FILE = %s\n",
662 gdb_tm_file);
663 #ifdef TARGET_ADDR_BIT
664 fprintf_unfiltered (file,
665 "gdbarch_dump: TARGET_ADDR_BIT # %s\n",
666 XSTRING (TARGET_ADDR_BIT));
667 #endif
668 fprintf_unfiltered (file,
669 "gdbarch_dump: addr_bit = %s\n",
670 paddr_d (current_gdbarch->addr_bit));
671 #ifdef ADDR_BITS_REMOVE
672 fprintf_unfiltered (file,
673 "gdbarch_dump: %s # %s\n",
674 "ADDR_BITS_REMOVE(addr)",
675 XSTRING (ADDR_BITS_REMOVE (addr)));
676 #endif
677 fprintf_unfiltered (file,
678 "gdbarch_dump: addr_bits_remove = <0x%lx>\n",
679 (long) current_gdbarch->addr_bits_remove);
680 fprintf_unfiltered (file,
681 "gdbarch_dump: gdbarch_address_class_name_to_type_flags_p() = %d\n",
682 gdbarch_address_class_name_to_type_flags_p (current_gdbarch));
683 fprintf_unfiltered (file,
684 "gdbarch_dump: address_class_name_to_type_flags = <0x%lx>\n",
685 (long) current_gdbarch->address_class_name_to_type_flags);
686 #ifdef ADDRESS_CLASS_TYPE_FLAGS_P
687 fprintf_unfiltered (file,
688 "gdbarch_dump: %s # %s\n",
689 "ADDRESS_CLASS_TYPE_FLAGS_P()",
690 XSTRING (ADDRESS_CLASS_TYPE_FLAGS_P ()));
691 #endif
692 fprintf_unfiltered (file,
693 "gdbarch_dump: gdbarch_address_class_type_flags_p() = %d\n",
694 gdbarch_address_class_type_flags_p (current_gdbarch));
695 #ifdef ADDRESS_CLASS_TYPE_FLAGS
696 fprintf_unfiltered (file,
697 "gdbarch_dump: %s # %s\n",
698 "ADDRESS_CLASS_TYPE_FLAGS(byte_size, dwarf2_addr_class)",
699 XSTRING (ADDRESS_CLASS_TYPE_FLAGS (byte_size, dwarf2_addr_class)));
700 #endif
701 fprintf_unfiltered (file,
702 "gdbarch_dump: address_class_type_flags = <0x%lx>\n",
703 (long) current_gdbarch->address_class_type_flags);
704 fprintf_unfiltered (file,
705 "gdbarch_dump: gdbarch_address_class_type_flags_to_name_p() = %d\n",
706 gdbarch_address_class_type_flags_to_name_p (current_gdbarch));
707 fprintf_unfiltered (file,
708 "gdbarch_dump: address_class_type_flags_to_name = <0x%lx>\n",
709 (long) current_gdbarch->address_class_type_flags_to_name);
710 #ifdef ADDRESS_TO_POINTER
711 fprintf_unfiltered (file,
712 "gdbarch_dump: %s # %s\n",
713 "ADDRESS_TO_POINTER(type, buf, addr)",
714 XSTRING (ADDRESS_TO_POINTER (type, buf, addr)));
715 #endif
716 fprintf_unfiltered (file,
717 "gdbarch_dump: address_to_pointer = <0x%lx>\n",
718 (long) current_gdbarch->address_to_pointer);
719 fprintf_unfiltered (file,
720 "gdbarch_dump: gdbarch_adjust_breakpoint_address_p() = %d\n",
721 gdbarch_adjust_breakpoint_address_p (current_gdbarch));
722 fprintf_unfiltered (file,
723 "gdbarch_dump: adjust_breakpoint_address = <0x%lx>\n",
724 (long) current_gdbarch->adjust_breakpoint_address);
725 #ifdef BELIEVE_PCC_PROMOTION
726 fprintf_unfiltered (file,
727 "gdbarch_dump: BELIEVE_PCC_PROMOTION # %s\n",
728 XSTRING (BELIEVE_PCC_PROMOTION));
729 #endif
730 fprintf_unfiltered (file,
731 "gdbarch_dump: believe_pcc_promotion = %s\n",
732 paddr_d (current_gdbarch->believe_pcc_promotion));
733 #ifdef TARGET_ARCHITECTURE
734 fprintf_unfiltered (file,
735 "gdbarch_dump: TARGET_ARCHITECTURE # %s\n",
736 XSTRING (TARGET_ARCHITECTURE));
737 #endif
738 fprintf_unfiltered (file,
739 "gdbarch_dump: bfd_arch_info = %s\n",
740 TARGET_ARCHITECTURE->printable_name);
741 #ifdef TARGET_BFD_VMA_BIT
742 fprintf_unfiltered (file,
743 "gdbarch_dump: TARGET_BFD_VMA_BIT # %s\n",
744 XSTRING (TARGET_BFD_VMA_BIT));
745 #endif
746 fprintf_unfiltered (file,
747 "gdbarch_dump: bfd_vma_bit = %s\n",
748 paddr_d (current_gdbarch->bfd_vma_bit));
749 #ifdef BREAKPOINT_FROM_PC
750 fprintf_unfiltered (file,
751 "gdbarch_dump: %s # %s\n",
752 "BREAKPOINT_FROM_PC(pcptr, lenptr)",
753 XSTRING (BREAKPOINT_FROM_PC (pcptr, lenptr)));
754 #endif
755 fprintf_unfiltered (file,
756 "gdbarch_dump: breakpoint_from_pc = <0x%lx>\n",
757 (long) current_gdbarch->breakpoint_from_pc);
758 #ifdef TARGET_BYTE_ORDER
759 fprintf_unfiltered (file,
760 "gdbarch_dump: TARGET_BYTE_ORDER # %s\n",
761 XSTRING (TARGET_BYTE_ORDER));
762 #endif
763 fprintf_unfiltered (file,
764 "gdbarch_dump: byte_order = %s\n",
765 paddr_d (current_gdbarch->byte_order));
766 #ifdef CALL_DUMMY_LOCATION
767 fprintf_unfiltered (file,
768 "gdbarch_dump: CALL_DUMMY_LOCATION # %s\n",
769 XSTRING (CALL_DUMMY_LOCATION));
770 #endif
771 fprintf_unfiltered (file,
772 "gdbarch_dump: call_dummy_location = %s\n",
773 paddr_d (current_gdbarch->call_dummy_location));
774 #ifdef CANNOT_FETCH_REGISTER
775 fprintf_unfiltered (file,
776 "gdbarch_dump: %s # %s\n",
777 "CANNOT_FETCH_REGISTER(regnum)",
778 XSTRING (CANNOT_FETCH_REGISTER (regnum)));
779 #endif
780 fprintf_unfiltered (file,
781 "gdbarch_dump: cannot_fetch_register = <0x%lx>\n",
782 (long) current_gdbarch->cannot_fetch_register);
783 #ifdef CANNOT_STEP_BREAKPOINT
784 fprintf_unfiltered (file,
785 "gdbarch_dump: CANNOT_STEP_BREAKPOINT # %s\n",
786 XSTRING (CANNOT_STEP_BREAKPOINT));
787 #endif
788 fprintf_unfiltered (file,
789 "gdbarch_dump: cannot_step_breakpoint = %s\n",
790 paddr_d (current_gdbarch->cannot_step_breakpoint));
791 #ifdef CANNOT_STORE_REGISTER
792 fprintf_unfiltered (file,
793 "gdbarch_dump: %s # %s\n",
794 "CANNOT_STORE_REGISTER(regnum)",
795 XSTRING (CANNOT_STORE_REGISTER (regnum)));
796 #endif
797 fprintf_unfiltered (file,
798 "gdbarch_dump: cannot_store_register = <0x%lx>\n",
799 (long) current_gdbarch->cannot_store_register);
800 #ifdef TARGET_CHAR_SIGNED
801 fprintf_unfiltered (file,
802 "gdbarch_dump: TARGET_CHAR_SIGNED # %s\n",
803 XSTRING (TARGET_CHAR_SIGNED));
804 #endif
805 fprintf_unfiltered (file,
806 "gdbarch_dump: char_signed = %s\n",
807 paddr_d (current_gdbarch->char_signed));
808 #ifdef COFF_MAKE_MSYMBOL_SPECIAL
809 fprintf_unfiltered (file,
810 "gdbarch_dump: %s # %s\n",
811 "COFF_MAKE_MSYMBOL_SPECIAL(val, msym)",
812 XSTRING (COFF_MAKE_MSYMBOL_SPECIAL (val, msym)));
813 #endif
814 fprintf_unfiltered (file,
815 "gdbarch_dump: coff_make_msymbol_special = <0x%lx>\n",
816 (long) current_gdbarch->coff_make_msymbol_special);
817 fprintf_unfiltered (file,
818 "gdbarch_dump: construct_inferior_arguments = <0x%lx>\n",
819 (long) current_gdbarch->construct_inferior_arguments);
820 fprintf_unfiltered (file,
821 "gdbarch_dump: convert_from_func_ptr_addr = <0x%lx>\n",
822 (long) current_gdbarch->convert_from_func_ptr_addr);
823 #ifdef CONVERT_REGISTER_P
824 fprintf_unfiltered (file,
825 "gdbarch_dump: %s # %s\n",
826 "CONVERT_REGISTER_P(regnum, type)",
827 XSTRING (CONVERT_REGISTER_P (regnum, type)));
828 #endif
829 fprintf_unfiltered (file,
830 "gdbarch_dump: convert_register_p = <0x%lx>\n",
831 (long) current_gdbarch->convert_register_p);
832 #ifdef DECR_PC_AFTER_BREAK
833 fprintf_unfiltered (file,
834 "gdbarch_dump: DECR_PC_AFTER_BREAK # %s\n",
835 XSTRING (DECR_PC_AFTER_BREAK));
836 #endif
837 fprintf_unfiltered (file,
838 "gdbarch_dump: decr_pc_after_break = 0x%s\n",
839 paddr_nz (current_gdbarch->decr_pc_after_break));
840 #ifdef DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P
841 fprintf_unfiltered (file,
842 "gdbarch_dump: %s # %s\n",
843 "DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P()",
844 XSTRING (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P ()));
845 #endif
846 fprintf_unfiltered (file,
847 "gdbarch_dump: gdbarch_deprecated_extract_struct_value_address_p() = %d\n",
848 gdbarch_deprecated_extract_struct_value_address_p (current_gdbarch));
849 #ifdef DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS
850 fprintf_unfiltered (file,
851 "gdbarch_dump: %s # %s\n",
852 "DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(regcache)",
853 XSTRING (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS (regcache)));
854 #endif
855 fprintf_unfiltered (file,
856 "gdbarch_dump: deprecated_extract_struct_value_address = <0x%lx>\n",
857 (long) current_gdbarch->deprecated_extract_struct_value_address);
858 #ifdef DEPRECATED_FP_REGNUM
859 fprintf_unfiltered (file,
860 "gdbarch_dump: DEPRECATED_FP_REGNUM # %s\n",
861 XSTRING (DEPRECATED_FP_REGNUM));
862 #endif
863 fprintf_unfiltered (file,
864 "gdbarch_dump: deprecated_fp_regnum = %s\n",
865 paddr_d (current_gdbarch->deprecated_fp_regnum));
866 #ifdef DEPRECATED_FUNCTION_START_OFFSET
867 fprintf_unfiltered (file,
868 "gdbarch_dump: DEPRECATED_FUNCTION_START_OFFSET # %s\n",
869 XSTRING (DEPRECATED_FUNCTION_START_OFFSET));
870 #endif
871 fprintf_unfiltered (file,
872 "gdbarch_dump: deprecated_function_start_offset = 0x%s\n",
873 paddr_nz (current_gdbarch->deprecated_function_start_offset));
874 #ifdef DEPRECATED_REG_STRUCT_HAS_ADDR_P
875 fprintf_unfiltered (file,
876 "gdbarch_dump: %s # %s\n",
877 "DEPRECATED_REG_STRUCT_HAS_ADDR_P()",
878 XSTRING (DEPRECATED_REG_STRUCT_HAS_ADDR_P ()));
879 #endif
880 fprintf_unfiltered (file,
881 "gdbarch_dump: gdbarch_deprecated_reg_struct_has_addr_p() = %d\n",
882 gdbarch_deprecated_reg_struct_has_addr_p (current_gdbarch));
883 #ifdef DEPRECATED_REG_STRUCT_HAS_ADDR
884 fprintf_unfiltered (file,
885 "gdbarch_dump: %s # %s\n",
886 "DEPRECATED_REG_STRUCT_HAS_ADDR(gcc_p, type)",
887 XSTRING (DEPRECATED_REG_STRUCT_HAS_ADDR (gcc_p, type)));
888 #endif
889 fprintf_unfiltered (file,
890 "gdbarch_dump: deprecated_reg_struct_has_addr = <0x%lx>\n",
891 (long) current_gdbarch->deprecated_reg_struct_has_addr);
892 #ifdef DEPRECATED_REGISTER_SIZE
893 fprintf_unfiltered (file,
894 "gdbarch_dump: DEPRECATED_REGISTER_SIZE # %s\n",
895 XSTRING (DEPRECATED_REGISTER_SIZE));
896 #endif
897 fprintf_unfiltered (file,
898 "gdbarch_dump: deprecated_register_size = %s\n",
899 paddr_d (current_gdbarch->deprecated_register_size));
900 #ifdef DEPRECATED_STACK_ALIGN_P
901 fprintf_unfiltered (file,
902 "gdbarch_dump: %s # %s\n",
903 "DEPRECATED_STACK_ALIGN_P()",
904 XSTRING (DEPRECATED_STACK_ALIGN_P ()));
905 #endif
906 fprintf_unfiltered (file,
907 "gdbarch_dump: gdbarch_deprecated_stack_align_p() = %d\n",
908 gdbarch_deprecated_stack_align_p (current_gdbarch));
909 #ifdef DEPRECATED_STACK_ALIGN
910 fprintf_unfiltered (file,
911 "gdbarch_dump: %s # %s\n",
912 "DEPRECATED_STACK_ALIGN(sp)",
913 XSTRING (DEPRECATED_STACK_ALIGN (sp)));
914 #endif
915 fprintf_unfiltered (file,
916 "gdbarch_dump: deprecated_stack_align = <0x%lx>\n",
917 (long) current_gdbarch->deprecated_stack_align);
918 #ifdef DEPRECATED_USE_STRUCT_CONVENTION
919 fprintf_unfiltered (file,
920 "gdbarch_dump: %s # %s\n",
921 "DEPRECATED_USE_STRUCT_CONVENTION(gcc_p, value_type)",
922 XSTRING (DEPRECATED_USE_STRUCT_CONVENTION (gcc_p, value_type)));
923 #endif
924 fprintf_unfiltered (file,
925 "gdbarch_dump: deprecated_use_struct_convention = <0x%lx>\n",
926 (long) current_gdbarch->deprecated_use_struct_convention);
927 #ifdef TARGET_DOUBLE_BIT
928 fprintf_unfiltered (file,
929 "gdbarch_dump: TARGET_DOUBLE_BIT # %s\n",
930 XSTRING (TARGET_DOUBLE_BIT));
931 #endif
932 fprintf_unfiltered (file,
933 "gdbarch_dump: double_bit = %s\n",
934 paddr_d (current_gdbarch->double_bit));
935 #ifdef TARGET_DOUBLE_FORMAT
936 fprintf_unfiltered (file,
937 "gdbarch_dump: TARGET_DOUBLE_FORMAT # %s\n",
938 XSTRING (TARGET_DOUBLE_FORMAT));
939 #endif
940 fprintf_unfiltered (file,
941 "gdbarch_dump: double_format = %s\n",
942 pformat (current_gdbarch->double_format));
943 #ifdef DWARF2_REG_TO_REGNUM
944 fprintf_unfiltered (file,
945 "gdbarch_dump: %s # %s\n",
946 "DWARF2_REG_TO_REGNUM(dwarf2_regnr)",
947 XSTRING (DWARF2_REG_TO_REGNUM (dwarf2_regnr)));
948 #endif
949 fprintf_unfiltered (file,
950 "gdbarch_dump: dwarf2_reg_to_regnum = <0x%lx>\n",
951 (long) current_gdbarch->dwarf2_reg_to_regnum);
952 #ifdef DWARF_REG_TO_REGNUM
953 fprintf_unfiltered (file,
954 "gdbarch_dump: %s # %s\n",
955 "DWARF_REG_TO_REGNUM(dwarf_regnr)",
956 XSTRING (DWARF_REG_TO_REGNUM (dwarf_regnr)));
957 #endif
958 fprintf_unfiltered (file,
959 "gdbarch_dump: dwarf_reg_to_regnum = <0x%lx>\n",
960 (long) current_gdbarch->dwarf_reg_to_regnum);
961 #ifdef ECOFF_REG_TO_REGNUM
962 fprintf_unfiltered (file,
963 "gdbarch_dump: %s # %s\n",
964 "ECOFF_REG_TO_REGNUM(ecoff_regnr)",
965 XSTRING (ECOFF_REG_TO_REGNUM (ecoff_regnr)));
966 #endif
967 fprintf_unfiltered (file,
968 "gdbarch_dump: ecoff_reg_to_regnum = <0x%lx>\n",
969 (long) current_gdbarch->ecoff_reg_to_regnum);
970 #ifdef ELF_MAKE_MSYMBOL_SPECIAL
971 fprintf_unfiltered (file,
972 "gdbarch_dump: %s # %s\n",
973 "ELF_MAKE_MSYMBOL_SPECIAL(sym, msym)",
974 XSTRING (ELF_MAKE_MSYMBOL_SPECIAL (sym, msym)));
975 #endif
976 fprintf_unfiltered (file,
977 "gdbarch_dump: elf_make_msymbol_special = <0x%lx>\n",
978 (long) current_gdbarch->elf_make_msymbol_special);
979 #ifdef EXTRACT_RETURN_VALUE
980 fprintf_unfiltered (file,
981 "gdbarch_dump: %s # %s\n",
982 "EXTRACT_RETURN_VALUE(type, regcache, valbuf)",
983 XSTRING (EXTRACT_RETURN_VALUE (type, regcache, valbuf)));
984 #endif
985 fprintf_unfiltered (file,
986 "gdbarch_dump: extract_return_value = <0x%lx>\n",
987 (long) current_gdbarch->extract_return_value);
988 #ifdef FETCH_POINTER_ARGUMENT_P
989 fprintf_unfiltered (file,
990 "gdbarch_dump: %s # %s\n",
991 "FETCH_POINTER_ARGUMENT_P()",
992 XSTRING (FETCH_POINTER_ARGUMENT_P ()));
993 #endif
994 fprintf_unfiltered (file,
995 "gdbarch_dump: gdbarch_fetch_pointer_argument_p() = %d\n",
996 gdbarch_fetch_pointer_argument_p (current_gdbarch));
997 #ifdef FETCH_POINTER_ARGUMENT
998 fprintf_unfiltered (file,
999 "gdbarch_dump: %s # %s\n",
1000 "FETCH_POINTER_ARGUMENT(frame, argi, type)",
1001 XSTRING (FETCH_POINTER_ARGUMENT (frame, argi, type)));
1002 #endif
1003 fprintf_unfiltered (file,
1004 "gdbarch_dump: fetch_pointer_argument = <0x%lx>\n",
1005 (long) current_gdbarch->fetch_pointer_argument);
1006 #ifdef FETCH_TLS_LOAD_MODULE_ADDRESS_P
1007 fprintf_unfiltered (file,
1008 "gdbarch_dump: %s # %s\n",
1009 "FETCH_TLS_LOAD_MODULE_ADDRESS_P()",
1010 XSTRING (FETCH_TLS_LOAD_MODULE_ADDRESS_P ()));
1011 #endif
1012 fprintf_unfiltered (file,
1013 "gdbarch_dump: gdbarch_fetch_tls_load_module_address_p() = %d\n",
1014 gdbarch_fetch_tls_load_module_address_p (current_gdbarch));
1015 #ifdef FETCH_TLS_LOAD_MODULE_ADDRESS
1016 fprintf_unfiltered (file,
1017 "gdbarch_dump: %s # %s\n",
1018 "FETCH_TLS_LOAD_MODULE_ADDRESS(objfile)",
1019 XSTRING (FETCH_TLS_LOAD_MODULE_ADDRESS (objfile)));
1020 #endif
1021 fprintf_unfiltered (file,
1022 "gdbarch_dump: fetch_tls_load_module_address = <0x%lx>\n",
1023 (long) current_gdbarch->fetch_tls_load_module_address);
1024 #ifdef TARGET_FLOAT_BIT
1025 fprintf_unfiltered (file,
1026 "gdbarch_dump: TARGET_FLOAT_BIT # %s\n",
1027 XSTRING (TARGET_FLOAT_BIT));
1028 #endif
1029 fprintf_unfiltered (file,
1030 "gdbarch_dump: float_bit = %s\n",
1031 paddr_d (current_gdbarch->float_bit));
1032 #ifdef TARGET_FLOAT_FORMAT
1033 fprintf_unfiltered (file,
1034 "gdbarch_dump: TARGET_FLOAT_FORMAT # %s\n",
1035 XSTRING (TARGET_FLOAT_FORMAT));
1036 #endif
1037 fprintf_unfiltered (file,
1038 "gdbarch_dump: float_format = %s\n",
1039 pformat (current_gdbarch->float_format));
1040 #ifdef FP0_REGNUM
1041 fprintf_unfiltered (file,
1042 "gdbarch_dump: FP0_REGNUM # %s\n",
1043 XSTRING (FP0_REGNUM));
1044 #endif
1045 fprintf_unfiltered (file,
1046 "gdbarch_dump: fp0_regnum = %s\n",
1047 paddr_d (current_gdbarch->fp0_regnum));
1048 fprintf_unfiltered (file,
1049 "gdbarch_dump: gdbarch_frame_align_p() = %d\n",
1050 gdbarch_frame_align_p (current_gdbarch));
1051 fprintf_unfiltered (file,
1052 "gdbarch_dump: frame_align = <0x%lx>\n",
1053 (long) current_gdbarch->frame_align);
1054 #ifdef FRAME_ARGS_SKIP
1055 fprintf_unfiltered (file,
1056 "gdbarch_dump: FRAME_ARGS_SKIP # %s\n",
1057 XSTRING (FRAME_ARGS_SKIP));
1058 #endif
1059 fprintf_unfiltered (file,
1060 "gdbarch_dump: frame_args_skip = 0x%s\n",
1061 paddr_nz (current_gdbarch->frame_args_skip));
1062 #ifdef FRAME_NUM_ARGS_P
1063 fprintf_unfiltered (file,
1064 "gdbarch_dump: %s # %s\n",
1065 "FRAME_NUM_ARGS_P()",
1066 XSTRING (FRAME_NUM_ARGS_P ()));
1067 #endif
1068 fprintf_unfiltered (file,
1069 "gdbarch_dump: gdbarch_frame_num_args_p() = %d\n",
1070 gdbarch_frame_num_args_p (current_gdbarch));
1071 #ifdef FRAME_NUM_ARGS
1072 fprintf_unfiltered (file,
1073 "gdbarch_dump: %s # %s\n",
1074 "FRAME_NUM_ARGS(frame)",
1075 XSTRING (FRAME_NUM_ARGS (frame)));
1076 #endif
1077 fprintf_unfiltered (file,
1078 "gdbarch_dump: frame_num_args = <0x%lx>\n",
1079 (long) current_gdbarch->frame_num_args);
1080 #ifdef FRAME_RED_ZONE_SIZE
1081 fprintf_unfiltered (file,
1082 "gdbarch_dump: FRAME_RED_ZONE_SIZE # %s\n",
1083 XSTRING (FRAME_RED_ZONE_SIZE));
1084 #endif
1085 fprintf_unfiltered (file,
1086 "gdbarch_dump: frame_red_zone_size = %s\n",
1087 paddr_d (current_gdbarch->frame_red_zone_size));
1088 #ifdef GET_LONGJMP_TARGET_P
1089 fprintf_unfiltered (file,
1090 "gdbarch_dump: %s # %s\n",
1091 "GET_LONGJMP_TARGET_P()",
1092 XSTRING (GET_LONGJMP_TARGET_P ()));
1093 #endif
1094 fprintf_unfiltered (file,
1095 "gdbarch_dump: gdbarch_get_longjmp_target_p() = %d\n",
1096 gdbarch_get_longjmp_target_p (current_gdbarch));
1097 #ifdef GET_LONGJMP_TARGET
1098 fprintf_unfiltered (file,
1099 "gdbarch_dump: %s # %s\n",
1100 "GET_LONGJMP_TARGET(pc)",
1101 XSTRING (GET_LONGJMP_TARGET (pc)));
1102 #endif
1103 fprintf_unfiltered (file,
1104 "gdbarch_dump: get_longjmp_target = <0x%lx>\n",
1105 (long) current_gdbarch->get_longjmp_target);
1106 #ifdef HAVE_NONSTEPPABLE_WATCHPOINT
1107 fprintf_unfiltered (file,
1108 "gdbarch_dump: HAVE_NONSTEPPABLE_WATCHPOINT # %s\n",
1109 XSTRING (HAVE_NONSTEPPABLE_WATCHPOINT));
1110 #endif
1111 fprintf_unfiltered (file,
1112 "gdbarch_dump: have_nonsteppable_watchpoint = %s\n",
1113 paddr_d (current_gdbarch->have_nonsteppable_watchpoint));
1114 fprintf_unfiltered (file,
1115 "gdbarch_dump: in_function_epilogue_p = <0x%lx>\n",
1116 (long) current_gdbarch->in_function_epilogue_p);
1117 #ifdef IN_SOLIB_RETURN_TRAMPOLINE
1118 fprintf_unfiltered (file,
1119 "gdbarch_dump: %s # %s\n",
1120 "IN_SOLIB_RETURN_TRAMPOLINE(pc, name)",
1121 XSTRING (IN_SOLIB_RETURN_TRAMPOLINE (pc, name)));
1122 #endif
1123 fprintf_unfiltered (file,
1124 "gdbarch_dump: in_solib_return_trampoline = <0x%lx>\n",
1125 (long) current_gdbarch->in_solib_return_trampoline);
1126 #ifdef INNER_THAN
1127 fprintf_unfiltered (file,
1128 "gdbarch_dump: %s # %s\n",
1129 "INNER_THAN(lhs, rhs)",
1130 XSTRING (INNER_THAN (lhs, rhs)));
1131 #endif
1132 fprintf_unfiltered (file,
1133 "gdbarch_dump: inner_than = <0x%lx>\n",
1134 (long) current_gdbarch->inner_than);
1135 #ifdef TARGET_INT_BIT
1136 fprintf_unfiltered (file,
1137 "gdbarch_dump: TARGET_INT_BIT # %s\n",
1138 XSTRING (TARGET_INT_BIT));
1139 #endif
1140 fprintf_unfiltered (file,
1141 "gdbarch_dump: int_bit = %s\n",
1142 paddr_d (current_gdbarch->int_bit));
1143 fprintf_unfiltered (file,
1144 "gdbarch_dump: gdbarch_integer_to_address_p() = %d\n",
1145 gdbarch_integer_to_address_p (current_gdbarch));
1146 fprintf_unfiltered (file,
1147 "gdbarch_dump: integer_to_address = <0x%lx>\n",
1148 (long) current_gdbarch->integer_to_address);
1149 #ifdef TARGET_LONG_BIT
1150 fprintf_unfiltered (file,
1151 "gdbarch_dump: TARGET_LONG_BIT # %s\n",
1152 XSTRING (TARGET_LONG_BIT));
1153 #endif
1154 fprintf_unfiltered (file,
1155 "gdbarch_dump: long_bit = %s\n",
1156 paddr_d (current_gdbarch->long_bit));
1157 #ifdef TARGET_LONG_DOUBLE_BIT
1158 fprintf_unfiltered (file,
1159 "gdbarch_dump: TARGET_LONG_DOUBLE_BIT # %s\n",
1160 XSTRING (TARGET_LONG_DOUBLE_BIT));
1161 #endif
1162 fprintf_unfiltered (file,
1163 "gdbarch_dump: long_double_bit = %s\n",
1164 paddr_d (current_gdbarch->long_double_bit));
1165 #ifdef TARGET_LONG_DOUBLE_FORMAT
1166 fprintf_unfiltered (file,
1167 "gdbarch_dump: TARGET_LONG_DOUBLE_FORMAT # %s\n",
1168 XSTRING (TARGET_LONG_DOUBLE_FORMAT));
1169 #endif
1170 fprintf_unfiltered (file,
1171 "gdbarch_dump: long_double_format = %s\n",
1172 pformat (current_gdbarch->long_double_format));
1173 #ifdef TARGET_LONG_LONG_BIT
1174 fprintf_unfiltered (file,
1175 "gdbarch_dump: TARGET_LONG_LONG_BIT # %s\n",
1176 XSTRING (TARGET_LONG_LONG_BIT));
1177 #endif
1178 fprintf_unfiltered (file,
1179 "gdbarch_dump: long_long_bit = %s\n",
1180 paddr_d (current_gdbarch->long_long_bit));
1181 #ifdef MEMORY_INSERT_BREAKPOINT
1182 fprintf_unfiltered (file,
1183 "gdbarch_dump: %s # %s\n",
1184 "MEMORY_INSERT_BREAKPOINT(bp_tgt)",
1185 XSTRING (MEMORY_INSERT_BREAKPOINT (bp_tgt)));
1186 #endif
1187 fprintf_unfiltered (file,
1188 "gdbarch_dump: memory_insert_breakpoint = <0x%lx>\n",
1189 (long) current_gdbarch->memory_insert_breakpoint);
1190 #ifdef MEMORY_REMOVE_BREAKPOINT
1191 fprintf_unfiltered (file,
1192 "gdbarch_dump: %s # %s\n",
1193 "MEMORY_REMOVE_BREAKPOINT(bp_tgt)",
1194 XSTRING (MEMORY_REMOVE_BREAKPOINT (bp_tgt)));
1195 #endif
1196 fprintf_unfiltered (file,
1197 "gdbarch_dump: memory_remove_breakpoint = <0x%lx>\n",
1198 (long) current_gdbarch->memory_remove_breakpoint);
1199 #ifdef NAME_OF_MALLOC
1200 fprintf_unfiltered (file,
1201 "gdbarch_dump: NAME_OF_MALLOC # %s\n",
1202 XSTRING (NAME_OF_MALLOC));
1203 #endif
1204 fprintf_unfiltered (file,
1205 "gdbarch_dump: name_of_malloc = %s\n",
1206 NAME_OF_MALLOC);
1207 #ifdef NUM_PSEUDO_REGS
1208 fprintf_unfiltered (file,
1209 "gdbarch_dump: NUM_PSEUDO_REGS # %s\n",
1210 XSTRING (NUM_PSEUDO_REGS));
1211 #endif
1212 fprintf_unfiltered (file,
1213 "gdbarch_dump: num_pseudo_regs = %s\n",
1214 paddr_d (current_gdbarch->num_pseudo_regs));
1215 #ifdef NUM_REGS
1216 fprintf_unfiltered (file,
1217 "gdbarch_dump: NUM_REGS # %s\n",
1218 XSTRING (NUM_REGS));
1219 #endif
1220 fprintf_unfiltered (file,
1221 "gdbarch_dump: num_regs = %s\n",
1222 paddr_d (current_gdbarch->num_regs));
1223 #ifdef TARGET_OSABI
1224 fprintf_unfiltered (file,
1225 "gdbarch_dump: TARGET_OSABI # %s\n",
1226 XSTRING (TARGET_OSABI));
1227 #endif
1228 fprintf_unfiltered (file,
1229 "gdbarch_dump: osabi = %s\n",
1230 paddr_d (current_gdbarch->osabi));
1231 #ifdef PC_REGNUM
1232 fprintf_unfiltered (file,
1233 "gdbarch_dump: PC_REGNUM # %s\n",
1234 XSTRING (PC_REGNUM));
1235 #endif
1236 fprintf_unfiltered (file,
1237 "gdbarch_dump: pc_regnum = %s\n",
1238 paddr_d (current_gdbarch->pc_regnum));
1239 #ifdef POINTER_TO_ADDRESS
1240 fprintf_unfiltered (file,
1241 "gdbarch_dump: %s # %s\n",
1242 "POINTER_TO_ADDRESS(type, buf)",
1243 XSTRING (POINTER_TO_ADDRESS (type, buf)));
1244 #endif
1245 fprintf_unfiltered (file,
1246 "gdbarch_dump: pointer_to_address = <0x%lx>\n",
1247 (long) current_gdbarch->pointer_to_address);
1248 fprintf_unfiltered (file,
1249 "gdbarch_dump: gdbarch_print_float_info_p() = %d\n",
1250 gdbarch_print_float_info_p (current_gdbarch));
1251 fprintf_unfiltered (file,
1252 "gdbarch_dump: print_float_info = <0x%lx>\n",
1253 (long) current_gdbarch->print_float_info);
1254 #ifdef TARGET_PRINT_INSN
1255 fprintf_unfiltered (file,
1256 "gdbarch_dump: %s # %s\n",
1257 "TARGET_PRINT_INSN(vma, info)",
1258 XSTRING (TARGET_PRINT_INSN (vma, info)));
1259 #endif
1260 fprintf_unfiltered (file,
1261 "gdbarch_dump: print_insn = <0x%lx>\n",
1262 (long) current_gdbarch->print_insn);
1263 fprintf_unfiltered (file,
1264 "gdbarch_dump: print_registers_info = <0x%lx>\n",
1265 (long) current_gdbarch->print_registers_info);
1266 fprintf_unfiltered (file,
1267 "gdbarch_dump: gdbarch_print_vector_info_p() = %d\n",
1268 gdbarch_print_vector_info_p (current_gdbarch));
1269 fprintf_unfiltered (file,
1270 "gdbarch_dump: print_vector_info = <0x%lx>\n",
1271 (long) current_gdbarch->print_vector_info);
1272 #ifdef PS_REGNUM
1273 fprintf_unfiltered (file,
1274 "gdbarch_dump: PS_REGNUM # %s\n",
1275 XSTRING (PS_REGNUM));
1276 #endif
1277 fprintf_unfiltered (file,
1278 "gdbarch_dump: ps_regnum = %s\n",
1279 paddr_d (current_gdbarch->ps_regnum));
1280 fprintf_unfiltered (file,
1281 "gdbarch_dump: gdbarch_pseudo_register_read_p() = %d\n",
1282 gdbarch_pseudo_register_read_p (current_gdbarch));
1283 fprintf_unfiltered (file,
1284 "gdbarch_dump: pseudo_register_read = <0x%lx>\n",
1285 (long) current_gdbarch->pseudo_register_read);
1286 fprintf_unfiltered (file,
1287 "gdbarch_dump: gdbarch_pseudo_register_write_p() = %d\n",
1288 gdbarch_pseudo_register_write_p (current_gdbarch));
1289 fprintf_unfiltered (file,
1290 "gdbarch_dump: pseudo_register_write = <0x%lx>\n",
1291 (long) current_gdbarch->pseudo_register_write);
1292 #ifdef TARGET_PTR_BIT
1293 fprintf_unfiltered (file,
1294 "gdbarch_dump: TARGET_PTR_BIT # %s\n",
1295 XSTRING (TARGET_PTR_BIT));
1296 #endif
1297 fprintf_unfiltered (file,
1298 "gdbarch_dump: ptr_bit = %s\n",
1299 paddr_d (current_gdbarch->ptr_bit));
1300 fprintf_unfiltered (file,
1301 "gdbarch_dump: gdbarch_push_dummy_call_p() = %d\n",
1302 gdbarch_push_dummy_call_p (current_gdbarch));
1303 fprintf_unfiltered (file,
1304 "gdbarch_dump: push_dummy_call = <0x%lx>\n",
1305 (long) current_gdbarch->push_dummy_call);
1306 fprintf_unfiltered (file,
1307 "gdbarch_dump: gdbarch_push_dummy_code_p() = %d\n",
1308 gdbarch_push_dummy_code_p (current_gdbarch));
1309 fprintf_unfiltered (file,
1310 "gdbarch_dump: push_dummy_code = <0x%lx>\n",
1311 (long) current_gdbarch->push_dummy_code);
1312 #ifdef TARGET_READ_PC_P
1313 fprintf_unfiltered (file,
1314 "gdbarch_dump: %s # %s\n",
1315 "TARGET_READ_PC_P()",
1316 XSTRING (TARGET_READ_PC_P ()));
1317 #endif
1318 fprintf_unfiltered (file,
1319 "gdbarch_dump: gdbarch_read_pc_p() = %d\n",
1320 gdbarch_read_pc_p (current_gdbarch));
1321 #ifdef TARGET_READ_PC
1322 fprintf_unfiltered (file,
1323 "gdbarch_dump: %s # %s\n",
1324 "TARGET_READ_PC(ptid)",
1325 XSTRING (TARGET_READ_PC (ptid)));
1326 #endif
1327 fprintf_unfiltered (file,
1328 "gdbarch_dump: read_pc = <0x%lx>\n",
1329 (long) current_gdbarch->read_pc);
1330 #ifdef TARGET_READ_SP_P
1331 fprintf_unfiltered (file,
1332 "gdbarch_dump: %s # %s\n",
1333 "TARGET_READ_SP_P()",
1334 XSTRING (TARGET_READ_SP_P ()));
1335 #endif
1336 fprintf_unfiltered (file,
1337 "gdbarch_dump: gdbarch_read_sp_p() = %d\n",
1338 gdbarch_read_sp_p (current_gdbarch));
1339 #ifdef TARGET_READ_SP
1340 fprintf_unfiltered (file,
1341 "gdbarch_dump: %s # %s\n",
1342 "TARGET_READ_SP()",
1343 XSTRING (TARGET_READ_SP ()));
1344 #endif
1345 fprintf_unfiltered (file,
1346 "gdbarch_dump: read_sp = <0x%lx>\n",
1347 (long) current_gdbarch->read_sp);
1348 #ifdef REGISTER_BYTES_OK_P
1349 fprintf_unfiltered (file,
1350 "gdbarch_dump: %s # %s\n",
1351 "REGISTER_BYTES_OK_P()",
1352 XSTRING (REGISTER_BYTES_OK_P ()));
1353 #endif
1354 fprintf_unfiltered (file,
1355 "gdbarch_dump: gdbarch_register_bytes_ok_p() = %d\n",
1356 gdbarch_register_bytes_ok_p (current_gdbarch));
1357 #ifdef REGISTER_BYTES_OK
1358 fprintf_unfiltered (file,
1359 "gdbarch_dump: %s # %s\n",
1360 "REGISTER_BYTES_OK(nr_bytes)",
1361 XSTRING (REGISTER_BYTES_OK (nr_bytes)));
1362 #endif
1363 fprintf_unfiltered (file,
1364 "gdbarch_dump: register_bytes_ok = <0x%lx>\n",
1365 (long) current_gdbarch->register_bytes_ok);
1366 #ifdef REGISTER_NAME
1367 fprintf_unfiltered (file,
1368 "gdbarch_dump: %s # %s\n",
1369 "REGISTER_NAME(regnr)",
1370 XSTRING (REGISTER_NAME (regnr)));
1371 #endif
1372 fprintf_unfiltered (file,
1373 "gdbarch_dump: register_name = <0x%lx>\n",
1374 (long) current_gdbarch->register_name);
1375 fprintf_unfiltered (file,
1376 "gdbarch_dump: register_reggroup_p = <0x%lx>\n",
1377 (long) current_gdbarch->register_reggroup_p);
1378 #ifdef REGISTER_SIM_REGNO
1379 fprintf_unfiltered (file,
1380 "gdbarch_dump: %s # %s\n",
1381 "REGISTER_SIM_REGNO(reg_nr)",
1382 XSTRING (REGISTER_SIM_REGNO (reg_nr)));
1383 #endif
1384 fprintf_unfiltered (file,
1385 "gdbarch_dump: register_sim_regno = <0x%lx>\n",
1386 (long) current_gdbarch->register_sim_regno);
1387 #ifdef REGISTER_TO_VALUE
1388 fprintf_unfiltered (file,
1389 "gdbarch_dump: %s # %s\n",
1390 "REGISTER_TO_VALUE(frame, regnum, type, buf)",
1391 XSTRING (REGISTER_TO_VALUE (frame, regnum, type, buf)));
1392 #endif
1393 fprintf_unfiltered (file,
1394 "gdbarch_dump: register_to_value = <0x%lx>\n",
1395 (long) current_gdbarch->register_to_value);
1396 fprintf_unfiltered (file,
1397 "gdbarch_dump: gdbarch_register_type_p() = %d\n",
1398 gdbarch_register_type_p (current_gdbarch));
1399 fprintf_unfiltered (file,
1400 "gdbarch_dump: register_type = <0x%lx>\n",
1401 (long) current_gdbarch->register_type);
1402 fprintf_unfiltered (file,
1403 "gdbarch_dump: gdbarch_regset_from_core_section_p() = %d\n",
1404 gdbarch_regset_from_core_section_p (current_gdbarch));
1405 fprintf_unfiltered (file,
1406 "gdbarch_dump: regset_from_core_section = <0x%lx>\n",
1407 (long) current_gdbarch->regset_from_core_section);
1408 fprintf_unfiltered (file,
1409 "gdbarch_dump: remote_register_number = <0x%lx>\n",
1410 (long) current_gdbarch->remote_register_number);
1411 fprintf_unfiltered (file,
1412 "gdbarch_dump: remote_translate_xfer_address = <0x%lx>\n",
1413 (long) current_gdbarch->remote_translate_xfer_address);
1414 fprintf_unfiltered (file,
1415 "gdbarch_dump: gdbarch_return_value_p() = %d\n",
1416 gdbarch_return_value_p (current_gdbarch));
1417 fprintf_unfiltered (file,
1418 "gdbarch_dump: return_value = <0x%lx>\n",
1419 (long) current_gdbarch->return_value);
1420 #ifdef SDB_REG_TO_REGNUM
1421 fprintf_unfiltered (file,
1422 "gdbarch_dump: %s # %s\n",
1423 "SDB_REG_TO_REGNUM(sdb_regnr)",
1424 XSTRING (SDB_REG_TO_REGNUM (sdb_regnr)));
1425 #endif
1426 fprintf_unfiltered (file,
1427 "gdbarch_dump: sdb_reg_to_regnum = <0x%lx>\n",
1428 (long) current_gdbarch->sdb_reg_to_regnum);
1429 #ifdef TARGET_SHORT_BIT
1430 fprintf_unfiltered (file,
1431 "gdbarch_dump: TARGET_SHORT_BIT # %s\n",
1432 XSTRING (TARGET_SHORT_BIT));
1433 #endif
1434 fprintf_unfiltered (file,
1435 "gdbarch_dump: short_bit = %s\n",
1436 paddr_d (current_gdbarch->short_bit));
1437 fprintf_unfiltered (file,
1438 "gdbarch_dump: gdbarch_single_step_through_delay_p() = %d\n",
1439 gdbarch_single_step_through_delay_p (current_gdbarch));
1440 fprintf_unfiltered (file,
1441 "gdbarch_dump: single_step_through_delay = <0x%lx>\n",
1442 (long) current_gdbarch->single_step_through_delay);
1443 fprintf_unfiltered (file,
1444 "gdbarch_dump: gdbarch_skip_permanent_breakpoint_p() = %d\n",
1445 gdbarch_skip_permanent_breakpoint_p (current_gdbarch));
1446 fprintf_unfiltered (file,
1447 "gdbarch_dump: skip_permanent_breakpoint = <0x%lx>\n",
1448 (long) current_gdbarch->skip_permanent_breakpoint);
1449 #ifdef SKIP_PROLOGUE
1450 fprintf_unfiltered (file,
1451 "gdbarch_dump: %s # %s\n",
1452 "SKIP_PROLOGUE(ip)",
1453 XSTRING (SKIP_PROLOGUE (ip)));
1454 #endif
1455 fprintf_unfiltered (file,
1456 "gdbarch_dump: skip_prologue = <0x%lx>\n",
1457 (long) current_gdbarch->skip_prologue);
1458 fprintf_unfiltered (file,
1459 "gdbarch_dump: skip_solib_resolver = <0x%lx>\n",
1460 (long) current_gdbarch->skip_solib_resolver);
1461 #ifdef SKIP_TRAMPOLINE_CODE
1462 fprintf_unfiltered (file,
1463 "gdbarch_dump: %s # %s\n",
1464 "SKIP_TRAMPOLINE_CODE(pc)",
1465 XSTRING (SKIP_TRAMPOLINE_CODE (pc)));
1466 #endif
1467 fprintf_unfiltered (file,
1468 "gdbarch_dump: skip_trampoline_code = <0x%lx>\n",
1469 (long) current_gdbarch->skip_trampoline_code);
1470 #ifdef SMASH_TEXT_ADDRESS
1471 fprintf_unfiltered (file,
1472 "gdbarch_dump: %s # %s\n",
1473 "SMASH_TEXT_ADDRESS(addr)",
1474 XSTRING (SMASH_TEXT_ADDRESS (addr)));
1475 #endif
1476 fprintf_unfiltered (file,
1477 "gdbarch_dump: smash_text_address = <0x%lx>\n",
1478 (long) current_gdbarch->smash_text_address);
1479 #ifdef SOFTWARE_SINGLE_STEP_P
1480 fprintf_unfiltered (file,
1481 "gdbarch_dump: %s # %s\n",
1482 "SOFTWARE_SINGLE_STEP_P()",
1483 XSTRING (SOFTWARE_SINGLE_STEP_P ()));
1484 #endif
1485 fprintf_unfiltered (file,
1486 "gdbarch_dump: gdbarch_software_single_step_p() = %d\n",
1487 gdbarch_software_single_step_p (current_gdbarch));
1488 #ifdef SOFTWARE_SINGLE_STEP
1489 fprintf_unfiltered (file,
1490 "gdbarch_dump: %s # %s\n",
1491 "SOFTWARE_SINGLE_STEP(regcache)",
1492 XSTRING (SOFTWARE_SINGLE_STEP (regcache)));
1493 #endif
1494 fprintf_unfiltered (file,
1495 "gdbarch_dump: software_single_step = <0x%lx>\n",
1496 (long) current_gdbarch->software_single_step);
1497 #ifdef SP_REGNUM
1498 fprintf_unfiltered (file,
1499 "gdbarch_dump: SP_REGNUM # %s\n",
1500 XSTRING (SP_REGNUM));
1501 #endif
1502 fprintf_unfiltered (file,
1503 "gdbarch_dump: sp_regnum = %s\n",
1504 paddr_d (current_gdbarch->sp_regnum));
1505 #ifdef STAB_REG_TO_REGNUM
1506 fprintf_unfiltered (file,
1507 "gdbarch_dump: %s # %s\n",
1508 "STAB_REG_TO_REGNUM(stab_regnr)",
1509 XSTRING (STAB_REG_TO_REGNUM (stab_regnr)));
1510 #endif
1511 fprintf_unfiltered (file,
1512 "gdbarch_dump: stab_reg_to_regnum = <0x%lx>\n",
1513 (long) current_gdbarch->stab_reg_to_regnum);
1514 fprintf_unfiltered (file,
1515 "gdbarch_dump: stabs_argument_has_addr = <0x%lx>\n",
1516 (long) current_gdbarch->stabs_argument_has_addr);
1517 #ifdef STORE_RETURN_VALUE
1518 fprintf_unfiltered (file,
1519 "gdbarch_dump: %s # %s\n",
1520 "STORE_RETURN_VALUE(type, regcache, valbuf)",
1521 XSTRING (STORE_RETURN_VALUE (type, regcache, valbuf)));
1522 #endif
1523 fprintf_unfiltered (file,
1524 "gdbarch_dump: store_return_value = <0x%lx>\n",
1525 (long) current_gdbarch->store_return_value);
1526 fprintf_unfiltered (file,
1527 "gdbarch_dump: target_desc = %s\n",
1528 paddr_d ((long) current_gdbarch->target_desc));
1529 fprintf_unfiltered (file,
1530 "gdbarch_dump: gdbarch_unwind_dummy_id_p() = %d\n",
1531 gdbarch_unwind_dummy_id_p (current_gdbarch));
1532 fprintf_unfiltered (file,
1533 "gdbarch_dump: unwind_dummy_id = <0x%lx>\n",
1534 (long) current_gdbarch->unwind_dummy_id);
1535 fprintf_unfiltered (file,
1536 "gdbarch_dump: gdbarch_unwind_pc_p() = %d\n",
1537 gdbarch_unwind_pc_p (current_gdbarch));
1538 fprintf_unfiltered (file,
1539 "gdbarch_dump: unwind_pc = <0x%lx>\n",
1540 (long) current_gdbarch->unwind_pc);
1541 fprintf_unfiltered (file,
1542 "gdbarch_dump: gdbarch_unwind_sp_p() = %d\n",
1543 gdbarch_unwind_sp_p (current_gdbarch));
1544 fprintf_unfiltered (file,
1545 "gdbarch_dump: unwind_sp = <0x%lx>\n",
1546 (long) current_gdbarch->unwind_sp);
1547 fprintf_unfiltered (file,
1548 "gdbarch_dump: value_from_register = <0x%lx>\n",
1549 (long) current_gdbarch->value_from_register);
1550 #ifdef VALUE_TO_REGISTER
1551 fprintf_unfiltered (file,
1552 "gdbarch_dump: %s # %s\n",
1553 "VALUE_TO_REGISTER(frame, regnum, type, buf)",
1554 XSTRING (VALUE_TO_REGISTER (frame, regnum, type, buf)));
1555 #endif
1556 fprintf_unfiltered (file,
1557 "gdbarch_dump: value_to_register = <0x%lx>\n",
1558 (long) current_gdbarch->value_to_register);
1559 fprintf_unfiltered (file,
1560 "gdbarch_dump: vbit_in_delta = %s\n",
1561 paddr_d (current_gdbarch->vbit_in_delta));
1562 #ifdef TARGET_VIRTUAL_FRAME_POINTER
1563 fprintf_unfiltered (file,
1564 "gdbarch_dump: %s # %s\n",
1565 "TARGET_VIRTUAL_FRAME_POINTER(pc, frame_regnum, frame_offset)",
1566 XSTRING (TARGET_VIRTUAL_FRAME_POINTER (pc, frame_regnum, frame_offset)));
1567 #endif
1568 fprintf_unfiltered (file,
1569 "gdbarch_dump: virtual_frame_pointer = <0x%lx>\n",
1570 (long) current_gdbarch->virtual_frame_pointer);
1571 fprintf_unfiltered (file,
1572 "gdbarch_dump: vtable_function_descriptors = %s\n",
1573 paddr_d (current_gdbarch->vtable_function_descriptors));
1574 #ifdef TARGET_WRITE_PC
1575 fprintf_unfiltered (file,
1576 "gdbarch_dump: %s # %s\n",
1577 "TARGET_WRITE_PC(val, ptid)",
1578 XSTRING (TARGET_WRITE_PC (val, ptid)));
1579 #endif
1580 fprintf_unfiltered (file,
1581 "gdbarch_dump: write_pc = <0x%lx>\n",
1582 (long) current_gdbarch->write_pc);
1583 if (current_gdbarch->dump_tdep != NULL)
1584 current_gdbarch->dump_tdep (current_gdbarch, file);
1585 }
1586
1587 struct gdbarch_tdep *
1588 gdbarch_tdep (struct gdbarch *gdbarch)
1589 {
1590 if (gdbarch_debug >= 2)
1591 fprintf_unfiltered (gdb_stdlog, "gdbarch_tdep called\n");
1592 return gdbarch->tdep;
1593 }
1594
1595
1596 const struct bfd_arch_info *
1597 gdbarch_bfd_arch_info (struct gdbarch *gdbarch)
1598 {
1599 gdb_assert (gdbarch != NULL);
1600 if (gdbarch_debug >= 2)
1601 fprintf_unfiltered (gdb_stdlog, "gdbarch_bfd_arch_info called\n");
1602 return gdbarch->bfd_arch_info;
1603 }
1604
1605 int
1606 gdbarch_byte_order (struct gdbarch *gdbarch)
1607 {
1608 gdb_assert (gdbarch != NULL);
1609 if (gdbarch_debug >= 2)
1610 fprintf_unfiltered (gdb_stdlog, "gdbarch_byte_order called\n");
1611 return gdbarch->byte_order;
1612 }
1613
1614 enum gdb_osabi
1615 gdbarch_osabi (struct gdbarch *gdbarch)
1616 {
1617 gdb_assert (gdbarch != NULL);
1618 if (gdbarch_debug >= 2)
1619 fprintf_unfiltered (gdb_stdlog, "gdbarch_osabi called\n");
1620 return gdbarch->osabi;
1621 }
1622
1623 const struct target_desc *
1624 gdbarch_target_desc (struct gdbarch *gdbarch)
1625 {
1626 gdb_assert (gdbarch != NULL);
1627 if (gdbarch_debug >= 2)
1628 fprintf_unfiltered (gdb_stdlog, "gdbarch_target_desc called\n");
1629 return gdbarch->target_desc;
1630 }
1631
1632 int
1633 gdbarch_short_bit (struct gdbarch *gdbarch)
1634 {
1635 gdb_assert (gdbarch != NULL);
1636 /* Skip verify of short_bit, invalid_p == 0 */
1637 if (gdbarch_debug >= 2)
1638 fprintf_unfiltered (gdb_stdlog, "gdbarch_short_bit called\n");
1639 return gdbarch->short_bit;
1640 }
1641
1642 void
1643 set_gdbarch_short_bit (struct gdbarch *gdbarch,
1644 int short_bit)
1645 {
1646 gdbarch->short_bit = short_bit;
1647 }
1648
1649 int
1650 gdbarch_int_bit (struct gdbarch *gdbarch)
1651 {
1652 gdb_assert (gdbarch != NULL);
1653 /* Skip verify of int_bit, invalid_p == 0 */
1654 if (gdbarch_debug >= 2)
1655 fprintf_unfiltered (gdb_stdlog, "gdbarch_int_bit called\n");
1656 return gdbarch->int_bit;
1657 }
1658
1659 void
1660 set_gdbarch_int_bit (struct gdbarch *gdbarch,
1661 int int_bit)
1662 {
1663 gdbarch->int_bit = int_bit;
1664 }
1665
1666 int
1667 gdbarch_long_bit (struct gdbarch *gdbarch)
1668 {
1669 gdb_assert (gdbarch != NULL);
1670 /* Skip verify of long_bit, invalid_p == 0 */
1671 if (gdbarch_debug >= 2)
1672 fprintf_unfiltered (gdb_stdlog, "gdbarch_long_bit called\n");
1673 return gdbarch->long_bit;
1674 }
1675
1676 void
1677 set_gdbarch_long_bit (struct gdbarch *gdbarch,
1678 int long_bit)
1679 {
1680 gdbarch->long_bit = long_bit;
1681 }
1682
1683 int
1684 gdbarch_long_long_bit (struct gdbarch *gdbarch)
1685 {
1686 gdb_assert (gdbarch != NULL);
1687 /* Skip verify of long_long_bit, invalid_p == 0 */
1688 if (gdbarch_debug >= 2)
1689 fprintf_unfiltered (gdb_stdlog, "gdbarch_long_long_bit called\n");
1690 return gdbarch->long_long_bit;
1691 }
1692
1693 void
1694 set_gdbarch_long_long_bit (struct gdbarch *gdbarch,
1695 int long_long_bit)
1696 {
1697 gdbarch->long_long_bit = long_long_bit;
1698 }
1699
1700 int
1701 gdbarch_float_bit (struct gdbarch *gdbarch)
1702 {
1703 gdb_assert (gdbarch != NULL);
1704 /* Skip verify of float_bit, invalid_p == 0 */
1705 if (gdbarch_debug >= 2)
1706 fprintf_unfiltered (gdb_stdlog, "gdbarch_float_bit called\n");
1707 return gdbarch->float_bit;
1708 }
1709
1710 void
1711 set_gdbarch_float_bit (struct gdbarch *gdbarch,
1712 int float_bit)
1713 {
1714 gdbarch->float_bit = float_bit;
1715 }
1716
1717 const struct floatformat **
1718 gdbarch_float_format (struct gdbarch *gdbarch)
1719 {
1720 gdb_assert (gdbarch != NULL);
1721 if (gdbarch_debug >= 2)
1722 fprintf_unfiltered (gdb_stdlog, "gdbarch_float_format called\n");
1723 return gdbarch->float_format;
1724 }
1725
1726 void
1727 set_gdbarch_float_format (struct gdbarch *gdbarch,
1728 const struct floatformat ** float_format)
1729 {
1730 gdbarch->float_format = float_format;
1731 }
1732
1733 int
1734 gdbarch_double_bit (struct gdbarch *gdbarch)
1735 {
1736 gdb_assert (gdbarch != NULL);
1737 /* Skip verify of double_bit, invalid_p == 0 */
1738 if (gdbarch_debug >= 2)
1739 fprintf_unfiltered (gdb_stdlog, "gdbarch_double_bit called\n");
1740 return gdbarch->double_bit;
1741 }
1742
1743 void
1744 set_gdbarch_double_bit (struct gdbarch *gdbarch,
1745 int double_bit)
1746 {
1747 gdbarch->double_bit = double_bit;
1748 }
1749
1750 const struct floatformat **
1751 gdbarch_double_format (struct gdbarch *gdbarch)
1752 {
1753 gdb_assert (gdbarch != NULL);
1754 if (gdbarch_debug >= 2)
1755 fprintf_unfiltered (gdb_stdlog, "gdbarch_double_format called\n");
1756 return gdbarch->double_format;
1757 }
1758
1759 void
1760 set_gdbarch_double_format (struct gdbarch *gdbarch,
1761 const struct floatformat ** double_format)
1762 {
1763 gdbarch->double_format = double_format;
1764 }
1765
1766 int
1767 gdbarch_long_double_bit (struct gdbarch *gdbarch)
1768 {
1769 gdb_assert (gdbarch != NULL);
1770 /* Skip verify of long_double_bit, invalid_p == 0 */
1771 if (gdbarch_debug >= 2)
1772 fprintf_unfiltered (gdb_stdlog, "gdbarch_long_double_bit called\n");
1773 return gdbarch->long_double_bit;
1774 }
1775
1776 void
1777 set_gdbarch_long_double_bit (struct gdbarch *gdbarch,
1778 int long_double_bit)
1779 {
1780 gdbarch->long_double_bit = long_double_bit;
1781 }
1782
1783 const struct floatformat **
1784 gdbarch_long_double_format (struct gdbarch *gdbarch)
1785 {
1786 gdb_assert (gdbarch != NULL);
1787 if (gdbarch_debug >= 2)
1788 fprintf_unfiltered (gdb_stdlog, "gdbarch_long_double_format called\n");
1789 return gdbarch->long_double_format;
1790 }
1791
1792 void
1793 set_gdbarch_long_double_format (struct gdbarch *gdbarch,
1794 const struct floatformat ** long_double_format)
1795 {
1796 gdbarch->long_double_format = long_double_format;
1797 }
1798
1799 int
1800 gdbarch_ptr_bit (struct gdbarch *gdbarch)
1801 {
1802 gdb_assert (gdbarch != NULL);
1803 /* Skip verify of ptr_bit, invalid_p == 0 */
1804 if (gdbarch_debug >= 2)
1805 fprintf_unfiltered (gdb_stdlog, "gdbarch_ptr_bit called\n");
1806 return gdbarch->ptr_bit;
1807 }
1808
1809 void
1810 set_gdbarch_ptr_bit (struct gdbarch *gdbarch,
1811 int ptr_bit)
1812 {
1813 gdbarch->ptr_bit = ptr_bit;
1814 }
1815
1816 int
1817 gdbarch_addr_bit (struct gdbarch *gdbarch)
1818 {
1819 gdb_assert (gdbarch != NULL);
1820 /* Check variable changed from pre-default. */
1821 gdb_assert (gdbarch->addr_bit != 0);
1822 if (gdbarch_debug >= 2)
1823 fprintf_unfiltered (gdb_stdlog, "gdbarch_addr_bit called\n");
1824 return gdbarch->addr_bit;
1825 }
1826
1827 void
1828 set_gdbarch_addr_bit (struct gdbarch *gdbarch,
1829 int addr_bit)
1830 {
1831 gdbarch->addr_bit = addr_bit;
1832 }
1833
1834 int
1835 gdbarch_bfd_vma_bit (struct gdbarch *gdbarch)
1836 {
1837 gdb_assert (gdbarch != NULL);
1838 /* Skip verify of bfd_vma_bit, invalid_p == 0 */
1839 if (gdbarch_debug >= 2)
1840 fprintf_unfiltered (gdb_stdlog, "gdbarch_bfd_vma_bit called\n");
1841 return gdbarch->bfd_vma_bit;
1842 }
1843
1844 void
1845 set_gdbarch_bfd_vma_bit (struct gdbarch *gdbarch,
1846 int bfd_vma_bit)
1847 {
1848 gdbarch->bfd_vma_bit = bfd_vma_bit;
1849 }
1850
1851 int
1852 gdbarch_char_signed (struct gdbarch *gdbarch)
1853 {
1854 gdb_assert (gdbarch != NULL);
1855 /* Check variable changed from pre-default. */
1856 gdb_assert (gdbarch->char_signed != -1);
1857 if (gdbarch_debug >= 2)
1858 fprintf_unfiltered (gdb_stdlog, "gdbarch_char_signed called\n");
1859 return gdbarch->char_signed;
1860 }
1861
1862 void
1863 set_gdbarch_char_signed (struct gdbarch *gdbarch,
1864 int char_signed)
1865 {
1866 gdbarch->char_signed = char_signed;
1867 }
1868
1869 int
1870 gdbarch_read_pc_p (struct gdbarch *gdbarch)
1871 {
1872 gdb_assert (gdbarch != NULL);
1873 return gdbarch->read_pc != NULL;
1874 }
1875
1876 CORE_ADDR
1877 gdbarch_read_pc (struct gdbarch *gdbarch, ptid_t ptid)
1878 {
1879 gdb_assert (gdbarch != NULL);
1880 gdb_assert (gdbarch->read_pc != NULL);
1881 if (gdbarch_debug >= 2)
1882 fprintf_unfiltered (gdb_stdlog, "gdbarch_read_pc called\n");
1883 return gdbarch->read_pc (ptid);
1884 }
1885
1886 void
1887 set_gdbarch_read_pc (struct gdbarch *gdbarch,
1888 gdbarch_read_pc_ftype read_pc)
1889 {
1890 gdbarch->read_pc = read_pc;
1891 }
1892
1893 void
1894 gdbarch_write_pc (struct gdbarch *gdbarch, CORE_ADDR val, ptid_t ptid)
1895 {
1896 gdb_assert (gdbarch != NULL);
1897 gdb_assert (gdbarch->write_pc != NULL);
1898 if (gdbarch_debug >= 2)
1899 fprintf_unfiltered (gdb_stdlog, "gdbarch_write_pc called\n");
1900 gdbarch->write_pc (val, ptid);
1901 }
1902
1903 void
1904 set_gdbarch_write_pc (struct gdbarch *gdbarch,
1905 gdbarch_write_pc_ftype write_pc)
1906 {
1907 gdbarch->write_pc = write_pc;
1908 }
1909
1910 int
1911 gdbarch_read_sp_p (struct gdbarch *gdbarch)
1912 {
1913 gdb_assert (gdbarch != NULL);
1914 return gdbarch->read_sp != NULL;
1915 }
1916
1917 CORE_ADDR
1918 gdbarch_read_sp (struct gdbarch *gdbarch)
1919 {
1920 gdb_assert (gdbarch != NULL);
1921 gdb_assert (gdbarch->read_sp != NULL);
1922 if (gdbarch_debug >= 2)
1923 fprintf_unfiltered (gdb_stdlog, "gdbarch_read_sp called\n");
1924 return gdbarch->read_sp ();
1925 }
1926
1927 void
1928 set_gdbarch_read_sp (struct gdbarch *gdbarch,
1929 gdbarch_read_sp_ftype read_sp)
1930 {
1931 gdbarch->read_sp = read_sp;
1932 }
1933
1934 void
1935 gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset)
1936 {
1937 gdb_assert (gdbarch != NULL);
1938 gdb_assert (gdbarch->virtual_frame_pointer != NULL);
1939 if (gdbarch_debug >= 2)
1940 fprintf_unfiltered (gdb_stdlog, "gdbarch_virtual_frame_pointer called\n");
1941 gdbarch->virtual_frame_pointer (pc, frame_regnum, frame_offset);
1942 }
1943
1944 void
1945 set_gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch,
1946 gdbarch_virtual_frame_pointer_ftype virtual_frame_pointer)
1947 {
1948 gdbarch->virtual_frame_pointer = virtual_frame_pointer;
1949 }
1950
1951 int
1952 gdbarch_pseudo_register_read_p (struct gdbarch *gdbarch)
1953 {
1954 gdb_assert (gdbarch != NULL);
1955 return gdbarch->pseudo_register_read != NULL;
1956 }
1957
1958 void
1959 gdbarch_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, gdb_byte *buf)
1960 {
1961 gdb_assert (gdbarch != NULL);
1962 gdb_assert (gdbarch->pseudo_register_read != NULL);
1963 if (gdbarch_debug >= 2)
1964 fprintf_unfiltered (gdb_stdlog, "gdbarch_pseudo_register_read called\n");
1965 gdbarch->pseudo_register_read (gdbarch, regcache, cookednum, buf);
1966 }
1967
1968 void
1969 set_gdbarch_pseudo_register_read (struct gdbarch *gdbarch,
1970 gdbarch_pseudo_register_read_ftype pseudo_register_read)
1971 {
1972 gdbarch->pseudo_register_read = pseudo_register_read;
1973 }
1974
1975 int
1976 gdbarch_pseudo_register_write_p (struct gdbarch *gdbarch)
1977 {
1978 gdb_assert (gdbarch != NULL);
1979 return gdbarch->pseudo_register_write != NULL;
1980 }
1981
1982 void
1983 gdbarch_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, const gdb_byte *buf)
1984 {
1985 gdb_assert (gdbarch != NULL);
1986 gdb_assert (gdbarch->pseudo_register_write != NULL);
1987 if (gdbarch_debug >= 2)
1988 fprintf_unfiltered (gdb_stdlog, "gdbarch_pseudo_register_write called\n");
1989 gdbarch->pseudo_register_write (gdbarch, regcache, cookednum, buf);
1990 }
1991
1992 void
1993 set_gdbarch_pseudo_register_write (struct gdbarch *gdbarch,
1994 gdbarch_pseudo_register_write_ftype pseudo_register_write)
1995 {
1996 gdbarch->pseudo_register_write = pseudo_register_write;
1997 }
1998
1999 int
2000 gdbarch_num_regs (struct gdbarch *gdbarch)
2001 {
2002 gdb_assert (gdbarch != NULL);
2003 /* Check variable changed from pre-default. */
2004 gdb_assert (gdbarch->num_regs != -1);
2005 if (gdbarch_debug >= 2)
2006 fprintf_unfiltered (gdb_stdlog, "gdbarch_num_regs called\n");
2007 return gdbarch->num_regs;
2008 }
2009
2010 void
2011 set_gdbarch_num_regs (struct gdbarch *gdbarch,
2012 int num_regs)
2013 {
2014 gdbarch->num_regs = num_regs;
2015 }
2016
2017 int
2018 gdbarch_num_pseudo_regs (struct gdbarch *gdbarch)
2019 {
2020 gdb_assert (gdbarch != NULL);
2021 /* Skip verify of num_pseudo_regs, invalid_p == 0 */
2022 if (gdbarch_debug >= 2)
2023 fprintf_unfiltered (gdb_stdlog, "gdbarch_num_pseudo_regs called\n");
2024 return gdbarch->num_pseudo_regs;
2025 }
2026
2027 void
2028 set_gdbarch_num_pseudo_regs (struct gdbarch *gdbarch,
2029 int num_pseudo_regs)
2030 {
2031 gdbarch->num_pseudo_regs = num_pseudo_regs;
2032 }
2033
2034 int
2035 gdbarch_sp_regnum (struct gdbarch *gdbarch)
2036 {
2037 gdb_assert (gdbarch != NULL);
2038 /* Skip verify of sp_regnum, invalid_p == 0 */
2039 if (gdbarch_debug >= 2)
2040 fprintf_unfiltered (gdb_stdlog, "gdbarch_sp_regnum called\n");
2041 return gdbarch->sp_regnum;
2042 }
2043
2044 void
2045 set_gdbarch_sp_regnum (struct gdbarch *gdbarch,
2046 int sp_regnum)
2047 {
2048 gdbarch->sp_regnum = sp_regnum;
2049 }
2050
2051 int
2052 gdbarch_pc_regnum (struct gdbarch *gdbarch)
2053 {
2054 gdb_assert (gdbarch != NULL);
2055 /* Skip verify of pc_regnum, invalid_p == 0 */
2056 if (gdbarch_debug >= 2)
2057 fprintf_unfiltered (gdb_stdlog, "gdbarch_pc_regnum called\n");
2058 return gdbarch->pc_regnum;
2059 }
2060
2061 void
2062 set_gdbarch_pc_regnum (struct gdbarch *gdbarch,
2063 int pc_regnum)
2064 {
2065 gdbarch->pc_regnum = pc_regnum;
2066 }
2067
2068 int
2069 gdbarch_ps_regnum (struct gdbarch *gdbarch)
2070 {
2071 gdb_assert (gdbarch != NULL);
2072 /* Skip verify of ps_regnum, invalid_p == 0 */
2073 if (gdbarch_debug >= 2)
2074 fprintf_unfiltered (gdb_stdlog, "gdbarch_ps_regnum called\n");
2075 return gdbarch->ps_regnum;
2076 }
2077
2078 void
2079 set_gdbarch_ps_regnum (struct gdbarch *gdbarch,
2080 int ps_regnum)
2081 {
2082 gdbarch->ps_regnum = ps_regnum;
2083 }
2084
2085 int
2086 gdbarch_fp0_regnum (struct gdbarch *gdbarch)
2087 {
2088 gdb_assert (gdbarch != NULL);
2089 /* Skip verify of fp0_regnum, invalid_p == 0 */
2090 if (gdbarch_debug >= 2)
2091 fprintf_unfiltered (gdb_stdlog, "gdbarch_fp0_regnum called\n");
2092 return gdbarch->fp0_regnum;
2093 }
2094
2095 void
2096 set_gdbarch_fp0_regnum (struct gdbarch *gdbarch,
2097 int fp0_regnum)
2098 {
2099 gdbarch->fp0_regnum = fp0_regnum;
2100 }
2101
2102 int
2103 gdbarch_stab_reg_to_regnum (struct gdbarch *gdbarch, int stab_regnr)
2104 {
2105 gdb_assert (gdbarch != NULL);
2106 gdb_assert (gdbarch->stab_reg_to_regnum != NULL);
2107 if (gdbarch_debug >= 2)
2108 fprintf_unfiltered (gdb_stdlog, "gdbarch_stab_reg_to_regnum called\n");
2109 return gdbarch->stab_reg_to_regnum (stab_regnr);
2110 }
2111
2112 void
2113 set_gdbarch_stab_reg_to_regnum (struct gdbarch *gdbarch,
2114 gdbarch_stab_reg_to_regnum_ftype stab_reg_to_regnum)
2115 {
2116 gdbarch->stab_reg_to_regnum = stab_reg_to_regnum;
2117 }
2118
2119 int
2120 gdbarch_ecoff_reg_to_regnum (struct gdbarch *gdbarch, int ecoff_regnr)
2121 {
2122 gdb_assert (gdbarch != NULL);
2123 gdb_assert (gdbarch->ecoff_reg_to_regnum != NULL);
2124 if (gdbarch_debug >= 2)
2125 fprintf_unfiltered (gdb_stdlog, "gdbarch_ecoff_reg_to_regnum called\n");
2126 return gdbarch->ecoff_reg_to_regnum (ecoff_regnr);
2127 }
2128
2129 void
2130 set_gdbarch_ecoff_reg_to_regnum (struct gdbarch *gdbarch,
2131 gdbarch_ecoff_reg_to_regnum_ftype ecoff_reg_to_regnum)
2132 {
2133 gdbarch->ecoff_reg_to_regnum = ecoff_reg_to_regnum;
2134 }
2135
2136 int
2137 gdbarch_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int dwarf_regnr)
2138 {
2139 gdb_assert (gdbarch != NULL);
2140 gdb_assert (gdbarch->dwarf_reg_to_regnum != NULL);
2141 if (gdbarch_debug >= 2)
2142 fprintf_unfiltered (gdb_stdlog, "gdbarch_dwarf_reg_to_regnum called\n");
2143 return gdbarch->dwarf_reg_to_regnum (dwarf_regnr);
2144 }
2145
2146 void
2147 set_gdbarch_dwarf_reg_to_regnum (struct gdbarch *gdbarch,
2148 gdbarch_dwarf_reg_to_regnum_ftype dwarf_reg_to_regnum)
2149 {
2150 gdbarch->dwarf_reg_to_regnum = dwarf_reg_to_regnum;
2151 }
2152
2153 int
2154 gdbarch_sdb_reg_to_regnum (struct gdbarch *gdbarch, int sdb_regnr)
2155 {
2156 gdb_assert (gdbarch != NULL);
2157 gdb_assert (gdbarch->sdb_reg_to_regnum != NULL);
2158 if (gdbarch_debug >= 2)
2159 fprintf_unfiltered (gdb_stdlog, "gdbarch_sdb_reg_to_regnum called\n");
2160 return gdbarch->sdb_reg_to_regnum (sdb_regnr);
2161 }
2162
2163 void
2164 set_gdbarch_sdb_reg_to_regnum (struct gdbarch *gdbarch,
2165 gdbarch_sdb_reg_to_regnum_ftype sdb_reg_to_regnum)
2166 {
2167 gdbarch->sdb_reg_to_regnum = sdb_reg_to_regnum;
2168 }
2169
2170 int
2171 gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int dwarf2_regnr)
2172 {
2173 gdb_assert (gdbarch != NULL);
2174 gdb_assert (gdbarch->dwarf2_reg_to_regnum != NULL);
2175 if (gdbarch_debug >= 2)
2176 fprintf_unfiltered (gdb_stdlog, "gdbarch_dwarf2_reg_to_regnum called\n");
2177 return gdbarch->dwarf2_reg_to_regnum (dwarf2_regnr);
2178 }
2179
2180 void
2181 set_gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch,
2182 gdbarch_dwarf2_reg_to_regnum_ftype dwarf2_reg_to_regnum)
2183 {
2184 gdbarch->dwarf2_reg_to_regnum = dwarf2_reg_to_regnum;
2185 }
2186
2187 const char *
2188 gdbarch_register_name (struct gdbarch *gdbarch, int regnr)
2189 {
2190 gdb_assert (gdbarch != NULL);
2191 gdb_assert (gdbarch->register_name != NULL);
2192 if (gdbarch_debug >= 2)
2193 fprintf_unfiltered (gdb_stdlog, "gdbarch_register_name called\n");
2194 return gdbarch->register_name (regnr);
2195 }
2196
2197 void
2198 set_gdbarch_register_name (struct gdbarch *gdbarch,
2199 gdbarch_register_name_ftype register_name)
2200 {
2201 gdbarch->register_name = register_name;
2202 }
2203
2204 int
2205 gdbarch_register_type_p (struct gdbarch *gdbarch)
2206 {
2207 gdb_assert (gdbarch != NULL);
2208 return gdbarch->register_type != NULL;
2209 }
2210
2211 struct type *
2212 gdbarch_register_type (struct gdbarch *gdbarch, int reg_nr)
2213 {
2214 gdb_assert (gdbarch != NULL);
2215 gdb_assert (gdbarch->register_type != NULL);
2216 if (gdbarch_debug >= 2)
2217 fprintf_unfiltered (gdb_stdlog, "gdbarch_register_type called\n");
2218 return gdbarch->register_type (gdbarch, reg_nr);
2219 }
2220
2221 void
2222 set_gdbarch_register_type (struct gdbarch *gdbarch,
2223 gdbarch_register_type_ftype register_type)
2224 {
2225 gdbarch->register_type = register_type;
2226 }
2227
2228 int
2229 gdbarch_unwind_dummy_id_p (struct gdbarch *gdbarch)
2230 {
2231 gdb_assert (gdbarch != NULL);
2232 return gdbarch->unwind_dummy_id != NULL;
2233 }
2234
2235 struct frame_id
2236 gdbarch_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *info)
2237 {
2238 gdb_assert (gdbarch != NULL);
2239 gdb_assert (gdbarch->unwind_dummy_id != NULL);
2240 if (gdbarch_debug >= 2)
2241 fprintf_unfiltered (gdb_stdlog, "gdbarch_unwind_dummy_id called\n");
2242 return gdbarch->unwind_dummy_id (gdbarch, info);
2243 }
2244
2245 void
2246 set_gdbarch_unwind_dummy_id (struct gdbarch *gdbarch,
2247 gdbarch_unwind_dummy_id_ftype unwind_dummy_id)
2248 {
2249 gdbarch->unwind_dummy_id = unwind_dummy_id;
2250 }
2251
2252 int
2253 gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch)
2254 {
2255 gdb_assert (gdbarch != NULL);
2256 /* Skip verify of deprecated_fp_regnum, invalid_p == 0 */
2257 if (gdbarch_debug >= 2)
2258 fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_fp_regnum called\n");
2259 return gdbarch->deprecated_fp_regnum;
2260 }
2261
2262 void
2263 set_gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch,
2264 int deprecated_fp_regnum)
2265 {
2266 gdbarch->deprecated_fp_regnum = deprecated_fp_regnum;
2267 }
2268
2269 int
2270 gdbarch_push_dummy_call_p (struct gdbarch *gdbarch)
2271 {
2272 gdb_assert (gdbarch != NULL);
2273 return gdbarch->push_dummy_call != NULL;
2274 }
2275
2276 CORE_ADDR
2277 gdbarch_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
2278 {
2279 gdb_assert (gdbarch != NULL);
2280 gdb_assert (gdbarch->push_dummy_call != NULL);
2281 if (gdbarch_debug >= 2)
2282 fprintf_unfiltered (gdb_stdlog, "gdbarch_push_dummy_call called\n");
2283 return gdbarch->push_dummy_call (gdbarch, function, regcache, bp_addr, nargs, args, sp, struct_return, struct_addr);
2284 }
2285
2286 void
2287 set_gdbarch_push_dummy_call (struct gdbarch *gdbarch,
2288 gdbarch_push_dummy_call_ftype push_dummy_call)
2289 {
2290 gdbarch->push_dummy_call = push_dummy_call;
2291 }
2292
2293 int
2294 gdbarch_deprecated_register_size (struct gdbarch *gdbarch)
2295 {
2296 gdb_assert (gdbarch != NULL);
2297 if (gdbarch_debug >= 2)
2298 fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_register_size called\n");
2299 return gdbarch->deprecated_register_size;
2300 }
2301
2302 void
2303 set_gdbarch_deprecated_register_size (struct gdbarch *gdbarch,
2304 int deprecated_register_size)
2305 {
2306 gdbarch->deprecated_register_size = deprecated_register_size;
2307 }
2308
2309 int
2310 gdbarch_call_dummy_location (struct gdbarch *gdbarch)
2311 {
2312 gdb_assert (gdbarch != NULL);
2313 /* Skip verify of call_dummy_location, invalid_p == 0 */
2314 if (gdbarch_debug >= 2)
2315 fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_location called\n");
2316 return gdbarch->call_dummy_location;
2317 }
2318
2319 void
2320 set_gdbarch_call_dummy_location (struct gdbarch *gdbarch,
2321 int call_dummy_location)
2322 {
2323 gdbarch->call_dummy_location = call_dummy_location;
2324 }
2325
2326 int
2327 gdbarch_push_dummy_code_p (struct gdbarch *gdbarch)
2328 {
2329 gdb_assert (gdbarch != NULL);
2330 return gdbarch->push_dummy_code != NULL;
2331 }
2332
2333 CORE_ADDR
2334 gdbarch_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr, int using_gcc, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr)
2335 {
2336 gdb_assert (gdbarch != NULL);
2337 gdb_assert (gdbarch->push_dummy_code != NULL);
2338 if (gdbarch_debug >= 2)
2339 fprintf_unfiltered (gdb_stdlog, "gdbarch_push_dummy_code called\n");
2340 return gdbarch->push_dummy_code (gdbarch, sp, funaddr, using_gcc, args, nargs, value_type, real_pc, bp_addr);
2341 }
2342
2343 void
2344 set_gdbarch_push_dummy_code (struct gdbarch *gdbarch,
2345 gdbarch_push_dummy_code_ftype push_dummy_code)
2346 {
2347 gdbarch->push_dummy_code = push_dummy_code;
2348 }
2349
2350 void
2351 gdbarch_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, int regnum, int all)
2352 {
2353 gdb_assert (gdbarch != NULL);
2354 gdb_assert (gdbarch->print_registers_info != NULL);
2355 if (gdbarch_debug >= 2)
2356 fprintf_unfiltered (gdb_stdlog, "gdbarch_print_registers_info called\n");
2357 gdbarch->print_registers_info (gdbarch, file, frame, regnum, all);
2358 }
2359
2360 void
2361 set_gdbarch_print_registers_info (struct gdbarch *gdbarch,
2362 gdbarch_print_registers_info_ftype print_registers_info)
2363 {
2364 gdbarch->print_registers_info = print_registers_info;
2365 }
2366
2367 int
2368 gdbarch_print_float_info_p (struct gdbarch *gdbarch)
2369 {
2370 gdb_assert (gdbarch != NULL);
2371 return gdbarch->print_float_info != NULL;
2372 }
2373
2374 void
2375 gdbarch_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, const char *args)
2376 {
2377 gdb_assert (gdbarch != NULL);
2378 gdb_assert (gdbarch->print_float_info != NULL);
2379 if (gdbarch_debug >= 2)
2380 fprintf_unfiltered (gdb_stdlog, "gdbarch_print_float_info called\n");
2381 gdbarch->print_float_info (gdbarch, file, frame, args);
2382 }
2383
2384 void
2385 set_gdbarch_print_float_info (struct gdbarch *gdbarch,
2386 gdbarch_print_float_info_ftype print_float_info)
2387 {
2388 gdbarch->print_float_info = print_float_info;
2389 }
2390
2391 int
2392 gdbarch_print_vector_info_p (struct gdbarch *gdbarch)
2393 {
2394 gdb_assert (gdbarch != NULL);
2395 return gdbarch->print_vector_info != NULL;
2396 }
2397
2398 void
2399 gdbarch_print_vector_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, const char *args)
2400 {
2401 gdb_assert (gdbarch != NULL);
2402 gdb_assert (gdbarch->print_vector_info != NULL);
2403 if (gdbarch_debug >= 2)
2404 fprintf_unfiltered (gdb_stdlog, "gdbarch_print_vector_info called\n");
2405 gdbarch->print_vector_info (gdbarch, file, frame, args);
2406 }
2407
2408 void
2409 set_gdbarch_print_vector_info (struct gdbarch *gdbarch,
2410 gdbarch_print_vector_info_ftype print_vector_info)
2411 {
2412 gdbarch->print_vector_info = print_vector_info;
2413 }
2414
2415 int
2416 gdbarch_register_sim_regno (struct gdbarch *gdbarch, int reg_nr)
2417 {
2418 gdb_assert (gdbarch != NULL);
2419 gdb_assert (gdbarch->register_sim_regno != NULL);
2420 if (gdbarch_debug >= 2)
2421 fprintf_unfiltered (gdb_stdlog, "gdbarch_register_sim_regno called\n");
2422 return gdbarch->register_sim_regno (reg_nr);
2423 }
2424
2425 void
2426 set_gdbarch_register_sim_regno (struct gdbarch *gdbarch,
2427 gdbarch_register_sim_regno_ftype register_sim_regno)
2428 {
2429 gdbarch->register_sim_regno = register_sim_regno;
2430 }
2431
2432 int
2433 gdbarch_register_bytes_ok_p (struct gdbarch *gdbarch)
2434 {
2435 gdb_assert (gdbarch != NULL);
2436 return gdbarch->register_bytes_ok != NULL;
2437 }
2438
2439 int
2440 gdbarch_register_bytes_ok (struct gdbarch *gdbarch, long nr_bytes)
2441 {
2442 gdb_assert (gdbarch != NULL);
2443 gdb_assert (gdbarch->register_bytes_ok != NULL);
2444 if (gdbarch_debug >= 2)
2445 fprintf_unfiltered (gdb_stdlog, "gdbarch_register_bytes_ok called\n");
2446 return gdbarch->register_bytes_ok (nr_bytes);
2447 }
2448
2449 void
2450 set_gdbarch_register_bytes_ok (struct gdbarch *gdbarch,
2451 gdbarch_register_bytes_ok_ftype register_bytes_ok)
2452 {
2453 gdbarch->register_bytes_ok = register_bytes_ok;
2454 }
2455
2456 int
2457 gdbarch_cannot_fetch_register (struct gdbarch *gdbarch, int regnum)
2458 {
2459 gdb_assert (gdbarch != NULL);
2460 gdb_assert (gdbarch->cannot_fetch_register != NULL);
2461 if (gdbarch_debug >= 2)
2462 fprintf_unfiltered (gdb_stdlog, "gdbarch_cannot_fetch_register called\n");
2463 return gdbarch->cannot_fetch_register (regnum);
2464 }
2465
2466 void
2467 set_gdbarch_cannot_fetch_register (struct gdbarch *gdbarch,
2468 gdbarch_cannot_fetch_register_ftype cannot_fetch_register)
2469 {
2470 gdbarch->cannot_fetch_register = cannot_fetch_register;
2471 }
2472
2473 int
2474 gdbarch_cannot_store_register (struct gdbarch *gdbarch, int regnum)
2475 {
2476 gdb_assert (gdbarch != NULL);
2477 gdb_assert (gdbarch->cannot_store_register != NULL);
2478 if (gdbarch_debug >= 2)
2479 fprintf_unfiltered (gdb_stdlog, "gdbarch_cannot_store_register called\n");
2480 return gdbarch->cannot_store_register (regnum);
2481 }
2482
2483 void
2484 set_gdbarch_cannot_store_register (struct gdbarch *gdbarch,
2485 gdbarch_cannot_store_register_ftype cannot_store_register)
2486 {
2487 gdbarch->cannot_store_register = cannot_store_register;
2488 }
2489
2490 int
2491 gdbarch_get_longjmp_target_p (struct gdbarch *gdbarch)
2492 {
2493 gdb_assert (gdbarch != NULL);
2494 return gdbarch->get_longjmp_target != NULL;
2495 }
2496
2497 int
2498 gdbarch_get_longjmp_target (struct gdbarch *gdbarch, CORE_ADDR *pc)
2499 {
2500 gdb_assert (gdbarch != NULL);
2501 gdb_assert (gdbarch->get_longjmp_target != NULL);
2502 if (gdbarch_debug >= 2)
2503 fprintf_unfiltered (gdb_stdlog, "gdbarch_get_longjmp_target called\n");
2504 return gdbarch->get_longjmp_target (pc);
2505 }
2506
2507 void
2508 set_gdbarch_get_longjmp_target (struct gdbarch *gdbarch,
2509 gdbarch_get_longjmp_target_ftype get_longjmp_target)
2510 {
2511 gdbarch->get_longjmp_target = get_longjmp_target;
2512 }
2513
2514 int
2515 gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch)
2516 {
2517 gdb_assert (gdbarch != NULL);
2518 if (gdbarch_debug >= 2)
2519 fprintf_unfiltered (gdb_stdlog, "gdbarch_believe_pcc_promotion called\n");
2520 return gdbarch->believe_pcc_promotion;
2521 }
2522
2523 void
2524 set_gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch,
2525 int believe_pcc_promotion)
2526 {
2527 gdbarch->believe_pcc_promotion = believe_pcc_promotion;
2528 }
2529
2530 int
2531 gdbarch_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type)
2532 {
2533 gdb_assert (gdbarch != NULL);
2534 gdb_assert (gdbarch->convert_register_p != NULL);
2535 if (gdbarch_debug >= 2)
2536 fprintf_unfiltered (gdb_stdlog, "gdbarch_convert_register_p called\n");
2537 return gdbarch->convert_register_p (regnum, type);
2538 }
2539
2540 void
2541 set_gdbarch_convert_register_p (struct gdbarch *gdbarch,
2542 gdbarch_convert_register_p_ftype convert_register_p)
2543 {
2544 gdbarch->convert_register_p = convert_register_p;
2545 }
2546
2547 void
2548 gdbarch_register_to_value (struct gdbarch *gdbarch, struct frame_info *frame, int regnum, struct type *type, gdb_byte *buf)
2549 {
2550 gdb_assert (gdbarch != NULL);
2551 gdb_assert (gdbarch->register_to_value != NULL);
2552 if (gdbarch_debug >= 2)
2553 fprintf_unfiltered (gdb_stdlog, "gdbarch_register_to_value called\n");
2554 gdbarch->register_to_value (frame, regnum, type, buf);
2555 }
2556
2557 void
2558 set_gdbarch_register_to_value (struct gdbarch *gdbarch,
2559 gdbarch_register_to_value_ftype register_to_value)
2560 {
2561 gdbarch->register_to_value = register_to_value;
2562 }
2563
2564 void
2565 gdbarch_value_to_register (struct gdbarch *gdbarch, struct frame_info *frame, int regnum, struct type *type, const gdb_byte *buf)
2566 {
2567 gdb_assert (gdbarch != NULL);
2568 gdb_assert (gdbarch->value_to_register != NULL);
2569 if (gdbarch_debug >= 2)
2570 fprintf_unfiltered (gdb_stdlog, "gdbarch_value_to_register called\n");
2571 gdbarch->value_to_register (frame, regnum, type, buf);
2572 }
2573
2574 void
2575 set_gdbarch_value_to_register (struct gdbarch *gdbarch,
2576 gdbarch_value_to_register_ftype value_to_register)
2577 {
2578 gdbarch->value_to_register = value_to_register;
2579 }
2580
2581 struct value *
2582 gdbarch_value_from_register (struct gdbarch *gdbarch, struct type *type, int regnum, struct frame_info *frame)
2583 {
2584 gdb_assert (gdbarch != NULL);
2585 gdb_assert (gdbarch->value_from_register != NULL);
2586 if (gdbarch_debug >= 2)
2587 fprintf_unfiltered (gdb_stdlog, "gdbarch_value_from_register called\n");
2588 return gdbarch->value_from_register (type, regnum, frame);
2589 }
2590
2591 void
2592 set_gdbarch_value_from_register (struct gdbarch *gdbarch,
2593 gdbarch_value_from_register_ftype value_from_register)
2594 {
2595 gdbarch->value_from_register = value_from_register;
2596 }
2597
2598 CORE_ADDR
2599 gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf)
2600 {
2601 gdb_assert (gdbarch != NULL);
2602 gdb_assert (gdbarch->pointer_to_address != NULL);
2603 if (gdbarch_debug >= 2)
2604 fprintf_unfiltered (gdb_stdlog, "gdbarch_pointer_to_address called\n");
2605 return gdbarch->pointer_to_address (type, buf);
2606 }
2607
2608 void
2609 set_gdbarch_pointer_to_address (struct gdbarch *gdbarch,
2610 gdbarch_pointer_to_address_ftype pointer_to_address)
2611 {
2612 gdbarch->pointer_to_address = pointer_to_address;
2613 }
2614
2615 void
2616 gdbarch_address_to_pointer (struct gdbarch *gdbarch, struct type *type, gdb_byte *buf, CORE_ADDR addr)
2617 {
2618 gdb_assert (gdbarch != NULL);
2619 gdb_assert (gdbarch->address_to_pointer != NULL);
2620 if (gdbarch_debug >= 2)
2621 fprintf_unfiltered (gdb_stdlog, "gdbarch_address_to_pointer called\n");
2622 gdbarch->address_to_pointer (type, buf, addr);
2623 }
2624
2625 void
2626 set_gdbarch_address_to_pointer (struct gdbarch *gdbarch,
2627 gdbarch_address_to_pointer_ftype address_to_pointer)
2628 {
2629 gdbarch->address_to_pointer = address_to_pointer;
2630 }
2631
2632 int
2633 gdbarch_integer_to_address_p (struct gdbarch *gdbarch)
2634 {
2635 gdb_assert (gdbarch != NULL);
2636 return gdbarch->integer_to_address != NULL;
2637 }
2638
2639 CORE_ADDR
2640 gdbarch_integer_to_address (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf)
2641 {
2642 gdb_assert (gdbarch != NULL);
2643 gdb_assert (gdbarch->integer_to_address != NULL);
2644 if (gdbarch_debug >= 2)
2645 fprintf_unfiltered (gdb_stdlog, "gdbarch_integer_to_address called\n");
2646 return gdbarch->integer_to_address (gdbarch, type, buf);
2647 }
2648
2649 void
2650 set_gdbarch_integer_to_address (struct gdbarch *gdbarch,
2651 gdbarch_integer_to_address_ftype integer_to_address)
2652 {
2653 gdbarch->integer_to_address = integer_to_address;
2654 }
2655
2656 int
2657 gdbarch_return_value_p (struct gdbarch *gdbarch)
2658 {
2659 gdb_assert (gdbarch != NULL);
2660 return gdbarch->return_value != legacy_return_value;
2661 }
2662
2663 enum return_value_convention
2664 gdbarch_return_value (struct gdbarch *gdbarch, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf)
2665 {
2666 gdb_assert (gdbarch != NULL);
2667 gdb_assert (gdbarch->return_value != NULL);
2668 /* Do not check predicate: gdbarch->return_value != legacy_return_value, allow call. */
2669 if (gdbarch_debug >= 2)
2670 fprintf_unfiltered (gdb_stdlog, "gdbarch_return_value called\n");
2671 return gdbarch->return_value (gdbarch, valtype, regcache, readbuf, writebuf);
2672 }
2673
2674 void
2675 set_gdbarch_return_value (struct gdbarch *gdbarch,
2676 gdbarch_return_value_ftype return_value)
2677 {
2678 gdbarch->return_value = return_value;
2679 }
2680
2681 void
2682 gdbarch_extract_return_value (struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, gdb_byte *valbuf)
2683 {
2684 gdb_assert (gdbarch != NULL);
2685 gdb_assert (gdbarch->extract_return_value != NULL);
2686 if (gdbarch_debug >= 2)
2687 fprintf_unfiltered (gdb_stdlog, "gdbarch_extract_return_value called\n");
2688 gdbarch->extract_return_value (type, regcache, valbuf);
2689 }
2690
2691 void
2692 set_gdbarch_extract_return_value (struct gdbarch *gdbarch,
2693 gdbarch_extract_return_value_ftype extract_return_value)
2694 {
2695 gdbarch->extract_return_value = extract_return_value;
2696 }
2697
2698 void
2699 gdbarch_store_return_value (struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, const gdb_byte *valbuf)
2700 {
2701 gdb_assert (gdbarch != NULL);
2702 gdb_assert (gdbarch->store_return_value != NULL);
2703 if (gdbarch_debug >= 2)
2704 fprintf_unfiltered (gdb_stdlog, "gdbarch_store_return_value called\n");
2705 gdbarch->store_return_value (type, regcache, valbuf);
2706 }
2707
2708 void
2709 set_gdbarch_store_return_value (struct gdbarch *gdbarch,
2710 gdbarch_store_return_value_ftype store_return_value)
2711 {
2712 gdbarch->store_return_value = store_return_value;
2713 }
2714
2715 int
2716 gdbarch_deprecated_use_struct_convention (struct gdbarch *gdbarch, int gcc_p, struct type *value_type)
2717 {
2718 gdb_assert (gdbarch != NULL);
2719 gdb_assert (gdbarch->deprecated_use_struct_convention != NULL);
2720 if (gdbarch_debug >= 2)
2721 fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_use_struct_convention called\n");
2722 return gdbarch->deprecated_use_struct_convention (gcc_p, value_type);
2723 }
2724
2725 void
2726 set_gdbarch_deprecated_use_struct_convention (struct gdbarch *gdbarch,
2727 gdbarch_deprecated_use_struct_convention_ftype deprecated_use_struct_convention)
2728 {
2729 gdbarch->deprecated_use_struct_convention = deprecated_use_struct_convention;
2730 }
2731
2732 int
2733 gdbarch_deprecated_extract_struct_value_address_p (struct gdbarch *gdbarch)
2734 {
2735 gdb_assert (gdbarch != NULL);
2736 return gdbarch->deprecated_extract_struct_value_address != NULL;
2737 }
2738
2739 CORE_ADDR
2740 gdbarch_deprecated_extract_struct_value_address (struct gdbarch *gdbarch, struct regcache *regcache)
2741 {
2742 gdb_assert (gdbarch != NULL);
2743 gdb_assert (gdbarch->deprecated_extract_struct_value_address != NULL);
2744 if (gdbarch_debug >= 2)
2745 fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_extract_struct_value_address called\n");
2746 return gdbarch->deprecated_extract_struct_value_address (regcache);
2747 }
2748
2749 void
2750 set_gdbarch_deprecated_extract_struct_value_address (struct gdbarch *gdbarch,
2751 gdbarch_deprecated_extract_struct_value_address_ftype deprecated_extract_struct_value_address)
2752 {
2753 gdbarch->deprecated_extract_struct_value_address = deprecated_extract_struct_value_address;
2754 }
2755
2756 CORE_ADDR
2757 gdbarch_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR ip)
2758 {
2759 gdb_assert (gdbarch != NULL);
2760 gdb_assert (gdbarch->skip_prologue != NULL);
2761 if (gdbarch_debug >= 2)
2762 fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_prologue called\n");
2763 return gdbarch->skip_prologue (ip);
2764 }
2765
2766 void
2767 set_gdbarch_skip_prologue (struct gdbarch *gdbarch,
2768 gdbarch_skip_prologue_ftype skip_prologue)
2769 {
2770 gdbarch->skip_prologue = skip_prologue;
2771 }
2772
2773 int
2774 gdbarch_inner_than (struct gdbarch *gdbarch, CORE_ADDR lhs, CORE_ADDR rhs)
2775 {
2776 gdb_assert (gdbarch != NULL);
2777 gdb_assert (gdbarch->inner_than != NULL);
2778 if (gdbarch_debug >= 2)
2779 fprintf_unfiltered (gdb_stdlog, "gdbarch_inner_than called\n");
2780 return gdbarch->inner_than (lhs, rhs);
2781 }
2782
2783 void
2784 set_gdbarch_inner_than (struct gdbarch *gdbarch,
2785 gdbarch_inner_than_ftype inner_than)
2786 {
2787 gdbarch->inner_than = inner_than;
2788 }
2789
2790 const gdb_byte *
2791 gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr)
2792 {
2793 gdb_assert (gdbarch != NULL);
2794 gdb_assert (gdbarch->breakpoint_from_pc != NULL);
2795 if (gdbarch_debug >= 2)
2796 fprintf_unfiltered (gdb_stdlog, "gdbarch_breakpoint_from_pc called\n");
2797 return gdbarch->breakpoint_from_pc (pcptr, lenptr);
2798 }
2799
2800 void
2801 set_gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch,
2802 gdbarch_breakpoint_from_pc_ftype breakpoint_from_pc)
2803 {
2804 gdbarch->breakpoint_from_pc = breakpoint_from_pc;
2805 }
2806
2807 int
2808 gdbarch_adjust_breakpoint_address_p (struct gdbarch *gdbarch)
2809 {
2810 gdb_assert (gdbarch != NULL);
2811 return gdbarch->adjust_breakpoint_address != NULL;
2812 }
2813
2814 CORE_ADDR
2815 gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr)
2816 {
2817 gdb_assert (gdbarch != NULL);
2818 gdb_assert (gdbarch->adjust_breakpoint_address != NULL);
2819 if (gdbarch_debug >= 2)
2820 fprintf_unfiltered (gdb_stdlog, "gdbarch_adjust_breakpoint_address called\n");
2821 return gdbarch->adjust_breakpoint_address (gdbarch, bpaddr);
2822 }
2823
2824 void
2825 set_gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch,
2826 gdbarch_adjust_breakpoint_address_ftype adjust_breakpoint_address)
2827 {
2828 gdbarch->adjust_breakpoint_address = adjust_breakpoint_address;
2829 }
2830
2831 int
2832 gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
2833 {
2834 gdb_assert (gdbarch != NULL);
2835 gdb_assert (gdbarch->memory_insert_breakpoint != NULL);
2836 if (gdbarch_debug >= 2)
2837 fprintf_unfiltered (gdb_stdlog, "gdbarch_memory_insert_breakpoint called\n");
2838 return gdbarch->memory_insert_breakpoint (bp_tgt);
2839 }
2840
2841 void
2842 set_gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch,
2843 gdbarch_memory_insert_breakpoint_ftype memory_insert_breakpoint)
2844 {
2845 gdbarch->memory_insert_breakpoint = memory_insert_breakpoint;
2846 }
2847
2848 int
2849 gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
2850 {
2851 gdb_assert (gdbarch != NULL);
2852 gdb_assert (gdbarch->memory_remove_breakpoint != NULL);
2853 if (gdbarch_debug >= 2)
2854 fprintf_unfiltered (gdb_stdlog, "gdbarch_memory_remove_breakpoint called\n");
2855 return gdbarch->memory_remove_breakpoint (bp_tgt);
2856 }
2857
2858 void
2859 set_gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch,
2860 gdbarch_memory_remove_breakpoint_ftype memory_remove_breakpoint)
2861 {
2862 gdbarch->memory_remove_breakpoint = memory_remove_breakpoint;
2863 }
2864
2865 CORE_ADDR
2866 gdbarch_decr_pc_after_break (struct gdbarch *gdbarch)
2867 {
2868 gdb_assert (gdbarch != NULL);
2869 /* Skip verify of decr_pc_after_break, invalid_p == 0 */
2870 if (gdbarch_debug >= 2)
2871 fprintf_unfiltered (gdb_stdlog, "gdbarch_decr_pc_after_break called\n");
2872 return gdbarch->decr_pc_after_break;
2873 }
2874
2875 void
2876 set_gdbarch_decr_pc_after_break (struct gdbarch *gdbarch,
2877 CORE_ADDR decr_pc_after_break)
2878 {
2879 gdbarch->decr_pc_after_break = decr_pc_after_break;
2880 }
2881
2882 CORE_ADDR
2883 gdbarch_deprecated_function_start_offset (struct gdbarch *gdbarch)
2884 {
2885 gdb_assert (gdbarch != NULL);
2886 /* Skip verify of deprecated_function_start_offset, invalid_p == 0 */
2887 if (gdbarch_debug >= 2)
2888 fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_function_start_offset called\n");
2889 return gdbarch->deprecated_function_start_offset;
2890 }
2891
2892 void
2893 set_gdbarch_deprecated_function_start_offset (struct gdbarch *gdbarch,
2894 CORE_ADDR deprecated_function_start_offset)
2895 {
2896 gdbarch->deprecated_function_start_offset = deprecated_function_start_offset;
2897 }
2898
2899 void
2900 gdbarch_remote_translate_xfer_address (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len)
2901 {
2902 gdb_assert (gdbarch != NULL);
2903 gdb_assert (gdbarch->remote_translate_xfer_address != NULL);
2904 if (gdbarch_debug >= 2)
2905 fprintf_unfiltered (gdb_stdlog, "gdbarch_remote_translate_xfer_address called\n");
2906 gdbarch->remote_translate_xfer_address (gdbarch, regcache, gdb_addr, gdb_len, rem_addr, rem_len);
2907 }
2908
2909 void
2910 set_gdbarch_remote_translate_xfer_address (struct gdbarch *gdbarch,
2911 gdbarch_remote_translate_xfer_address_ftype remote_translate_xfer_address)
2912 {
2913 gdbarch->remote_translate_xfer_address = remote_translate_xfer_address;
2914 }
2915
2916 int
2917 gdbarch_remote_register_number (struct gdbarch *gdbarch, int regno)
2918 {
2919 gdb_assert (gdbarch != NULL);
2920 gdb_assert (gdbarch->remote_register_number != NULL);
2921 if (gdbarch_debug >= 2)
2922 fprintf_unfiltered (gdb_stdlog, "gdbarch_remote_register_number called\n");
2923 return gdbarch->remote_register_number (gdbarch, regno);
2924 }
2925
2926 void
2927 set_gdbarch_remote_register_number (struct gdbarch *gdbarch,
2928 gdbarch_remote_register_number_ftype remote_register_number)
2929 {
2930 gdbarch->remote_register_number = remote_register_number;
2931 }
2932
2933 int
2934 gdbarch_fetch_tls_load_module_address_p (struct gdbarch *gdbarch)
2935 {
2936 gdb_assert (gdbarch != NULL);
2937 return gdbarch->fetch_tls_load_module_address != NULL;
2938 }
2939
2940 CORE_ADDR
2941 gdbarch_fetch_tls_load_module_address (struct gdbarch *gdbarch, struct objfile *objfile)
2942 {
2943 gdb_assert (gdbarch != NULL);
2944 gdb_assert (gdbarch->fetch_tls_load_module_address != NULL);
2945 if (gdbarch_debug >= 2)
2946 fprintf_unfiltered (gdb_stdlog, "gdbarch_fetch_tls_load_module_address called\n");
2947 return gdbarch->fetch_tls_load_module_address (objfile);
2948 }
2949
2950 void
2951 set_gdbarch_fetch_tls_load_module_address (struct gdbarch *gdbarch,
2952 gdbarch_fetch_tls_load_module_address_ftype fetch_tls_load_module_address)
2953 {
2954 gdbarch->fetch_tls_load_module_address = fetch_tls_load_module_address;
2955 }
2956
2957 CORE_ADDR
2958 gdbarch_frame_args_skip (struct gdbarch *gdbarch)
2959 {
2960 gdb_assert (gdbarch != NULL);
2961 /* Skip verify of frame_args_skip, invalid_p == 0 */
2962 if (gdbarch_debug >= 2)
2963 fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_args_skip called\n");
2964 return gdbarch->frame_args_skip;
2965 }
2966
2967 void
2968 set_gdbarch_frame_args_skip (struct gdbarch *gdbarch,
2969 CORE_ADDR frame_args_skip)
2970 {
2971 gdbarch->frame_args_skip = frame_args_skip;
2972 }
2973
2974 int
2975 gdbarch_unwind_pc_p (struct gdbarch *gdbarch)
2976 {
2977 gdb_assert (gdbarch != NULL);
2978 return gdbarch->unwind_pc != NULL;
2979 }
2980
2981 CORE_ADDR
2982 gdbarch_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
2983 {
2984 gdb_assert (gdbarch != NULL);
2985 gdb_assert (gdbarch->unwind_pc != NULL);
2986 if (gdbarch_debug >= 2)
2987 fprintf_unfiltered (gdb_stdlog, "gdbarch_unwind_pc called\n");
2988 return gdbarch->unwind_pc (gdbarch, next_frame);
2989 }
2990
2991 void
2992 set_gdbarch_unwind_pc (struct gdbarch *gdbarch,
2993 gdbarch_unwind_pc_ftype unwind_pc)
2994 {
2995 gdbarch->unwind_pc = unwind_pc;
2996 }
2997
2998 int
2999 gdbarch_unwind_sp_p (struct gdbarch *gdbarch)
3000 {
3001 gdb_assert (gdbarch != NULL);
3002 return gdbarch->unwind_sp != NULL;
3003 }
3004
3005 CORE_ADDR
3006 gdbarch_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
3007 {
3008 gdb_assert (gdbarch != NULL);
3009 gdb_assert (gdbarch->unwind_sp != NULL);
3010 if (gdbarch_debug >= 2)
3011 fprintf_unfiltered (gdb_stdlog, "gdbarch_unwind_sp called\n");
3012 return gdbarch->unwind_sp (gdbarch, next_frame);
3013 }
3014
3015 void
3016 set_gdbarch_unwind_sp (struct gdbarch *gdbarch,
3017 gdbarch_unwind_sp_ftype unwind_sp)
3018 {
3019 gdbarch->unwind_sp = unwind_sp;
3020 }
3021
3022 int
3023 gdbarch_frame_num_args_p (struct gdbarch *gdbarch)
3024 {
3025 gdb_assert (gdbarch != NULL);
3026 return gdbarch->frame_num_args != NULL;
3027 }
3028
3029 int
3030 gdbarch_frame_num_args (struct gdbarch *gdbarch, struct frame_info *frame)
3031 {
3032 gdb_assert (gdbarch != NULL);
3033 gdb_assert (gdbarch->frame_num_args != NULL);
3034 if (gdbarch_debug >= 2)
3035 fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_num_args called\n");
3036 return gdbarch->frame_num_args (frame);
3037 }
3038
3039 void
3040 set_gdbarch_frame_num_args (struct gdbarch *gdbarch,
3041 gdbarch_frame_num_args_ftype frame_num_args)
3042 {
3043 gdbarch->frame_num_args = frame_num_args;
3044 }
3045
3046 int
3047 gdbarch_deprecated_stack_align_p (struct gdbarch *gdbarch)
3048 {
3049 gdb_assert (gdbarch != NULL);
3050 return gdbarch->deprecated_stack_align != NULL;
3051 }
3052
3053 CORE_ADDR
3054 gdbarch_deprecated_stack_align (struct gdbarch *gdbarch, CORE_ADDR sp)
3055 {
3056 gdb_assert (gdbarch != NULL);
3057 gdb_assert (gdbarch->deprecated_stack_align != NULL);
3058 if (gdbarch_debug >= 2)
3059 fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_stack_align called\n");
3060 return gdbarch->deprecated_stack_align (sp);
3061 }
3062
3063 void
3064 set_gdbarch_deprecated_stack_align (struct gdbarch *gdbarch,
3065 gdbarch_deprecated_stack_align_ftype deprecated_stack_align)
3066 {
3067 gdbarch->deprecated_stack_align = deprecated_stack_align;
3068 }
3069
3070 int
3071 gdbarch_frame_align_p (struct gdbarch *gdbarch)
3072 {
3073 gdb_assert (gdbarch != NULL);
3074 return gdbarch->frame_align != NULL;
3075 }
3076
3077 CORE_ADDR
3078 gdbarch_frame_align (struct gdbarch *gdbarch, CORE_ADDR address)
3079 {
3080 gdb_assert (gdbarch != NULL);
3081 gdb_assert (gdbarch->frame_align != NULL);
3082 if (gdbarch_debug >= 2)
3083 fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_align called\n");
3084 return gdbarch->frame_align (gdbarch, address);
3085 }
3086
3087 void
3088 set_gdbarch_frame_align (struct gdbarch *gdbarch,
3089 gdbarch_frame_align_ftype frame_align)
3090 {
3091 gdbarch->frame_align = frame_align;
3092 }
3093
3094 int
3095 gdbarch_deprecated_reg_struct_has_addr_p (struct gdbarch *gdbarch)
3096 {
3097 gdb_assert (gdbarch != NULL);
3098 return gdbarch->deprecated_reg_struct_has_addr != NULL;
3099 }
3100
3101 int
3102 gdbarch_deprecated_reg_struct_has_addr (struct gdbarch *gdbarch, int gcc_p, struct type *type)
3103 {
3104 gdb_assert (gdbarch != NULL);
3105 gdb_assert (gdbarch->deprecated_reg_struct_has_addr != NULL);
3106 if (gdbarch_debug >= 2)
3107 fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_reg_struct_has_addr called\n");
3108 return gdbarch->deprecated_reg_struct_has_addr (gcc_p, type);
3109 }
3110
3111 void
3112 set_gdbarch_deprecated_reg_struct_has_addr (struct gdbarch *gdbarch,
3113 gdbarch_deprecated_reg_struct_has_addr_ftype deprecated_reg_struct_has_addr)
3114 {
3115 gdbarch->deprecated_reg_struct_has_addr = deprecated_reg_struct_has_addr;
3116 }
3117
3118 int
3119 gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type)
3120 {
3121 gdb_assert (gdbarch != NULL);
3122 gdb_assert (gdbarch->stabs_argument_has_addr != NULL);
3123 if (gdbarch_debug >= 2)
3124 fprintf_unfiltered (gdb_stdlog, "gdbarch_stabs_argument_has_addr called\n");
3125 return gdbarch->stabs_argument_has_addr (gdbarch, type);
3126 }
3127
3128 void
3129 set_gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch,
3130 gdbarch_stabs_argument_has_addr_ftype stabs_argument_has_addr)
3131 {
3132 gdbarch->stabs_argument_has_addr = stabs_argument_has_addr;
3133 }
3134
3135 int
3136 gdbarch_frame_red_zone_size (struct gdbarch *gdbarch)
3137 {
3138 gdb_assert (gdbarch != NULL);
3139 if (gdbarch_debug >= 2)
3140 fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_red_zone_size called\n");
3141 return gdbarch->frame_red_zone_size;
3142 }
3143
3144 void
3145 set_gdbarch_frame_red_zone_size (struct gdbarch *gdbarch,
3146 int frame_red_zone_size)
3147 {
3148 gdbarch->frame_red_zone_size = frame_red_zone_size;
3149 }
3150
3151 CORE_ADDR
3152 gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr, struct target_ops *targ)
3153 {
3154 gdb_assert (gdbarch != NULL);
3155 gdb_assert (gdbarch->convert_from_func_ptr_addr != NULL);
3156 if (gdbarch_debug >= 2)
3157 fprintf_unfiltered (gdb_stdlog, "gdbarch_convert_from_func_ptr_addr called\n");
3158 return gdbarch->convert_from_func_ptr_addr (gdbarch, addr, targ);
3159 }
3160
3161 void
3162 set_gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
3163 gdbarch_convert_from_func_ptr_addr_ftype convert_from_func_ptr_addr)
3164 {
3165 gdbarch->convert_from_func_ptr_addr = convert_from_func_ptr_addr;
3166 }
3167
3168 CORE_ADDR
3169 gdbarch_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr)
3170 {
3171 gdb_assert (gdbarch != NULL);
3172 gdb_assert (gdbarch->addr_bits_remove != NULL);
3173 if (gdbarch_debug >= 2)
3174 fprintf_unfiltered (gdb_stdlog, "gdbarch_addr_bits_remove called\n");
3175 return gdbarch->addr_bits_remove (addr);
3176 }
3177
3178 void
3179 set_gdbarch_addr_bits_remove (struct gdbarch *gdbarch,
3180 gdbarch_addr_bits_remove_ftype addr_bits_remove)
3181 {
3182 gdbarch->addr_bits_remove = addr_bits_remove;
3183 }
3184
3185 CORE_ADDR
3186 gdbarch_smash_text_address (struct gdbarch *gdbarch, CORE_ADDR addr)
3187 {
3188 gdb_assert (gdbarch != NULL);
3189 gdb_assert (gdbarch->smash_text_address != NULL);
3190 if (gdbarch_debug >= 2)
3191 fprintf_unfiltered (gdb_stdlog, "gdbarch_smash_text_address called\n");
3192 return gdbarch->smash_text_address (addr);
3193 }
3194
3195 void
3196 set_gdbarch_smash_text_address (struct gdbarch *gdbarch,
3197 gdbarch_smash_text_address_ftype smash_text_address)
3198 {
3199 gdbarch->smash_text_address = smash_text_address;
3200 }
3201
3202 int
3203 gdbarch_software_single_step_p (struct gdbarch *gdbarch)
3204 {
3205 gdb_assert (gdbarch != NULL);
3206 return gdbarch->software_single_step != NULL;
3207 }
3208
3209 int
3210 gdbarch_software_single_step (struct gdbarch *gdbarch, struct regcache *regcache)
3211 {
3212 gdb_assert (gdbarch != NULL);
3213 gdb_assert (gdbarch->software_single_step != NULL);
3214 if (gdbarch_debug >= 2)
3215 fprintf_unfiltered (gdb_stdlog, "gdbarch_software_single_step called\n");
3216 return gdbarch->software_single_step (regcache);
3217 }
3218
3219 void
3220 set_gdbarch_software_single_step (struct gdbarch *gdbarch,
3221 gdbarch_software_single_step_ftype software_single_step)
3222 {
3223 gdbarch->software_single_step = software_single_step;
3224 }
3225
3226 int
3227 gdbarch_single_step_through_delay_p (struct gdbarch *gdbarch)
3228 {
3229 gdb_assert (gdbarch != NULL);
3230 return gdbarch->single_step_through_delay != NULL;
3231 }
3232
3233 int
3234 gdbarch_single_step_through_delay (struct gdbarch *gdbarch, struct frame_info *frame)
3235 {
3236 gdb_assert (gdbarch != NULL);
3237 gdb_assert (gdbarch->single_step_through_delay != NULL);
3238 if (gdbarch_debug >= 2)
3239 fprintf_unfiltered (gdb_stdlog, "gdbarch_single_step_through_delay called\n");
3240 return gdbarch->single_step_through_delay (gdbarch, frame);
3241 }
3242
3243 void
3244 set_gdbarch_single_step_through_delay (struct gdbarch *gdbarch,
3245 gdbarch_single_step_through_delay_ftype single_step_through_delay)
3246 {
3247 gdbarch->single_step_through_delay = single_step_through_delay;
3248 }
3249
3250 int
3251 gdbarch_print_insn (struct gdbarch *gdbarch, bfd_vma vma, struct disassemble_info *info)
3252 {
3253 gdb_assert (gdbarch != NULL);
3254 gdb_assert (gdbarch->print_insn != NULL);
3255 if (gdbarch_debug >= 2)
3256 fprintf_unfiltered (gdb_stdlog, "gdbarch_print_insn called\n");
3257 return gdbarch->print_insn (vma, info);
3258 }
3259
3260 void
3261 set_gdbarch_print_insn (struct gdbarch *gdbarch,
3262 gdbarch_print_insn_ftype print_insn)
3263 {
3264 gdbarch->print_insn = print_insn;
3265 }
3266
3267 CORE_ADDR
3268 gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, CORE_ADDR pc)
3269 {
3270 gdb_assert (gdbarch != NULL);
3271 gdb_assert (gdbarch->skip_trampoline_code != NULL);
3272 if (gdbarch_debug >= 2)
3273 fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_trampoline_code called\n");
3274 return gdbarch->skip_trampoline_code (pc);
3275 }
3276
3277 void
3278 set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch,
3279 gdbarch_skip_trampoline_code_ftype skip_trampoline_code)
3280 {
3281 gdbarch->skip_trampoline_code = skip_trampoline_code;
3282 }
3283
3284 CORE_ADDR
3285 gdbarch_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
3286 {
3287 gdb_assert (gdbarch != NULL);
3288 gdb_assert (gdbarch->skip_solib_resolver != NULL);
3289 if (gdbarch_debug >= 2)
3290 fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_solib_resolver called\n");
3291 return gdbarch->skip_solib_resolver (gdbarch, pc);
3292 }
3293
3294 void
3295 set_gdbarch_skip_solib_resolver (struct gdbarch *gdbarch,
3296 gdbarch_skip_solib_resolver_ftype skip_solib_resolver)
3297 {
3298 gdbarch->skip_solib_resolver = skip_solib_resolver;
3299 }
3300
3301 int
3302 gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, char *name)
3303 {
3304 gdb_assert (gdbarch != NULL);
3305 gdb_assert (gdbarch->in_solib_return_trampoline != NULL);
3306 if (gdbarch_debug >= 2)
3307 fprintf_unfiltered (gdb_stdlog, "gdbarch_in_solib_return_trampoline called\n");
3308 return gdbarch->in_solib_return_trampoline (pc, name);
3309 }
3310
3311 void
3312 set_gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch,
3313 gdbarch_in_solib_return_trampoline_ftype in_solib_return_trampoline)
3314 {
3315 gdbarch->in_solib_return_trampoline = in_solib_return_trampoline;
3316 }
3317
3318 int
3319 gdbarch_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR addr)
3320 {
3321 gdb_assert (gdbarch != NULL);
3322 gdb_assert (gdbarch->in_function_epilogue_p != NULL);
3323 if (gdbarch_debug >= 2)
3324 fprintf_unfiltered (gdb_stdlog, "gdbarch_in_function_epilogue_p called\n");
3325 return gdbarch->in_function_epilogue_p (gdbarch, addr);
3326 }
3327
3328 void
3329 set_gdbarch_in_function_epilogue_p (struct gdbarch *gdbarch,
3330 gdbarch_in_function_epilogue_p_ftype in_function_epilogue_p)
3331 {
3332 gdbarch->in_function_epilogue_p = in_function_epilogue_p;
3333 }
3334
3335 char *
3336 gdbarch_construct_inferior_arguments (struct gdbarch *gdbarch, int argc, char **argv)
3337 {
3338 gdb_assert (gdbarch != NULL);
3339 gdb_assert (gdbarch->construct_inferior_arguments != NULL);
3340 if (gdbarch_debug >= 2)
3341 fprintf_unfiltered (gdb_stdlog, "gdbarch_construct_inferior_arguments called\n");
3342 return gdbarch->construct_inferior_arguments (gdbarch, argc, argv);
3343 }
3344
3345 void
3346 set_gdbarch_construct_inferior_arguments (struct gdbarch *gdbarch,
3347 gdbarch_construct_inferior_arguments_ftype construct_inferior_arguments)
3348 {
3349 gdbarch->construct_inferior_arguments = construct_inferior_arguments;
3350 }
3351
3352 void
3353 gdbarch_elf_make_msymbol_special (struct gdbarch *gdbarch, asymbol *sym, struct minimal_symbol *msym)
3354 {
3355 gdb_assert (gdbarch != NULL);
3356 gdb_assert (gdbarch->elf_make_msymbol_special != NULL);
3357 if (gdbarch_debug >= 2)
3358 fprintf_unfiltered (gdb_stdlog, "gdbarch_elf_make_msymbol_special called\n");
3359 gdbarch->elf_make_msymbol_special (sym, msym);
3360 }
3361
3362 void
3363 set_gdbarch_elf_make_msymbol_special (struct gdbarch *gdbarch,
3364 gdbarch_elf_make_msymbol_special_ftype elf_make_msymbol_special)
3365 {
3366 gdbarch->elf_make_msymbol_special = elf_make_msymbol_special;
3367 }
3368
3369 void
3370 gdbarch_coff_make_msymbol_special (struct gdbarch *gdbarch, int val, struct minimal_symbol *msym)
3371 {
3372 gdb_assert (gdbarch != NULL);
3373 gdb_assert (gdbarch->coff_make_msymbol_special != NULL);
3374 if (gdbarch_debug >= 2)
3375 fprintf_unfiltered (gdb_stdlog, "gdbarch_coff_make_msymbol_special called\n");
3376 gdbarch->coff_make_msymbol_special (val, msym);
3377 }
3378
3379 void
3380 set_gdbarch_coff_make_msymbol_special (struct gdbarch *gdbarch,
3381 gdbarch_coff_make_msymbol_special_ftype coff_make_msymbol_special)
3382 {
3383 gdbarch->coff_make_msymbol_special = coff_make_msymbol_special;
3384 }
3385
3386 const char *
3387 gdbarch_name_of_malloc (struct gdbarch *gdbarch)
3388 {
3389 gdb_assert (gdbarch != NULL);
3390 /* Skip verify of name_of_malloc, invalid_p == 0 */
3391 if (gdbarch_debug >= 2)
3392 fprintf_unfiltered (gdb_stdlog, "gdbarch_name_of_malloc called\n");
3393 return gdbarch->name_of_malloc;
3394 }
3395
3396 void
3397 set_gdbarch_name_of_malloc (struct gdbarch *gdbarch,
3398 const char * name_of_malloc)
3399 {
3400 gdbarch->name_of_malloc = name_of_malloc;
3401 }
3402
3403 int
3404 gdbarch_cannot_step_breakpoint (struct gdbarch *gdbarch)
3405 {
3406 gdb_assert (gdbarch != NULL);
3407 /* Skip verify of cannot_step_breakpoint, invalid_p == 0 */
3408 if (gdbarch_debug >= 2)
3409 fprintf_unfiltered (gdb_stdlog, "gdbarch_cannot_step_breakpoint called\n");
3410 return gdbarch->cannot_step_breakpoint;
3411 }
3412
3413 void
3414 set_gdbarch_cannot_step_breakpoint (struct gdbarch *gdbarch,
3415 int cannot_step_breakpoint)
3416 {
3417 gdbarch->cannot_step_breakpoint = cannot_step_breakpoint;
3418 }
3419
3420 int
3421 gdbarch_have_nonsteppable_watchpoint (struct gdbarch *gdbarch)
3422 {
3423 gdb_assert (gdbarch != NULL);
3424 /* Skip verify of have_nonsteppable_watchpoint, invalid_p == 0 */
3425 if (gdbarch_debug >= 2)
3426 fprintf_unfiltered (gdb_stdlog, "gdbarch_have_nonsteppable_watchpoint called\n");
3427 return gdbarch->have_nonsteppable_watchpoint;
3428 }
3429
3430 void
3431 set_gdbarch_have_nonsteppable_watchpoint (struct gdbarch *gdbarch,
3432 int have_nonsteppable_watchpoint)
3433 {
3434 gdbarch->have_nonsteppable_watchpoint = have_nonsteppable_watchpoint;
3435 }
3436
3437 int
3438 gdbarch_address_class_type_flags_p (struct gdbarch *gdbarch)
3439 {
3440 gdb_assert (gdbarch != NULL);
3441 return gdbarch->address_class_type_flags != NULL;
3442 }
3443
3444 int
3445 gdbarch_address_class_type_flags (struct gdbarch *gdbarch, int byte_size, int dwarf2_addr_class)
3446 {
3447 gdb_assert (gdbarch != NULL);
3448 gdb_assert (gdbarch->address_class_type_flags != NULL);
3449 if (gdbarch_debug >= 2)
3450 fprintf_unfiltered (gdb_stdlog, "gdbarch_address_class_type_flags called\n");
3451 return gdbarch->address_class_type_flags (byte_size, dwarf2_addr_class);
3452 }
3453
3454 void
3455 set_gdbarch_address_class_type_flags (struct gdbarch *gdbarch,
3456 gdbarch_address_class_type_flags_ftype address_class_type_flags)
3457 {
3458 gdbarch->address_class_type_flags = address_class_type_flags;
3459 }
3460
3461 int
3462 gdbarch_address_class_type_flags_to_name_p (struct gdbarch *gdbarch)
3463 {
3464 gdb_assert (gdbarch != NULL);
3465 return gdbarch->address_class_type_flags_to_name != NULL;
3466 }
3467
3468 const char *
3469 gdbarch_address_class_type_flags_to_name (struct gdbarch *gdbarch, int type_flags)
3470 {
3471 gdb_assert (gdbarch != NULL);
3472 gdb_assert (gdbarch->address_class_type_flags_to_name != NULL);
3473 if (gdbarch_debug >= 2)
3474 fprintf_unfiltered (gdb_stdlog, "gdbarch_address_class_type_flags_to_name called\n");
3475 return gdbarch->address_class_type_flags_to_name (gdbarch, type_flags);
3476 }
3477
3478 void
3479 set_gdbarch_address_class_type_flags_to_name (struct gdbarch *gdbarch,
3480 gdbarch_address_class_type_flags_to_name_ftype address_class_type_flags_to_name)
3481 {
3482 gdbarch->address_class_type_flags_to_name = address_class_type_flags_to_name;
3483 }
3484
3485 int
3486 gdbarch_address_class_name_to_type_flags_p (struct gdbarch *gdbarch)
3487 {
3488 gdb_assert (gdbarch != NULL);
3489 return gdbarch->address_class_name_to_type_flags != NULL;
3490 }
3491
3492 int
3493 gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarch, const char *name, int *type_flags_ptr)
3494 {
3495 gdb_assert (gdbarch != NULL);
3496 gdb_assert (gdbarch->address_class_name_to_type_flags != NULL);
3497 if (gdbarch_debug >= 2)
3498 fprintf_unfiltered (gdb_stdlog, "gdbarch_address_class_name_to_type_flags called\n");
3499 return gdbarch->address_class_name_to_type_flags (gdbarch, name, type_flags_ptr);
3500 }
3501
3502 void
3503 set_gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarch,
3504 gdbarch_address_class_name_to_type_flags_ftype address_class_name_to_type_flags)
3505 {
3506 gdbarch->address_class_name_to_type_flags = address_class_name_to_type_flags;
3507 }
3508
3509 int
3510 gdbarch_register_reggroup_p (struct gdbarch *gdbarch, int regnum, struct reggroup *reggroup)
3511 {
3512 gdb_assert (gdbarch != NULL);
3513 gdb_assert (gdbarch->register_reggroup_p != NULL);
3514 if (gdbarch_debug >= 2)
3515 fprintf_unfiltered (gdb_stdlog, "gdbarch_register_reggroup_p called\n");
3516 return gdbarch->register_reggroup_p (gdbarch, regnum, reggroup);
3517 }
3518
3519 void
3520 set_gdbarch_register_reggroup_p (struct gdbarch *gdbarch,
3521 gdbarch_register_reggroup_p_ftype register_reggroup_p)
3522 {
3523 gdbarch->register_reggroup_p = register_reggroup_p;
3524 }
3525
3526 int
3527 gdbarch_fetch_pointer_argument_p (struct gdbarch *gdbarch)
3528 {
3529 gdb_assert (gdbarch != NULL);
3530 return gdbarch->fetch_pointer_argument != NULL;
3531 }
3532
3533 CORE_ADDR
3534 gdbarch_fetch_pointer_argument (struct gdbarch *gdbarch, struct frame_info *frame, int argi, struct type *type)
3535 {
3536 gdb_assert (gdbarch != NULL);
3537 gdb_assert (gdbarch->fetch_pointer_argument != NULL);
3538 if (gdbarch_debug >= 2)
3539 fprintf_unfiltered (gdb_stdlog, "gdbarch_fetch_pointer_argument called\n");
3540 return gdbarch->fetch_pointer_argument (frame, argi, type);
3541 }
3542
3543 void
3544 set_gdbarch_fetch_pointer_argument (struct gdbarch *gdbarch,
3545 gdbarch_fetch_pointer_argument_ftype fetch_pointer_argument)
3546 {
3547 gdbarch->fetch_pointer_argument = fetch_pointer_argument;
3548 }
3549
3550 int
3551 gdbarch_regset_from_core_section_p (struct gdbarch *gdbarch)
3552 {
3553 gdb_assert (gdbarch != NULL);
3554 return gdbarch->regset_from_core_section != NULL;
3555 }
3556
3557 const struct regset *
3558 gdbarch_regset_from_core_section (struct gdbarch *gdbarch, const char *sect_name, size_t sect_size)
3559 {
3560 gdb_assert (gdbarch != NULL);
3561 gdb_assert (gdbarch->regset_from_core_section != NULL);
3562 if (gdbarch_debug >= 2)
3563 fprintf_unfiltered (gdb_stdlog, "gdbarch_regset_from_core_section called\n");
3564 return gdbarch->regset_from_core_section (gdbarch, sect_name, sect_size);
3565 }
3566
3567 void
3568 set_gdbarch_regset_from_core_section (struct gdbarch *gdbarch,
3569 gdbarch_regset_from_core_section_ftype regset_from_core_section)
3570 {
3571 gdbarch->regset_from_core_section = regset_from_core_section;
3572 }
3573
3574 int
3575 gdbarch_vtable_function_descriptors (struct gdbarch *gdbarch)
3576 {
3577 gdb_assert (gdbarch != NULL);
3578 /* Skip verify of vtable_function_descriptors, invalid_p == 0 */
3579 if (gdbarch_debug >= 2)
3580 fprintf_unfiltered (gdb_stdlog, "gdbarch_vtable_function_descriptors called\n");
3581 return gdbarch->vtable_function_descriptors;
3582 }
3583
3584 void
3585 set_gdbarch_vtable_function_descriptors (struct gdbarch *gdbarch,
3586 int vtable_function_descriptors)
3587 {
3588 gdbarch->vtable_function_descriptors = vtable_function_descriptors;
3589 }
3590
3591 int
3592 gdbarch_vbit_in_delta (struct gdbarch *gdbarch)
3593 {
3594 gdb_assert (gdbarch != NULL);
3595 /* Skip verify of vbit_in_delta, invalid_p == 0 */
3596 if (gdbarch_debug >= 2)
3597 fprintf_unfiltered (gdb_stdlog, "gdbarch_vbit_in_delta called\n");
3598 return gdbarch->vbit_in_delta;
3599 }
3600
3601 void
3602 set_gdbarch_vbit_in_delta (struct gdbarch *gdbarch,
3603 int vbit_in_delta)
3604 {
3605 gdbarch->vbit_in_delta = vbit_in_delta;
3606 }
3607
3608 int
3609 gdbarch_skip_permanent_breakpoint_p (struct gdbarch *gdbarch)
3610 {
3611 gdb_assert (gdbarch != NULL);
3612 return gdbarch->skip_permanent_breakpoint != NULL;
3613 }
3614
3615 void
3616 gdbarch_skip_permanent_breakpoint (struct gdbarch *gdbarch, struct regcache *regcache)
3617 {
3618 gdb_assert (gdbarch != NULL);
3619 gdb_assert (gdbarch->skip_permanent_breakpoint != NULL);
3620 if (gdbarch_debug >= 2)
3621 fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_permanent_breakpoint called\n");
3622 gdbarch->skip_permanent_breakpoint (regcache);
3623 }
3624
3625 void
3626 set_gdbarch_skip_permanent_breakpoint (struct gdbarch *gdbarch,
3627 gdbarch_skip_permanent_breakpoint_ftype skip_permanent_breakpoint)
3628 {
3629 gdbarch->skip_permanent_breakpoint = skip_permanent_breakpoint;
3630 }
3631
3632
3633 /* Keep a registry of per-architecture data-pointers required by GDB
3634 modules. */
3635
3636 struct gdbarch_data
3637 {
3638 unsigned index;
3639 int init_p;
3640 gdbarch_data_pre_init_ftype *pre_init;
3641 gdbarch_data_post_init_ftype *post_init;
3642 };
3643
3644 struct gdbarch_data_registration
3645 {
3646 struct gdbarch_data *data;
3647 struct gdbarch_data_registration *next;
3648 };
3649
3650 struct gdbarch_data_registry
3651 {
3652 unsigned nr;
3653 struct gdbarch_data_registration *registrations;
3654 };
3655
3656 struct gdbarch_data_registry gdbarch_data_registry =
3657 {
3658 0, NULL,
3659 };
3660
3661 static struct gdbarch_data *
3662 gdbarch_data_register (gdbarch_data_pre_init_ftype *pre_init,
3663 gdbarch_data_post_init_ftype *post_init)
3664 {
3665 struct gdbarch_data_registration **curr;
3666 /* Append the new registraration. */
3667 for (curr = &gdbarch_data_registry.registrations;
3668 (*curr) != NULL;
3669 curr = &(*curr)->next);
3670 (*curr) = XMALLOC (struct gdbarch_data_registration);
3671 (*curr)->next = NULL;
3672 (*curr)->data = XMALLOC (struct gdbarch_data);
3673 (*curr)->data->index = gdbarch_data_registry.nr++;
3674 (*curr)->data->pre_init = pre_init;
3675 (*curr)->data->post_init = post_init;
3676 (*curr)->data->init_p = 1;
3677 return (*curr)->data;
3678 }
3679
3680 struct gdbarch_data *
3681 gdbarch_data_register_pre_init (gdbarch_data_pre_init_ftype *pre_init)
3682 {
3683 return gdbarch_data_register (pre_init, NULL);
3684 }
3685
3686 struct gdbarch_data *
3687 gdbarch_data_register_post_init (gdbarch_data_post_init_ftype *post_init)
3688 {
3689 return gdbarch_data_register (NULL, post_init);
3690 }
3691
3692 /* Create/delete the gdbarch data vector. */
3693
3694 static void
3695 alloc_gdbarch_data (struct gdbarch *gdbarch)
3696 {
3697 gdb_assert (gdbarch->data == NULL);
3698 gdbarch->nr_data = gdbarch_data_registry.nr;
3699 gdbarch->data = GDBARCH_OBSTACK_CALLOC (gdbarch, gdbarch->nr_data, void *);
3700 }
3701
3702 /* Initialize the current value of the specified per-architecture
3703 data-pointer. */
3704
3705 void
3706 deprecated_set_gdbarch_data (struct gdbarch *gdbarch,
3707 struct gdbarch_data *data,
3708 void *pointer)
3709 {
3710 gdb_assert (data->index < gdbarch->nr_data);
3711 gdb_assert (gdbarch->data[data->index] == NULL);
3712 gdb_assert (data->pre_init == NULL);
3713 gdbarch->data[data->index] = pointer;
3714 }
3715
3716 /* Return the current value of the specified per-architecture
3717 data-pointer. */
3718
3719 void *
3720 gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *data)
3721 {
3722 gdb_assert (data->index < gdbarch->nr_data);
3723 if (gdbarch->data[data->index] == NULL)
3724 {
3725 /* The data-pointer isn't initialized, call init() to get a
3726 value. */
3727 if (data->pre_init != NULL)
3728 /* Mid architecture creation: pass just the obstack, and not
3729 the entire architecture, as that way it isn't possible for
3730 pre-init code to refer to undefined architecture
3731 fields. */
3732 gdbarch->data[data->index] = data->pre_init (gdbarch->obstack);
3733 else if (gdbarch->initialized_p
3734 && data->post_init != NULL)
3735 /* Post architecture creation: pass the entire architecture
3736 (as all fields are valid), but be careful to also detect
3737 recursive references. */
3738 {
3739 gdb_assert (data->init_p);
3740 data->init_p = 0;
3741 gdbarch->data[data->index] = data->post_init (gdbarch);
3742 data->init_p = 1;
3743 }
3744 else
3745 /* The architecture initialization hasn't completed - punt -
3746 hope that the caller knows what they are doing. Once
3747 deprecated_set_gdbarch_data has been initialized, this can be
3748 changed to an internal error. */
3749 return NULL;
3750 gdb_assert (gdbarch->data[data->index] != NULL);
3751 }
3752 return gdbarch->data[data->index];
3753 }
3754
3755
3756
3757 /* Keep a registry of swapped data required by GDB modules. */
3758
3759 struct gdbarch_swap
3760 {
3761 void *swap;
3762 struct gdbarch_swap_registration *source;
3763 struct gdbarch_swap *next;
3764 };
3765
3766 struct gdbarch_swap_registration
3767 {
3768 void *data;
3769 unsigned long sizeof_data;
3770 gdbarch_swap_ftype *init;
3771 struct gdbarch_swap_registration *next;
3772 };
3773
3774 struct gdbarch_swap_registry
3775 {
3776 int nr;
3777 struct gdbarch_swap_registration *registrations;
3778 };
3779
3780 struct gdbarch_swap_registry gdbarch_swap_registry =
3781 {
3782 0, NULL,
3783 };
3784
3785 void
3786 deprecated_register_gdbarch_swap (void *data,
3787 unsigned long sizeof_data,
3788 gdbarch_swap_ftype *init)
3789 {
3790 struct gdbarch_swap_registration **rego;
3791 for (rego = &gdbarch_swap_registry.registrations;
3792 (*rego) != NULL;
3793 rego = &(*rego)->next);
3794 (*rego) = XMALLOC (struct gdbarch_swap_registration);
3795 (*rego)->next = NULL;
3796 (*rego)->init = init;
3797 (*rego)->data = data;
3798 (*rego)->sizeof_data = sizeof_data;
3799 }
3800
3801 static void
3802 current_gdbarch_swap_init_hack (void)
3803 {
3804 struct gdbarch_swap_registration *rego;
3805 struct gdbarch_swap **curr = &current_gdbarch->swap;
3806 for (rego = gdbarch_swap_registry.registrations;
3807 rego != NULL;
3808 rego = rego->next)
3809 {
3810 if (rego->data != NULL)
3811 {
3812 (*curr) = GDBARCH_OBSTACK_ZALLOC (current_gdbarch,
3813 struct gdbarch_swap);
3814 (*curr)->source = rego;
3815 (*curr)->swap = gdbarch_obstack_zalloc (current_gdbarch,
3816 rego->sizeof_data);
3817 (*curr)->next = NULL;
3818 curr = &(*curr)->next;
3819 }
3820 if (rego->init != NULL)
3821 rego->init ();
3822 }
3823 }
3824
3825 static struct gdbarch *
3826 current_gdbarch_swap_out_hack (void)
3827 {
3828 struct gdbarch *old_gdbarch = current_gdbarch;
3829 struct gdbarch_swap *curr;
3830
3831 gdb_assert (old_gdbarch != NULL);
3832 for (curr = old_gdbarch->swap;
3833 curr != NULL;
3834 curr = curr->next)
3835 {
3836 memcpy (curr->swap, curr->source->data, curr->source->sizeof_data);
3837 memset (curr->source->data, 0, curr->source->sizeof_data);
3838 }
3839 current_gdbarch = NULL;
3840 return old_gdbarch;
3841 }
3842
3843 static void
3844 current_gdbarch_swap_in_hack (struct gdbarch *new_gdbarch)
3845 {
3846 struct gdbarch_swap *curr;
3847
3848 gdb_assert (current_gdbarch == NULL);
3849 for (curr = new_gdbarch->swap;
3850 curr != NULL;
3851 curr = curr->next)
3852 memcpy (curr->source->data, curr->swap, curr->source->sizeof_data);
3853 current_gdbarch = new_gdbarch;
3854 }
3855
3856
3857 /* Keep a registry of the architectures known by GDB. */
3858
3859 struct gdbarch_registration
3860 {
3861 enum bfd_architecture bfd_architecture;
3862 gdbarch_init_ftype *init;
3863 gdbarch_dump_tdep_ftype *dump_tdep;
3864 struct gdbarch_list *arches;
3865 struct gdbarch_registration *next;
3866 };
3867
3868 static struct gdbarch_registration *gdbarch_registry = NULL;
3869
3870 static void
3871 append_name (const char ***buf, int *nr, const char *name)
3872 {
3873 *buf = xrealloc (*buf, sizeof (char**) * (*nr + 1));
3874 (*buf)[*nr] = name;
3875 *nr += 1;
3876 }
3877
3878 const char **
3879 gdbarch_printable_names (void)
3880 {
3881 /* Accumulate a list of names based on the registed list of
3882 architectures. */
3883 enum bfd_architecture a;
3884 int nr_arches = 0;
3885 const char **arches = NULL;
3886 struct gdbarch_registration *rego;
3887 for (rego = gdbarch_registry;
3888 rego != NULL;
3889 rego = rego->next)
3890 {
3891 const struct bfd_arch_info *ap;
3892 ap = bfd_lookup_arch (rego->bfd_architecture, 0);
3893 if (ap == NULL)
3894 internal_error (__FILE__, __LINE__,
3895 _("gdbarch_architecture_names: multi-arch unknown"));
3896 do
3897 {
3898 append_name (&arches, &nr_arches, ap->printable_name);
3899 ap = ap->next;
3900 }
3901 while (ap != NULL);
3902 }
3903 append_name (&arches, &nr_arches, NULL);
3904 return arches;
3905 }
3906
3907
3908 void
3909 gdbarch_register (enum bfd_architecture bfd_architecture,
3910 gdbarch_init_ftype *init,
3911 gdbarch_dump_tdep_ftype *dump_tdep)
3912 {
3913 struct gdbarch_registration **curr;
3914 const struct bfd_arch_info *bfd_arch_info;
3915 /* Check that BFD recognizes this architecture */
3916 bfd_arch_info = bfd_lookup_arch (bfd_architecture, 0);
3917 if (bfd_arch_info == NULL)
3918 {
3919 internal_error (__FILE__, __LINE__,
3920 _("gdbarch: Attempt to register unknown architecture (%d)"),
3921 bfd_architecture);
3922 }
3923 /* Check that we haven't seen this architecture before */
3924 for (curr = &gdbarch_registry;
3925 (*curr) != NULL;
3926 curr = &(*curr)->next)
3927 {
3928 if (bfd_architecture == (*curr)->bfd_architecture)
3929 internal_error (__FILE__, __LINE__,
3930 _("gdbarch: Duplicate registraration of architecture (%s)"),
3931 bfd_arch_info->printable_name);
3932 }
3933 /* log it */
3934 if (gdbarch_debug)
3935 fprintf_unfiltered (gdb_stdlog, "register_gdbarch_init (%s, 0x%08lx)\n",
3936 bfd_arch_info->printable_name,
3937 (long) init);
3938 /* Append it */
3939 (*curr) = XMALLOC (struct gdbarch_registration);
3940 (*curr)->bfd_architecture = bfd_architecture;
3941 (*curr)->init = init;
3942 (*curr)->dump_tdep = dump_tdep;
3943 (*curr)->arches = NULL;
3944 (*curr)->next = NULL;
3945 }
3946
3947 void
3948 register_gdbarch_init (enum bfd_architecture bfd_architecture,
3949 gdbarch_init_ftype *init)
3950 {
3951 gdbarch_register (bfd_architecture, init, NULL);
3952 }
3953
3954
3955 /* Look for an architecture using gdbarch_info. */
3956
3957 struct gdbarch_list *
3958 gdbarch_list_lookup_by_info (struct gdbarch_list *arches,
3959 const struct gdbarch_info *info)
3960 {
3961 for (; arches != NULL; arches = arches->next)
3962 {
3963 if (info->bfd_arch_info != arches->gdbarch->bfd_arch_info)
3964 continue;
3965 if (info->byte_order != arches->gdbarch->byte_order)
3966 continue;
3967 if (info->osabi != arches->gdbarch->osabi)
3968 continue;
3969 if (info->target_desc != arches->gdbarch->target_desc)
3970 continue;
3971 return arches;
3972 }
3973 return NULL;
3974 }
3975
3976
3977 /* Find an architecture that matches the specified INFO. Create a new
3978 architecture if needed. Return that new architecture. Assumes
3979 that there is no current architecture. */
3980
3981 static struct gdbarch *
3982 find_arch_by_info (struct gdbarch_info info)
3983 {
3984 struct gdbarch *new_gdbarch;
3985 struct gdbarch_registration *rego;
3986
3987 /* The existing architecture has been swapped out - all this code
3988 works from a clean slate. */
3989 gdb_assert (current_gdbarch == NULL);
3990
3991 /* Fill in missing parts of the INFO struct using a number of
3992 sources: "set ..."; INFOabfd supplied; and the global
3993 defaults. */
3994 gdbarch_info_fill (&info);
3995
3996 /* Must have found some sort of architecture. */
3997 gdb_assert (info.bfd_arch_info != NULL);
3998
3999 if (gdbarch_debug)
4000 {
4001 fprintf_unfiltered (gdb_stdlog,
4002 "find_arch_by_info: info.bfd_arch_info %s\n",
4003 (info.bfd_arch_info != NULL
4004 ? info.bfd_arch_info->printable_name
4005 : "(null)"));
4006 fprintf_unfiltered (gdb_stdlog,
4007 "find_arch_by_info: info.byte_order %d (%s)\n",
4008 info.byte_order,
4009 (info.byte_order == BFD_ENDIAN_BIG ? "big"
4010 : info.byte_order == BFD_ENDIAN_LITTLE ? "little"
4011 : "default"));
4012 fprintf_unfiltered (gdb_stdlog,
4013 "find_arch_by_info: info.osabi %d (%s)\n",
4014 info.osabi, gdbarch_osabi_name (info.osabi));
4015 fprintf_unfiltered (gdb_stdlog,
4016 "find_arch_by_info: info.abfd 0x%lx\n",
4017 (long) info.abfd);
4018 fprintf_unfiltered (gdb_stdlog,
4019 "find_arch_by_info: info.tdep_info 0x%lx\n",
4020 (long) info.tdep_info);
4021 }
4022
4023 /* Find the tdep code that knows about this architecture. */
4024 for (rego = gdbarch_registry;
4025 rego != NULL;
4026 rego = rego->next)
4027 if (rego->bfd_architecture == info.bfd_arch_info->arch)
4028 break;
4029 if (rego == NULL)
4030 {
4031 if (gdbarch_debug)
4032 fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: "
4033 "No matching architecture\n");
4034 return 0;
4035 }
4036
4037 /* Ask the tdep code for an architecture that matches "info". */
4038 new_gdbarch = rego->init (info, rego->arches);
4039
4040 /* Did the tdep code like it? No. Reject the change and revert to
4041 the old architecture. */
4042 if (new_gdbarch == NULL)
4043 {
4044 if (gdbarch_debug)
4045 fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: "
4046 "Target rejected architecture\n");
4047 return NULL;
4048 }
4049
4050 /* Is this a pre-existing architecture (as determined by already
4051 being initialized)? Move it to the front of the architecture
4052 list (keeping the list sorted Most Recently Used). */
4053 if (new_gdbarch->initialized_p)
4054 {
4055 struct gdbarch_list **list;
4056 struct gdbarch_list *this;
4057 if (gdbarch_debug)
4058 fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: "
4059 "Previous architecture 0x%08lx (%s) selected\n",
4060 (long) new_gdbarch,
4061 new_gdbarch->bfd_arch_info->printable_name);
4062 /* Find the existing arch in the list. */
4063 for (list = &rego->arches;
4064 (*list) != NULL && (*list)->gdbarch != new_gdbarch;
4065 list = &(*list)->next);
4066 /* It had better be in the list of architectures. */
4067 gdb_assert ((*list) != NULL && (*list)->gdbarch == new_gdbarch);
4068 /* Unlink THIS. */
4069 this = (*list);
4070 (*list) = this->next;
4071 /* Insert THIS at the front. */
4072 this->next = rego->arches;
4073 rego->arches = this;
4074 /* Return it. */
4075 return new_gdbarch;
4076 }
4077
4078 /* It's a new architecture. */
4079 if (gdbarch_debug)
4080 fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: "
4081 "New architecture 0x%08lx (%s) selected\n",
4082 (long) new_gdbarch,
4083 new_gdbarch->bfd_arch_info->printable_name);
4084
4085 /* Insert the new architecture into the front of the architecture
4086 list (keep the list sorted Most Recently Used). */
4087 {
4088 struct gdbarch_list *this = XMALLOC (struct gdbarch_list);
4089 this->next = rego->arches;
4090 this->gdbarch = new_gdbarch;
4091 rego->arches = this;
4092 }
4093
4094 /* Check that the newly installed architecture is valid. Plug in
4095 any post init values. */
4096 new_gdbarch->dump_tdep = rego->dump_tdep;
4097 verify_gdbarch (new_gdbarch);
4098 new_gdbarch->initialized_p = 1;
4099
4100 /* Initialize any per-architecture swap areas. This phase requires
4101 a valid global CURRENT_GDBARCH. Set it momentarially, and then
4102 swap the entire architecture out. */
4103 current_gdbarch = new_gdbarch;
4104 current_gdbarch_swap_init_hack ();
4105 current_gdbarch_swap_out_hack ();
4106
4107 if (gdbarch_debug)
4108 gdbarch_dump (new_gdbarch, gdb_stdlog);
4109
4110 return new_gdbarch;
4111 }
4112
4113 struct gdbarch *
4114 gdbarch_find_by_info (struct gdbarch_info info)
4115 {
4116 /* Save the previously selected architecture, setting the global to
4117 NULL. This stops things like gdbarch->init() trying to use the
4118 previous architecture's configuration. The previous architecture
4119 may not even be of the same architecture family. The most recent
4120 architecture of the same family is found at the head of the
4121 rego->arches list. */
4122 struct gdbarch *old_gdbarch = current_gdbarch_swap_out_hack ();
4123
4124 /* Find the specified architecture. */
4125 struct gdbarch *new_gdbarch = find_arch_by_info (info);
4126
4127 /* Restore the existing architecture. */
4128 gdb_assert (current_gdbarch == NULL);
4129 current_gdbarch_swap_in_hack (old_gdbarch);
4130
4131 return new_gdbarch;
4132 }
4133
4134 /* Make the specified architecture current, swapping the existing one
4135 out. */
4136
4137 void
4138 deprecated_current_gdbarch_select_hack (struct gdbarch *new_gdbarch)
4139 {
4140 gdb_assert (new_gdbarch != NULL);
4141 gdb_assert (current_gdbarch != NULL);
4142 gdb_assert (new_gdbarch->initialized_p);
4143 current_gdbarch_swap_out_hack ();
4144 current_gdbarch_swap_in_hack (new_gdbarch);
4145 architecture_changed_event ();
4146 reinit_frame_cache ();
4147 }
4148
4149 extern void _initialize_gdbarch (void);
4150
4151 void
4152 _initialize_gdbarch (void)
4153 {
4154 struct cmd_list_element *c;
4155
4156 add_setshow_zinteger_cmd ("arch", class_maintenance, &gdbarch_debug, _("\
4157 Set architecture debugging."), _("\
4158 Show architecture debugging."), _("\
4159 When non-zero, architecture debugging is enabled."),
4160 NULL,
4161 show_gdbarch_debug,
4162 &setdebuglist, &showdebuglist);
4163 }
This page took 0.116673 seconds and 4 git commands to generate.