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