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