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