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