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