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