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