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