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