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