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