]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/gdbarch.c
2012-05-24 Pedro Alves <palves@redhat.com>
[thirdparty/binutils-gdb.git] / gdb / gdbarch.c
1 /* *INDENT-OFF* */ /* THIS FILE IS GENERATED */
2
3 /* Dynamic architecture support for GDB, the GNU debugger.
4
5 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
6 2007, 2008, 2009 Free Software Foundation, Inc.
7
8 This file is part of GDB.
9
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 3 of the License, or
13 (at your option) any later version.
14
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.
19
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22
23 /* This file was created with the aid of ``gdbarch.sh''.
24
25 The Bourne shell script ``gdbarch.sh'' creates the files
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
31 changes into that script. Conversely, when making sweeping changes
32 to this file, modifying gdbarch.sh and using its output may prove
33 easier. */
34
35
36 #include "defs.h"
37 #include "arch-utils.h"
38
39 #include "gdbcmd.h"
40 #include "inferior.h"
41 #include "symcat.h"
42
43 #include "floatformat.h"
44
45 #include "gdb_assert.h"
46 #include "gdb_string.h"
47 #include "reggroups.h"
48 #include "osabi.h"
49 #include "gdb_obstack.h"
50 #include "observer.h"
51 #include "regcache.h"
52
53 /* Static function declarations */
54
55 static void alloc_gdbarch_data (struct gdbarch *);
56
57 /* Non-zero if we want to trace architecture code. */
58
59 #ifndef GDBARCH_DEBUG
60 #define GDBARCH_DEBUG 0
61 #endif
62 int gdbarch_debug = GDBARCH_DEBUG;
63 static void
64 show_gdbarch_debug (struct ui_file *file, int from_tty,
65 struct cmd_list_element *c, const char *value)
66 {
67 fprintf_filtered (file, _("Architecture debugging is %s.\n"), value);
68 }
69
70 static const char *
71 pformat (const struct floatformat **format)
72 {
73 if (format == NULL)
74 return "(null)";
75 else
76 /* Just print out one of them - this is only for diagnostics. */
77 return format[0]->name;
78 }
79
80 static const char *
81 pstring (const char *string)
82 {
83 if (string == NULL)
84 return "(null)";
85 return string;
86 }
87
88
89 /* Maintain the struct gdbarch object. */
90
91 struct gdbarch
92 {
93 /* Has this architecture been fully initialized? */
94 int initialized_p;
95
96 /* An obstack bound to the lifetime of the architecture. */
97 struct obstack *obstack;
98
99 /* basic architectural information. */
100 const struct bfd_arch_info * bfd_arch_info;
101 int byte_order;
102 int byte_order_for_code;
103 enum gdb_osabi osabi;
104 const struct target_desc * target_desc;
105
106 /* target specific vector. */
107 struct gdbarch_tdep *tdep;
108 gdbarch_dump_tdep_ftype *dump_tdep;
109
110 /* per-architecture data-pointers. */
111 unsigned nr_data;
112 void **data;
113
114 /* per-architecture swap-regions. */
115 struct gdbarch_swap *swap;
116
117 /* Multi-arch values.
118
119 When extending this structure you must:
120
121 Add the field below.
122
123 Declare set/get functions and define the corresponding
124 macro in gdbarch.h.
125
126 gdbarch_alloc(): If zero/NULL is not a suitable default,
127 initialize the new field.
128
129 verify_gdbarch(): Confirm that the target updated the field
130 correctly.
131
132 gdbarch_dump(): Add a fprintf_unfiltered call so that the new
133 field is dumped out
134
135 ``startup_gdbarch()'': Append an initial value to the static
136 variable (base values on the host's c-type system).
137
138 get_gdbarch(): Implement the set/get functions (probably using
139 the macro's as shortcuts).
140
141 */
142
143 int bits_big_endian;
144 int short_bit;
145 int int_bit;
146 int long_bit;
147 int long_long_bit;
148 int long_long_align_bit;
149 int half_bit;
150 const struct floatformat ** half_format;
151 int float_bit;
152 const struct floatformat ** float_format;
153 int double_bit;
154 const struct floatformat ** double_format;
155 int long_double_bit;
156 const struct floatformat ** long_double_format;
157 int ptr_bit;
158 int addr_bit;
159 int dwarf2_addr_size;
160 int char_signed;
161 gdbarch_read_pc_ftype *read_pc;
162 gdbarch_write_pc_ftype *write_pc;
163 gdbarch_virtual_frame_pointer_ftype *virtual_frame_pointer;
164 gdbarch_pseudo_register_read_ftype *pseudo_register_read;
165 gdbarch_pseudo_register_read_value_ftype *pseudo_register_read_value;
166 gdbarch_pseudo_register_write_ftype *pseudo_register_write;
167 int num_regs;
168 int num_pseudo_regs;
169 gdbarch_ax_pseudo_register_collect_ftype *ax_pseudo_register_collect;
170 gdbarch_ax_pseudo_register_push_stack_ftype *ax_pseudo_register_push_stack;
171 int sp_regnum;
172 int pc_regnum;
173 int ps_regnum;
174 int fp0_regnum;
175 gdbarch_stab_reg_to_regnum_ftype *stab_reg_to_regnum;
176 gdbarch_ecoff_reg_to_regnum_ftype *ecoff_reg_to_regnum;
177 gdbarch_sdb_reg_to_regnum_ftype *sdb_reg_to_regnum;
178 gdbarch_dwarf2_reg_to_regnum_ftype *dwarf2_reg_to_regnum;
179 gdbarch_register_name_ftype *register_name;
180 gdbarch_register_type_ftype *register_type;
181 gdbarch_dummy_id_ftype *dummy_id;
182 int deprecated_fp_regnum;
183 gdbarch_push_dummy_call_ftype *push_dummy_call;
184 int call_dummy_location;
185 gdbarch_push_dummy_code_ftype *push_dummy_code;
186 gdbarch_print_registers_info_ftype *print_registers_info;
187 gdbarch_print_float_info_ftype *print_float_info;
188 gdbarch_print_vector_info_ftype *print_vector_info;
189 gdbarch_register_sim_regno_ftype *register_sim_regno;
190 gdbarch_cannot_fetch_register_ftype *cannot_fetch_register;
191 gdbarch_cannot_store_register_ftype *cannot_store_register;
192 gdbarch_get_longjmp_target_ftype *get_longjmp_target;
193 int believe_pcc_promotion;
194 gdbarch_convert_register_p_ftype *convert_register_p;
195 gdbarch_register_to_value_ftype *register_to_value;
196 gdbarch_value_to_register_ftype *value_to_register;
197 gdbarch_value_from_register_ftype *value_from_register;
198 gdbarch_pointer_to_address_ftype *pointer_to_address;
199 gdbarch_address_to_pointer_ftype *address_to_pointer;
200 gdbarch_integer_to_address_ftype *integer_to_address;
201 gdbarch_return_value_ftype *return_value;
202 gdbarch_skip_prologue_ftype *skip_prologue;
203 gdbarch_skip_main_prologue_ftype *skip_main_prologue;
204 gdbarch_inner_than_ftype *inner_than;
205 gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc;
206 gdbarch_remote_breakpoint_from_pc_ftype *remote_breakpoint_from_pc;
207 gdbarch_adjust_breakpoint_address_ftype *adjust_breakpoint_address;
208 gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint;
209 gdbarch_memory_remove_breakpoint_ftype *memory_remove_breakpoint;
210 CORE_ADDR decr_pc_after_break;
211 CORE_ADDR deprecated_function_start_offset;
212 gdbarch_remote_register_number_ftype *remote_register_number;
213 gdbarch_fetch_tls_load_module_address_ftype *fetch_tls_load_module_address;
214 CORE_ADDR frame_args_skip;
215 gdbarch_unwind_pc_ftype *unwind_pc;
216 gdbarch_unwind_sp_ftype *unwind_sp;
217 gdbarch_frame_num_args_ftype *frame_num_args;
218 gdbarch_frame_align_ftype *frame_align;
219 gdbarch_stabs_argument_has_addr_ftype *stabs_argument_has_addr;
220 int frame_red_zone_size;
221 gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr;
222 gdbarch_addr_bits_remove_ftype *addr_bits_remove;
223 gdbarch_smash_text_address_ftype *smash_text_address;
224 gdbarch_software_single_step_ftype *software_single_step;
225 gdbarch_single_step_through_delay_ftype *single_step_through_delay;
226 gdbarch_print_insn_ftype *print_insn;
227 gdbarch_skip_trampoline_code_ftype *skip_trampoline_code;
228 gdbarch_skip_solib_resolver_ftype *skip_solib_resolver;
229 gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline;
230 gdbarch_in_function_epilogue_p_ftype *in_function_epilogue_p;
231 gdbarch_elf_make_msymbol_special_ftype *elf_make_msymbol_special;
232 gdbarch_coff_make_msymbol_special_ftype *coff_make_msymbol_special;
233 int cannot_step_breakpoint;
234 int have_nonsteppable_watchpoint;
235 gdbarch_address_class_type_flags_ftype *address_class_type_flags;
236 gdbarch_address_class_type_flags_to_name_ftype *address_class_type_flags_to_name;
237 gdbarch_address_class_name_to_type_flags_ftype *address_class_name_to_type_flags;
238 gdbarch_register_reggroup_p_ftype *register_reggroup_p;
239 gdbarch_fetch_pointer_argument_ftype *fetch_pointer_argument;
240 gdbarch_regset_from_core_section_ftype *regset_from_core_section;
241 struct core_regset_section * core_regset_sections;
242 gdbarch_make_corefile_notes_ftype *make_corefile_notes;
243 gdbarch_find_memory_regions_ftype *find_memory_regions;
244 gdbarch_core_xfer_shared_libraries_ftype *core_xfer_shared_libraries;
245 gdbarch_core_pid_to_str_ftype *core_pid_to_str;
246 const char * gcore_bfd_target;
247 int vtable_function_descriptors;
248 int vbit_in_delta;
249 gdbarch_skip_permanent_breakpoint_ftype *skip_permanent_breakpoint;
250 ULONGEST max_insn_length;
251 gdbarch_displaced_step_copy_insn_ftype *displaced_step_copy_insn;
252 gdbarch_displaced_step_hw_singlestep_ftype *displaced_step_hw_singlestep;
253 gdbarch_displaced_step_fixup_ftype *displaced_step_fixup;
254 gdbarch_displaced_step_free_closure_ftype *displaced_step_free_closure;
255 gdbarch_displaced_step_location_ftype *displaced_step_location;
256 gdbarch_relocate_instruction_ftype *relocate_instruction;
257 gdbarch_overlay_update_ftype *overlay_update;
258 gdbarch_core_read_description_ftype *core_read_description;
259 gdbarch_static_transform_name_ftype *static_transform_name;
260 int sofun_address_maybe_missing;
261 gdbarch_process_record_ftype *process_record;
262 gdbarch_process_record_signal_ftype *process_record_signal;
263 gdbarch_gdb_signal_from_target_ftype *gdb_signal_from_target;
264 gdbarch_get_siginfo_type_ftype *get_siginfo_type;
265 gdbarch_record_special_symbol_ftype *record_special_symbol;
266 gdbarch_get_syscall_number_ftype *get_syscall_number;
267 const char * stap_integer_prefix;
268 const char * stap_integer_suffix;
269 const char * stap_register_prefix;
270 const char * stap_register_suffix;
271 const char * stap_register_indirection_prefix;
272 const char * stap_register_indirection_suffix;
273 const char * stap_gdb_register_prefix;
274 const char * stap_gdb_register_suffix;
275 gdbarch_stap_is_single_operand_ftype *stap_is_single_operand;
276 gdbarch_stap_parse_special_token_ftype *stap_parse_special_token;
277 int has_global_solist;
278 int has_global_breakpoints;
279 gdbarch_has_shared_address_space_ftype *has_shared_address_space;
280 gdbarch_fast_tracepoint_valid_at_ftype *fast_tracepoint_valid_at;
281 gdbarch_auto_charset_ftype *auto_charset;
282 gdbarch_auto_wide_charset_ftype *auto_wide_charset;
283 const char * solib_symbols_extension;
284 int has_dos_based_file_system;
285 gdbarch_gen_return_address_ftype *gen_return_address;
286 gdbarch_info_proc_ftype *info_proc;
287 };
288
289
290 /* The default architecture uses host values (for want of a better
291 choice). */
292
293 extern const struct bfd_arch_info bfd_default_arch_struct;
294
295 struct gdbarch startup_gdbarch =
296 {
297 1, /* Always initialized. */
298 NULL, /* The obstack. */
299 /* basic architecture information. */
300 &bfd_default_arch_struct, /* bfd_arch_info */
301 BFD_ENDIAN_BIG, /* byte_order */
302 BFD_ENDIAN_BIG, /* byte_order_for_code */
303 GDB_OSABI_UNKNOWN, /* osabi */
304 0, /* target_desc */
305 /* target specific vector and its dump routine. */
306 NULL, NULL,
307 /*per-architecture data-pointers and swap regions. */
308 0, NULL, NULL,
309 /* Multi-arch values */
310 1, /* bits_big_endian */
311 8 * sizeof (short), /* short_bit */
312 8 * sizeof (int), /* int_bit */
313 8 * sizeof (long), /* long_bit */
314 8 * sizeof (LONGEST), /* long_long_bit */
315 8 * sizeof (LONGEST), /* long_long_align_bit */
316 16, /* half_bit */
317 0, /* half_format */
318 8 * sizeof (float), /* float_bit */
319 0, /* float_format */
320 8 * sizeof (double), /* double_bit */
321 0, /* double_format */
322 8 * sizeof (long double), /* long_double_bit */
323 0, /* long_double_format */
324 8 * sizeof (void*), /* ptr_bit */
325 8 * sizeof (void*), /* addr_bit */
326 sizeof (void*), /* dwarf2_addr_size */
327 1, /* char_signed */
328 0, /* read_pc */
329 0, /* write_pc */
330 legacy_virtual_frame_pointer, /* virtual_frame_pointer */
331 0, /* pseudo_register_read */
332 0, /* pseudo_register_read_value */
333 0, /* pseudo_register_write */
334 0, /* num_regs */
335 0, /* num_pseudo_regs */
336 0, /* ax_pseudo_register_collect */
337 0, /* ax_pseudo_register_push_stack */
338 -1, /* sp_regnum */
339 -1, /* pc_regnum */
340 -1, /* ps_regnum */
341 0, /* fp0_regnum */
342 no_op_reg_to_regnum, /* stab_reg_to_regnum */
343 no_op_reg_to_regnum, /* ecoff_reg_to_regnum */
344 no_op_reg_to_regnum, /* sdb_reg_to_regnum */
345 no_op_reg_to_regnum, /* dwarf2_reg_to_regnum */
346 0, /* register_name */
347 0, /* register_type */
348 0, /* dummy_id */
349 -1, /* deprecated_fp_regnum */
350 0, /* push_dummy_call */
351 0, /* call_dummy_location */
352 0, /* push_dummy_code */
353 default_print_registers_info, /* print_registers_info */
354 0, /* print_float_info */
355 0, /* print_vector_info */
356 legacy_register_sim_regno, /* register_sim_regno */
357 cannot_register_not, /* cannot_fetch_register */
358 cannot_register_not, /* cannot_store_register */
359 0, /* get_longjmp_target */
360 0, /* believe_pcc_promotion */
361 generic_convert_register_p, /* convert_register_p */
362 0, /* register_to_value */
363 0, /* value_to_register */
364 0, /* value_from_register */
365 unsigned_pointer_to_address, /* pointer_to_address */
366 unsigned_address_to_pointer, /* address_to_pointer */
367 0, /* integer_to_address */
368 0, /* return_value */
369 0, /* skip_prologue */
370 0, /* skip_main_prologue */
371 0, /* inner_than */
372 0, /* breakpoint_from_pc */
373 default_remote_breakpoint_from_pc, /* remote_breakpoint_from_pc */
374 0, /* adjust_breakpoint_address */
375 default_memory_insert_breakpoint, /* memory_insert_breakpoint */
376 default_memory_remove_breakpoint, /* memory_remove_breakpoint */
377 0, /* decr_pc_after_break */
378 0, /* deprecated_function_start_offset */
379 default_remote_register_number, /* remote_register_number */
380 0, /* fetch_tls_load_module_address */
381 0, /* frame_args_skip */
382 0, /* unwind_pc */
383 0, /* unwind_sp */
384 0, /* frame_num_args */
385 0, /* frame_align */
386 default_stabs_argument_has_addr, /* stabs_argument_has_addr */
387 0, /* frame_red_zone_size */
388 convert_from_func_ptr_addr_identity, /* convert_from_func_ptr_addr */
389 core_addr_identity, /* addr_bits_remove */
390 core_addr_identity, /* smash_text_address */
391 0, /* software_single_step */
392 0, /* single_step_through_delay */
393 0, /* print_insn */
394 0, /* skip_trampoline_code */
395 generic_skip_solib_resolver, /* skip_solib_resolver */
396 generic_in_solib_return_trampoline, /* in_solib_return_trampoline */
397 generic_in_function_epilogue_p, /* in_function_epilogue_p */
398 0, /* elf_make_msymbol_special */
399 0, /* coff_make_msymbol_special */
400 0, /* cannot_step_breakpoint */
401 0, /* have_nonsteppable_watchpoint */
402 0, /* address_class_type_flags */
403 0, /* address_class_type_flags_to_name */
404 0, /* address_class_name_to_type_flags */
405 default_register_reggroup_p, /* register_reggroup_p */
406 0, /* fetch_pointer_argument */
407 0, /* regset_from_core_section */
408 0, /* core_regset_sections */
409 0, /* make_corefile_notes */
410 0, /* find_memory_regions */
411 0, /* core_xfer_shared_libraries */
412 0, /* core_pid_to_str */
413 0, /* gcore_bfd_target */
414 0, /* vtable_function_descriptors */
415 0, /* vbit_in_delta */
416 0, /* skip_permanent_breakpoint */
417 0, /* max_insn_length */
418 0, /* displaced_step_copy_insn */
419 default_displaced_step_hw_singlestep, /* displaced_step_hw_singlestep */
420 0, /* displaced_step_fixup */
421 NULL, /* displaced_step_free_closure */
422 NULL, /* displaced_step_location */
423 0, /* relocate_instruction */
424 0, /* overlay_update */
425 0, /* core_read_description */
426 0, /* static_transform_name */
427 0, /* sofun_address_maybe_missing */
428 0, /* process_record */
429 0, /* process_record_signal */
430 default_gdb_signal_from_target, /* gdb_signal_from_target */
431 0, /* get_siginfo_type */
432 0, /* record_special_symbol */
433 0, /* get_syscall_number */
434 0, /* stap_integer_prefix */
435 0, /* stap_integer_suffix */
436 0, /* stap_register_prefix */
437 0, /* stap_register_suffix */
438 0, /* stap_register_indirection_prefix */
439 0, /* stap_register_indirection_suffix */
440 0, /* stap_gdb_register_prefix */
441 0, /* stap_gdb_register_suffix */
442 0, /* stap_is_single_operand */
443 0, /* stap_parse_special_token */
444 0, /* has_global_solist */
445 0, /* has_global_breakpoints */
446 default_has_shared_address_space, /* has_shared_address_space */
447 default_fast_tracepoint_valid_at, /* fast_tracepoint_valid_at */
448 default_auto_charset, /* auto_charset */
449 default_auto_wide_charset, /* auto_wide_charset */
450 0, /* solib_symbols_extension */
451 0, /* has_dos_based_file_system */
452 default_gen_return_address, /* gen_return_address */
453 0, /* info_proc */
454 /* startup_gdbarch() */
455 };
456
457 struct gdbarch *target_gdbarch = &startup_gdbarch;
458
459 /* Create a new ``struct gdbarch'' based on information provided by
460 ``struct gdbarch_info''. */
461
462 struct gdbarch *
463 gdbarch_alloc (const struct gdbarch_info *info,
464 struct gdbarch_tdep *tdep)
465 {
466 struct gdbarch *gdbarch;
467
468 /* Create an obstack for allocating all the per-architecture memory,
469 then use that to allocate the architecture vector. */
470 struct obstack *obstack = XMALLOC (struct obstack);
471 obstack_init (obstack);
472 gdbarch = obstack_alloc (obstack, sizeof (*gdbarch));
473 memset (gdbarch, 0, sizeof (*gdbarch));
474 gdbarch->obstack = obstack;
475
476 alloc_gdbarch_data (gdbarch);
477
478 gdbarch->tdep = tdep;
479
480 gdbarch->bfd_arch_info = info->bfd_arch_info;
481 gdbarch->byte_order = info->byte_order;
482 gdbarch->byte_order_for_code = info->byte_order_for_code;
483 gdbarch->osabi = info->osabi;
484 gdbarch->target_desc = info->target_desc;
485
486 /* Force the explicit initialization of these. */
487 gdbarch->bits_big_endian = (gdbarch->byte_order == BFD_ENDIAN_BIG);
488 gdbarch->short_bit = 2*TARGET_CHAR_BIT;
489 gdbarch->int_bit = 4*TARGET_CHAR_BIT;
490 gdbarch->long_bit = 4*TARGET_CHAR_BIT;
491 gdbarch->long_long_bit = 2*gdbarch->long_bit;
492 gdbarch->long_long_align_bit = 2*gdbarch->long_bit;
493 gdbarch->half_bit = 2*TARGET_CHAR_BIT;
494 gdbarch->float_bit = 4*TARGET_CHAR_BIT;
495 gdbarch->double_bit = 8*TARGET_CHAR_BIT;
496 gdbarch->long_double_bit = 8*TARGET_CHAR_BIT;
497 gdbarch->ptr_bit = gdbarch->int_bit;
498 gdbarch->char_signed = -1;
499 gdbarch->virtual_frame_pointer = legacy_virtual_frame_pointer;
500 gdbarch->num_regs = -1;
501 gdbarch->sp_regnum = -1;
502 gdbarch->pc_regnum = -1;
503 gdbarch->ps_regnum = -1;
504 gdbarch->fp0_regnum = -1;
505 gdbarch->stab_reg_to_regnum = no_op_reg_to_regnum;
506 gdbarch->ecoff_reg_to_regnum = no_op_reg_to_regnum;
507 gdbarch->sdb_reg_to_regnum = no_op_reg_to_regnum;
508 gdbarch->dwarf2_reg_to_regnum = no_op_reg_to_regnum;
509 gdbarch->deprecated_fp_regnum = -1;
510 gdbarch->call_dummy_location = AT_ENTRY_POINT;
511 gdbarch->print_registers_info = default_print_registers_info;
512 gdbarch->register_sim_regno = legacy_register_sim_regno;
513 gdbarch->cannot_fetch_register = cannot_register_not;
514 gdbarch->cannot_store_register = cannot_register_not;
515 gdbarch->convert_register_p = generic_convert_register_p;
516 gdbarch->value_from_register = default_value_from_register;
517 gdbarch->pointer_to_address = unsigned_pointer_to_address;
518 gdbarch->address_to_pointer = unsigned_address_to_pointer;
519 gdbarch->remote_breakpoint_from_pc = default_remote_breakpoint_from_pc;
520 gdbarch->memory_insert_breakpoint = default_memory_insert_breakpoint;
521 gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint;
522 gdbarch->remote_register_number = default_remote_register_number;
523 gdbarch->stabs_argument_has_addr = default_stabs_argument_has_addr;
524 gdbarch->convert_from_func_ptr_addr = convert_from_func_ptr_addr_identity;
525 gdbarch->addr_bits_remove = core_addr_identity;
526 gdbarch->smash_text_address = core_addr_identity;
527 gdbarch->skip_trampoline_code = generic_skip_trampoline_code;
528 gdbarch->skip_solib_resolver = generic_skip_solib_resolver;
529 gdbarch->in_solib_return_trampoline = generic_in_solib_return_trampoline;
530 gdbarch->in_function_epilogue_p = generic_in_function_epilogue_p;
531 gdbarch->elf_make_msymbol_special = default_elf_make_msymbol_special;
532 gdbarch->coff_make_msymbol_special = default_coff_make_msymbol_special;
533 gdbarch->register_reggroup_p = default_register_reggroup_p;
534 gdbarch->displaced_step_hw_singlestep = default_displaced_step_hw_singlestep;
535 gdbarch->displaced_step_fixup = NULL;
536 gdbarch->displaced_step_free_closure = NULL;
537 gdbarch->displaced_step_location = NULL;
538 gdbarch->relocate_instruction = NULL;
539 gdbarch->gdb_signal_from_target = default_gdb_signal_from_target;
540 gdbarch->has_shared_address_space = default_has_shared_address_space;
541 gdbarch->fast_tracepoint_valid_at = default_fast_tracepoint_valid_at;
542 gdbarch->auto_charset = default_auto_charset;
543 gdbarch->auto_wide_charset = default_auto_wide_charset;
544 gdbarch->gen_return_address = default_gen_return_address;
545 /* gdbarch_alloc() */
546
547 return gdbarch;
548 }
549
550
551 /* Allocate extra space using the per-architecture obstack. */
552
553 void *
554 gdbarch_obstack_zalloc (struct gdbarch *arch, long size)
555 {
556 void *data = obstack_alloc (arch->obstack, size);
557
558 memset (data, 0, size);
559 return data;
560 }
561
562
563 /* Free a gdbarch struct. This should never happen in normal
564 operation --- once you've created a gdbarch, you keep it around.
565 However, if an architecture's init function encounters an error
566 building the structure, it may need to clean up a partially
567 constructed gdbarch. */
568
569 void
570 gdbarch_free (struct gdbarch *arch)
571 {
572 struct obstack *obstack;
573
574 gdb_assert (arch != NULL);
575 gdb_assert (!arch->initialized_p);
576 obstack = arch->obstack;
577 obstack_free (obstack, 0); /* Includes the ARCH. */
578 xfree (obstack);
579 }
580
581
582 /* Ensure that all values in a GDBARCH are reasonable. */
583
584 static void
585 verify_gdbarch (struct gdbarch *gdbarch)
586 {
587 struct ui_file *log;
588 struct cleanup *cleanups;
589 long length;
590 char *buf;
591
592 log = mem_fileopen ();
593 cleanups = make_cleanup_ui_file_delete (log);
594 /* fundamental */
595 if (gdbarch->byte_order == BFD_ENDIAN_UNKNOWN)
596 fprintf_unfiltered (log, "\n\tbyte-order");
597 if (gdbarch->bfd_arch_info == NULL)
598 fprintf_unfiltered (log, "\n\tbfd_arch_info");
599 /* Check those that need to be defined for the given multi-arch level. */
600 /* Skip verify of bits_big_endian, invalid_p == 0 */
601 /* Skip verify of short_bit, invalid_p == 0 */
602 /* Skip verify of int_bit, invalid_p == 0 */
603 /* Skip verify of long_bit, invalid_p == 0 */
604 /* Skip verify of long_long_bit, invalid_p == 0 */
605 /* Skip verify of long_long_align_bit, invalid_p == 0 */
606 /* Skip verify of half_bit, invalid_p == 0 */
607 if (gdbarch->half_format == 0)
608 gdbarch->half_format = floatformats_ieee_half;
609 /* Skip verify of float_bit, invalid_p == 0 */
610 if (gdbarch->float_format == 0)
611 gdbarch->float_format = floatformats_ieee_single;
612 /* Skip verify of double_bit, invalid_p == 0 */
613 if (gdbarch->double_format == 0)
614 gdbarch->double_format = floatformats_ieee_double;
615 /* Skip verify of long_double_bit, invalid_p == 0 */
616 if (gdbarch->long_double_format == 0)
617 gdbarch->long_double_format = floatformats_ieee_double;
618 /* Skip verify of ptr_bit, invalid_p == 0 */
619 if (gdbarch->addr_bit == 0)
620 gdbarch->addr_bit = gdbarch_ptr_bit (gdbarch);
621 if (gdbarch->dwarf2_addr_size == 0)
622 gdbarch->dwarf2_addr_size = gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT;
623 if (gdbarch->char_signed == -1)
624 gdbarch->char_signed = 1;
625 /* Skip verify of read_pc, has predicate. */
626 /* Skip verify of write_pc, has predicate. */
627 /* Skip verify of virtual_frame_pointer, invalid_p == 0 */
628 /* Skip verify of pseudo_register_read, has predicate. */
629 /* Skip verify of pseudo_register_read_value, has predicate. */
630 /* Skip verify of pseudo_register_write, has predicate. */
631 if (gdbarch->num_regs == -1)
632 fprintf_unfiltered (log, "\n\tnum_regs");
633 /* Skip verify of num_pseudo_regs, invalid_p == 0 */
634 /* Skip verify of ax_pseudo_register_collect, has predicate. */
635 /* Skip verify of ax_pseudo_register_push_stack, has predicate. */
636 /* Skip verify of sp_regnum, invalid_p == 0 */
637 /* Skip verify of pc_regnum, invalid_p == 0 */
638 /* Skip verify of ps_regnum, invalid_p == 0 */
639 /* Skip verify of fp0_regnum, invalid_p == 0 */
640 /* Skip verify of stab_reg_to_regnum, invalid_p == 0 */
641 /* Skip verify of ecoff_reg_to_regnum, invalid_p == 0 */
642 /* Skip verify of sdb_reg_to_regnum, invalid_p == 0 */
643 /* Skip verify of dwarf2_reg_to_regnum, invalid_p == 0 */
644 if (gdbarch->register_name == 0)
645 fprintf_unfiltered (log, "\n\tregister_name");
646 /* Skip verify of register_type, has predicate. */
647 /* Skip verify of dummy_id, has predicate. */
648 /* Skip verify of deprecated_fp_regnum, invalid_p == 0 */
649 /* Skip verify of push_dummy_call, has predicate. */
650 /* Skip verify of call_dummy_location, invalid_p == 0 */
651 /* Skip verify of push_dummy_code, has predicate. */
652 /* Skip verify of print_registers_info, invalid_p == 0 */
653 /* Skip verify of print_float_info, has predicate. */
654 /* Skip verify of print_vector_info, has predicate. */
655 /* Skip verify of register_sim_regno, invalid_p == 0 */
656 /* Skip verify of cannot_fetch_register, invalid_p == 0 */
657 /* Skip verify of cannot_store_register, invalid_p == 0 */
658 /* Skip verify of get_longjmp_target, has predicate. */
659 /* Skip verify of convert_register_p, invalid_p == 0 */
660 /* Skip verify of value_from_register, invalid_p == 0 */
661 /* Skip verify of pointer_to_address, invalid_p == 0 */
662 /* Skip verify of address_to_pointer, invalid_p == 0 */
663 /* Skip verify of integer_to_address, has predicate. */
664 /* Skip verify of return_value, has predicate. */
665 if (gdbarch->skip_prologue == 0)
666 fprintf_unfiltered (log, "\n\tskip_prologue");
667 /* Skip verify of skip_main_prologue, has predicate. */
668 if (gdbarch->inner_than == 0)
669 fprintf_unfiltered (log, "\n\tinner_than");
670 if (gdbarch->breakpoint_from_pc == 0)
671 fprintf_unfiltered (log, "\n\tbreakpoint_from_pc");
672 /* Skip verify of remote_breakpoint_from_pc, invalid_p == 0 */
673 /* Skip verify of adjust_breakpoint_address, has predicate. */
674 /* Skip verify of memory_insert_breakpoint, invalid_p == 0 */
675 /* Skip verify of memory_remove_breakpoint, invalid_p == 0 */
676 /* Skip verify of decr_pc_after_break, invalid_p == 0 */
677 /* Skip verify of deprecated_function_start_offset, invalid_p == 0 */
678 /* Skip verify of remote_register_number, invalid_p == 0 */
679 /* Skip verify of fetch_tls_load_module_address, has predicate. */
680 /* Skip verify of frame_args_skip, invalid_p == 0 */
681 /* Skip verify of unwind_pc, has predicate. */
682 /* Skip verify of unwind_sp, has predicate. */
683 /* Skip verify of frame_num_args, has predicate. */
684 /* Skip verify of frame_align, has predicate. */
685 /* Skip verify of stabs_argument_has_addr, invalid_p == 0 */
686 /* Skip verify of convert_from_func_ptr_addr, invalid_p == 0 */
687 /* Skip verify of addr_bits_remove, invalid_p == 0 */
688 /* Skip verify of smash_text_address, invalid_p == 0 */
689 /* Skip verify of software_single_step, has predicate. */
690 /* Skip verify of single_step_through_delay, has predicate. */
691 if (gdbarch->print_insn == 0)
692 fprintf_unfiltered (log, "\n\tprint_insn");
693 /* Skip verify of skip_trampoline_code, invalid_p == 0 */
694 /* Skip verify of skip_solib_resolver, invalid_p == 0 */
695 /* Skip verify of in_solib_return_trampoline, invalid_p == 0 */
696 /* Skip verify of in_function_epilogue_p, invalid_p == 0 */
697 /* Skip verify of elf_make_msymbol_special, invalid_p == 0 */
698 /* Skip verify of coff_make_msymbol_special, invalid_p == 0 */
699 /* Skip verify of cannot_step_breakpoint, invalid_p == 0 */
700 /* Skip verify of have_nonsteppable_watchpoint, invalid_p == 0 */
701 /* Skip verify of address_class_type_flags, has predicate. */
702 /* Skip verify of address_class_type_flags_to_name, has predicate. */
703 /* Skip verify of address_class_name_to_type_flags, has predicate. */
704 /* Skip verify of register_reggroup_p, invalid_p == 0 */
705 /* Skip verify of fetch_pointer_argument, has predicate. */
706 /* Skip verify of regset_from_core_section, has predicate. */
707 /* Skip verify of make_corefile_notes, has predicate. */
708 /* Skip verify of find_memory_regions, has predicate. */
709 /* Skip verify of core_xfer_shared_libraries, has predicate. */
710 /* Skip verify of core_pid_to_str, has predicate. */
711 /* Skip verify of gcore_bfd_target, has predicate. */
712 /* Skip verify of vtable_function_descriptors, invalid_p == 0 */
713 /* Skip verify of vbit_in_delta, invalid_p == 0 */
714 /* Skip verify of skip_permanent_breakpoint, has predicate. */
715 /* Skip verify of max_insn_length, has predicate. */
716 /* Skip verify of displaced_step_copy_insn, has predicate. */
717 /* Skip verify of displaced_step_hw_singlestep, invalid_p == 0 */
718 /* Skip verify of displaced_step_fixup, has predicate. */
719 if ((! gdbarch->displaced_step_free_closure) != (! gdbarch->displaced_step_copy_insn))
720 fprintf_unfiltered (log, "\n\tdisplaced_step_free_closure");
721 if ((! gdbarch->displaced_step_location) != (! gdbarch->displaced_step_copy_insn))
722 fprintf_unfiltered (log, "\n\tdisplaced_step_location");
723 /* Skip verify of relocate_instruction, has predicate. */
724 /* Skip verify of overlay_update, has predicate. */
725 /* Skip verify of core_read_description, has predicate. */
726 /* Skip verify of static_transform_name, has predicate. */
727 /* Skip verify of sofun_address_maybe_missing, invalid_p == 0 */
728 /* Skip verify of process_record, has predicate. */
729 /* Skip verify of process_record_signal, has predicate. */
730 /* Skip verify of gdb_signal_from_target, invalid_p == 0 */
731 /* Skip verify of get_siginfo_type, has predicate. */
732 /* Skip verify of record_special_symbol, has predicate. */
733 /* Skip verify of get_syscall_number, has predicate. */
734 /* Skip verify of stap_integer_prefix, invalid_p == 0 */
735 /* Skip verify of stap_integer_suffix, invalid_p == 0 */
736 /* Skip verify of stap_register_prefix, invalid_p == 0 */
737 /* Skip verify of stap_register_suffix, invalid_p == 0 */
738 /* Skip verify of stap_register_indirection_prefix, invalid_p == 0 */
739 /* Skip verify of stap_register_indirection_suffix, invalid_p == 0 */
740 /* Skip verify of stap_gdb_register_prefix, invalid_p == 0 */
741 /* Skip verify of stap_gdb_register_suffix, invalid_p == 0 */
742 /* Skip verify of stap_is_single_operand, has predicate. */
743 /* Skip verify of stap_parse_special_token, has predicate. */
744 /* Skip verify of has_global_solist, invalid_p == 0 */
745 /* Skip verify of has_global_breakpoints, invalid_p == 0 */
746 /* Skip verify of has_shared_address_space, invalid_p == 0 */
747 /* Skip verify of fast_tracepoint_valid_at, invalid_p == 0 */
748 /* Skip verify of auto_charset, invalid_p == 0 */
749 /* Skip verify of auto_wide_charset, invalid_p == 0 */
750 /* Skip verify of has_dos_based_file_system, invalid_p == 0 */
751 /* Skip verify of gen_return_address, invalid_p == 0 */
752 /* Skip verify of info_proc, has predicate. */
753 buf = ui_file_xstrdup (log, &length);
754 make_cleanup (xfree, buf);
755 if (length > 0)
756 internal_error (__FILE__, __LINE__,
757 _("verify_gdbarch: the following are invalid ...%s"),
758 buf);
759 do_cleanups (cleanups);
760 }
761
762
763 /* Print out the details of the current architecture. */
764
765 void
766 gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
767 {
768 const char *gdb_nm_file = "<not-defined>";
769
770 #if defined (GDB_NM_FILE)
771 gdb_nm_file = GDB_NM_FILE;
772 #endif
773 fprintf_unfiltered (file,
774 "gdbarch_dump: GDB_NM_FILE = %s\n",
775 gdb_nm_file);
776 fprintf_unfiltered (file,
777 "gdbarch_dump: addr_bit = %s\n",
778 plongest (gdbarch->addr_bit));
779 fprintf_unfiltered (file,
780 "gdbarch_dump: addr_bits_remove = <%s>\n",
781 host_address_to_string (gdbarch->addr_bits_remove));
782 fprintf_unfiltered (file,
783 "gdbarch_dump: gdbarch_address_class_name_to_type_flags_p() = %d\n",
784 gdbarch_address_class_name_to_type_flags_p (gdbarch));
785 fprintf_unfiltered (file,
786 "gdbarch_dump: address_class_name_to_type_flags = <%s>\n",
787 host_address_to_string (gdbarch->address_class_name_to_type_flags));
788 fprintf_unfiltered (file,
789 "gdbarch_dump: gdbarch_address_class_type_flags_p() = %d\n",
790 gdbarch_address_class_type_flags_p (gdbarch));
791 fprintf_unfiltered (file,
792 "gdbarch_dump: address_class_type_flags = <%s>\n",
793 host_address_to_string (gdbarch->address_class_type_flags));
794 fprintf_unfiltered (file,
795 "gdbarch_dump: gdbarch_address_class_type_flags_to_name_p() = %d\n",
796 gdbarch_address_class_type_flags_to_name_p (gdbarch));
797 fprintf_unfiltered (file,
798 "gdbarch_dump: address_class_type_flags_to_name = <%s>\n",
799 host_address_to_string (gdbarch->address_class_type_flags_to_name));
800 fprintf_unfiltered (file,
801 "gdbarch_dump: address_to_pointer = <%s>\n",
802 host_address_to_string (gdbarch->address_to_pointer));
803 fprintf_unfiltered (file,
804 "gdbarch_dump: gdbarch_adjust_breakpoint_address_p() = %d\n",
805 gdbarch_adjust_breakpoint_address_p (gdbarch));
806 fprintf_unfiltered (file,
807 "gdbarch_dump: adjust_breakpoint_address = <%s>\n",
808 host_address_to_string (gdbarch->adjust_breakpoint_address));
809 fprintf_unfiltered (file,
810 "gdbarch_dump: auto_charset = <%s>\n",
811 host_address_to_string (gdbarch->auto_charset));
812 fprintf_unfiltered (file,
813 "gdbarch_dump: auto_wide_charset = <%s>\n",
814 host_address_to_string (gdbarch->auto_wide_charset));
815 fprintf_unfiltered (file,
816 "gdbarch_dump: gdbarch_ax_pseudo_register_collect_p() = %d\n",
817 gdbarch_ax_pseudo_register_collect_p (gdbarch));
818 fprintf_unfiltered (file,
819 "gdbarch_dump: ax_pseudo_register_collect = <%s>\n",
820 host_address_to_string (gdbarch->ax_pseudo_register_collect));
821 fprintf_unfiltered (file,
822 "gdbarch_dump: gdbarch_ax_pseudo_register_push_stack_p() = %d\n",
823 gdbarch_ax_pseudo_register_push_stack_p (gdbarch));
824 fprintf_unfiltered (file,
825 "gdbarch_dump: ax_pseudo_register_push_stack = <%s>\n",
826 host_address_to_string (gdbarch->ax_pseudo_register_push_stack));
827 fprintf_unfiltered (file,
828 "gdbarch_dump: believe_pcc_promotion = %s\n",
829 plongest (gdbarch->believe_pcc_promotion));
830 fprintf_unfiltered (file,
831 "gdbarch_dump: bfd_arch_info = %s\n",
832 gdbarch_bfd_arch_info (gdbarch)->printable_name);
833 fprintf_unfiltered (file,
834 "gdbarch_dump: bits_big_endian = %s\n",
835 plongest (gdbarch->bits_big_endian));
836 fprintf_unfiltered (file,
837 "gdbarch_dump: breakpoint_from_pc = <%s>\n",
838 host_address_to_string (gdbarch->breakpoint_from_pc));
839 fprintf_unfiltered (file,
840 "gdbarch_dump: byte_order = %s\n",
841 plongest (gdbarch->byte_order));
842 fprintf_unfiltered (file,
843 "gdbarch_dump: byte_order_for_code = %s\n",
844 plongest (gdbarch->byte_order_for_code));
845 fprintf_unfiltered (file,
846 "gdbarch_dump: call_dummy_location = %s\n",
847 plongest (gdbarch->call_dummy_location));
848 fprintf_unfiltered (file,
849 "gdbarch_dump: cannot_fetch_register = <%s>\n",
850 host_address_to_string (gdbarch->cannot_fetch_register));
851 fprintf_unfiltered (file,
852 "gdbarch_dump: cannot_step_breakpoint = %s\n",
853 plongest (gdbarch->cannot_step_breakpoint));
854 fprintf_unfiltered (file,
855 "gdbarch_dump: cannot_store_register = <%s>\n",
856 host_address_to_string (gdbarch->cannot_store_register));
857 fprintf_unfiltered (file,
858 "gdbarch_dump: char_signed = %s\n",
859 plongest (gdbarch->char_signed));
860 fprintf_unfiltered (file,
861 "gdbarch_dump: coff_make_msymbol_special = <%s>\n",
862 host_address_to_string (gdbarch->coff_make_msymbol_special));
863 fprintf_unfiltered (file,
864 "gdbarch_dump: convert_from_func_ptr_addr = <%s>\n",
865 host_address_to_string (gdbarch->convert_from_func_ptr_addr));
866 fprintf_unfiltered (file,
867 "gdbarch_dump: convert_register_p = <%s>\n",
868 host_address_to_string (gdbarch->convert_register_p));
869 fprintf_unfiltered (file,
870 "gdbarch_dump: gdbarch_core_pid_to_str_p() = %d\n",
871 gdbarch_core_pid_to_str_p (gdbarch));
872 fprintf_unfiltered (file,
873 "gdbarch_dump: core_pid_to_str = <%s>\n",
874 host_address_to_string (gdbarch->core_pid_to_str));
875 fprintf_unfiltered (file,
876 "gdbarch_dump: gdbarch_core_read_description_p() = %d\n",
877 gdbarch_core_read_description_p (gdbarch));
878 fprintf_unfiltered (file,
879 "gdbarch_dump: core_read_description = <%s>\n",
880 host_address_to_string (gdbarch->core_read_description));
881 fprintf_unfiltered (file,
882 "gdbarch_dump: core_regset_sections = %s\n",
883 host_address_to_string (gdbarch->core_regset_sections));
884 fprintf_unfiltered (file,
885 "gdbarch_dump: gdbarch_core_xfer_shared_libraries_p() = %d\n",
886 gdbarch_core_xfer_shared_libraries_p (gdbarch));
887 fprintf_unfiltered (file,
888 "gdbarch_dump: core_xfer_shared_libraries = <%s>\n",
889 host_address_to_string (gdbarch->core_xfer_shared_libraries));
890 fprintf_unfiltered (file,
891 "gdbarch_dump: decr_pc_after_break = %s\n",
892 core_addr_to_string_nz (gdbarch->decr_pc_after_break));
893 fprintf_unfiltered (file,
894 "gdbarch_dump: deprecated_fp_regnum = %s\n",
895 plongest (gdbarch->deprecated_fp_regnum));
896 fprintf_unfiltered (file,
897 "gdbarch_dump: deprecated_function_start_offset = %s\n",
898 core_addr_to_string_nz (gdbarch->deprecated_function_start_offset));
899 fprintf_unfiltered (file,
900 "gdbarch_dump: gdbarch_displaced_step_copy_insn_p() = %d\n",
901 gdbarch_displaced_step_copy_insn_p (gdbarch));
902 fprintf_unfiltered (file,
903 "gdbarch_dump: displaced_step_copy_insn = <%s>\n",
904 host_address_to_string (gdbarch->displaced_step_copy_insn));
905 fprintf_unfiltered (file,
906 "gdbarch_dump: gdbarch_displaced_step_fixup_p() = %d\n",
907 gdbarch_displaced_step_fixup_p (gdbarch));
908 fprintf_unfiltered (file,
909 "gdbarch_dump: displaced_step_fixup = <%s>\n",
910 host_address_to_string (gdbarch->displaced_step_fixup));
911 fprintf_unfiltered (file,
912 "gdbarch_dump: displaced_step_free_closure = <%s>\n",
913 host_address_to_string (gdbarch->displaced_step_free_closure));
914 fprintf_unfiltered (file,
915 "gdbarch_dump: displaced_step_hw_singlestep = <%s>\n",
916 host_address_to_string (gdbarch->displaced_step_hw_singlestep));
917 fprintf_unfiltered (file,
918 "gdbarch_dump: displaced_step_location = <%s>\n",
919 host_address_to_string (gdbarch->displaced_step_location));
920 fprintf_unfiltered (file,
921 "gdbarch_dump: double_bit = %s\n",
922 plongest (gdbarch->double_bit));
923 fprintf_unfiltered (file,
924 "gdbarch_dump: double_format = %s\n",
925 pformat (gdbarch->double_format));
926 fprintf_unfiltered (file,
927 "gdbarch_dump: gdbarch_dummy_id_p() = %d\n",
928 gdbarch_dummy_id_p (gdbarch));
929 fprintf_unfiltered (file,
930 "gdbarch_dump: dummy_id = <%s>\n",
931 host_address_to_string (gdbarch->dummy_id));
932 fprintf_unfiltered (file,
933 "gdbarch_dump: dwarf2_addr_size = %s\n",
934 plongest (gdbarch->dwarf2_addr_size));
935 fprintf_unfiltered (file,
936 "gdbarch_dump: dwarf2_reg_to_regnum = <%s>\n",
937 host_address_to_string (gdbarch->dwarf2_reg_to_regnum));
938 fprintf_unfiltered (file,
939 "gdbarch_dump: ecoff_reg_to_regnum = <%s>\n",
940 host_address_to_string (gdbarch->ecoff_reg_to_regnum));
941 fprintf_unfiltered (file,
942 "gdbarch_dump: elf_make_msymbol_special = <%s>\n",
943 host_address_to_string (gdbarch->elf_make_msymbol_special));
944 fprintf_unfiltered (file,
945 "gdbarch_dump: fast_tracepoint_valid_at = <%s>\n",
946 host_address_to_string (gdbarch->fast_tracepoint_valid_at));
947 fprintf_unfiltered (file,
948 "gdbarch_dump: gdbarch_fetch_pointer_argument_p() = %d\n",
949 gdbarch_fetch_pointer_argument_p (gdbarch));
950 fprintf_unfiltered (file,
951 "gdbarch_dump: fetch_pointer_argument = <%s>\n",
952 host_address_to_string (gdbarch->fetch_pointer_argument));
953 fprintf_unfiltered (file,
954 "gdbarch_dump: gdbarch_fetch_tls_load_module_address_p() = %d\n",
955 gdbarch_fetch_tls_load_module_address_p (gdbarch));
956 fprintf_unfiltered (file,
957 "gdbarch_dump: fetch_tls_load_module_address = <%s>\n",
958 host_address_to_string (gdbarch->fetch_tls_load_module_address));
959 fprintf_unfiltered (file,
960 "gdbarch_dump: gdbarch_find_memory_regions_p() = %d\n",
961 gdbarch_find_memory_regions_p (gdbarch));
962 fprintf_unfiltered (file,
963 "gdbarch_dump: find_memory_regions = <%s>\n",
964 host_address_to_string (gdbarch->find_memory_regions));
965 fprintf_unfiltered (file,
966 "gdbarch_dump: float_bit = %s\n",
967 plongest (gdbarch->float_bit));
968 fprintf_unfiltered (file,
969 "gdbarch_dump: float_format = %s\n",
970 pformat (gdbarch->float_format));
971 fprintf_unfiltered (file,
972 "gdbarch_dump: fp0_regnum = %s\n",
973 plongest (gdbarch->fp0_regnum));
974 fprintf_unfiltered (file,
975 "gdbarch_dump: gdbarch_frame_align_p() = %d\n",
976 gdbarch_frame_align_p (gdbarch));
977 fprintf_unfiltered (file,
978 "gdbarch_dump: frame_align = <%s>\n",
979 host_address_to_string (gdbarch->frame_align));
980 fprintf_unfiltered (file,
981 "gdbarch_dump: frame_args_skip = %s\n",
982 core_addr_to_string_nz (gdbarch->frame_args_skip));
983 fprintf_unfiltered (file,
984 "gdbarch_dump: gdbarch_frame_num_args_p() = %d\n",
985 gdbarch_frame_num_args_p (gdbarch));
986 fprintf_unfiltered (file,
987 "gdbarch_dump: frame_num_args = <%s>\n",
988 host_address_to_string (gdbarch->frame_num_args));
989 fprintf_unfiltered (file,
990 "gdbarch_dump: frame_red_zone_size = %s\n",
991 plongest (gdbarch->frame_red_zone_size));
992 fprintf_unfiltered (file,
993 "gdbarch_dump: gdbarch_gcore_bfd_target_p() = %d\n",
994 gdbarch_gcore_bfd_target_p (gdbarch));
995 fprintf_unfiltered (file,
996 "gdbarch_dump: gcore_bfd_target = %s\n",
997 pstring (gdbarch->gcore_bfd_target));
998 fprintf_unfiltered (file,
999 "gdbarch_dump: gdb_signal_from_target = <%s>\n",
1000 host_address_to_string (gdbarch->gdb_signal_from_target));
1001 fprintf_unfiltered (file,
1002 "gdbarch_dump: gen_return_address = <%s>\n",
1003 host_address_to_string (gdbarch->gen_return_address));
1004 fprintf_unfiltered (file,
1005 "gdbarch_dump: gdbarch_get_longjmp_target_p() = %d\n",
1006 gdbarch_get_longjmp_target_p (gdbarch));
1007 fprintf_unfiltered (file,
1008 "gdbarch_dump: get_longjmp_target = <%s>\n",
1009 host_address_to_string (gdbarch->get_longjmp_target));
1010 fprintf_unfiltered (file,
1011 "gdbarch_dump: gdbarch_get_siginfo_type_p() = %d\n",
1012 gdbarch_get_siginfo_type_p (gdbarch));
1013 fprintf_unfiltered (file,
1014 "gdbarch_dump: get_siginfo_type = <%s>\n",
1015 host_address_to_string (gdbarch->get_siginfo_type));
1016 fprintf_unfiltered (file,
1017 "gdbarch_dump: gdbarch_get_syscall_number_p() = %d\n",
1018 gdbarch_get_syscall_number_p (gdbarch));
1019 fprintf_unfiltered (file,
1020 "gdbarch_dump: get_syscall_number = <%s>\n",
1021 host_address_to_string (gdbarch->get_syscall_number));
1022 fprintf_unfiltered (file,
1023 "gdbarch_dump: half_bit = %s\n",
1024 plongest (gdbarch->half_bit));
1025 fprintf_unfiltered (file,
1026 "gdbarch_dump: half_format = %s\n",
1027 pformat (gdbarch->half_format));
1028 fprintf_unfiltered (file,
1029 "gdbarch_dump: has_dos_based_file_system = %s\n",
1030 plongest (gdbarch->has_dos_based_file_system));
1031 fprintf_unfiltered (file,
1032 "gdbarch_dump: has_global_breakpoints = %s\n",
1033 plongest (gdbarch->has_global_breakpoints));
1034 fprintf_unfiltered (file,
1035 "gdbarch_dump: has_global_solist = %s\n",
1036 plongest (gdbarch->has_global_solist));
1037 fprintf_unfiltered (file,
1038 "gdbarch_dump: has_shared_address_space = <%s>\n",
1039 host_address_to_string (gdbarch->has_shared_address_space));
1040 fprintf_unfiltered (file,
1041 "gdbarch_dump: have_nonsteppable_watchpoint = %s\n",
1042 plongest (gdbarch->have_nonsteppable_watchpoint));
1043 fprintf_unfiltered (file,
1044 "gdbarch_dump: in_function_epilogue_p = <%s>\n",
1045 host_address_to_string (gdbarch->in_function_epilogue_p));
1046 fprintf_unfiltered (file,
1047 "gdbarch_dump: in_solib_return_trampoline = <%s>\n",
1048 host_address_to_string (gdbarch->in_solib_return_trampoline));
1049 fprintf_unfiltered (file,
1050 "gdbarch_dump: gdbarch_info_proc_p() = %d\n",
1051 gdbarch_info_proc_p (gdbarch));
1052 fprintf_unfiltered (file,
1053 "gdbarch_dump: info_proc = <%s>\n",
1054 host_address_to_string (gdbarch->info_proc));
1055 fprintf_unfiltered (file,
1056 "gdbarch_dump: inner_than = <%s>\n",
1057 host_address_to_string (gdbarch->inner_than));
1058 fprintf_unfiltered (file,
1059 "gdbarch_dump: int_bit = %s\n",
1060 plongest (gdbarch->int_bit));
1061 fprintf_unfiltered (file,
1062 "gdbarch_dump: gdbarch_integer_to_address_p() = %d\n",
1063 gdbarch_integer_to_address_p (gdbarch));
1064 fprintf_unfiltered (file,
1065 "gdbarch_dump: integer_to_address = <%s>\n",
1066 host_address_to_string (gdbarch->integer_to_address));
1067 fprintf_unfiltered (file,
1068 "gdbarch_dump: long_bit = %s\n",
1069 plongest (gdbarch->long_bit));
1070 fprintf_unfiltered (file,
1071 "gdbarch_dump: long_double_bit = %s\n",
1072 plongest (gdbarch->long_double_bit));
1073 fprintf_unfiltered (file,
1074 "gdbarch_dump: long_double_format = %s\n",
1075 pformat (gdbarch->long_double_format));
1076 fprintf_unfiltered (file,
1077 "gdbarch_dump: long_long_align_bit = %s\n",
1078 plongest (gdbarch->long_long_align_bit));
1079 fprintf_unfiltered (file,
1080 "gdbarch_dump: long_long_bit = %s\n",
1081 plongest (gdbarch->long_long_bit));
1082 fprintf_unfiltered (file,
1083 "gdbarch_dump: gdbarch_make_corefile_notes_p() = %d\n",
1084 gdbarch_make_corefile_notes_p (gdbarch));
1085 fprintf_unfiltered (file,
1086 "gdbarch_dump: make_corefile_notes = <%s>\n",
1087 host_address_to_string (gdbarch->make_corefile_notes));
1088 fprintf_unfiltered (file,
1089 "gdbarch_dump: gdbarch_max_insn_length_p() = %d\n",
1090 gdbarch_max_insn_length_p (gdbarch));
1091 fprintf_unfiltered (file,
1092 "gdbarch_dump: max_insn_length = %s\n",
1093 plongest (gdbarch->max_insn_length));
1094 fprintf_unfiltered (file,
1095 "gdbarch_dump: memory_insert_breakpoint = <%s>\n",
1096 host_address_to_string (gdbarch->memory_insert_breakpoint));
1097 fprintf_unfiltered (file,
1098 "gdbarch_dump: memory_remove_breakpoint = <%s>\n",
1099 host_address_to_string (gdbarch->memory_remove_breakpoint));
1100 fprintf_unfiltered (file,
1101 "gdbarch_dump: num_pseudo_regs = %s\n",
1102 plongest (gdbarch->num_pseudo_regs));
1103 fprintf_unfiltered (file,
1104 "gdbarch_dump: num_regs = %s\n",
1105 plongest (gdbarch->num_regs));
1106 fprintf_unfiltered (file,
1107 "gdbarch_dump: osabi = %s\n",
1108 plongest (gdbarch->osabi));
1109 fprintf_unfiltered (file,
1110 "gdbarch_dump: gdbarch_overlay_update_p() = %d\n",
1111 gdbarch_overlay_update_p (gdbarch));
1112 fprintf_unfiltered (file,
1113 "gdbarch_dump: overlay_update = <%s>\n",
1114 host_address_to_string (gdbarch->overlay_update));
1115 fprintf_unfiltered (file,
1116 "gdbarch_dump: pc_regnum = %s\n",
1117 plongest (gdbarch->pc_regnum));
1118 fprintf_unfiltered (file,
1119 "gdbarch_dump: pointer_to_address = <%s>\n",
1120 host_address_to_string (gdbarch->pointer_to_address));
1121 fprintf_unfiltered (file,
1122 "gdbarch_dump: gdbarch_print_float_info_p() = %d\n",
1123 gdbarch_print_float_info_p (gdbarch));
1124 fprintf_unfiltered (file,
1125 "gdbarch_dump: print_float_info = <%s>\n",
1126 host_address_to_string (gdbarch->print_float_info));
1127 fprintf_unfiltered (file,
1128 "gdbarch_dump: print_insn = <%s>\n",
1129 host_address_to_string (gdbarch->print_insn));
1130 fprintf_unfiltered (file,
1131 "gdbarch_dump: print_registers_info = <%s>\n",
1132 host_address_to_string (gdbarch->print_registers_info));
1133 fprintf_unfiltered (file,
1134 "gdbarch_dump: gdbarch_print_vector_info_p() = %d\n",
1135 gdbarch_print_vector_info_p (gdbarch));
1136 fprintf_unfiltered (file,
1137 "gdbarch_dump: print_vector_info = <%s>\n",
1138 host_address_to_string (gdbarch->print_vector_info));
1139 fprintf_unfiltered (file,
1140 "gdbarch_dump: gdbarch_process_record_p() = %d\n",
1141 gdbarch_process_record_p (gdbarch));
1142 fprintf_unfiltered (file,
1143 "gdbarch_dump: process_record = <%s>\n",
1144 host_address_to_string (gdbarch->process_record));
1145 fprintf_unfiltered (file,
1146 "gdbarch_dump: gdbarch_process_record_signal_p() = %d\n",
1147 gdbarch_process_record_signal_p (gdbarch));
1148 fprintf_unfiltered (file,
1149 "gdbarch_dump: process_record_signal = <%s>\n",
1150 host_address_to_string (gdbarch->process_record_signal));
1151 fprintf_unfiltered (file,
1152 "gdbarch_dump: ps_regnum = %s\n",
1153 plongest (gdbarch->ps_regnum));
1154 fprintf_unfiltered (file,
1155 "gdbarch_dump: gdbarch_pseudo_register_read_p() = %d\n",
1156 gdbarch_pseudo_register_read_p (gdbarch));
1157 fprintf_unfiltered (file,
1158 "gdbarch_dump: pseudo_register_read = <%s>\n",
1159 host_address_to_string (gdbarch->pseudo_register_read));
1160 fprintf_unfiltered (file,
1161 "gdbarch_dump: gdbarch_pseudo_register_read_value_p() = %d\n",
1162 gdbarch_pseudo_register_read_value_p (gdbarch));
1163 fprintf_unfiltered (file,
1164 "gdbarch_dump: pseudo_register_read_value = <%s>\n",
1165 host_address_to_string (gdbarch->pseudo_register_read_value));
1166 fprintf_unfiltered (file,
1167 "gdbarch_dump: gdbarch_pseudo_register_write_p() = %d\n",
1168 gdbarch_pseudo_register_write_p (gdbarch));
1169 fprintf_unfiltered (file,
1170 "gdbarch_dump: pseudo_register_write = <%s>\n",
1171 host_address_to_string (gdbarch->pseudo_register_write));
1172 fprintf_unfiltered (file,
1173 "gdbarch_dump: ptr_bit = %s\n",
1174 plongest (gdbarch->ptr_bit));
1175 fprintf_unfiltered (file,
1176 "gdbarch_dump: gdbarch_push_dummy_call_p() = %d\n",
1177 gdbarch_push_dummy_call_p (gdbarch));
1178 fprintf_unfiltered (file,
1179 "gdbarch_dump: push_dummy_call = <%s>\n",
1180 host_address_to_string (gdbarch->push_dummy_call));
1181 fprintf_unfiltered (file,
1182 "gdbarch_dump: gdbarch_push_dummy_code_p() = %d\n",
1183 gdbarch_push_dummy_code_p (gdbarch));
1184 fprintf_unfiltered (file,
1185 "gdbarch_dump: push_dummy_code = <%s>\n",
1186 host_address_to_string (gdbarch->push_dummy_code));
1187 fprintf_unfiltered (file,
1188 "gdbarch_dump: gdbarch_read_pc_p() = %d\n",
1189 gdbarch_read_pc_p (gdbarch));
1190 fprintf_unfiltered (file,
1191 "gdbarch_dump: read_pc = <%s>\n",
1192 host_address_to_string (gdbarch->read_pc));
1193 fprintf_unfiltered (file,
1194 "gdbarch_dump: gdbarch_record_special_symbol_p() = %d\n",
1195 gdbarch_record_special_symbol_p (gdbarch));
1196 fprintf_unfiltered (file,
1197 "gdbarch_dump: record_special_symbol = <%s>\n",
1198 host_address_to_string (gdbarch->record_special_symbol));
1199 fprintf_unfiltered (file,
1200 "gdbarch_dump: register_name = <%s>\n",
1201 host_address_to_string (gdbarch->register_name));
1202 fprintf_unfiltered (file,
1203 "gdbarch_dump: register_reggroup_p = <%s>\n",
1204 host_address_to_string (gdbarch->register_reggroup_p));
1205 fprintf_unfiltered (file,
1206 "gdbarch_dump: register_sim_regno = <%s>\n",
1207 host_address_to_string (gdbarch->register_sim_regno));
1208 fprintf_unfiltered (file,
1209 "gdbarch_dump: register_to_value = <%s>\n",
1210 host_address_to_string (gdbarch->register_to_value));
1211 fprintf_unfiltered (file,
1212 "gdbarch_dump: gdbarch_register_type_p() = %d\n",
1213 gdbarch_register_type_p (gdbarch));
1214 fprintf_unfiltered (file,
1215 "gdbarch_dump: register_type = <%s>\n",
1216 host_address_to_string (gdbarch->register_type));
1217 fprintf_unfiltered (file,
1218 "gdbarch_dump: gdbarch_regset_from_core_section_p() = %d\n",
1219 gdbarch_regset_from_core_section_p (gdbarch));
1220 fprintf_unfiltered (file,
1221 "gdbarch_dump: regset_from_core_section = <%s>\n",
1222 host_address_to_string (gdbarch->regset_from_core_section));
1223 fprintf_unfiltered (file,
1224 "gdbarch_dump: gdbarch_relocate_instruction_p() = %d\n",
1225 gdbarch_relocate_instruction_p (gdbarch));
1226 fprintf_unfiltered (file,
1227 "gdbarch_dump: relocate_instruction = <%s>\n",
1228 host_address_to_string (gdbarch->relocate_instruction));
1229 fprintf_unfiltered (file,
1230 "gdbarch_dump: remote_breakpoint_from_pc = <%s>\n",
1231 host_address_to_string (gdbarch->remote_breakpoint_from_pc));
1232 fprintf_unfiltered (file,
1233 "gdbarch_dump: remote_register_number = <%s>\n",
1234 host_address_to_string (gdbarch->remote_register_number));
1235 fprintf_unfiltered (file,
1236 "gdbarch_dump: gdbarch_return_value_p() = %d\n",
1237 gdbarch_return_value_p (gdbarch));
1238 fprintf_unfiltered (file,
1239 "gdbarch_dump: return_value = <%s>\n",
1240 host_address_to_string (gdbarch->return_value));
1241 fprintf_unfiltered (file,
1242 "gdbarch_dump: sdb_reg_to_regnum = <%s>\n",
1243 host_address_to_string (gdbarch->sdb_reg_to_regnum));
1244 fprintf_unfiltered (file,
1245 "gdbarch_dump: short_bit = %s\n",
1246 plongest (gdbarch->short_bit));
1247 fprintf_unfiltered (file,
1248 "gdbarch_dump: gdbarch_single_step_through_delay_p() = %d\n",
1249 gdbarch_single_step_through_delay_p (gdbarch));
1250 fprintf_unfiltered (file,
1251 "gdbarch_dump: single_step_through_delay = <%s>\n",
1252 host_address_to_string (gdbarch->single_step_through_delay));
1253 fprintf_unfiltered (file,
1254 "gdbarch_dump: gdbarch_skip_main_prologue_p() = %d\n",
1255 gdbarch_skip_main_prologue_p (gdbarch));
1256 fprintf_unfiltered (file,
1257 "gdbarch_dump: skip_main_prologue = <%s>\n",
1258 host_address_to_string (gdbarch->skip_main_prologue));
1259 fprintf_unfiltered (file,
1260 "gdbarch_dump: gdbarch_skip_permanent_breakpoint_p() = %d\n",
1261 gdbarch_skip_permanent_breakpoint_p (gdbarch));
1262 fprintf_unfiltered (file,
1263 "gdbarch_dump: skip_permanent_breakpoint = <%s>\n",
1264 host_address_to_string (gdbarch->skip_permanent_breakpoint));
1265 fprintf_unfiltered (file,
1266 "gdbarch_dump: skip_prologue = <%s>\n",
1267 host_address_to_string (gdbarch->skip_prologue));
1268 fprintf_unfiltered (file,
1269 "gdbarch_dump: skip_solib_resolver = <%s>\n",
1270 host_address_to_string (gdbarch->skip_solib_resolver));
1271 fprintf_unfiltered (file,
1272 "gdbarch_dump: skip_trampoline_code = <%s>\n",
1273 host_address_to_string (gdbarch->skip_trampoline_code));
1274 fprintf_unfiltered (file,
1275 "gdbarch_dump: smash_text_address = <%s>\n",
1276 host_address_to_string (gdbarch->smash_text_address));
1277 fprintf_unfiltered (file,
1278 "gdbarch_dump: gdbarch_software_single_step_p() = %d\n",
1279 gdbarch_software_single_step_p (gdbarch));
1280 fprintf_unfiltered (file,
1281 "gdbarch_dump: software_single_step = <%s>\n",
1282 host_address_to_string (gdbarch->software_single_step));
1283 fprintf_unfiltered (file,
1284 "gdbarch_dump: sofun_address_maybe_missing = %s\n",
1285 plongest (gdbarch->sofun_address_maybe_missing));
1286 fprintf_unfiltered (file,
1287 "gdbarch_dump: solib_symbols_extension = %s\n",
1288 pstring (gdbarch->solib_symbols_extension));
1289 fprintf_unfiltered (file,
1290 "gdbarch_dump: sp_regnum = %s\n",
1291 plongest (gdbarch->sp_regnum));
1292 fprintf_unfiltered (file,
1293 "gdbarch_dump: stab_reg_to_regnum = <%s>\n",
1294 host_address_to_string (gdbarch->stab_reg_to_regnum));
1295 fprintf_unfiltered (file,
1296 "gdbarch_dump: stabs_argument_has_addr = <%s>\n",
1297 host_address_to_string (gdbarch->stabs_argument_has_addr));
1298 fprintf_unfiltered (file,
1299 "gdbarch_dump: stap_gdb_register_prefix = %s\n",
1300 gdbarch->stap_gdb_register_prefix);
1301 fprintf_unfiltered (file,
1302 "gdbarch_dump: stap_gdb_register_suffix = %s\n",
1303 gdbarch->stap_gdb_register_suffix);
1304 fprintf_unfiltered (file,
1305 "gdbarch_dump: stap_integer_prefix = %s\n",
1306 gdbarch->stap_integer_prefix);
1307 fprintf_unfiltered (file,
1308 "gdbarch_dump: stap_integer_suffix = %s\n",
1309 gdbarch->stap_integer_suffix);
1310 fprintf_unfiltered (file,
1311 "gdbarch_dump: gdbarch_stap_is_single_operand_p() = %d\n",
1312 gdbarch_stap_is_single_operand_p (gdbarch));
1313 fprintf_unfiltered (file,
1314 "gdbarch_dump: stap_is_single_operand = <%s>\n",
1315 host_address_to_string (gdbarch->stap_is_single_operand));
1316 fprintf_unfiltered (file,
1317 "gdbarch_dump: gdbarch_stap_parse_special_token_p() = %d\n",
1318 gdbarch_stap_parse_special_token_p (gdbarch));
1319 fprintf_unfiltered (file,
1320 "gdbarch_dump: stap_parse_special_token = <%s>\n",
1321 host_address_to_string (gdbarch->stap_parse_special_token));
1322 fprintf_unfiltered (file,
1323 "gdbarch_dump: stap_register_indirection_prefix = %s\n",
1324 gdbarch->stap_register_indirection_prefix);
1325 fprintf_unfiltered (file,
1326 "gdbarch_dump: stap_register_indirection_suffix = %s\n",
1327 gdbarch->stap_register_indirection_suffix);
1328 fprintf_unfiltered (file,
1329 "gdbarch_dump: stap_register_prefix = %s\n",
1330 gdbarch->stap_register_prefix);
1331 fprintf_unfiltered (file,
1332 "gdbarch_dump: stap_register_suffix = %s\n",
1333 gdbarch->stap_register_suffix);
1334 fprintf_unfiltered (file,
1335 "gdbarch_dump: gdbarch_static_transform_name_p() = %d\n",
1336 gdbarch_static_transform_name_p (gdbarch));
1337 fprintf_unfiltered (file,
1338 "gdbarch_dump: static_transform_name = <%s>\n",
1339 host_address_to_string (gdbarch->static_transform_name));
1340 fprintf_unfiltered (file,
1341 "gdbarch_dump: target_desc = %s\n",
1342 host_address_to_string (gdbarch->target_desc));
1343 fprintf_unfiltered (file,
1344 "gdbarch_dump: gdbarch_unwind_pc_p() = %d\n",
1345 gdbarch_unwind_pc_p (gdbarch));
1346 fprintf_unfiltered (file,
1347 "gdbarch_dump: unwind_pc = <%s>\n",
1348 host_address_to_string (gdbarch->unwind_pc));
1349 fprintf_unfiltered (file,
1350 "gdbarch_dump: gdbarch_unwind_sp_p() = %d\n",
1351 gdbarch_unwind_sp_p (gdbarch));
1352 fprintf_unfiltered (file,
1353 "gdbarch_dump: unwind_sp = <%s>\n",
1354 host_address_to_string (gdbarch->unwind_sp));
1355 fprintf_unfiltered (file,
1356 "gdbarch_dump: value_from_register = <%s>\n",
1357 host_address_to_string (gdbarch->value_from_register));
1358 fprintf_unfiltered (file,
1359 "gdbarch_dump: value_to_register = <%s>\n",
1360 host_address_to_string (gdbarch->value_to_register));
1361 fprintf_unfiltered (file,
1362 "gdbarch_dump: vbit_in_delta = %s\n",
1363 plongest (gdbarch->vbit_in_delta));
1364 fprintf_unfiltered (file,
1365 "gdbarch_dump: virtual_frame_pointer = <%s>\n",
1366 host_address_to_string (gdbarch->virtual_frame_pointer));
1367 fprintf_unfiltered (file,
1368 "gdbarch_dump: vtable_function_descriptors = %s\n",
1369 plongest (gdbarch->vtable_function_descriptors));
1370 fprintf_unfiltered (file,
1371 "gdbarch_dump: gdbarch_write_pc_p() = %d\n",
1372 gdbarch_write_pc_p (gdbarch));
1373 fprintf_unfiltered (file,
1374 "gdbarch_dump: write_pc = <%s>\n",
1375 host_address_to_string (gdbarch->write_pc));
1376 if (gdbarch->dump_tdep != NULL)
1377 gdbarch->dump_tdep (gdbarch, file);
1378 }
1379
1380 struct gdbarch_tdep *
1381 gdbarch_tdep (struct gdbarch *gdbarch)
1382 {
1383 if (gdbarch_debug >= 2)
1384 fprintf_unfiltered (gdb_stdlog, "gdbarch_tdep called\n");
1385 return gdbarch->tdep;
1386 }
1387
1388
1389 const struct bfd_arch_info *
1390 gdbarch_bfd_arch_info (struct gdbarch *gdbarch)
1391 {
1392 gdb_assert (gdbarch != NULL);
1393 if (gdbarch_debug >= 2)
1394 fprintf_unfiltered (gdb_stdlog, "gdbarch_bfd_arch_info called\n");
1395 return gdbarch->bfd_arch_info;
1396 }
1397
1398 int
1399 gdbarch_byte_order (struct gdbarch *gdbarch)
1400 {
1401 gdb_assert (gdbarch != NULL);
1402 if (gdbarch_debug >= 2)
1403 fprintf_unfiltered (gdb_stdlog, "gdbarch_byte_order called\n");
1404 return gdbarch->byte_order;
1405 }
1406
1407 int
1408 gdbarch_byte_order_for_code (struct gdbarch *gdbarch)
1409 {
1410 gdb_assert (gdbarch != NULL);
1411 if (gdbarch_debug >= 2)
1412 fprintf_unfiltered (gdb_stdlog, "gdbarch_byte_order_for_code called\n");
1413 return gdbarch->byte_order_for_code;
1414 }
1415
1416 enum gdb_osabi
1417 gdbarch_osabi (struct gdbarch *gdbarch)
1418 {
1419 gdb_assert (gdbarch != NULL);
1420 if (gdbarch_debug >= 2)
1421 fprintf_unfiltered (gdb_stdlog, "gdbarch_osabi called\n");
1422 return gdbarch->osabi;
1423 }
1424
1425 const struct target_desc *
1426 gdbarch_target_desc (struct gdbarch *gdbarch)
1427 {
1428 gdb_assert (gdbarch != NULL);
1429 if (gdbarch_debug >= 2)
1430 fprintf_unfiltered (gdb_stdlog, "gdbarch_target_desc called\n");
1431 return gdbarch->target_desc;
1432 }
1433
1434 int
1435 gdbarch_bits_big_endian (struct gdbarch *gdbarch)
1436 {
1437 gdb_assert (gdbarch != NULL);
1438 /* Skip verify of bits_big_endian, invalid_p == 0 */
1439 if (gdbarch_debug >= 2)
1440 fprintf_unfiltered (gdb_stdlog, "gdbarch_bits_big_endian called\n");
1441 return gdbarch->bits_big_endian;
1442 }
1443
1444 void
1445 set_gdbarch_bits_big_endian (struct gdbarch *gdbarch,
1446 int bits_big_endian)
1447 {
1448 gdbarch->bits_big_endian = bits_big_endian;
1449 }
1450
1451 int
1452 gdbarch_short_bit (struct gdbarch *gdbarch)
1453 {
1454 gdb_assert (gdbarch != NULL);
1455 /* Skip verify of short_bit, invalid_p == 0 */
1456 if (gdbarch_debug >= 2)
1457 fprintf_unfiltered (gdb_stdlog, "gdbarch_short_bit called\n");
1458 return gdbarch->short_bit;
1459 }
1460
1461 void
1462 set_gdbarch_short_bit (struct gdbarch *gdbarch,
1463 int short_bit)
1464 {
1465 gdbarch->short_bit = short_bit;
1466 }
1467
1468 int
1469 gdbarch_int_bit (struct gdbarch *gdbarch)
1470 {
1471 gdb_assert (gdbarch != NULL);
1472 /* Skip verify of int_bit, invalid_p == 0 */
1473 if (gdbarch_debug >= 2)
1474 fprintf_unfiltered (gdb_stdlog, "gdbarch_int_bit called\n");
1475 return gdbarch->int_bit;
1476 }
1477
1478 void
1479 set_gdbarch_int_bit (struct gdbarch *gdbarch,
1480 int int_bit)
1481 {
1482 gdbarch->int_bit = int_bit;
1483 }
1484
1485 int
1486 gdbarch_long_bit (struct gdbarch *gdbarch)
1487 {
1488 gdb_assert (gdbarch != NULL);
1489 /* Skip verify of long_bit, invalid_p == 0 */
1490 if (gdbarch_debug >= 2)
1491 fprintf_unfiltered (gdb_stdlog, "gdbarch_long_bit called\n");
1492 return gdbarch->long_bit;
1493 }
1494
1495 void
1496 set_gdbarch_long_bit (struct gdbarch *gdbarch,
1497 int long_bit)
1498 {
1499 gdbarch->long_bit = long_bit;
1500 }
1501
1502 int
1503 gdbarch_long_long_bit (struct gdbarch *gdbarch)
1504 {
1505 gdb_assert (gdbarch != NULL);
1506 /* Skip verify of long_long_bit, invalid_p == 0 */
1507 if (gdbarch_debug >= 2)
1508 fprintf_unfiltered (gdb_stdlog, "gdbarch_long_long_bit called\n");
1509 return gdbarch->long_long_bit;
1510 }
1511
1512 void
1513 set_gdbarch_long_long_bit (struct gdbarch *gdbarch,
1514 int long_long_bit)
1515 {
1516 gdbarch->long_long_bit = long_long_bit;
1517 }
1518
1519 int
1520 gdbarch_long_long_align_bit (struct gdbarch *gdbarch)
1521 {
1522 gdb_assert (gdbarch != NULL);
1523 /* Skip verify of long_long_align_bit, invalid_p == 0 */
1524 if (gdbarch_debug >= 2)
1525 fprintf_unfiltered (gdb_stdlog, "gdbarch_long_long_align_bit called\n");
1526 return gdbarch->long_long_align_bit;
1527 }
1528
1529 void
1530 set_gdbarch_long_long_align_bit (struct gdbarch *gdbarch,
1531 int long_long_align_bit)
1532 {
1533 gdbarch->long_long_align_bit = long_long_align_bit;
1534 }
1535
1536 int
1537 gdbarch_half_bit (struct gdbarch *gdbarch)
1538 {
1539 gdb_assert (gdbarch != NULL);
1540 /* Skip verify of half_bit, invalid_p == 0 */
1541 if (gdbarch_debug >= 2)
1542 fprintf_unfiltered (gdb_stdlog, "gdbarch_half_bit called\n");
1543 return gdbarch->half_bit;
1544 }
1545
1546 void
1547 set_gdbarch_half_bit (struct gdbarch *gdbarch,
1548 int half_bit)
1549 {
1550 gdbarch->half_bit = half_bit;
1551 }
1552
1553 const struct floatformat **
1554 gdbarch_half_format (struct gdbarch *gdbarch)
1555 {
1556 gdb_assert (gdbarch != NULL);
1557 if (gdbarch_debug >= 2)
1558 fprintf_unfiltered (gdb_stdlog, "gdbarch_half_format called\n");
1559 return gdbarch->half_format;
1560 }
1561
1562 void
1563 set_gdbarch_half_format (struct gdbarch *gdbarch,
1564 const struct floatformat ** half_format)
1565 {
1566 gdbarch->half_format = half_format;
1567 }
1568
1569 int
1570 gdbarch_float_bit (struct gdbarch *gdbarch)
1571 {
1572 gdb_assert (gdbarch != NULL);
1573 /* Skip verify of float_bit, invalid_p == 0 */
1574 if (gdbarch_debug >= 2)
1575 fprintf_unfiltered (gdb_stdlog, "gdbarch_float_bit called\n");
1576 return gdbarch->float_bit;
1577 }
1578
1579 void
1580 set_gdbarch_float_bit (struct gdbarch *gdbarch,
1581 int float_bit)
1582 {
1583 gdbarch->float_bit = float_bit;
1584 }
1585
1586 const struct floatformat **
1587 gdbarch_float_format (struct gdbarch *gdbarch)
1588 {
1589 gdb_assert (gdbarch != NULL);
1590 if (gdbarch_debug >= 2)
1591 fprintf_unfiltered (gdb_stdlog, "gdbarch_float_format called\n");
1592 return gdbarch->float_format;
1593 }
1594
1595 void
1596 set_gdbarch_float_format (struct gdbarch *gdbarch,
1597 const struct floatformat ** float_format)
1598 {
1599 gdbarch->float_format = float_format;
1600 }
1601
1602 int
1603 gdbarch_double_bit (struct gdbarch *gdbarch)
1604 {
1605 gdb_assert (gdbarch != NULL);
1606 /* Skip verify of double_bit, invalid_p == 0 */
1607 if (gdbarch_debug >= 2)
1608 fprintf_unfiltered (gdb_stdlog, "gdbarch_double_bit called\n");
1609 return gdbarch->double_bit;
1610 }
1611
1612 void
1613 set_gdbarch_double_bit (struct gdbarch *gdbarch,
1614 int double_bit)
1615 {
1616 gdbarch->double_bit = double_bit;
1617 }
1618
1619 const struct floatformat **
1620 gdbarch_double_format (struct gdbarch *gdbarch)
1621 {
1622 gdb_assert (gdbarch != NULL);
1623 if (gdbarch_debug >= 2)
1624 fprintf_unfiltered (gdb_stdlog, "gdbarch_double_format called\n");
1625 return gdbarch->double_format;
1626 }
1627
1628 void
1629 set_gdbarch_double_format (struct gdbarch *gdbarch,
1630 const struct floatformat ** double_format)
1631 {
1632 gdbarch->double_format = double_format;
1633 }
1634
1635 int
1636 gdbarch_long_double_bit (struct gdbarch *gdbarch)
1637 {
1638 gdb_assert (gdbarch != NULL);
1639 /* Skip verify of long_double_bit, invalid_p == 0 */
1640 if (gdbarch_debug >= 2)
1641 fprintf_unfiltered (gdb_stdlog, "gdbarch_long_double_bit called\n");
1642 return gdbarch->long_double_bit;
1643 }
1644
1645 void
1646 set_gdbarch_long_double_bit (struct gdbarch *gdbarch,
1647 int long_double_bit)
1648 {
1649 gdbarch->long_double_bit = long_double_bit;
1650 }
1651
1652 const struct floatformat **
1653 gdbarch_long_double_format (struct gdbarch *gdbarch)
1654 {
1655 gdb_assert (gdbarch != NULL);
1656 if (gdbarch_debug >= 2)
1657 fprintf_unfiltered (gdb_stdlog, "gdbarch_long_double_format called\n");
1658 return gdbarch->long_double_format;
1659 }
1660
1661 void
1662 set_gdbarch_long_double_format (struct gdbarch *gdbarch,
1663 const struct floatformat ** long_double_format)
1664 {
1665 gdbarch->long_double_format = long_double_format;
1666 }
1667
1668 int
1669 gdbarch_ptr_bit (struct gdbarch *gdbarch)
1670 {
1671 gdb_assert (gdbarch != NULL);
1672 /* Skip verify of ptr_bit, invalid_p == 0 */
1673 if (gdbarch_debug >= 2)
1674 fprintf_unfiltered (gdb_stdlog, "gdbarch_ptr_bit called\n");
1675 return gdbarch->ptr_bit;
1676 }
1677
1678 void
1679 set_gdbarch_ptr_bit (struct gdbarch *gdbarch,
1680 int ptr_bit)
1681 {
1682 gdbarch->ptr_bit = ptr_bit;
1683 }
1684
1685 int
1686 gdbarch_addr_bit (struct gdbarch *gdbarch)
1687 {
1688 gdb_assert (gdbarch != NULL);
1689 /* Check variable changed from pre-default. */
1690 gdb_assert (gdbarch->addr_bit != 0);
1691 if (gdbarch_debug >= 2)
1692 fprintf_unfiltered (gdb_stdlog, "gdbarch_addr_bit called\n");
1693 return gdbarch->addr_bit;
1694 }
1695
1696 void
1697 set_gdbarch_addr_bit (struct gdbarch *gdbarch,
1698 int addr_bit)
1699 {
1700 gdbarch->addr_bit = addr_bit;
1701 }
1702
1703 int
1704 gdbarch_dwarf2_addr_size (struct gdbarch *gdbarch)
1705 {
1706 gdb_assert (gdbarch != NULL);
1707 /* Check variable changed from pre-default. */
1708 gdb_assert (gdbarch->dwarf2_addr_size != 0);
1709 if (gdbarch_debug >= 2)
1710 fprintf_unfiltered (gdb_stdlog, "gdbarch_dwarf2_addr_size called\n");
1711 return gdbarch->dwarf2_addr_size;
1712 }
1713
1714 void
1715 set_gdbarch_dwarf2_addr_size (struct gdbarch *gdbarch,
1716 int dwarf2_addr_size)
1717 {
1718 gdbarch->dwarf2_addr_size = dwarf2_addr_size;
1719 }
1720
1721 int
1722 gdbarch_char_signed (struct gdbarch *gdbarch)
1723 {
1724 gdb_assert (gdbarch != NULL);
1725 /* Check variable changed from pre-default. */
1726 gdb_assert (gdbarch->char_signed != -1);
1727 if (gdbarch_debug >= 2)
1728 fprintf_unfiltered (gdb_stdlog, "gdbarch_char_signed called\n");
1729 return gdbarch->char_signed;
1730 }
1731
1732 void
1733 set_gdbarch_char_signed (struct gdbarch *gdbarch,
1734 int char_signed)
1735 {
1736 gdbarch->char_signed = char_signed;
1737 }
1738
1739 int
1740 gdbarch_read_pc_p (struct gdbarch *gdbarch)
1741 {
1742 gdb_assert (gdbarch != NULL);
1743 return gdbarch->read_pc != NULL;
1744 }
1745
1746 CORE_ADDR
1747 gdbarch_read_pc (struct gdbarch *gdbarch, struct regcache *regcache)
1748 {
1749 gdb_assert (gdbarch != NULL);
1750 gdb_assert (gdbarch->read_pc != NULL);
1751 if (gdbarch_debug >= 2)
1752 fprintf_unfiltered (gdb_stdlog, "gdbarch_read_pc called\n");
1753 return gdbarch->read_pc (regcache);
1754 }
1755
1756 void
1757 set_gdbarch_read_pc (struct gdbarch *gdbarch,
1758 gdbarch_read_pc_ftype read_pc)
1759 {
1760 gdbarch->read_pc = read_pc;
1761 }
1762
1763 int
1764 gdbarch_write_pc_p (struct gdbarch *gdbarch)
1765 {
1766 gdb_assert (gdbarch != NULL);
1767 return gdbarch->write_pc != NULL;
1768 }
1769
1770 void
1771 gdbarch_write_pc (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR val)
1772 {
1773 gdb_assert (gdbarch != NULL);
1774 gdb_assert (gdbarch->write_pc != NULL);
1775 if (gdbarch_debug >= 2)
1776 fprintf_unfiltered (gdb_stdlog, "gdbarch_write_pc called\n");
1777 gdbarch->write_pc (regcache, val);
1778 }
1779
1780 void
1781 set_gdbarch_write_pc (struct gdbarch *gdbarch,
1782 gdbarch_write_pc_ftype write_pc)
1783 {
1784 gdbarch->write_pc = write_pc;
1785 }
1786
1787 void
1788 gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset)
1789 {
1790 gdb_assert (gdbarch != NULL);
1791 gdb_assert (gdbarch->virtual_frame_pointer != NULL);
1792 if (gdbarch_debug >= 2)
1793 fprintf_unfiltered (gdb_stdlog, "gdbarch_virtual_frame_pointer called\n");
1794 gdbarch->virtual_frame_pointer (gdbarch, pc, frame_regnum, frame_offset);
1795 }
1796
1797 void
1798 set_gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch,
1799 gdbarch_virtual_frame_pointer_ftype virtual_frame_pointer)
1800 {
1801 gdbarch->virtual_frame_pointer = virtual_frame_pointer;
1802 }
1803
1804 int
1805 gdbarch_pseudo_register_read_p (struct gdbarch *gdbarch)
1806 {
1807 gdb_assert (gdbarch != NULL);
1808 return gdbarch->pseudo_register_read != NULL;
1809 }
1810
1811 enum register_status
1812 gdbarch_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, gdb_byte *buf)
1813 {
1814 gdb_assert (gdbarch != NULL);
1815 gdb_assert (gdbarch->pseudo_register_read != NULL);
1816 if (gdbarch_debug >= 2)
1817 fprintf_unfiltered (gdb_stdlog, "gdbarch_pseudo_register_read called\n");
1818 return gdbarch->pseudo_register_read (gdbarch, regcache, cookednum, buf);
1819 }
1820
1821 void
1822 set_gdbarch_pseudo_register_read (struct gdbarch *gdbarch,
1823 gdbarch_pseudo_register_read_ftype pseudo_register_read)
1824 {
1825 gdbarch->pseudo_register_read = pseudo_register_read;
1826 }
1827
1828 int
1829 gdbarch_pseudo_register_read_value_p (struct gdbarch *gdbarch)
1830 {
1831 gdb_assert (gdbarch != NULL);
1832 return gdbarch->pseudo_register_read_value != NULL;
1833 }
1834
1835 struct value *
1836 gdbarch_pseudo_register_read_value (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum)
1837 {
1838 gdb_assert (gdbarch != NULL);
1839 gdb_assert (gdbarch->pseudo_register_read_value != NULL);
1840 if (gdbarch_debug >= 2)
1841 fprintf_unfiltered (gdb_stdlog, "gdbarch_pseudo_register_read_value called\n");
1842 return gdbarch->pseudo_register_read_value (gdbarch, regcache, cookednum);
1843 }
1844
1845 void
1846 set_gdbarch_pseudo_register_read_value (struct gdbarch *gdbarch,
1847 gdbarch_pseudo_register_read_value_ftype pseudo_register_read_value)
1848 {
1849 gdbarch->pseudo_register_read_value = pseudo_register_read_value;
1850 }
1851
1852 int
1853 gdbarch_pseudo_register_write_p (struct gdbarch *gdbarch)
1854 {
1855 gdb_assert (gdbarch != NULL);
1856 return gdbarch->pseudo_register_write != NULL;
1857 }
1858
1859 void
1860 gdbarch_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, const gdb_byte *buf)
1861 {
1862 gdb_assert (gdbarch != NULL);
1863 gdb_assert (gdbarch->pseudo_register_write != NULL);
1864 if (gdbarch_debug >= 2)
1865 fprintf_unfiltered (gdb_stdlog, "gdbarch_pseudo_register_write called\n");
1866 gdbarch->pseudo_register_write (gdbarch, regcache, cookednum, buf);
1867 }
1868
1869 void
1870 set_gdbarch_pseudo_register_write (struct gdbarch *gdbarch,
1871 gdbarch_pseudo_register_write_ftype pseudo_register_write)
1872 {
1873 gdbarch->pseudo_register_write = pseudo_register_write;
1874 }
1875
1876 int
1877 gdbarch_num_regs (struct gdbarch *gdbarch)
1878 {
1879 gdb_assert (gdbarch != NULL);
1880 /* Check variable changed from pre-default. */
1881 gdb_assert (gdbarch->num_regs != -1);
1882 if (gdbarch_debug >= 2)
1883 fprintf_unfiltered (gdb_stdlog, "gdbarch_num_regs called\n");
1884 return gdbarch->num_regs;
1885 }
1886
1887 void
1888 set_gdbarch_num_regs (struct gdbarch *gdbarch,
1889 int num_regs)
1890 {
1891 gdbarch->num_regs = num_regs;
1892 }
1893
1894 int
1895 gdbarch_num_pseudo_regs (struct gdbarch *gdbarch)
1896 {
1897 gdb_assert (gdbarch != NULL);
1898 /* Skip verify of num_pseudo_regs, invalid_p == 0 */
1899 if (gdbarch_debug >= 2)
1900 fprintf_unfiltered (gdb_stdlog, "gdbarch_num_pseudo_regs called\n");
1901 return gdbarch->num_pseudo_regs;
1902 }
1903
1904 void
1905 set_gdbarch_num_pseudo_regs (struct gdbarch *gdbarch,
1906 int num_pseudo_regs)
1907 {
1908 gdbarch->num_pseudo_regs = num_pseudo_regs;
1909 }
1910
1911 int
1912 gdbarch_ax_pseudo_register_collect_p (struct gdbarch *gdbarch)
1913 {
1914 gdb_assert (gdbarch != NULL);
1915 return gdbarch->ax_pseudo_register_collect != NULL;
1916 }
1917
1918 int
1919 gdbarch_ax_pseudo_register_collect (struct gdbarch *gdbarch, struct agent_expr *ax, int reg)
1920 {
1921 gdb_assert (gdbarch != NULL);
1922 gdb_assert (gdbarch->ax_pseudo_register_collect != NULL);
1923 if (gdbarch_debug >= 2)
1924 fprintf_unfiltered (gdb_stdlog, "gdbarch_ax_pseudo_register_collect called\n");
1925 return gdbarch->ax_pseudo_register_collect (gdbarch, ax, reg);
1926 }
1927
1928 void
1929 set_gdbarch_ax_pseudo_register_collect (struct gdbarch *gdbarch,
1930 gdbarch_ax_pseudo_register_collect_ftype ax_pseudo_register_collect)
1931 {
1932 gdbarch->ax_pseudo_register_collect = ax_pseudo_register_collect;
1933 }
1934
1935 int
1936 gdbarch_ax_pseudo_register_push_stack_p (struct gdbarch *gdbarch)
1937 {
1938 gdb_assert (gdbarch != NULL);
1939 return gdbarch->ax_pseudo_register_push_stack != NULL;
1940 }
1941
1942 int
1943 gdbarch_ax_pseudo_register_push_stack (struct gdbarch *gdbarch, struct agent_expr *ax, int reg)
1944 {
1945 gdb_assert (gdbarch != NULL);
1946 gdb_assert (gdbarch->ax_pseudo_register_push_stack != NULL);
1947 if (gdbarch_debug >= 2)
1948 fprintf_unfiltered (gdb_stdlog, "gdbarch_ax_pseudo_register_push_stack called\n");
1949 return gdbarch->ax_pseudo_register_push_stack (gdbarch, ax, reg);
1950 }
1951
1952 void
1953 set_gdbarch_ax_pseudo_register_push_stack (struct gdbarch *gdbarch,
1954 gdbarch_ax_pseudo_register_push_stack_ftype ax_pseudo_register_push_stack)
1955 {
1956 gdbarch->ax_pseudo_register_push_stack = ax_pseudo_register_push_stack;
1957 }
1958
1959 int
1960 gdbarch_sp_regnum (struct gdbarch *gdbarch)
1961 {
1962 gdb_assert (gdbarch != NULL);
1963 /* Skip verify of sp_regnum, invalid_p == 0 */
1964 if (gdbarch_debug >= 2)
1965 fprintf_unfiltered (gdb_stdlog, "gdbarch_sp_regnum called\n");
1966 return gdbarch->sp_regnum;
1967 }
1968
1969 void
1970 set_gdbarch_sp_regnum (struct gdbarch *gdbarch,
1971 int sp_regnum)
1972 {
1973 gdbarch->sp_regnum = sp_regnum;
1974 }
1975
1976 int
1977 gdbarch_pc_regnum (struct gdbarch *gdbarch)
1978 {
1979 gdb_assert (gdbarch != NULL);
1980 /* Skip verify of pc_regnum, invalid_p == 0 */
1981 if (gdbarch_debug >= 2)
1982 fprintf_unfiltered (gdb_stdlog, "gdbarch_pc_regnum called\n");
1983 return gdbarch->pc_regnum;
1984 }
1985
1986 void
1987 set_gdbarch_pc_regnum (struct gdbarch *gdbarch,
1988 int pc_regnum)
1989 {
1990 gdbarch->pc_regnum = pc_regnum;
1991 }
1992
1993 int
1994 gdbarch_ps_regnum (struct gdbarch *gdbarch)
1995 {
1996 gdb_assert (gdbarch != NULL);
1997 /* Skip verify of ps_regnum, invalid_p == 0 */
1998 if (gdbarch_debug >= 2)
1999 fprintf_unfiltered (gdb_stdlog, "gdbarch_ps_regnum called\n");
2000 return gdbarch->ps_regnum;
2001 }
2002
2003 void
2004 set_gdbarch_ps_regnum (struct gdbarch *gdbarch,
2005 int ps_regnum)
2006 {
2007 gdbarch->ps_regnum = ps_regnum;
2008 }
2009
2010 int
2011 gdbarch_fp0_regnum (struct gdbarch *gdbarch)
2012 {
2013 gdb_assert (gdbarch != NULL);
2014 /* Skip verify of fp0_regnum, invalid_p == 0 */
2015 if (gdbarch_debug >= 2)
2016 fprintf_unfiltered (gdb_stdlog, "gdbarch_fp0_regnum called\n");
2017 return gdbarch->fp0_regnum;
2018 }
2019
2020 void
2021 set_gdbarch_fp0_regnum (struct gdbarch *gdbarch,
2022 int fp0_regnum)
2023 {
2024 gdbarch->fp0_regnum = fp0_regnum;
2025 }
2026
2027 int
2028 gdbarch_stab_reg_to_regnum (struct gdbarch *gdbarch, int stab_regnr)
2029 {
2030 gdb_assert (gdbarch != NULL);
2031 gdb_assert (gdbarch->stab_reg_to_regnum != NULL);
2032 if (gdbarch_debug >= 2)
2033 fprintf_unfiltered (gdb_stdlog, "gdbarch_stab_reg_to_regnum called\n");
2034 return gdbarch->stab_reg_to_regnum (gdbarch, stab_regnr);
2035 }
2036
2037 void
2038 set_gdbarch_stab_reg_to_regnum (struct gdbarch *gdbarch,
2039 gdbarch_stab_reg_to_regnum_ftype stab_reg_to_regnum)
2040 {
2041 gdbarch->stab_reg_to_regnum = stab_reg_to_regnum;
2042 }
2043
2044 int
2045 gdbarch_ecoff_reg_to_regnum (struct gdbarch *gdbarch, int ecoff_regnr)
2046 {
2047 gdb_assert (gdbarch != NULL);
2048 gdb_assert (gdbarch->ecoff_reg_to_regnum != NULL);
2049 if (gdbarch_debug >= 2)
2050 fprintf_unfiltered (gdb_stdlog, "gdbarch_ecoff_reg_to_regnum called\n");
2051 return gdbarch->ecoff_reg_to_regnum (gdbarch, ecoff_regnr);
2052 }
2053
2054 void
2055 set_gdbarch_ecoff_reg_to_regnum (struct gdbarch *gdbarch,
2056 gdbarch_ecoff_reg_to_regnum_ftype ecoff_reg_to_regnum)
2057 {
2058 gdbarch->ecoff_reg_to_regnum = ecoff_reg_to_regnum;
2059 }
2060
2061 int
2062 gdbarch_sdb_reg_to_regnum (struct gdbarch *gdbarch, int sdb_regnr)
2063 {
2064 gdb_assert (gdbarch != NULL);
2065 gdb_assert (gdbarch->sdb_reg_to_regnum != NULL);
2066 if (gdbarch_debug >= 2)
2067 fprintf_unfiltered (gdb_stdlog, "gdbarch_sdb_reg_to_regnum called\n");
2068 return gdbarch->sdb_reg_to_regnum (gdbarch, sdb_regnr);
2069 }
2070
2071 void
2072 set_gdbarch_sdb_reg_to_regnum (struct gdbarch *gdbarch,
2073 gdbarch_sdb_reg_to_regnum_ftype sdb_reg_to_regnum)
2074 {
2075 gdbarch->sdb_reg_to_regnum = sdb_reg_to_regnum;
2076 }
2077
2078 int
2079 gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int dwarf2_regnr)
2080 {
2081 gdb_assert (gdbarch != NULL);
2082 gdb_assert (gdbarch->dwarf2_reg_to_regnum != NULL);
2083 if (gdbarch_debug >= 2)
2084 fprintf_unfiltered (gdb_stdlog, "gdbarch_dwarf2_reg_to_regnum called\n");
2085 return gdbarch->dwarf2_reg_to_regnum (gdbarch, dwarf2_regnr);
2086 }
2087
2088 void
2089 set_gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch,
2090 gdbarch_dwarf2_reg_to_regnum_ftype dwarf2_reg_to_regnum)
2091 {
2092 gdbarch->dwarf2_reg_to_regnum = dwarf2_reg_to_regnum;
2093 }
2094
2095 const char *
2096 gdbarch_register_name (struct gdbarch *gdbarch, int regnr)
2097 {
2098 gdb_assert (gdbarch != NULL);
2099 gdb_assert (gdbarch->register_name != NULL);
2100 if (gdbarch_debug >= 2)
2101 fprintf_unfiltered (gdb_stdlog, "gdbarch_register_name called\n");
2102 return gdbarch->register_name (gdbarch, regnr);
2103 }
2104
2105 void
2106 set_gdbarch_register_name (struct gdbarch *gdbarch,
2107 gdbarch_register_name_ftype register_name)
2108 {
2109 gdbarch->register_name = register_name;
2110 }
2111
2112 int
2113 gdbarch_register_type_p (struct gdbarch *gdbarch)
2114 {
2115 gdb_assert (gdbarch != NULL);
2116 return gdbarch->register_type != NULL;
2117 }
2118
2119 struct type *
2120 gdbarch_register_type (struct gdbarch *gdbarch, int reg_nr)
2121 {
2122 gdb_assert (gdbarch != NULL);
2123 gdb_assert (gdbarch->register_type != NULL);
2124 if (gdbarch_debug >= 2)
2125 fprintf_unfiltered (gdb_stdlog, "gdbarch_register_type called\n");
2126 return gdbarch->register_type (gdbarch, reg_nr);
2127 }
2128
2129 void
2130 set_gdbarch_register_type (struct gdbarch *gdbarch,
2131 gdbarch_register_type_ftype register_type)
2132 {
2133 gdbarch->register_type = register_type;
2134 }
2135
2136 int
2137 gdbarch_dummy_id_p (struct gdbarch *gdbarch)
2138 {
2139 gdb_assert (gdbarch != NULL);
2140 return gdbarch->dummy_id != NULL;
2141 }
2142
2143 struct frame_id
2144 gdbarch_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
2145 {
2146 gdb_assert (gdbarch != NULL);
2147 gdb_assert (gdbarch->dummy_id != NULL);
2148 if (gdbarch_debug >= 2)
2149 fprintf_unfiltered (gdb_stdlog, "gdbarch_dummy_id called\n");
2150 return gdbarch->dummy_id (gdbarch, this_frame);
2151 }
2152
2153 void
2154 set_gdbarch_dummy_id (struct gdbarch *gdbarch,
2155 gdbarch_dummy_id_ftype dummy_id)
2156 {
2157 gdbarch->dummy_id = dummy_id;
2158 }
2159
2160 int
2161 gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch)
2162 {
2163 gdb_assert (gdbarch != NULL);
2164 /* Skip verify of deprecated_fp_regnum, invalid_p == 0 */
2165 if (gdbarch_debug >= 2)
2166 fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_fp_regnum called\n");
2167 return gdbarch->deprecated_fp_regnum;
2168 }
2169
2170 void
2171 set_gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch,
2172 int deprecated_fp_regnum)
2173 {
2174 gdbarch->deprecated_fp_regnum = deprecated_fp_regnum;
2175 }
2176
2177 int
2178 gdbarch_push_dummy_call_p (struct gdbarch *gdbarch)
2179 {
2180 gdb_assert (gdbarch != NULL);
2181 return gdbarch->push_dummy_call != NULL;
2182 }
2183
2184 CORE_ADDR
2185 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)
2186 {
2187 gdb_assert (gdbarch != NULL);
2188 gdb_assert (gdbarch->push_dummy_call != NULL);
2189 if (gdbarch_debug >= 2)
2190 fprintf_unfiltered (gdb_stdlog, "gdbarch_push_dummy_call called\n");
2191 return gdbarch->push_dummy_call (gdbarch, function, regcache, bp_addr, nargs, args, sp, struct_return, struct_addr);
2192 }
2193
2194 void
2195 set_gdbarch_push_dummy_call (struct gdbarch *gdbarch,
2196 gdbarch_push_dummy_call_ftype push_dummy_call)
2197 {
2198 gdbarch->push_dummy_call = push_dummy_call;
2199 }
2200
2201 int
2202 gdbarch_call_dummy_location (struct gdbarch *gdbarch)
2203 {
2204 gdb_assert (gdbarch != NULL);
2205 /* Skip verify of call_dummy_location, invalid_p == 0 */
2206 if (gdbarch_debug >= 2)
2207 fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_location called\n");
2208 return gdbarch->call_dummy_location;
2209 }
2210
2211 void
2212 set_gdbarch_call_dummy_location (struct gdbarch *gdbarch,
2213 int call_dummy_location)
2214 {
2215 gdbarch->call_dummy_location = call_dummy_location;
2216 }
2217
2218 int
2219 gdbarch_push_dummy_code_p (struct gdbarch *gdbarch)
2220 {
2221 gdb_assert (gdbarch != NULL);
2222 return gdbarch->push_dummy_code != NULL;
2223 }
2224
2225 CORE_ADDR
2226 gdbarch_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr, struct regcache *regcache)
2227 {
2228 gdb_assert (gdbarch != NULL);
2229 gdb_assert (gdbarch->push_dummy_code != NULL);
2230 if (gdbarch_debug >= 2)
2231 fprintf_unfiltered (gdb_stdlog, "gdbarch_push_dummy_code called\n");
2232 return gdbarch->push_dummy_code (gdbarch, sp, funaddr, args, nargs, value_type, real_pc, bp_addr, regcache);
2233 }
2234
2235 void
2236 set_gdbarch_push_dummy_code (struct gdbarch *gdbarch,
2237 gdbarch_push_dummy_code_ftype push_dummy_code)
2238 {
2239 gdbarch->push_dummy_code = push_dummy_code;
2240 }
2241
2242 void
2243 gdbarch_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, int regnum, int all)
2244 {
2245 gdb_assert (gdbarch != NULL);
2246 gdb_assert (gdbarch->print_registers_info != NULL);
2247 if (gdbarch_debug >= 2)
2248 fprintf_unfiltered (gdb_stdlog, "gdbarch_print_registers_info called\n");
2249 gdbarch->print_registers_info (gdbarch, file, frame, regnum, all);
2250 }
2251
2252 void
2253 set_gdbarch_print_registers_info (struct gdbarch *gdbarch,
2254 gdbarch_print_registers_info_ftype print_registers_info)
2255 {
2256 gdbarch->print_registers_info = print_registers_info;
2257 }
2258
2259 int
2260 gdbarch_print_float_info_p (struct gdbarch *gdbarch)
2261 {
2262 gdb_assert (gdbarch != NULL);
2263 return gdbarch->print_float_info != NULL;
2264 }
2265
2266 void
2267 gdbarch_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, const char *args)
2268 {
2269 gdb_assert (gdbarch != NULL);
2270 gdb_assert (gdbarch->print_float_info != NULL);
2271 if (gdbarch_debug >= 2)
2272 fprintf_unfiltered (gdb_stdlog, "gdbarch_print_float_info called\n");
2273 gdbarch->print_float_info (gdbarch, file, frame, args);
2274 }
2275
2276 void
2277 set_gdbarch_print_float_info (struct gdbarch *gdbarch,
2278 gdbarch_print_float_info_ftype print_float_info)
2279 {
2280 gdbarch->print_float_info = print_float_info;
2281 }
2282
2283 int
2284 gdbarch_print_vector_info_p (struct gdbarch *gdbarch)
2285 {
2286 gdb_assert (gdbarch != NULL);
2287 return gdbarch->print_vector_info != NULL;
2288 }
2289
2290 void
2291 gdbarch_print_vector_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, const char *args)
2292 {
2293 gdb_assert (gdbarch != NULL);
2294 gdb_assert (gdbarch->print_vector_info != NULL);
2295 if (gdbarch_debug >= 2)
2296 fprintf_unfiltered (gdb_stdlog, "gdbarch_print_vector_info called\n");
2297 gdbarch->print_vector_info (gdbarch, file, frame, args);
2298 }
2299
2300 void
2301 set_gdbarch_print_vector_info (struct gdbarch *gdbarch,
2302 gdbarch_print_vector_info_ftype print_vector_info)
2303 {
2304 gdbarch->print_vector_info = print_vector_info;
2305 }
2306
2307 int
2308 gdbarch_register_sim_regno (struct gdbarch *gdbarch, int reg_nr)
2309 {
2310 gdb_assert (gdbarch != NULL);
2311 gdb_assert (gdbarch->register_sim_regno != NULL);
2312 if (gdbarch_debug >= 2)
2313 fprintf_unfiltered (gdb_stdlog, "gdbarch_register_sim_regno called\n");
2314 return gdbarch->register_sim_regno (gdbarch, reg_nr);
2315 }
2316
2317 void
2318 set_gdbarch_register_sim_regno (struct gdbarch *gdbarch,
2319 gdbarch_register_sim_regno_ftype register_sim_regno)
2320 {
2321 gdbarch->register_sim_regno = register_sim_regno;
2322 }
2323
2324 int
2325 gdbarch_cannot_fetch_register (struct gdbarch *gdbarch, int regnum)
2326 {
2327 gdb_assert (gdbarch != NULL);
2328 gdb_assert (gdbarch->cannot_fetch_register != NULL);
2329 if (gdbarch_debug >= 2)
2330 fprintf_unfiltered (gdb_stdlog, "gdbarch_cannot_fetch_register called\n");
2331 return gdbarch->cannot_fetch_register (gdbarch, regnum);
2332 }
2333
2334 void
2335 set_gdbarch_cannot_fetch_register (struct gdbarch *gdbarch,
2336 gdbarch_cannot_fetch_register_ftype cannot_fetch_register)
2337 {
2338 gdbarch->cannot_fetch_register = cannot_fetch_register;
2339 }
2340
2341 int
2342 gdbarch_cannot_store_register (struct gdbarch *gdbarch, int regnum)
2343 {
2344 gdb_assert (gdbarch != NULL);
2345 gdb_assert (gdbarch->cannot_store_register != NULL);
2346 if (gdbarch_debug >= 2)
2347 fprintf_unfiltered (gdb_stdlog, "gdbarch_cannot_store_register called\n");
2348 return gdbarch->cannot_store_register (gdbarch, regnum);
2349 }
2350
2351 void
2352 set_gdbarch_cannot_store_register (struct gdbarch *gdbarch,
2353 gdbarch_cannot_store_register_ftype cannot_store_register)
2354 {
2355 gdbarch->cannot_store_register = cannot_store_register;
2356 }
2357
2358 int
2359 gdbarch_get_longjmp_target_p (struct gdbarch *gdbarch)
2360 {
2361 gdb_assert (gdbarch != NULL);
2362 return gdbarch->get_longjmp_target != NULL;
2363 }
2364
2365 int
2366 gdbarch_get_longjmp_target (struct gdbarch *gdbarch, struct frame_info *frame, CORE_ADDR *pc)
2367 {
2368 gdb_assert (gdbarch != NULL);
2369 gdb_assert (gdbarch->get_longjmp_target != NULL);
2370 if (gdbarch_debug >= 2)
2371 fprintf_unfiltered (gdb_stdlog, "gdbarch_get_longjmp_target called\n");
2372 return gdbarch->get_longjmp_target (frame, pc);
2373 }
2374
2375 void
2376 set_gdbarch_get_longjmp_target (struct gdbarch *gdbarch,
2377 gdbarch_get_longjmp_target_ftype get_longjmp_target)
2378 {
2379 gdbarch->get_longjmp_target = get_longjmp_target;
2380 }
2381
2382 int
2383 gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch)
2384 {
2385 gdb_assert (gdbarch != NULL);
2386 if (gdbarch_debug >= 2)
2387 fprintf_unfiltered (gdb_stdlog, "gdbarch_believe_pcc_promotion called\n");
2388 return gdbarch->believe_pcc_promotion;
2389 }
2390
2391 void
2392 set_gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch,
2393 int believe_pcc_promotion)
2394 {
2395 gdbarch->believe_pcc_promotion = believe_pcc_promotion;
2396 }
2397
2398 int
2399 gdbarch_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type)
2400 {
2401 gdb_assert (gdbarch != NULL);
2402 gdb_assert (gdbarch->convert_register_p != NULL);
2403 if (gdbarch_debug >= 2)
2404 fprintf_unfiltered (gdb_stdlog, "gdbarch_convert_register_p called\n");
2405 return gdbarch->convert_register_p (gdbarch, regnum, type);
2406 }
2407
2408 void
2409 set_gdbarch_convert_register_p (struct gdbarch *gdbarch,
2410 gdbarch_convert_register_p_ftype convert_register_p)
2411 {
2412 gdbarch->convert_register_p = convert_register_p;
2413 }
2414
2415 int
2416 gdbarch_register_to_value (struct gdbarch *gdbarch, struct frame_info *frame, int regnum, struct type *type, gdb_byte *buf, int *optimizedp, int *unavailablep)
2417 {
2418 gdb_assert (gdbarch != NULL);
2419 gdb_assert (gdbarch->register_to_value != NULL);
2420 if (gdbarch_debug >= 2)
2421 fprintf_unfiltered (gdb_stdlog, "gdbarch_register_to_value called\n");
2422 return gdbarch->register_to_value (frame, regnum, type, buf, optimizedp, unavailablep);
2423 }
2424
2425 void
2426 set_gdbarch_register_to_value (struct gdbarch *gdbarch,
2427 gdbarch_register_to_value_ftype register_to_value)
2428 {
2429 gdbarch->register_to_value = register_to_value;
2430 }
2431
2432 void
2433 gdbarch_value_to_register (struct gdbarch *gdbarch, struct frame_info *frame, int regnum, struct type *type, const gdb_byte *buf)
2434 {
2435 gdb_assert (gdbarch != NULL);
2436 gdb_assert (gdbarch->value_to_register != NULL);
2437 if (gdbarch_debug >= 2)
2438 fprintf_unfiltered (gdb_stdlog, "gdbarch_value_to_register called\n");
2439 gdbarch->value_to_register (frame, regnum, type, buf);
2440 }
2441
2442 void
2443 set_gdbarch_value_to_register (struct gdbarch *gdbarch,
2444 gdbarch_value_to_register_ftype value_to_register)
2445 {
2446 gdbarch->value_to_register = value_to_register;
2447 }
2448
2449 struct value *
2450 gdbarch_value_from_register (struct gdbarch *gdbarch, struct type *type, int regnum, struct frame_info *frame)
2451 {
2452 gdb_assert (gdbarch != NULL);
2453 gdb_assert (gdbarch->value_from_register != NULL);
2454 if (gdbarch_debug >= 2)
2455 fprintf_unfiltered (gdb_stdlog, "gdbarch_value_from_register called\n");
2456 return gdbarch->value_from_register (type, regnum, frame);
2457 }
2458
2459 void
2460 set_gdbarch_value_from_register (struct gdbarch *gdbarch,
2461 gdbarch_value_from_register_ftype value_from_register)
2462 {
2463 gdbarch->value_from_register = value_from_register;
2464 }
2465
2466 CORE_ADDR
2467 gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf)
2468 {
2469 gdb_assert (gdbarch != NULL);
2470 gdb_assert (gdbarch->pointer_to_address != NULL);
2471 if (gdbarch_debug >= 2)
2472 fprintf_unfiltered (gdb_stdlog, "gdbarch_pointer_to_address called\n");
2473 return gdbarch->pointer_to_address (gdbarch, type, buf);
2474 }
2475
2476 void
2477 set_gdbarch_pointer_to_address (struct gdbarch *gdbarch,
2478 gdbarch_pointer_to_address_ftype pointer_to_address)
2479 {
2480 gdbarch->pointer_to_address = pointer_to_address;
2481 }
2482
2483 void
2484 gdbarch_address_to_pointer (struct gdbarch *gdbarch, struct type *type, gdb_byte *buf, CORE_ADDR addr)
2485 {
2486 gdb_assert (gdbarch != NULL);
2487 gdb_assert (gdbarch->address_to_pointer != NULL);
2488 if (gdbarch_debug >= 2)
2489 fprintf_unfiltered (gdb_stdlog, "gdbarch_address_to_pointer called\n");
2490 gdbarch->address_to_pointer (gdbarch, type, buf, addr);
2491 }
2492
2493 void
2494 set_gdbarch_address_to_pointer (struct gdbarch *gdbarch,
2495 gdbarch_address_to_pointer_ftype address_to_pointer)
2496 {
2497 gdbarch->address_to_pointer = address_to_pointer;
2498 }
2499
2500 int
2501 gdbarch_integer_to_address_p (struct gdbarch *gdbarch)
2502 {
2503 gdb_assert (gdbarch != NULL);
2504 return gdbarch->integer_to_address != NULL;
2505 }
2506
2507 CORE_ADDR
2508 gdbarch_integer_to_address (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf)
2509 {
2510 gdb_assert (gdbarch != NULL);
2511 gdb_assert (gdbarch->integer_to_address != NULL);
2512 if (gdbarch_debug >= 2)
2513 fprintf_unfiltered (gdb_stdlog, "gdbarch_integer_to_address called\n");
2514 return gdbarch->integer_to_address (gdbarch, type, buf);
2515 }
2516
2517 void
2518 set_gdbarch_integer_to_address (struct gdbarch *gdbarch,
2519 gdbarch_integer_to_address_ftype integer_to_address)
2520 {
2521 gdbarch->integer_to_address = integer_to_address;
2522 }
2523
2524 int
2525 gdbarch_return_value_p (struct gdbarch *gdbarch)
2526 {
2527 gdb_assert (gdbarch != NULL);
2528 return gdbarch->return_value != NULL;
2529 }
2530
2531 enum return_value_convention
2532 gdbarch_return_value (struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf)
2533 {
2534 gdb_assert (gdbarch != NULL);
2535 gdb_assert (gdbarch->return_value != NULL);
2536 if (gdbarch_debug >= 2)
2537 fprintf_unfiltered (gdb_stdlog, "gdbarch_return_value called\n");
2538 return gdbarch->return_value (gdbarch, function, valtype, regcache, readbuf, writebuf);
2539 }
2540
2541 void
2542 set_gdbarch_return_value (struct gdbarch *gdbarch,
2543 gdbarch_return_value_ftype return_value)
2544 {
2545 gdbarch->return_value = return_value;
2546 }
2547
2548 CORE_ADDR
2549 gdbarch_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR ip)
2550 {
2551 gdb_assert (gdbarch != NULL);
2552 gdb_assert (gdbarch->skip_prologue != NULL);
2553 if (gdbarch_debug >= 2)
2554 fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_prologue called\n");
2555 return gdbarch->skip_prologue (gdbarch, ip);
2556 }
2557
2558 void
2559 set_gdbarch_skip_prologue (struct gdbarch *gdbarch,
2560 gdbarch_skip_prologue_ftype skip_prologue)
2561 {
2562 gdbarch->skip_prologue = skip_prologue;
2563 }
2564
2565 int
2566 gdbarch_skip_main_prologue_p (struct gdbarch *gdbarch)
2567 {
2568 gdb_assert (gdbarch != NULL);
2569 return gdbarch->skip_main_prologue != NULL;
2570 }
2571
2572 CORE_ADDR
2573 gdbarch_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR ip)
2574 {
2575 gdb_assert (gdbarch != NULL);
2576 gdb_assert (gdbarch->skip_main_prologue != NULL);
2577 if (gdbarch_debug >= 2)
2578 fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_main_prologue called\n");
2579 return gdbarch->skip_main_prologue (gdbarch, ip);
2580 }
2581
2582 void
2583 set_gdbarch_skip_main_prologue (struct gdbarch *gdbarch,
2584 gdbarch_skip_main_prologue_ftype skip_main_prologue)
2585 {
2586 gdbarch->skip_main_prologue = skip_main_prologue;
2587 }
2588
2589 int
2590 gdbarch_inner_than (struct gdbarch *gdbarch, CORE_ADDR lhs, CORE_ADDR rhs)
2591 {
2592 gdb_assert (gdbarch != NULL);
2593 gdb_assert (gdbarch->inner_than != NULL);
2594 if (gdbarch_debug >= 2)
2595 fprintf_unfiltered (gdb_stdlog, "gdbarch_inner_than called\n");
2596 return gdbarch->inner_than (lhs, rhs);
2597 }
2598
2599 void
2600 set_gdbarch_inner_than (struct gdbarch *gdbarch,
2601 gdbarch_inner_than_ftype inner_than)
2602 {
2603 gdbarch->inner_than = inner_than;
2604 }
2605
2606 const gdb_byte *
2607 gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr)
2608 {
2609 gdb_assert (gdbarch != NULL);
2610 gdb_assert (gdbarch->breakpoint_from_pc != NULL);
2611 if (gdbarch_debug >= 2)
2612 fprintf_unfiltered (gdb_stdlog, "gdbarch_breakpoint_from_pc called\n");
2613 return gdbarch->breakpoint_from_pc (gdbarch, pcptr, lenptr);
2614 }
2615
2616 void
2617 set_gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch,
2618 gdbarch_breakpoint_from_pc_ftype breakpoint_from_pc)
2619 {
2620 gdbarch->breakpoint_from_pc = breakpoint_from_pc;
2621 }
2622
2623 void
2624 gdbarch_remote_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *kindptr)
2625 {
2626 gdb_assert (gdbarch != NULL);
2627 gdb_assert (gdbarch->remote_breakpoint_from_pc != NULL);
2628 if (gdbarch_debug >= 2)
2629 fprintf_unfiltered (gdb_stdlog, "gdbarch_remote_breakpoint_from_pc called\n");
2630 gdbarch->remote_breakpoint_from_pc (gdbarch, pcptr, kindptr);
2631 }
2632
2633 void
2634 set_gdbarch_remote_breakpoint_from_pc (struct gdbarch *gdbarch,
2635 gdbarch_remote_breakpoint_from_pc_ftype remote_breakpoint_from_pc)
2636 {
2637 gdbarch->remote_breakpoint_from_pc = remote_breakpoint_from_pc;
2638 }
2639
2640 int
2641 gdbarch_adjust_breakpoint_address_p (struct gdbarch *gdbarch)
2642 {
2643 gdb_assert (gdbarch != NULL);
2644 return gdbarch->adjust_breakpoint_address != NULL;
2645 }
2646
2647 CORE_ADDR
2648 gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr)
2649 {
2650 gdb_assert (gdbarch != NULL);
2651 gdb_assert (gdbarch->adjust_breakpoint_address != NULL);
2652 if (gdbarch_debug >= 2)
2653 fprintf_unfiltered (gdb_stdlog, "gdbarch_adjust_breakpoint_address called\n");
2654 return gdbarch->adjust_breakpoint_address (gdbarch, bpaddr);
2655 }
2656
2657 void
2658 set_gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch,
2659 gdbarch_adjust_breakpoint_address_ftype adjust_breakpoint_address)
2660 {
2661 gdbarch->adjust_breakpoint_address = adjust_breakpoint_address;
2662 }
2663
2664 int
2665 gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
2666 {
2667 gdb_assert (gdbarch != NULL);
2668 gdb_assert (gdbarch->memory_insert_breakpoint != NULL);
2669 if (gdbarch_debug >= 2)
2670 fprintf_unfiltered (gdb_stdlog, "gdbarch_memory_insert_breakpoint called\n");
2671 return gdbarch->memory_insert_breakpoint (gdbarch, bp_tgt);
2672 }
2673
2674 void
2675 set_gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch,
2676 gdbarch_memory_insert_breakpoint_ftype memory_insert_breakpoint)
2677 {
2678 gdbarch->memory_insert_breakpoint = memory_insert_breakpoint;
2679 }
2680
2681 int
2682 gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
2683 {
2684 gdb_assert (gdbarch != NULL);
2685 gdb_assert (gdbarch->memory_remove_breakpoint != NULL);
2686 if (gdbarch_debug >= 2)
2687 fprintf_unfiltered (gdb_stdlog, "gdbarch_memory_remove_breakpoint called\n");
2688 return gdbarch->memory_remove_breakpoint (gdbarch, bp_tgt);
2689 }
2690
2691 void
2692 set_gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch,
2693 gdbarch_memory_remove_breakpoint_ftype memory_remove_breakpoint)
2694 {
2695 gdbarch->memory_remove_breakpoint = memory_remove_breakpoint;
2696 }
2697
2698 CORE_ADDR
2699 gdbarch_decr_pc_after_break (struct gdbarch *gdbarch)
2700 {
2701 gdb_assert (gdbarch != NULL);
2702 /* Skip verify of decr_pc_after_break, invalid_p == 0 */
2703 if (gdbarch_debug >= 2)
2704 fprintf_unfiltered (gdb_stdlog, "gdbarch_decr_pc_after_break called\n");
2705 return gdbarch->decr_pc_after_break;
2706 }
2707
2708 void
2709 set_gdbarch_decr_pc_after_break (struct gdbarch *gdbarch,
2710 CORE_ADDR decr_pc_after_break)
2711 {
2712 gdbarch->decr_pc_after_break = decr_pc_after_break;
2713 }
2714
2715 CORE_ADDR
2716 gdbarch_deprecated_function_start_offset (struct gdbarch *gdbarch)
2717 {
2718 gdb_assert (gdbarch != NULL);
2719 /* Skip verify of deprecated_function_start_offset, invalid_p == 0 */
2720 if (gdbarch_debug >= 2)
2721 fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_function_start_offset called\n");
2722 return gdbarch->deprecated_function_start_offset;
2723 }
2724
2725 void
2726 set_gdbarch_deprecated_function_start_offset (struct gdbarch *gdbarch,
2727 CORE_ADDR deprecated_function_start_offset)
2728 {
2729 gdbarch->deprecated_function_start_offset = deprecated_function_start_offset;
2730 }
2731
2732 int
2733 gdbarch_remote_register_number (struct gdbarch *gdbarch, int regno)
2734 {
2735 gdb_assert (gdbarch != NULL);
2736 gdb_assert (gdbarch->remote_register_number != NULL);
2737 if (gdbarch_debug >= 2)
2738 fprintf_unfiltered (gdb_stdlog, "gdbarch_remote_register_number called\n");
2739 return gdbarch->remote_register_number (gdbarch, regno);
2740 }
2741
2742 void
2743 set_gdbarch_remote_register_number (struct gdbarch *gdbarch,
2744 gdbarch_remote_register_number_ftype remote_register_number)
2745 {
2746 gdbarch->remote_register_number = remote_register_number;
2747 }
2748
2749 int
2750 gdbarch_fetch_tls_load_module_address_p (struct gdbarch *gdbarch)
2751 {
2752 gdb_assert (gdbarch != NULL);
2753 return gdbarch->fetch_tls_load_module_address != NULL;
2754 }
2755
2756 CORE_ADDR
2757 gdbarch_fetch_tls_load_module_address (struct gdbarch *gdbarch, struct objfile *objfile)
2758 {
2759 gdb_assert (gdbarch != NULL);
2760 gdb_assert (gdbarch->fetch_tls_load_module_address != NULL);
2761 if (gdbarch_debug >= 2)
2762 fprintf_unfiltered (gdb_stdlog, "gdbarch_fetch_tls_load_module_address called\n");
2763 return gdbarch->fetch_tls_load_module_address (objfile);
2764 }
2765
2766 void
2767 set_gdbarch_fetch_tls_load_module_address (struct gdbarch *gdbarch,
2768 gdbarch_fetch_tls_load_module_address_ftype fetch_tls_load_module_address)
2769 {
2770 gdbarch->fetch_tls_load_module_address = fetch_tls_load_module_address;
2771 }
2772
2773 CORE_ADDR
2774 gdbarch_frame_args_skip (struct gdbarch *gdbarch)
2775 {
2776 gdb_assert (gdbarch != NULL);
2777 /* Skip verify of frame_args_skip, invalid_p == 0 */
2778 if (gdbarch_debug >= 2)
2779 fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_args_skip called\n");
2780 return gdbarch->frame_args_skip;
2781 }
2782
2783 void
2784 set_gdbarch_frame_args_skip (struct gdbarch *gdbarch,
2785 CORE_ADDR frame_args_skip)
2786 {
2787 gdbarch->frame_args_skip = frame_args_skip;
2788 }
2789
2790 int
2791 gdbarch_unwind_pc_p (struct gdbarch *gdbarch)
2792 {
2793 gdb_assert (gdbarch != NULL);
2794 return gdbarch->unwind_pc != NULL;
2795 }
2796
2797 CORE_ADDR
2798 gdbarch_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
2799 {
2800 gdb_assert (gdbarch != NULL);
2801 gdb_assert (gdbarch->unwind_pc != NULL);
2802 if (gdbarch_debug >= 2)
2803 fprintf_unfiltered (gdb_stdlog, "gdbarch_unwind_pc called\n");
2804 return gdbarch->unwind_pc (gdbarch, next_frame);
2805 }
2806
2807 void
2808 set_gdbarch_unwind_pc (struct gdbarch *gdbarch,
2809 gdbarch_unwind_pc_ftype unwind_pc)
2810 {
2811 gdbarch->unwind_pc = unwind_pc;
2812 }
2813
2814 int
2815 gdbarch_unwind_sp_p (struct gdbarch *gdbarch)
2816 {
2817 gdb_assert (gdbarch != NULL);
2818 return gdbarch->unwind_sp != NULL;
2819 }
2820
2821 CORE_ADDR
2822 gdbarch_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
2823 {
2824 gdb_assert (gdbarch != NULL);
2825 gdb_assert (gdbarch->unwind_sp != NULL);
2826 if (gdbarch_debug >= 2)
2827 fprintf_unfiltered (gdb_stdlog, "gdbarch_unwind_sp called\n");
2828 return gdbarch->unwind_sp (gdbarch, next_frame);
2829 }
2830
2831 void
2832 set_gdbarch_unwind_sp (struct gdbarch *gdbarch,
2833 gdbarch_unwind_sp_ftype unwind_sp)
2834 {
2835 gdbarch->unwind_sp = unwind_sp;
2836 }
2837
2838 int
2839 gdbarch_frame_num_args_p (struct gdbarch *gdbarch)
2840 {
2841 gdb_assert (gdbarch != NULL);
2842 return gdbarch->frame_num_args != NULL;
2843 }
2844
2845 int
2846 gdbarch_frame_num_args (struct gdbarch *gdbarch, struct frame_info *frame)
2847 {
2848 gdb_assert (gdbarch != NULL);
2849 gdb_assert (gdbarch->frame_num_args != NULL);
2850 if (gdbarch_debug >= 2)
2851 fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_num_args called\n");
2852 return gdbarch->frame_num_args (frame);
2853 }
2854
2855 void
2856 set_gdbarch_frame_num_args (struct gdbarch *gdbarch,
2857 gdbarch_frame_num_args_ftype frame_num_args)
2858 {
2859 gdbarch->frame_num_args = frame_num_args;
2860 }
2861
2862 int
2863 gdbarch_frame_align_p (struct gdbarch *gdbarch)
2864 {
2865 gdb_assert (gdbarch != NULL);
2866 return gdbarch->frame_align != NULL;
2867 }
2868
2869 CORE_ADDR
2870 gdbarch_frame_align (struct gdbarch *gdbarch, CORE_ADDR address)
2871 {
2872 gdb_assert (gdbarch != NULL);
2873 gdb_assert (gdbarch->frame_align != NULL);
2874 if (gdbarch_debug >= 2)
2875 fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_align called\n");
2876 return gdbarch->frame_align (gdbarch, address);
2877 }
2878
2879 void
2880 set_gdbarch_frame_align (struct gdbarch *gdbarch,
2881 gdbarch_frame_align_ftype frame_align)
2882 {
2883 gdbarch->frame_align = frame_align;
2884 }
2885
2886 int
2887 gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type)
2888 {
2889 gdb_assert (gdbarch != NULL);
2890 gdb_assert (gdbarch->stabs_argument_has_addr != NULL);
2891 if (gdbarch_debug >= 2)
2892 fprintf_unfiltered (gdb_stdlog, "gdbarch_stabs_argument_has_addr called\n");
2893 return gdbarch->stabs_argument_has_addr (gdbarch, type);
2894 }
2895
2896 void
2897 set_gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch,
2898 gdbarch_stabs_argument_has_addr_ftype stabs_argument_has_addr)
2899 {
2900 gdbarch->stabs_argument_has_addr = stabs_argument_has_addr;
2901 }
2902
2903 int
2904 gdbarch_frame_red_zone_size (struct gdbarch *gdbarch)
2905 {
2906 gdb_assert (gdbarch != NULL);
2907 if (gdbarch_debug >= 2)
2908 fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_red_zone_size called\n");
2909 return gdbarch->frame_red_zone_size;
2910 }
2911
2912 void
2913 set_gdbarch_frame_red_zone_size (struct gdbarch *gdbarch,
2914 int frame_red_zone_size)
2915 {
2916 gdbarch->frame_red_zone_size = frame_red_zone_size;
2917 }
2918
2919 CORE_ADDR
2920 gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr, struct target_ops *targ)
2921 {
2922 gdb_assert (gdbarch != NULL);
2923 gdb_assert (gdbarch->convert_from_func_ptr_addr != NULL);
2924 if (gdbarch_debug >= 2)
2925 fprintf_unfiltered (gdb_stdlog, "gdbarch_convert_from_func_ptr_addr called\n");
2926 return gdbarch->convert_from_func_ptr_addr (gdbarch, addr, targ);
2927 }
2928
2929 void
2930 set_gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
2931 gdbarch_convert_from_func_ptr_addr_ftype convert_from_func_ptr_addr)
2932 {
2933 gdbarch->convert_from_func_ptr_addr = convert_from_func_ptr_addr;
2934 }
2935
2936 CORE_ADDR
2937 gdbarch_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr)
2938 {
2939 gdb_assert (gdbarch != NULL);
2940 gdb_assert (gdbarch->addr_bits_remove != NULL);
2941 if (gdbarch_debug >= 2)
2942 fprintf_unfiltered (gdb_stdlog, "gdbarch_addr_bits_remove called\n");
2943 return gdbarch->addr_bits_remove (gdbarch, addr);
2944 }
2945
2946 void
2947 set_gdbarch_addr_bits_remove (struct gdbarch *gdbarch,
2948 gdbarch_addr_bits_remove_ftype addr_bits_remove)
2949 {
2950 gdbarch->addr_bits_remove = addr_bits_remove;
2951 }
2952
2953 CORE_ADDR
2954 gdbarch_smash_text_address (struct gdbarch *gdbarch, CORE_ADDR addr)
2955 {
2956 gdb_assert (gdbarch != NULL);
2957 gdb_assert (gdbarch->smash_text_address != NULL);
2958 if (gdbarch_debug >= 2)
2959 fprintf_unfiltered (gdb_stdlog, "gdbarch_smash_text_address called\n");
2960 return gdbarch->smash_text_address (gdbarch, addr);
2961 }
2962
2963 void
2964 set_gdbarch_smash_text_address (struct gdbarch *gdbarch,
2965 gdbarch_smash_text_address_ftype smash_text_address)
2966 {
2967 gdbarch->smash_text_address = smash_text_address;
2968 }
2969
2970 int
2971 gdbarch_software_single_step_p (struct gdbarch *gdbarch)
2972 {
2973 gdb_assert (gdbarch != NULL);
2974 return gdbarch->software_single_step != NULL;
2975 }
2976
2977 int
2978 gdbarch_software_single_step (struct gdbarch *gdbarch, struct frame_info *frame)
2979 {
2980 gdb_assert (gdbarch != NULL);
2981 gdb_assert (gdbarch->software_single_step != NULL);
2982 if (gdbarch_debug >= 2)
2983 fprintf_unfiltered (gdb_stdlog, "gdbarch_software_single_step called\n");
2984 return gdbarch->software_single_step (frame);
2985 }
2986
2987 void
2988 set_gdbarch_software_single_step (struct gdbarch *gdbarch,
2989 gdbarch_software_single_step_ftype software_single_step)
2990 {
2991 gdbarch->software_single_step = software_single_step;
2992 }
2993
2994 int
2995 gdbarch_single_step_through_delay_p (struct gdbarch *gdbarch)
2996 {
2997 gdb_assert (gdbarch != NULL);
2998 return gdbarch->single_step_through_delay != NULL;
2999 }
3000
3001 int
3002 gdbarch_single_step_through_delay (struct gdbarch *gdbarch, struct frame_info *frame)
3003 {
3004 gdb_assert (gdbarch != NULL);
3005 gdb_assert (gdbarch->single_step_through_delay != NULL);
3006 if (gdbarch_debug >= 2)
3007 fprintf_unfiltered (gdb_stdlog, "gdbarch_single_step_through_delay called\n");
3008 return gdbarch->single_step_through_delay (gdbarch, frame);
3009 }
3010
3011 void
3012 set_gdbarch_single_step_through_delay (struct gdbarch *gdbarch,
3013 gdbarch_single_step_through_delay_ftype single_step_through_delay)
3014 {
3015 gdbarch->single_step_through_delay = single_step_through_delay;
3016 }
3017
3018 int
3019 gdbarch_print_insn (struct gdbarch *gdbarch, bfd_vma vma, struct disassemble_info *info)
3020 {
3021 gdb_assert (gdbarch != NULL);
3022 gdb_assert (gdbarch->print_insn != NULL);
3023 if (gdbarch_debug >= 2)
3024 fprintf_unfiltered (gdb_stdlog, "gdbarch_print_insn called\n");
3025 return gdbarch->print_insn (vma, info);
3026 }
3027
3028 void
3029 set_gdbarch_print_insn (struct gdbarch *gdbarch,
3030 gdbarch_print_insn_ftype print_insn)
3031 {
3032 gdbarch->print_insn = print_insn;
3033 }
3034
3035 CORE_ADDR
3036 gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, struct frame_info *frame, CORE_ADDR pc)
3037 {
3038 gdb_assert (gdbarch != NULL);
3039 gdb_assert (gdbarch->skip_trampoline_code != NULL);
3040 if (gdbarch_debug >= 2)
3041 fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_trampoline_code called\n");
3042 return gdbarch->skip_trampoline_code (frame, pc);
3043 }
3044
3045 void
3046 set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch,
3047 gdbarch_skip_trampoline_code_ftype skip_trampoline_code)
3048 {
3049 gdbarch->skip_trampoline_code = skip_trampoline_code;
3050 }
3051
3052 CORE_ADDR
3053 gdbarch_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
3054 {
3055 gdb_assert (gdbarch != NULL);
3056 gdb_assert (gdbarch->skip_solib_resolver != NULL);
3057 if (gdbarch_debug >= 2)
3058 fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_solib_resolver called\n");
3059 return gdbarch->skip_solib_resolver (gdbarch, pc);
3060 }
3061
3062 void
3063 set_gdbarch_skip_solib_resolver (struct gdbarch *gdbarch,
3064 gdbarch_skip_solib_resolver_ftype skip_solib_resolver)
3065 {
3066 gdbarch->skip_solib_resolver = skip_solib_resolver;
3067 }
3068
3069 int
3070 gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, const char *name)
3071 {
3072 gdb_assert (gdbarch != NULL);
3073 gdb_assert (gdbarch->in_solib_return_trampoline != NULL);
3074 if (gdbarch_debug >= 2)
3075 fprintf_unfiltered (gdb_stdlog, "gdbarch_in_solib_return_trampoline called\n");
3076 return gdbarch->in_solib_return_trampoline (gdbarch, pc, name);
3077 }
3078
3079 void
3080 set_gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch,
3081 gdbarch_in_solib_return_trampoline_ftype in_solib_return_trampoline)
3082 {
3083 gdbarch->in_solib_return_trampoline = in_solib_return_trampoline;
3084 }
3085
3086 int
3087 gdbarch_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR addr)
3088 {
3089 gdb_assert (gdbarch != NULL);
3090 gdb_assert (gdbarch->in_function_epilogue_p != NULL);
3091 if (gdbarch_debug >= 2)
3092 fprintf_unfiltered (gdb_stdlog, "gdbarch_in_function_epilogue_p called\n");
3093 return gdbarch->in_function_epilogue_p (gdbarch, addr);
3094 }
3095
3096 void
3097 set_gdbarch_in_function_epilogue_p (struct gdbarch *gdbarch,
3098 gdbarch_in_function_epilogue_p_ftype in_function_epilogue_p)
3099 {
3100 gdbarch->in_function_epilogue_p = in_function_epilogue_p;
3101 }
3102
3103 void
3104 gdbarch_elf_make_msymbol_special (struct gdbarch *gdbarch, asymbol *sym, struct minimal_symbol *msym)
3105 {
3106 gdb_assert (gdbarch != NULL);
3107 gdb_assert (gdbarch->elf_make_msymbol_special != NULL);
3108 if (gdbarch_debug >= 2)
3109 fprintf_unfiltered (gdb_stdlog, "gdbarch_elf_make_msymbol_special called\n");
3110 gdbarch->elf_make_msymbol_special (sym, msym);
3111 }
3112
3113 void
3114 set_gdbarch_elf_make_msymbol_special (struct gdbarch *gdbarch,
3115 gdbarch_elf_make_msymbol_special_ftype elf_make_msymbol_special)
3116 {
3117 gdbarch->elf_make_msymbol_special = elf_make_msymbol_special;
3118 }
3119
3120 void
3121 gdbarch_coff_make_msymbol_special (struct gdbarch *gdbarch, int val, struct minimal_symbol *msym)
3122 {
3123 gdb_assert (gdbarch != NULL);
3124 gdb_assert (gdbarch->coff_make_msymbol_special != NULL);
3125 if (gdbarch_debug >= 2)
3126 fprintf_unfiltered (gdb_stdlog, "gdbarch_coff_make_msymbol_special called\n");
3127 gdbarch->coff_make_msymbol_special (val, msym);
3128 }
3129
3130 void
3131 set_gdbarch_coff_make_msymbol_special (struct gdbarch *gdbarch,
3132 gdbarch_coff_make_msymbol_special_ftype coff_make_msymbol_special)
3133 {
3134 gdbarch->coff_make_msymbol_special = coff_make_msymbol_special;
3135 }
3136
3137 int
3138 gdbarch_cannot_step_breakpoint (struct gdbarch *gdbarch)
3139 {
3140 gdb_assert (gdbarch != NULL);
3141 /* Skip verify of cannot_step_breakpoint, invalid_p == 0 */
3142 if (gdbarch_debug >= 2)
3143 fprintf_unfiltered (gdb_stdlog, "gdbarch_cannot_step_breakpoint called\n");
3144 return gdbarch->cannot_step_breakpoint;
3145 }
3146
3147 void
3148 set_gdbarch_cannot_step_breakpoint (struct gdbarch *gdbarch,
3149 int cannot_step_breakpoint)
3150 {
3151 gdbarch->cannot_step_breakpoint = cannot_step_breakpoint;
3152 }
3153
3154 int
3155 gdbarch_have_nonsteppable_watchpoint (struct gdbarch *gdbarch)
3156 {
3157 gdb_assert (gdbarch != NULL);
3158 /* Skip verify of have_nonsteppable_watchpoint, invalid_p == 0 */
3159 if (gdbarch_debug >= 2)
3160 fprintf_unfiltered (gdb_stdlog, "gdbarch_have_nonsteppable_watchpoint called\n");
3161 return gdbarch->have_nonsteppable_watchpoint;
3162 }
3163
3164 void
3165 set_gdbarch_have_nonsteppable_watchpoint (struct gdbarch *gdbarch,
3166 int have_nonsteppable_watchpoint)
3167 {
3168 gdbarch->have_nonsteppable_watchpoint = have_nonsteppable_watchpoint;
3169 }
3170
3171 int
3172 gdbarch_address_class_type_flags_p (struct gdbarch *gdbarch)
3173 {
3174 gdb_assert (gdbarch != NULL);
3175 return gdbarch->address_class_type_flags != NULL;
3176 }
3177
3178 int
3179 gdbarch_address_class_type_flags (struct gdbarch *gdbarch, int byte_size, int dwarf2_addr_class)
3180 {
3181 gdb_assert (gdbarch != NULL);
3182 gdb_assert (gdbarch->address_class_type_flags != NULL);
3183 if (gdbarch_debug >= 2)
3184 fprintf_unfiltered (gdb_stdlog, "gdbarch_address_class_type_flags called\n");
3185 return gdbarch->address_class_type_flags (byte_size, dwarf2_addr_class);
3186 }
3187
3188 void
3189 set_gdbarch_address_class_type_flags (struct gdbarch *gdbarch,
3190 gdbarch_address_class_type_flags_ftype address_class_type_flags)
3191 {
3192 gdbarch->address_class_type_flags = address_class_type_flags;
3193 }
3194
3195 int
3196 gdbarch_address_class_type_flags_to_name_p (struct gdbarch *gdbarch)
3197 {
3198 gdb_assert (gdbarch != NULL);
3199 return gdbarch->address_class_type_flags_to_name != NULL;
3200 }
3201
3202 const char *
3203 gdbarch_address_class_type_flags_to_name (struct gdbarch *gdbarch, int type_flags)
3204 {
3205 gdb_assert (gdbarch != NULL);
3206 gdb_assert (gdbarch->address_class_type_flags_to_name != NULL);
3207 if (gdbarch_debug >= 2)
3208 fprintf_unfiltered (gdb_stdlog, "gdbarch_address_class_type_flags_to_name called\n");
3209 return gdbarch->address_class_type_flags_to_name (gdbarch, type_flags);
3210 }
3211
3212 void
3213 set_gdbarch_address_class_type_flags_to_name (struct gdbarch *gdbarch,
3214 gdbarch_address_class_type_flags_to_name_ftype address_class_type_flags_to_name)
3215 {
3216 gdbarch->address_class_type_flags_to_name = address_class_type_flags_to_name;
3217 }
3218
3219 int
3220 gdbarch_address_class_name_to_type_flags_p (struct gdbarch *gdbarch)
3221 {
3222 gdb_assert (gdbarch != NULL);
3223 return gdbarch->address_class_name_to_type_flags != NULL;
3224 }
3225
3226 int
3227 gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarch, const char *name, int *type_flags_ptr)
3228 {
3229 gdb_assert (gdbarch != NULL);
3230 gdb_assert (gdbarch->address_class_name_to_type_flags != NULL);
3231 if (gdbarch_debug >= 2)
3232 fprintf_unfiltered (gdb_stdlog, "gdbarch_address_class_name_to_type_flags called\n");
3233 return gdbarch->address_class_name_to_type_flags (gdbarch, name, type_flags_ptr);
3234 }
3235
3236 void
3237 set_gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarch,
3238 gdbarch_address_class_name_to_type_flags_ftype address_class_name_to_type_flags)
3239 {
3240 gdbarch->address_class_name_to_type_flags = address_class_name_to_type_flags;
3241 }
3242
3243 int
3244 gdbarch_register_reggroup_p (struct gdbarch *gdbarch, int regnum, struct reggroup *reggroup)
3245 {
3246 gdb_assert (gdbarch != NULL);
3247 gdb_assert (gdbarch->register_reggroup_p != NULL);
3248 if (gdbarch_debug >= 2)
3249 fprintf_unfiltered (gdb_stdlog, "gdbarch_register_reggroup_p called\n");
3250 return gdbarch->register_reggroup_p (gdbarch, regnum, reggroup);
3251 }
3252
3253 void
3254 set_gdbarch_register_reggroup_p (struct gdbarch *gdbarch,
3255 gdbarch_register_reggroup_p_ftype register_reggroup_p)
3256 {
3257 gdbarch->register_reggroup_p = register_reggroup_p;
3258 }
3259
3260 int
3261 gdbarch_fetch_pointer_argument_p (struct gdbarch *gdbarch)
3262 {
3263 gdb_assert (gdbarch != NULL);
3264 return gdbarch->fetch_pointer_argument != NULL;
3265 }
3266
3267 CORE_ADDR
3268 gdbarch_fetch_pointer_argument (struct gdbarch *gdbarch, struct frame_info *frame, int argi, struct type *type)
3269 {
3270 gdb_assert (gdbarch != NULL);
3271 gdb_assert (gdbarch->fetch_pointer_argument != NULL);
3272 if (gdbarch_debug >= 2)
3273 fprintf_unfiltered (gdb_stdlog, "gdbarch_fetch_pointer_argument called\n");
3274 return gdbarch->fetch_pointer_argument (frame, argi, type);
3275 }
3276
3277 void
3278 set_gdbarch_fetch_pointer_argument (struct gdbarch *gdbarch,
3279 gdbarch_fetch_pointer_argument_ftype fetch_pointer_argument)
3280 {
3281 gdbarch->fetch_pointer_argument = fetch_pointer_argument;
3282 }
3283
3284 int
3285 gdbarch_regset_from_core_section_p (struct gdbarch *gdbarch)
3286 {
3287 gdb_assert (gdbarch != NULL);
3288 return gdbarch->regset_from_core_section != NULL;
3289 }
3290
3291 const struct regset *
3292 gdbarch_regset_from_core_section (struct gdbarch *gdbarch, const char *sect_name, size_t sect_size)
3293 {
3294 gdb_assert (gdbarch != NULL);
3295 gdb_assert (gdbarch->regset_from_core_section != NULL);
3296 if (gdbarch_debug >= 2)
3297 fprintf_unfiltered (gdb_stdlog, "gdbarch_regset_from_core_section called\n");
3298 return gdbarch->regset_from_core_section (gdbarch, sect_name, sect_size);
3299 }
3300
3301 void
3302 set_gdbarch_regset_from_core_section (struct gdbarch *gdbarch,
3303 gdbarch_regset_from_core_section_ftype regset_from_core_section)
3304 {
3305 gdbarch->regset_from_core_section = regset_from_core_section;
3306 }
3307
3308 struct core_regset_section *
3309 gdbarch_core_regset_sections (struct gdbarch *gdbarch)
3310 {
3311 gdb_assert (gdbarch != NULL);
3312 if (gdbarch_debug >= 2)
3313 fprintf_unfiltered (gdb_stdlog, "gdbarch_core_regset_sections called\n");
3314 return gdbarch->core_regset_sections;
3315 }
3316
3317 void
3318 set_gdbarch_core_regset_sections (struct gdbarch *gdbarch,
3319 struct core_regset_section * core_regset_sections)
3320 {
3321 gdbarch->core_regset_sections = core_regset_sections;
3322 }
3323
3324 int
3325 gdbarch_make_corefile_notes_p (struct gdbarch *gdbarch)
3326 {
3327 gdb_assert (gdbarch != NULL);
3328 return gdbarch->make_corefile_notes != NULL;
3329 }
3330
3331 char *
3332 gdbarch_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
3333 {
3334 gdb_assert (gdbarch != NULL);
3335 gdb_assert (gdbarch->make_corefile_notes != NULL);
3336 if (gdbarch_debug >= 2)
3337 fprintf_unfiltered (gdb_stdlog, "gdbarch_make_corefile_notes called\n");
3338 return gdbarch->make_corefile_notes (gdbarch, obfd, note_size);
3339 }
3340
3341 void
3342 set_gdbarch_make_corefile_notes (struct gdbarch *gdbarch,
3343 gdbarch_make_corefile_notes_ftype make_corefile_notes)
3344 {
3345 gdbarch->make_corefile_notes = make_corefile_notes;
3346 }
3347
3348 int
3349 gdbarch_find_memory_regions_p (struct gdbarch *gdbarch)
3350 {
3351 gdb_assert (gdbarch != NULL);
3352 return gdbarch->find_memory_regions != NULL;
3353 }
3354
3355 int
3356 gdbarch_find_memory_regions (struct gdbarch *gdbarch, find_memory_region_ftype func, void *data)
3357 {
3358 gdb_assert (gdbarch != NULL);
3359 gdb_assert (gdbarch->find_memory_regions != NULL);
3360 if (gdbarch_debug >= 2)
3361 fprintf_unfiltered (gdb_stdlog, "gdbarch_find_memory_regions called\n");
3362 return gdbarch->find_memory_regions (gdbarch, func, data);
3363 }
3364
3365 void
3366 set_gdbarch_find_memory_regions (struct gdbarch *gdbarch,
3367 gdbarch_find_memory_regions_ftype find_memory_regions)
3368 {
3369 gdbarch->find_memory_regions = find_memory_regions;
3370 }
3371
3372 int
3373 gdbarch_core_xfer_shared_libraries_p (struct gdbarch *gdbarch)
3374 {
3375 gdb_assert (gdbarch != NULL);
3376 return gdbarch->core_xfer_shared_libraries != NULL;
3377 }
3378
3379 LONGEST
3380 gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, LONGEST len)
3381 {
3382 gdb_assert (gdbarch != NULL);
3383 gdb_assert (gdbarch->core_xfer_shared_libraries != NULL);
3384 if (gdbarch_debug >= 2)
3385 fprintf_unfiltered (gdb_stdlog, "gdbarch_core_xfer_shared_libraries called\n");
3386 return gdbarch->core_xfer_shared_libraries (gdbarch, readbuf, offset, len);
3387 }
3388
3389 void
3390 set_gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch,
3391 gdbarch_core_xfer_shared_libraries_ftype core_xfer_shared_libraries)
3392 {
3393 gdbarch->core_xfer_shared_libraries = core_xfer_shared_libraries;
3394 }
3395
3396 int
3397 gdbarch_core_pid_to_str_p (struct gdbarch *gdbarch)
3398 {
3399 gdb_assert (gdbarch != NULL);
3400 return gdbarch->core_pid_to_str != NULL;
3401 }
3402
3403 char *
3404 gdbarch_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid)
3405 {
3406 gdb_assert (gdbarch != NULL);
3407 gdb_assert (gdbarch->core_pid_to_str != NULL);
3408 if (gdbarch_debug >= 2)
3409 fprintf_unfiltered (gdb_stdlog, "gdbarch_core_pid_to_str called\n");
3410 return gdbarch->core_pid_to_str (gdbarch, ptid);
3411 }
3412
3413 void
3414 set_gdbarch_core_pid_to_str (struct gdbarch *gdbarch,
3415 gdbarch_core_pid_to_str_ftype core_pid_to_str)
3416 {
3417 gdbarch->core_pid_to_str = core_pid_to_str;
3418 }
3419
3420 int
3421 gdbarch_gcore_bfd_target_p (struct gdbarch *gdbarch)
3422 {
3423 gdb_assert (gdbarch != NULL);
3424 return gdbarch->gcore_bfd_target != 0;
3425 }
3426
3427 const char *
3428 gdbarch_gcore_bfd_target (struct gdbarch *gdbarch)
3429 {
3430 gdb_assert (gdbarch != NULL);
3431 /* Check variable changed from pre-default. */
3432 gdb_assert (gdbarch->gcore_bfd_target != 0);
3433 if (gdbarch_debug >= 2)
3434 fprintf_unfiltered (gdb_stdlog, "gdbarch_gcore_bfd_target called\n");
3435 return gdbarch->gcore_bfd_target;
3436 }
3437
3438 void
3439 set_gdbarch_gcore_bfd_target (struct gdbarch *gdbarch,
3440 const char * gcore_bfd_target)
3441 {
3442 gdbarch->gcore_bfd_target = gcore_bfd_target;
3443 }
3444
3445 int
3446 gdbarch_vtable_function_descriptors (struct gdbarch *gdbarch)
3447 {
3448 gdb_assert (gdbarch != NULL);
3449 /* Skip verify of vtable_function_descriptors, invalid_p == 0 */
3450 if (gdbarch_debug >= 2)
3451 fprintf_unfiltered (gdb_stdlog, "gdbarch_vtable_function_descriptors called\n");
3452 return gdbarch->vtable_function_descriptors;
3453 }
3454
3455 void
3456 set_gdbarch_vtable_function_descriptors (struct gdbarch *gdbarch,
3457 int vtable_function_descriptors)
3458 {
3459 gdbarch->vtable_function_descriptors = vtable_function_descriptors;
3460 }
3461
3462 int
3463 gdbarch_vbit_in_delta (struct gdbarch *gdbarch)
3464 {
3465 gdb_assert (gdbarch != NULL);
3466 /* Skip verify of vbit_in_delta, invalid_p == 0 */
3467 if (gdbarch_debug >= 2)
3468 fprintf_unfiltered (gdb_stdlog, "gdbarch_vbit_in_delta called\n");
3469 return gdbarch->vbit_in_delta;
3470 }
3471
3472 void
3473 set_gdbarch_vbit_in_delta (struct gdbarch *gdbarch,
3474 int vbit_in_delta)
3475 {
3476 gdbarch->vbit_in_delta = vbit_in_delta;
3477 }
3478
3479 int
3480 gdbarch_skip_permanent_breakpoint_p (struct gdbarch *gdbarch)
3481 {
3482 gdb_assert (gdbarch != NULL);
3483 return gdbarch->skip_permanent_breakpoint != NULL;
3484 }
3485
3486 void
3487 gdbarch_skip_permanent_breakpoint (struct gdbarch *gdbarch, struct regcache *regcache)
3488 {
3489 gdb_assert (gdbarch != NULL);
3490 gdb_assert (gdbarch->skip_permanent_breakpoint != NULL);
3491 if (gdbarch_debug >= 2)
3492 fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_permanent_breakpoint called\n");
3493 gdbarch->skip_permanent_breakpoint (regcache);
3494 }
3495
3496 void
3497 set_gdbarch_skip_permanent_breakpoint (struct gdbarch *gdbarch,
3498 gdbarch_skip_permanent_breakpoint_ftype skip_permanent_breakpoint)
3499 {
3500 gdbarch->skip_permanent_breakpoint = skip_permanent_breakpoint;
3501 }
3502
3503 int
3504 gdbarch_max_insn_length_p (struct gdbarch *gdbarch)
3505 {
3506 gdb_assert (gdbarch != NULL);
3507 return gdbarch->max_insn_length != 0;
3508 }
3509
3510 ULONGEST
3511 gdbarch_max_insn_length (struct gdbarch *gdbarch)
3512 {
3513 gdb_assert (gdbarch != NULL);
3514 /* Check variable changed from pre-default. */
3515 gdb_assert (gdbarch->max_insn_length != 0);
3516 if (gdbarch_debug >= 2)
3517 fprintf_unfiltered (gdb_stdlog, "gdbarch_max_insn_length called\n");
3518 return gdbarch->max_insn_length;
3519 }
3520
3521 void
3522 set_gdbarch_max_insn_length (struct gdbarch *gdbarch,
3523 ULONGEST max_insn_length)
3524 {
3525 gdbarch->max_insn_length = max_insn_length;
3526 }
3527
3528 int
3529 gdbarch_displaced_step_copy_insn_p (struct gdbarch *gdbarch)
3530 {
3531 gdb_assert (gdbarch != NULL);
3532 return gdbarch->displaced_step_copy_insn != NULL;
3533 }
3534
3535 struct displaced_step_closure *
3536 gdbarch_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to, struct regcache *regs)
3537 {
3538 gdb_assert (gdbarch != NULL);
3539 gdb_assert (gdbarch->displaced_step_copy_insn != NULL);
3540 if (gdbarch_debug >= 2)
3541 fprintf_unfiltered (gdb_stdlog, "gdbarch_displaced_step_copy_insn called\n");
3542 return gdbarch->displaced_step_copy_insn (gdbarch, from, to, regs);
3543 }
3544
3545 void
3546 set_gdbarch_displaced_step_copy_insn (struct gdbarch *gdbarch,
3547 gdbarch_displaced_step_copy_insn_ftype displaced_step_copy_insn)
3548 {
3549 gdbarch->displaced_step_copy_insn = displaced_step_copy_insn;
3550 }
3551
3552 int
3553 gdbarch_displaced_step_hw_singlestep (struct gdbarch *gdbarch, struct displaced_step_closure *closure)
3554 {
3555 gdb_assert (gdbarch != NULL);
3556 gdb_assert (gdbarch->displaced_step_hw_singlestep != NULL);
3557 if (gdbarch_debug >= 2)
3558 fprintf_unfiltered (gdb_stdlog, "gdbarch_displaced_step_hw_singlestep called\n");
3559 return gdbarch->displaced_step_hw_singlestep (gdbarch, closure);
3560 }
3561
3562 void
3563 set_gdbarch_displaced_step_hw_singlestep (struct gdbarch *gdbarch,
3564 gdbarch_displaced_step_hw_singlestep_ftype displaced_step_hw_singlestep)
3565 {
3566 gdbarch->displaced_step_hw_singlestep = displaced_step_hw_singlestep;
3567 }
3568
3569 int
3570 gdbarch_displaced_step_fixup_p (struct gdbarch *gdbarch)
3571 {
3572 gdb_assert (gdbarch != NULL);
3573 return gdbarch->displaced_step_fixup != NULL;
3574 }
3575
3576 void
3577 gdbarch_displaced_step_fixup (struct gdbarch *gdbarch, struct displaced_step_closure *closure, CORE_ADDR from, CORE_ADDR to, struct regcache *regs)
3578 {
3579 gdb_assert (gdbarch != NULL);
3580 gdb_assert (gdbarch->displaced_step_fixup != NULL);
3581 /* Do not check predicate: gdbarch->displaced_step_fixup != NULL, allow call. */
3582 if (gdbarch_debug >= 2)
3583 fprintf_unfiltered (gdb_stdlog, "gdbarch_displaced_step_fixup called\n");
3584 gdbarch->displaced_step_fixup (gdbarch, closure, from, to, regs);
3585 }
3586
3587 void
3588 set_gdbarch_displaced_step_fixup (struct gdbarch *gdbarch,
3589 gdbarch_displaced_step_fixup_ftype displaced_step_fixup)
3590 {
3591 gdbarch->displaced_step_fixup = displaced_step_fixup;
3592 }
3593
3594 void
3595 gdbarch_displaced_step_free_closure (struct gdbarch *gdbarch, struct displaced_step_closure *closure)
3596 {
3597 gdb_assert (gdbarch != NULL);
3598 gdb_assert (gdbarch->displaced_step_free_closure != NULL);
3599 if (gdbarch_debug >= 2)
3600 fprintf_unfiltered (gdb_stdlog, "gdbarch_displaced_step_free_closure called\n");
3601 gdbarch->displaced_step_free_closure (gdbarch, closure);
3602 }
3603
3604 void
3605 set_gdbarch_displaced_step_free_closure (struct gdbarch *gdbarch,
3606 gdbarch_displaced_step_free_closure_ftype displaced_step_free_closure)
3607 {
3608 gdbarch->displaced_step_free_closure = displaced_step_free_closure;
3609 }
3610
3611 CORE_ADDR
3612 gdbarch_displaced_step_location (struct gdbarch *gdbarch)
3613 {
3614 gdb_assert (gdbarch != NULL);
3615 gdb_assert (gdbarch->displaced_step_location != NULL);
3616 if (gdbarch_debug >= 2)
3617 fprintf_unfiltered (gdb_stdlog, "gdbarch_displaced_step_location called\n");
3618 return gdbarch->displaced_step_location (gdbarch);
3619 }
3620
3621 void
3622 set_gdbarch_displaced_step_location (struct gdbarch *gdbarch,
3623 gdbarch_displaced_step_location_ftype displaced_step_location)
3624 {
3625 gdbarch->displaced_step_location = displaced_step_location;
3626 }
3627
3628 int
3629 gdbarch_relocate_instruction_p (struct gdbarch *gdbarch)
3630 {
3631 gdb_assert (gdbarch != NULL);
3632 return gdbarch->relocate_instruction != NULL;
3633 }
3634
3635 void
3636 gdbarch_relocate_instruction (struct gdbarch *gdbarch, CORE_ADDR *to, CORE_ADDR from)
3637 {
3638 gdb_assert (gdbarch != NULL);
3639 gdb_assert (gdbarch->relocate_instruction != NULL);
3640 /* Do not check predicate: gdbarch->relocate_instruction != NULL, allow call. */
3641 if (gdbarch_debug >= 2)
3642 fprintf_unfiltered (gdb_stdlog, "gdbarch_relocate_instruction called\n");
3643 gdbarch->relocate_instruction (gdbarch, to, from);
3644 }
3645
3646 void
3647 set_gdbarch_relocate_instruction (struct gdbarch *gdbarch,
3648 gdbarch_relocate_instruction_ftype relocate_instruction)
3649 {
3650 gdbarch->relocate_instruction = relocate_instruction;
3651 }
3652
3653 int
3654 gdbarch_overlay_update_p (struct gdbarch *gdbarch)
3655 {
3656 gdb_assert (gdbarch != NULL);
3657 return gdbarch->overlay_update != NULL;
3658 }
3659
3660 void
3661 gdbarch_overlay_update (struct gdbarch *gdbarch, struct obj_section *osect)
3662 {
3663 gdb_assert (gdbarch != NULL);
3664 gdb_assert (gdbarch->overlay_update != NULL);
3665 if (gdbarch_debug >= 2)
3666 fprintf_unfiltered (gdb_stdlog, "gdbarch_overlay_update called\n");
3667 gdbarch->overlay_update (osect);
3668 }
3669
3670 void
3671 set_gdbarch_overlay_update (struct gdbarch *gdbarch,
3672 gdbarch_overlay_update_ftype overlay_update)
3673 {
3674 gdbarch->overlay_update = overlay_update;
3675 }
3676
3677 int
3678 gdbarch_core_read_description_p (struct gdbarch *gdbarch)
3679 {
3680 gdb_assert (gdbarch != NULL);
3681 return gdbarch->core_read_description != NULL;
3682 }
3683
3684 const struct target_desc *
3685 gdbarch_core_read_description (struct gdbarch *gdbarch, struct target_ops *target, bfd *abfd)
3686 {
3687 gdb_assert (gdbarch != NULL);
3688 gdb_assert (gdbarch->core_read_description != NULL);
3689 if (gdbarch_debug >= 2)
3690 fprintf_unfiltered (gdb_stdlog, "gdbarch_core_read_description called\n");
3691 return gdbarch->core_read_description (gdbarch, target, abfd);
3692 }
3693
3694 void
3695 set_gdbarch_core_read_description (struct gdbarch *gdbarch,
3696 gdbarch_core_read_description_ftype core_read_description)
3697 {
3698 gdbarch->core_read_description = core_read_description;
3699 }
3700
3701 int
3702 gdbarch_static_transform_name_p (struct gdbarch *gdbarch)
3703 {
3704 gdb_assert (gdbarch != NULL);
3705 return gdbarch->static_transform_name != NULL;
3706 }
3707
3708 const char *
3709 gdbarch_static_transform_name (struct gdbarch *gdbarch, const char *name)
3710 {
3711 gdb_assert (gdbarch != NULL);
3712 gdb_assert (gdbarch->static_transform_name != NULL);
3713 if (gdbarch_debug >= 2)
3714 fprintf_unfiltered (gdb_stdlog, "gdbarch_static_transform_name called\n");
3715 return gdbarch->static_transform_name (name);
3716 }
3717
3718 void
3719 set_gdbarch_static_transform_name (struct gdbarch *gdbarch,
3720 gdbarch_static_transform_name_ftype static_transform_name)
3721 {
3722 gdbarch->static_transform_name = static_transform_name;
3723 }
3724
3725 int
3726 gdbarch_sofun_address_maybe_missing (struct gdbarch *gdbarch)
3727 {
3728 gdb_assert (gdbarch != NULL);
3729 /* Skip verify of sofun_address_maybe_missing, invalid_p == 0 */
3730 if (gdbarch_debug >= 2)
3731 fprintf_unfiltered (gdb_stdlog, "gdbarch_sofun_address_maybe_missing called\n");
3732 return gdbarch->sofun_address_maybe_missing;
3733 }
3734
3735 void
3736 set_gdbarch_sofun_address_maybe_missing (struct gdbarch *gdbarch,
3737 int sofun_address_maybe_missing)
3738 {
3739 gdbarch->sofun_address_maybe_missing = sofun_address_maybe_missing;
3740 }
3741
3742 int
3743 gdbarch_process_record_p (struct gdbarch *gdbarch)
3744 {
3745 gdb_assert (gdbarch != NULL);
3746 return gdbarch->process_record != NULL;
3747 }
3748
3749 int
3750 gdbarch_process_record (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr)
3751 {
3752 gdb_assert (gdbarch != NULL);
3753 gdb_assert (gdbarch->process_record != NULL);
3754 if (gdbarch_debug >= 2)
3755 fprintf_unfiltered (gdb_stdlog, "gdbarch_process_record called\n");
3756 return gdbarch->process_record (gdbarch, regcache, addr);
3757 }
3758
3759 void
3760 set_gdbarch_process_record (struct gdbarch *gdbarch,
3761 gdbarch_process_record_ftype process_record)
3762 {
3763 gdbarch->process_record = process_record;
3764 }
3765
3766 int
3767 gdbarch_process_record_signal_p (struct gdbarch *gdbarch)
3768 {
3769 gdb_assert (gdbarch != NULL);
3770 return gdbarch->process_record_signal != NULL;
3771 }
3772
3773 int
3774 gdbarch_process_record_signal (struct gdbarch *gdbarch, struct regcache *regcache, enum gdb_signal signal)
3775 {
3776 gdb_assert (gdbarch != NULL);
3777 gdb_assert (gdbarch->process_record_signal != NULL);
3778 if (gdbarch_debug >= 2)
3779 fprintf_unfiltered (gdb_stdlog, "gdbarch_process_record_signal called\n");
3780 return gdbarch->process_record_signal (gdbarch, regcache, signal);
3781 }
3782
3783 void
3784 set_gdbarch_process_record_signal (struct gdbarch *gdbarch,
3785 gdbarch_process_record_signal_ftype process_record_signal)
3786 {
3787 gdbarch->process_record_signal = process_record_signal;
3788 }
3789
3790 enum gdb_signal
3791 gdbarch_gdb_signal_from_target (struct gdbarch *gdbarch, int signo)
3792 {
3793 gdb_assert (gdbarch != NULL);
3794 gdb_assert (gdbarch->gdb_signal_from_target != NULL);
3795 if (gdbarch_debug >= 2)
3796 fprintf_unfiltered (gdb_stdlog, "gdbarch_gdb_signal_from_target called\n");
3797 return gdbarch->gdb_signal_from_target (gdbarch, signo);
3798 }
3799
3800 void
3801 set_gdbarch_gdb_signal_from_target (struct gdbarch *gdbarch,
3802 gdbarch_gdb_signal_from_target_ftype gdb_signal_from_target)
3803 {
3804 gdbarch->gdb_signal_from_target = gdb_signal_from_target;
3805 }
3806
3807 int
3808 gdbarch_get_siginfo_type_p (struct gdbarch *gdbarch)
3809 {
3810 gdb_assert (gdbarch != NULL);
3811 return gdbarch->get_siginfo_type != NULL;
3812 }
3813
3814 struct type *
3815 gdbarch_get_siginfo_type (struct gdbarch *gdbarch)
3816 {
3817 gdb_assert (gdbarch != NULL);
3818 gdb_assert (gdbarch->get_siginfo_type != NULL);
3819 if (gdbarch_debug >= 2)
3820 fprintf_unfiltered (gdb_stdlog, "gdbarch_get_siginfo_type called\n");
3821 return gdbarch->get_siginfo_type (gdbarch);
3822 }
3823
3824 void
3825 set_gdbarch_get_siginfo_type (struct gdbarch *gdbarch,
3826 gdbarch_get_siginfo_type_ftype get_siginfo_type)
3827 {
3828 gdbarch->get_siginfo_type = get_siginfo_type;
3829 }
3830
3831 int
3832 gdbarch_record_special_symbol_p (struct gdbarch *gdbarch)
3833 {
3834 gdb_assert (gdbarch != NULL);
3835 return gdbarch->record_special_symbol != NULL;
3836 }
3837
3838 void
3839 gdbarch_record_special_symbol (struct gdbarch *gdbarch, struct objfile *objfile, asymbol *sym)
3840 {
3841 gdb_assert (gdbarch != NULL);
3842 gdb_assert (gdbarch->record_special_symbol != NULL);
3843 if (gdbarch_debug >= 2)
3844 fprintf_unfiltered (gdb_stdlog, "gdbarch_record_special_symbol called\n");
3845 gdbarch->record_special_symbol (gdbarch, objfile, sym);
3846 }
3847
3848 void
3849 set_gdbarch_record_special_symbol (struct gdbarch *gdbarch,
3850 gdbarch_record_special_symbol_ftype record_special_symbol)
3851 {
3852 gdbarch->record_special_symbol = record_special_symbol;
3853 }
3854
3855 int
3856 gdbarch_get_syscall_number_p (struct gdbarch *gdbarch)
3857 {
3858 gdb_assert (gdbarch != NULL);
3859 return gdbarch->get_syscall_number != NULL;
3860 }
3861
3862 LONGEST
3863 gdbarch_get_syscall_number (struct gdbarch *gdbarch, ptid_t ptid)
3864 {
3865 gdb_assert (gdbarch != NULL);
3866 gdb_assert (gdbarch->get_syscall_number != NULL);
3867 if (gdbarch_debug >= 2)
3868 fprintf_unfiltered (gdb_stdlog, "gdbarch_get_syscall_number called\n");
3869 return gdbarch->get_syscall_number (gdbarch, ptid);
3870 }
3871
3872 void
3873 set_gdbarch_get_syscall_number (struct gdbarch *gdbarch,
3874 gdbarch_get_syscall_number_ftype get_syscall_number)
3875 {
3876 gdbarch->get_syscall_number = get_syscall_number;
3877 }
3878
3879 const char *
3880 gdbarch_stap_integer_prefix (struct gdbarch *gdbarch)
3881 {
3882 gdb_assert (gdbarch != NULL);
3883 /* Skip verify of stap_integer_prefix, invalid_p == 0 */
3884 if (gdbarch_debug >= 2)
3885 fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_integer_prefix called\n");
3886 return gdbarch->stap_integer_prefix;
3887 }
3888
3889 void
3890 set_gdbarch_stap_integer_prefix (struct gdbarch *gdbarch,
3891 const char * stap_integer_prefix)
3892 {
3893 gdbarch->stap_integer_prefix = stap_integer_prefix;
3894 }
3895
3896 const char *
3897 gdbarch_stap_integer_suffix (struct gdbarch *gdbarch)
3898 {
3899 gdb_assert (gdbarch != NULL);
3900 /* Skip verify of stap_integer_suffix, invalid_p == 0 */
3901 if (gdbarch_debug >= 2)
3902 fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_integer_suffix called\n");
3903 return gdbarch->stap_integer_suffix;
3904 }
3905
3906 void
3907 set_gdbarch_stap_integer_suffix (struct gdbarch *gdbarch,
3908 const char * stap_integer_suffix)
3909 {
3910 gdbarch->stap_integer_suffix = stap_integer_suffix;
3911 }
3912
3913 const char *
3914 gdbarch_stap_register_prefix (struct gdbarch *gdbarch)
3915 {
3916 gdb_assert (gdbarch != NULL);
3917 /* Skip verify of stap_register_prefix, invalid_p == 0 */
3918 if (gdbarch_debug >= 2)
3919 fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_register_prefix called\n");
3920 return gdbarch->stap_register_prefix;
3921 }
3922
3923 void
3924 set_gdbarch_stap_register_prefix (struct gdbarch *gdbarch,
3925 const char * stap_register_prefix)
3926 {
3927 gdbarch->stap_register_prefix = stap_register_prefix;
3928 }
3929
3930 const char *
3931 gdbarch_stap_register_suffix (struct gdbarch *gdbarch)
3932 {
3933 gdb_assert (gdbarch != NULL);
3934 /* Skip verify of stap_register_suffix, invalid_p == 0 */
3935 if (gdbarch_debug >= 2)
3936 fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_register_suffix called\n");
3937 return gdbarch->stap_register_suffix;
3938 }
3939
3940 void
3941 set_gdbarch_stap_register_suffix (struct gdbarch *gdbarch,
3942 const char * stap_register_suffix)
3943 {
3944 gdbarch->stap_register_suffix = stap_register_suffix;
3945 }
3946
3947 const char *
3948 gdbarch_stap_register_indirection_prefix (struct gdbarch *gdbarch)
3949 {
3950 gdb_assert (gdbarch != NULL);
3951 /* Skip verify of stap_register_indirection_prefix, invalid_p == 0 */
3952 if (gdbarch_debug >= 2)
3953 fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_register_indirection_prefix called\n");
3954 return gdbarch->stap_register_indirection_prefix;
3955 }
3956
3957 void
3958 set_gdbarch_stap_register_indirection_prefix (struct gdbarch *gdbarch,
3959 const char * stap_register_indirection_prefix)
3960 {
3961 gdbarch->stap_register_indirection_prefix = stap_register_indirection_prefix;
3962 }
3963
3964 const char *
3965 gdbarch_stap_register_indirection_suffix (struct gdbarch *gdbarch)
3966 {
3967 gdb_assert (gdbarch != NULL);
3968 /* Skip verify of stap_register_indirection_suffix, invalid_p == 0 */
3969 if (gdbarch_debug >= 2)
3970 fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_register_indirection_suffix called\n");
3971 return gdbarch->stap_register_indirection_suffix;
3972 }
3973
3974 void
3975 set_gdbarch_stap_register_indirection_suffix (struct gdbarch *gdbarch,
3976 const char * stap_register_indirection_suffix)
3977 {
3978 gdbarch->stap_register_indirection_suffix = stap_register_indirection_suffix;
3979 }
3980
3981 const char *
3982 gdbarch_stap_gdb_register_prefix (struct gdbarch *gdbarch)
3983 {
3984 gdb_assert (gdbarch != NULL);
3985 /* Skip verify of stap_gdb_register_prefix, invalid_p == 0 */
3986 if (gdbarch_debug >= 2)
3987 fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_gdb_register_prefix called\n");
3988 return gdbarch->stap_gdb_register_prefix;
3989 }
3990
3991 void
3992 set_gdbarch_stap_gdb_register_prefix (struct gdbarch *gdbarch,
3993 const char * stap_gdb_register_prefix)
3994 {
3995 gdbarch->stap_gdb_register_prefix = stap_gdb_register_prefix;
3996 }
3997
3998 const char *
3999 gdbarch_stap_gdb_register_suffix (struct gdbarch *gdbarch)
4000 {
4001 gdb_assert (gdbarch != NULL);
4002 /* Skip verify of stap_gdb_register_suffix, invalid_p == 0 */
4003 if (gdbarch_debug >= 2)
4004 fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_gdb_register_suffix called\n");
4005 return gdbarch->stap_gdb_register_suffix;
4006 }
4007
4008 void
4009 set_gdbarch_stap_gdb_register_suffix (struct gdbarch *gdbarch,
4010 const char * stap_gdb_register_suffix)
4011 {
4012 gdbarch->stap_gdb_register_suffix = stap_gdb_register_suffix;
4013 }
4014
4015 int
4016 gdbarch_stap_is_single_operand_p (struct gdbarch *gdbarch)
4017 {
4018 gdb_assert (gdbarch != NULL);
4019 return gdbarch->stap_is_single_operand != NULL;
4020 }
4021
4022 int
4023 gdbarch_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
4024 {
4025 gdb_assert (gdbarch != NULL);
4026 gdb_assert (gdbarch->stap_is_single_operand != NULL);
4027 if (gdbarch_debug >= 2)
4028 fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_is_single_operand called\n");
4029 return gdbarch->stap_is_single_operand (gdbarch, s);
4030 }
4031
4032 void
4033 set_gdbarch_stap_is_single_operand (struct gdbarch *gdbarch,
4034 gdbarch_stap_is_single_operand_ftype stap_is_single_operand)
4035 {
4036 gdbarch->stap_is_single_operand = stap_is_single_operand;
4037 }
4038
4039 int
4040 gdbarch_stap_parse_special_token_p (struct gdbarch *gdbarch)
4041 {
4042 gdb_assert (gdbarch != NULL);
4043 return gdbarch->stap_parse_special_token != NULL;
4044 }
4045
4046 int
4047 gdbarch_stap_parse_special_token (struct gdbarch *gdbarch, struct stap_parse_info *p)
4048 {
4049 gdb_assert (gdbarch != NULL);
4050 gdb_assert (gdbarch->stap_parse_special_token != NULL);
4051 if (gdbarch_debug >= 2)
4052 fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_parse_special_token called\n");
4053 return gdbarch->stap_parse_special_token (gdbarch, p);
4054 }
4055
4056 void
4057 set_gdbarch_stap_parse_special_token (struct gdbarch *gdbarch,
4058 gdbarch_stap_parse_special_token_ftype stap_parse_special_token)
4059 {
4060 gdbarch->stap_parse_special_token = stap_parse_special_token;
4061 }
4062
4063 int
4064 gdbarch_has_global_solist (struct gdbarch *gdbarch)
4065 {
4066 gdb_assert (gdbarch != NULL);
4067 /* Skip verify of has_global_solist, invalid_p == 0 */
4068 if (gdbarch_debug >= 2)
4069 fprintf_unfiltered (gdb_stdlog, "gdbarch_has_global_solist called\n");
4070 return gdbarch->has_global_solist;
4071 }
4072
4073 void
4074 set_gdbarch_has_global_solist (struct gdbarch *gdbarch,
4075 int has_global_solist)
4076 {
4077 gdbarch->has_global_solist = has_global_solist;
4078 }
4079
4080 int
4081 gdbarch_has_global_breakpoints (struct gdbarch *gdbarch)
4082 {
4083 gdb_assert (gdbarch != NULL);
4084 /* Skip verify of has_global_breakpoints, invalid_p == 0 */
4085 if (gdbarch_debug >= 2)
4086 fprintf_unfiltered (gdb_stdlog, "gdbarch_has_global_breakpoints called\n");
4087 return gdbarch->has_global_breakpoints;
4088 }
4089
4090 void
4091 set_gdbarch_has_global_breakpoints (struct gdbarch *gdbarch,
4092 int has_global_breakpoints)
4093 {
4094 gdbarch->has_global_breakpoints = has_global_breakpoints;
4095 }
4096
4097 int
4098 gdbarch_has_shared_address_space (struct gdbarch *gdbarch)
4099 {
4100 gdb_assert (gdbarch != NULL);
4101 gdb_assert (gdbarch->has_shared_address_space != NULL);
4102 if (gdbarch_debug >= 2)
4103 fprintf_unfiltered (gdb_stdlog, "gdbarch_has_shared_address_space called\n");
4104 return gdbarch->has_shared_address_space (gdbarch);
4105 }
4106
4107 void
4108 set_gdbarch_has_shared_address_space (struct gdbarch *gdbarch,
4109 gdbarch_has_shared_address_space_ftype has_shared_address_space)
4110 {
4111 gdbarch->has_shared_address_space = has_shared_address_space;
4112 }
4113
4114 int
4115 gdbarch_fast_tracepoint_valid_at (struct gdbarch *gdbarch, CORE_ADDR addr, int *isize, char **msg)
4116 {
4117 gdb_assert (gdbarch != NULL);
4118 gdb_assert (gdbarch->fast_tracepoint_valid_at != NULL);
4119 if (gdbarch_debug >= 2)
4120 fprintf_unfiltered (gdb_stdlog, "gdbarch_fast_tracepoint_valid_at called\n");
4121 return gdbarch->fast_tracepoint_valid_at (gdbarch, addr, isize, msg);
4122 }
4123
4124 void
4125 set_gdbarch_fast_tracepoint_valid_at (struct gdbarch *gdbarch,
4126 gdbarch_fast_tracepoint_valid_at_ftype fast_tracepoint_valid_at)
4127 {
4128 gdbarch->fast_tracepoint_valid_at = fast_tracepoint_valid_at;
4129 }
4130
4131 const char *
4132 gdbarch_auto_charset (struct gdbarch *gdbarch)
4133 {
4134 gdb_assert (gdbarch != NULL);
4135 gdb_assert (gdbarch->auto_charset != NULL);
4136 if (gdbarch_debug >= 2)
4137 fprintf_unfiltered (gdb_stdlog, "gdbarch_auto_charset called\n");
4138 return gdbarch->auto_charset ();
4139 }
4140
4141 void
4142 set_gdbarch_auto_charset (struct gdbarch *gdbarch,
4143 gdbarch_auto_charset_ftype auto_charset)
4144 {
4145 gdbarch->auto_charset = auto_charset;
4146 }
4147
4148 const char *
4149 gdbarch_auto_wide_charset (struct gdbarch *gdbarch)
4150 {
4151 gdb_assert (gdbarch != NULL);
4152 gdb_assert (gdbarch->auto_wide_charset != NULL);
4153 if (gdbarch_debug >= 2)
4154 fprintf_unfiltered (gdb_stdlog, "gdbarch_auto_wide_charset called\n");
4155 return gdbarch->auto_wide_charset ();
4156 }
4157
4158 void
4159 set_gdbarch_auto_wide_charset (struct gdbarch *gdbarch,
4160 gdbarch_auto_wide_charset_ftype auto_wide_charset)
4161 {
4162 gdbarch->auto_wide_charset = auto_wide_charset;
4163 }
4164
4165 const char *
4166 gdbarch_solib_symbols_extension (struct gdbarch *gdbarch)
4167 {
4168 gdb_assert (gdbarch != NULL);
4169 if (gdbarch_debug >= 2)
4170 fprintf_unfiltered (gdb_stdlog, "gdbarch_solib_symbols_extension called\n");
4171 return gdbarch->solib_symbols_extension;
4172 }
4173
4174 void
4175 set_gdbarch_solib_symbols_extension (struct gdbarch *gdbarch,
4176 const char * solib_symbols_extension)
4177 {
4178 gdbarch->solib_symbols_extension = solib_symbols_extension;
4179 }
4180
4181 int
4182 gdbarch_has_dos_based_file_system (struct gdbarch *gdbarch)
4183 {
4184 gdb_assert (gdbarch != NULL);
4185 /* Skip verify of has_dos_based_file_system, invalid_p == 0 */
4186 if (gdbarch_debug >= 2)
4187 fprintf_unfiltered (gdb_stdlog, "gdbarch_has_dos_based_file_system called\n");
4188 return gdbarch->has_dos_based_file_system;
4189 }
4190
4191 void
4192 set_gdbarch_has_dos_based_file_system (struct gdbarch *gdbarch,
4193 int has_dos_based_file_system)
4194 {
4195 gdbarch->has_dos_based_file_system = has_dos_based_file_system;
4196 }
4197
4198 void
4199 gdbarch_gen_return_address (struct gdbarch *gdbarch, struct agent_expr *ax, struct axs_value *value, CORE_ADDR scope)
4200 {
4201 gdb_assert (gdbarch != NULL);
4202 gdb_assert (gdbarch->gen_return_address != NULL);
4203 if (gdbarch_debug >= 2)
4204 fprintf_unfiltered (gdb_stdlog, "gdbarch_gen_return_address called\n");
4205 gdbarch->gen_return_address (gdbarch, ax, value, scope);
4206 }
4207
4208 void
4209 set_gdbarch_gen_return_address (struct gdbarch *gdbarch,
4210 gdbarch_gen_return_address_ftype gen_return_address)
4211 {
4212 gdbarch->gen_return_address = gen_return_address;
4213 }
4214
4215 int
4216 gdbarch_info_proc_p (struct gdbarch *gdbarch)
4217 {
4218 gdb_assert (gdbarch != NULL);
4219 return gdbarch->info_proc != NULL;
4220 }
4221
4222 void
4223 gdbarch_info_proc (struct gdbarch *gdbarch, char *args, enum info_proc_what what)
4224 {
4225 gdb_assert (gdbarch != NULL);
4226 gdb_assert (gdbarch->info_proc != NULL);
4227 if (gdbarch_debug >= 2)
4228 fprintf_unfiltered (gdb_stdlog, "gdbarch_info_proc called\n");
4229 gdbarch->info_proc (gdbarch, args, what);
4230 }
4231
4232 void
4233 set_gdbarch_info_proc (struct gdbarch *gdbarch,
4234 gdbarch_info_proc_ftype info_proc)
4235 {
4236 gdbarch->info_proc = info_proc;
4237 }
4238
4239
4240 /* Keep a registry of per-architecture data-pointers required by GDB
4241 modules. */
4242
4243 struct gdbarch_data
4244 {
4245 unsigned index;
4246 int init_p;
4247 gdbarch_data_pre_init_ftype *pre_init;
4248 gdbarch_data_post_init_ftype *post_init;
4249 };
4250
4251 struct gdbarch_data_registration
4252 {
4253 struct gdbarch_data *data;
4254 struct gdbarch_data_registration *next;
4255 };
4256
4257 struct gdbarch_data_registry
4258 {
4259 unsigned nr;
4260 struct gdbarch_data_registration *registrations;
4261 };
4262
4263 struct gdbarch_data_registry gdbarch_data_registry =
4264 {
4265 0, NULL,
4266 };
4267
4268 static struct gdbarch_data *
4269 gdbarch_data_register (gdbarch_data_pre_init_ftype *pre_init,
4270 gdbarch_data_post_init_ftype *post_init)
4271 {
4272 struct gdbarch_data_registration **curr;
4273
4274 /* Append the new registration. */
4275 for (curr = &gdbarch_data_registry.registrations;
4276 (*curr) != NULL;
4277 curr = &(*curr)->next);
4278 (*curr) = XMALLOC (struct gdbarch_data_registration);
4279 (*curr)->next = NULL;
4280 (*curr)->data = XMALLOC (struct gdbarch_data);
4281 (*curr)->data->index = gdbarch_data_registry.nr++;
4282 (*curr)->data->pre_init = pre_init;
4283 (*curr)->data->post_init = post_init;
4284 (*curr)->data->init_p = 1;
4285 return (*curr)->data;
4286 }
4287
4288 struct gdbarch_data *
4289 gdbarch_data_register_pre_init (gdbarch_data_pre_init_ftype *pre_init)
4290 {
4291 return gdbarch_data_register (pre_init, NULL);
4292 }
4293
4294 struct gdbarch_data *
4295 gdbarch_data_register_post_init (gdbarch_data_post_init_ftype *post_init)
4296 {
4297 return gdbarch_data_register (NULL, post_init);
4298 }
4299
4300 /* Create/delete the gdbarch data vector. */
4301
4302 static void
4303 alloc_gdbarch_data (struct gdbarch *gdbarch)
4304 {
4305 gdb_assert (gdbarch->data == NULL);
4306 gdbarch->nr_data = gdbarch_data_registry.nr;
4307 gdbarch->data = GDBARCH_OBSTACK_CALLOC (gdbarch, gdbarch->nr_data, void *);
4308 }
4309
4310 /* Initialize the current value of the specified per-architecture
4311 data-pointer. */
4312
4313 void
4314 deprecated_set_gdbarch_data (struct gdbarch *gdbarch,
4315 struct gdbarch_data *data,
4316 void *pointer)
4317 {
4318 gdb_assert (data->index < gdbarch->nr_data);
4319 gdb_assert (gdbarch->data[data->index] == NULL);
4320 gdb_assert (data->pre_init == NULL);
4321 gdbarch->data[data->index] = pointer;
4322 }
4323
4324 /* Return the current value of the specified per-architecture
4325 data-pointer. */
4326
4327 void *
4328 gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *data)
4329 {
4330 gdb_assert (data->index < gdbarch->nr_data);
4331 if (gdbarch->data[data->index] == NULL)
4332 {
4333 /* The data-pointer isn't initialized, call init() to get a
4334 value. */
4335 if (data->pre_init != NULL)
4336 /* Mid architecture creation: pass just the obstack, and not
4337 the entire architecture, as that way it isn't possible for
4338 pre-init code to refer to undefined architecture
4339 fields. */
4340 gdbarch->data[data->index] = data->pre_init (gdbarch->obstack);
4341 else if (gdbarch->initialized_p
4342 && data->post_init != NULL)
4343 /* Post architecture creation: pass the entire architecture
4344 (as all fields are valid), but be careful to also detect
4345 recursive references. */
4346 {
4347 gdb_assert (data->init_p);
4348 data->init_p = 0;
4349 gdbarch->data[data->index] = data->post_init (gdbarch);
4350 data->init_p = 1;
4351 }
4352 else
4353 /* The architecture initialization hasn't completed - punt -
4354 hope that the caller knows what they are doing. Once
4355 deprecated_set_gdbarch_data has been initialized, this can be
4356 changed to an internal error. */
4357 return NULL;
4358 gdb_assert (gdbarch->data[data->index] != NULL);
4359 }
4360 return gdbarch->data[data->index];
4361 }
4362
4363
4364 /* Keep a registry of the architectures known by GDB. */
4365
4366 struct gdbarch_registration
4367 {
4368 enum bfd_architecture bfd_architecture;
4369 gdbarch_init_ftype *init;
4370 gdbarch_dump_tdep_ftype *dump_tdep;
4371 struct gdbarch_list *arches;
4372 struct gdbarch_registration *next;
4373 };
4374
4375 static struct gdbarch_registration *gdbarch_registry = NULL;
4376
4377 static void
4378 append_name (const char ***buf, int *nr, const char *name)
4379 {
4380 *buf = xrealloc (*buf, sizeof (char**) * (*nr + 1));
4381 (*buf)[*nr] = name;
4382 *nr += 1;
4383 }
4384
4385 const char **
4386 gdbarch_printable_names (void)
4387 {
4388 /* Accumulate a list of names based on the registed list of
4389 architectures. */
4390 int nr_arches = 0;
4391 const char **arches = NULL;
4392 struct gdbarch_registration *rego;
4393
4394 for (rego = gdbarch_registry;
4395 rego != NULL;
4396 rego = rego->next)
4397 {
4398 const struct bfd_arch_info *ap;
4399 ap = bfd_lookup_arch (rego->bfd_architecture, 0);
4400 if (ap == NULL)
4401 internal_error (__FILE__, __LINE__,
4402 _("gdbarch_architecture_names: multi-arch unknown"));
4403 do
4404 {
4405 append_name (&arches, &nr_arches, ap->printable_name);
4406 ap = ap->next;
4407 }
4408 while (ap != NULL);
4409 }
4410 append_name (&arches, &nr_arches, NULL);
4411 return arches;
4412 }
4413
4414
4415 void
4416 gdbarch_register (enum bfd_architecture bfd_architecture,
4417 gdbarch_init_ftype *init,
4418 gdbarch_dump_tdep_ftype *dump_tdep)
4419 {
4420 struct gdbarch_registration **curr;
4421 const struct bfd_arch_info *bfd_arch_info;
4422
4423 /* Check that BFD recognizes this architecture */
4424 bfd_arch_info = bfd_lookup_arch (bfd_architecture, 0);
4425 if (bfd_arch_info == NULL)
4426 {
4427 internal_error (__FILE__, __LINE__,
4428 _("gdbarch: Attempt to register "
4429 "unknown architecture (%d)"),
4430 bfd_architecture);
4431 }
4432 /* Check that we haven't seen this architecture before. */
4433 for (curr = &gdbarch_registry;
4434 (*curr) != NULL;
4435 curr = &(*curr)->next)
4436 {
4437 if (bfd_architecture == (*curr)->bfd_architecture)
4438 internal_error (__FILE__, __LINE__,
4439 _("gdbarch: Duplicate registration "
4440 "of architecture (%s)"),
4441 bfd_arch_info->printable_name);
4442 }
4443 /* log it */
4444 if (gdbarch_debug)
4445 fprintf_unfiltered (gdb_stdlog, "register_gdbarch_init (%s, %s)\n",
4446 bfd_arch_info->printable_name,
4447 host_address_to_string (init));
4448 /* Append it */
4449 (*curr) = XMALLOC (struct gdbarch_registration);
4450 (*curr)->bfd_architecture = bfd_architecture;
4451 (*curr)->init = init;
4452 (*curr)->dump_tdep = dump_tdep;
4453 (*curr)->arches = NULL;
4454 (*curr)->next = NULL;
4455 }
4456
4457 void
4458 register_gdbarch_init (enum bfd_architecture bfd_architecture,
4459 gdbarch_init_ftype *init)
4460 {
4461 gdbarch_register (bfd_architecture, init, NULL);
4462 }
4463
4464
4465 /* Look for an architecture using gdbarch_info. */
4466
4467 struct gdbarch_list *
4468 gdbarch_list_lookup_by_info (struct gdbarch_list *arches,
4469 const struct gdbarch_info *info)
4470 {
4471 for (; arches != NULL; arches = arches->next)
4472 {
4473 if (info->bfd_arch_info != arches->gdbarch->bfd_arch_info)
4474 continue;
4475 if (info->byte_order != arches->gdbarch->byte_order)
4476 continue;
4477 if (info->osabi != arches->gdbarch->osabi)
4478 continue;
4479 if (info->target_desc != arches->gdbarch->target_desc)
4480 continue;
4481 return arches;
4482 }
4483 return NULL;
4484 }
4485
4486
4487 /* Find an architecture that matches the specified INFO. Create a new
4488 architecture if needed. Return that new architecture. */
4489
4490 struct gdbarch *
4491 gdbarch_find_by_info (struct gdbarch_info info)
4492 {
4493 struct gdbarch *new_gdbarch;
4494 struct gdbarch_registration *rego;
4495
4496 /* Fill in missing parts of the INFO struct using a number of
4497 sources: "set ..."; INFOabfd supplied; and the global
4498 defaults. */
4499 gdbarch_info_fill (&info);
4500
4501 /* Must have found some sort of architecture. */
4502 gdb_assert (info.bfd_arch_info != NULL);
4503
4504 if (gdbarch_debug)
4505 {
4506 fprintf_unfiltered (gdb_stdlog,
4507 "gdbarch_find_by_info: info.bfd_arch_info %s\n",
4508 (info.bfd_arch_info != NULL
4509 ? info.bfd_arch_info->printable_name
4510 : "(null)"));
4511 fprintf_unfiltered (gdb_stdlog,
4512 "gdbarch_find_by_info: info.byte_order %d (%s)\n",
4513 info.byte_order,
4514 (info.byte_order == BFD_ENDIAN_BIG ? "big"
4515 : info.byte_order == BFD_ENDIAN_LITTLE ? "little"
4516 : "default"));
4517 fprintf_unfiltered (gdb_stdlog,
4518 "gdbarch_find_by_info: info.osabi %d (%s)\n",
4519 info.osabi, gdbarch_osabi_name (info.osabi));
4520 fprintf_unfiltered (gdb_stdlog,
4521 "gdbarch_find_by_info: info.abfd %s\n",
4522 host_address_to_string (info.abfd));
4523 fprintf_unfiltered (gdb_stdlog,
4524 "gdbarch_find_by_info: info.tdep_info %s\n",
4525 host_address_to_string (info.tdep_info));
4526 }
4527
4528 /* Find the tdep code that knows about this architecture. */
4529 for (rego = gdbarch_registry;
4530 rego != NULL;
4531 rego = rego->next)
4532 if (rego->bfd_architecture == info.bfd_arch_info->arch)
4533 break;
4534 if (rego == NULL)
4535 {
4536 if (gdbarch_debug)
4537 fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: "
4538 "No matching architecture\n");
4539 return 0;
4540 }
4541
4542 /* Ask the tdep code for an architecture that matches "info". */
4543 new_gdbarch = rego->init (info, rego->arches);
4544
4545 /* Did the tdep code like it? No. Reject the change and revert to
4546 the old architecture. */
4547 if (new_gdbarch == NULL)
4548 {
4549 if (gdbarch_debug)
4550 fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: "
4551 "Target rejected architecture\n");
4552 return NULL;
4553 }
4554
4555 /* Is this a pre-existing architecture (as determined by already
4556 being initialized)? Move it to the front of the architecture
4557 list (keeping the list sorted Most Recently Used). */
4558 if (new_gdbarch->initialized_p)
4559 {
4560 struct gdbarch_list **list;
4561 struct gdbarch_list *this;
4562 if (gdbarch_debug)
4563 fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: "
4564 "Previous architecture %s (%s) selected\n",
4565 host_address_to_string (new_gdbarch),
4566 new_gdbarch->bfd_arch_info->printable_name);
4567 /* Find the existing arch in the list. */
4568 for (list = &rego->arches;
4569 (*list) != NULL && (*list)->gdbarch != new_gdbarch;
4570 list = &(*list)->next);
4571 /* It had better be in the list of architectures. */
4572 gdb_assert ((*list) != NULL && (*list)->gdbarch == new_gdbarch);
4573 /* Unlink THIS. */
4574 this = (*list);
4575 (*list) = this->next;
4576 /* Insert THIS at the front. */
4577 this->next = rego->arches;
4578 rego->arches = this;
4579 /* Return it. */
4580 return new_gdbarch;
4581 }
4582
4583 /* It's a new architecture. */
4584 if (gdbarch_debug)
4585 fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: "
4586 "New architecture %s (%s) selected\n",
4587 host_address_to_string (new_gdbarch),
4588 new_gdbarch->bfd_arch_info->printable_name);
4589
4590 /* Insert the new architecture into the front of the architecture
4591 list (keep the list sorted Most Recently Used). */
4592 {
4593 struct gdbarch_list *this = XMALLOC (struct gdbarch_list);
4594 this->next = rego->arches;
4595 this->gdbarch = new_gdbarch;
4596 rego->arches = this;
4597 }
4598
4599 /* Check that the newly installed architecture is valid. Plug in
4600 any post init values. */
4601 new_gdbarch->dump_tdep = rego->dump_tdep;
4602 verify_gdbarch (new_gdbarch);
4603 new_gdbarch->initialized_p = 1;
4604
4605 if (gdbarch_debug)
4606 gdbarch_dump (new_gdbarch, gdb_stdlog);
4607
4608 return new_gdbarch;
4609 }
4610
4611 /* Make the specified architecture current. */
4612
4613 void
4614 deprecated_target_gdbarch_select_hack (struct gdbarch *new_gdbarch)
4615 {
4616 gdb_assert (new_gdbarch != NULL);
4617 gdb_assert (new_gdbarch->initialized_p);
4618 target_gdbarch = new_gdbarch;
4619 observer_notify_architecture_changed (new_gdbarch);
4620 registers_changed ();
4621 }
4622
4623 extern void _initialize_gdbarch (void);
4624
4625 void
4626 _initialize_gdbarch (void)
4627 {
4628 add_setshow_zinteger_cmd ("arch", class_maintenance, &gdbarch_debug, _("\
4629 Set architecture debugging."), _("\
4630 Show architecture debugging."), _("\
4631 When non-zero, architecture debugging is enabled."),
4632 NULL,
4633 show_gdbarch_debug,
4634 &setdebuglist, &showdebuglist);
4635 }