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