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