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