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