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