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