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