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