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