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