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