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