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