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