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