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