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