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