From 7a45a4f881b4b89a9189a2452663750c4963b2aa Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Wed, 1 Sep 2004 18:09:58 +0000 Subject: Allow access to all 64 bits of the SPE GPR's in multi-threaded programs. * ppc-tdep.h (struct speregset): New struct type. * ppc-linux-tdep.c: #include "gdb_assert.h". (ppc_linux_supply_speregset, ppc_linux_collect_speregset): New functions. (ppc_linux_speregset): New structure. (ppc_linux_init_abi): Describe how to pass the full 64-bit values of the SPE GPRs across the thread-db interface. * ppc-linux-nat.c (struct gdb_evrregset_t): Doc fix. * Makefile.in (ppc-linux-tdep.o): Update dependencies. Allow targets to specify an extended register set, to be passed through libthread_db via its 'xregs' functions. * gdbarch.sh (XREGS_REGSET, XREGS_SIZE, XREGS_NAME): New gdbarch members. * gdbarch.c, gdbarch.h: Regenerated. * proc-service.c: #include "regset.h" and "regcache.h". (ps_lgetxregsize, ps_lgetxregs, ps_lsetxregs): Fill in real implementations of these functions. * thread-db.c: #include "regset.h". (td_thr_getxregsize_p, td_thr_getxregs_p, td_thr_setxregs_p): New variables. (thread_db_load): Initialize them. (warned_xregs_not_implemented): New variable. (thread_db_new_objfile): Clear it here. (thread_db_fetch_registers, thread_db_store_registers): Supply and collect the xregset, too, if the architecture says it has one, and libthread_db seems to be able to support it. * Makefile.in (proc-service.o, thread-db.o): Update dependencies. --- gdb/Makefile.in | 8 +- gdb/gdbarch.c | 5172 ++++++++++++++++++++++++++++++++++++++++++++++++++++ gdb/gdbarch.h | 2248 +++++++++++++++++++++++ gdb/gdbarch.sh | 2312 +++++++++++++++++++++++ gdb/ppc-tdep.h | 12 + gdb/proc-service.c | 42 +- gdb/thread-db.c | 1501 +++++++++++++++ 7 files changed, 11289 insertions(+), 6 deletions(-) create mode 100644 gdb/gdbarch.c create mode 100644 gdb/gdbarch.h create mode 100755 gdb/gdbarch.sh create mode 100644 gdb/thread-db.c diff --git a/gdb/Makefile.in b/gdb/Makefile.in index a81fe9f790b..8ffe32fed77 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -2208,7 +2208,8 @@ ppc-linux-nat.o: ppc-linux-nat.c $(defs_h) $(gdb_string_h) $(frame_h) \ ppc-linux-tdep.o: ppc-linux-tdep.c $(defs_h) $(frame_h) $(inferior_h) \ $(symtab_h) $(target_h) $(gdbcore_h) $(gdbcmd_h) $(symfile_h) \ $(objfiles_h) $(regcache_h) $(value_h) $(osabi_h) $(regset_h) \ - $(solib_svr4_h) $(ppc_tdep_h) $(trad_frame_h) $(frame_unwind_h) + $(solib_svr4_h) $(ppc_tdep_h) $(trad_frame_h) $(frame_unwind_h) \ + $(gdb_assert_h) ppcnbsd-nat.o: ppcnbsd-nat.c $(defs_h) $(inferior_h) $(ppc_tdep_h) \ $(ppcnbsd_tdep_h) $(gdb_assert_h) ppcnbsd-tdep.o: ppcnbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) \ @@ -2236,7 +2237,7 @@ procfs.o: procfs.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \ $(gdb_string_h) $(gdb_assert_h) $(inflow_h) $(auxv_h) \ $(gdb_dirent_h) $(X_OK) $(gdb_stat_h) $(proc_utils_h) $(gregset_h) proc-service.o: proc-service.c $(defs_h) $(gdb_proc_service_h) $(inferior_h) \ - $(symtab_h) $(target_h) $(gregset_h) + $(symtab_h) $(target_h) $(regset_h) $(regcache_h) $(gregset_h) proc-why.o: proc-why.c $(defs_h) $(proc_utils_h) p-typeprint.o: p-typeprint.c $(defs_h) $(gdb_obstack_h) $(bfd_h) $(symtab_h) \ $(gdbtypes_h) $(expression_h) $(value_h) $(gdbcore_h) $(target_h) \ @@ -2507,7 +2508,8 @@ thread.o: thread.c $(defs_h) $(symtab_h) $(frame_h) $(inferior_h) \ $(gdbcmd_h) $(regcache_h) $(gdb_h) $(gdb_string_h) $(ui_out_h) thread-db.o: thread-db.c $(defs_h) $(gdb_assert_h) $(gdb_proc_service_h) \ $(gdb_thread_db_h) $(bfd_h) $(gdbthread_h) $(inferior_h) \ - $(symfile_h) $(objfiles_h) $(target_h) $(regcache_h) $(solib_svr4_h) + $(symfile_h) $(objfiles_h) $(target_h) $(regset_h) $(regcache_h) \ + $(solib_svr4_h) top.o: top.c $(defs_h) $(gdbcmd_h) $(call_cmds_h) $(cli_cmds_h) \ $(cli_script_h) $(cli_setshow_h) $(cli_decode_h) $(symtab_h) \ $(inferior_h) $(target_h) $(breakpoint_h) $(gdbtypes_h) \ diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c new file mode 100644 index 00000000000..798e3ea03fa --- /dev/null +++ b/gdb/gdbarch.c @@ -0,0 +1,5172 @@ +/* *INDENT-OFF* */ /* THIS FILE IS GENERATED */ + +/* Dynamic architecture support for GDB, the GNU debugger. + + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free + Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* This file was created with the aid of ``gdbarch.sh''. + + The Bourne shell script ``gdbarch.sh'' creates the files + ``new-gdbarch.c'' and ``new-gdbarch.h and then compares them + against the existing ``gdbarch.[hc]''. Any differences found + being reported. + + If editing this file, please also run gdbarch.sh and merge any + changes into that script. Conversely, when making sweeping changes + to this file, modifying gdbarch.sh and using its output may prove + easier. */ + + +#include "defs.h" +#include "arch-utils.h" + +#include "gdbcmd.h" +#include "inferior.h" /* enum CALL_DUMMY_LOCATION et.al. */ +#include "symcat.h" + +#include "floatformat.h" + +#include "gdb_assert.h" +#include "gdb_string.h" +#include "gdb-events.h" +#include "reggroups.h" +#include "osabi.h" +#include "gdb_obstack.h" + +/* Static function declarations */ + +static void alloc_gdbarch_data (struct gdbarch *); + +/* Non-zero if we want to trace architecture code. */ + +#ifndef GDBARCH_DEBUG +#define GDBARCH_DEBUG 0 +#endif +int gdbarch_debug = GDBARCH_DEBUG; + + +/* Maintain the struct gdbarch object */ + +struct gdbarch +{ + /* Has this architecture been fully initialized? */ + int initialized_p; + + /* An obstack bound to the lifetime of the architecture. */ + struct obstack *obstack; + + /* basic architectural information */ + const struct bfd_arch_info * bfd_arch_info; + int byte_order; + enum gdb_osabi osabi; + + /* target specific vector. */ + struct gdbarch_tdep *tdep; + gdbarch_dump_tdep_ftype *dump_tdep; + + /* per-architecture data-pointers */ + unsigned nr_data; + void **data; + + /* per-architecture swap-regions */ + struct gdbarch_swap *swap; + + /* Multi-arch values. + + When extending this structure you must: + + Add the field below. + + Declare set/get functions and define the corresponding + macro in gdbarch.h. + + gdbarch_alloc(): If zero/NULL is not a suitable default, + initialize the new field. + + verify_gdbarch(): Confirm that the target updated the field + correctly. + + gdbarch_dump(): Add a fprintf_unfiltered call so that the new + field is dumped out + + ``startup_gdbarch()'': Append an initial value to the static + variable (base values on the host's c-type system). + + get_gdbarch(): Implement the set/get functions (probably using + the macro's as shortcuts). + + */ + + int short_bit; + int int_bit; + int long_bit; + int long_long_bit; + int float_bit; + int double_bit; + int long_double_bit; + int ptr_bit; + int addr_bit; + int bfd_vma_bit; + int char_signed; + gdbarch_read_pc_ftype *read_pc; + gdbarch_write_pc_ftype *write_pc; + gdbarch_read_sp_ftype *read_sp; + gdbarch_virtual_frame_pointer_ftype *virtual_frame_pointer; + gdbarch_pseudo_register_read_ftype *pseudo_register_read; + gdbarch_pseudo_register_write_ftype *pseudo_register_write; + int num_regs; + int num_pseudo_regs; + int sp_regnum; + int pc_regnum; + int ps_regnum; + int fp0_regnum; + gdbarch_stab_reg_to_regnum_ftype *stab_reg_to_regnum; + gdbarch_ecoff_reg_to_regnum_ftype *ecoff_reg_to_regnum; + gdbarch_dwarf_reg_to_regnum_ftype *dwarf_reg_to_regnum; + gdbarch_sdb_reg_to_regnum_ftype *sdb_reg_to_regnum; + gdbarch_dwarf2_reg_to_regnum_ftype *dwarf2_reg_to_regnum; + gdbarch_register_name_ftype *register_name; + gdbarch_register_type_ftype *register_type; + gdbarch_deprecated_register_virtual_type_ftype *deprecated_register_virtual_type; + int deprecated_register_bytes; + gdbarch_deprecated_register_byte_ftype *deprecated_register_byte; + gdbarch_deprecated_register_raw_size_ftype *deprecated_register_raw_size; + gdbarch_deprecated_register_virtual_size_ftype *deprecated_register_virtual_size; + gdbarch_unwind_dummy_id_ftype *unwind_dummy_id; + gdbarch_deprecated_save_dummy_frame_tos_ftype *deprecated_save_dummy_frame_tos; + int deprecated_fp_regnum; + gdbarch_deprecated_target_read_fp_ftype *deprecated_target_read_fp; + gdbarch_push_dummy_call_ftype *push_dummy_call; + gdbarch_deprecated_push_arguments_ftype *deprecated_push_arguments; + gdbarch_deprecated_push_return_address_ftype *deprecated_push_return_address; + gdbarch_deprecated_dummy_write_sp_ftype *deprecated_dummy_write_sp; + int deprecated_register_size; + int call_dummy_location; + gdbarch_push_dummy_code_ftype *push_dummy_code; + gdbarch_deprecated_do_registers_info_ftype *deprecated_do_registers_info; + gdbarch_print_registers_info_ftype *print_registers_info; + gdbarch_print_float_info_ftype *print_float_info; + gdbarch_print_vector_info_ftype *print_vector_info; + gdbarch_register_sim_regno_ftype *register_sim_regno; + gdbarch_register_bytes_ok_ftype *register_bytes_ok; + gdbarch_cannot_fetch_register_ftype *cannot_fetch_register; + gdbarch_cannot_store_register_ftype *cannot_store_register; + gdbarch_get_longjmp_target_ftype *get_longjmp_target; + gdbarch_deprecated_init_frame_pc_ftype *deprecated_init_frame_pc; + int believe_pcc_promotion; + gdbarch_deprecated_get_saved_register_ftype *deprecated_get_saved_register; + gdbarch_convert_register_p_ftype *convert_register_p; + gdbarch_register_to_value_ftype *register_to_value; + gdbarch_value_to_register_ftype *value_to_register; + gdbarch_pointer_to_address_ftype *pointer_to_address; + gdbarch_address_to_pointer_ftype *address_to_pointer; + gdbarch_integer_to_address_ftype *integer_to_address; + gdbarch_deprecated_pop_frame_ftype *deprecated_pop_frame; + gdbarch_deprecated_store_struct_return_ftype *deprecated_store_struct_return; + gdbarch_return_value_ftype *return_value; + gdbarch_extract_return_value_ftype *extract_return_value; + gdbarch_store_return_value_ftype *store_return_value; + gdbarch_deprecated_extract_return_value_ftype *deprecated_extract_return_value; + gdbarch_deprecated_store_return_value_ftype *deprecated_store_return_value; + gdbarch_deprecated_use_struct_convention_ftype *deprecated_use_struct_convention; + gdbarch_deprecated_extract_struct_value_address_ftype *deprecated_extract_struct_value_address; + gdbarch_deprecated_frame_init_saved_regs_ftype *deprecated_frame_init_saved_regs; + gdbarch_deprecated_init_extra_frame_info_ftype *deprecated_init_extra_frame_info; + gdbarch_skip_prologue_ftype *skip_prologue; + gdbarch_inner_than_ftype *inner_than; + gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc; + gdbarch_adjust_breakpoint_address_ftype *adjust_breakpoint_address; + gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint; + gdbarch_memory_remove_breakpoint_ftype *memory_remove_breakpoint; + CORE_ADDR decr_pc_after_break; + CORE_ADDR deprecated_function_start_offset; + gdbarch_remote_translate_xfer_address_ftype *remote_translate_xfer_address; + CORE_ADDR frame_args_skip; + gdbarch_deprecated_frameless_function_invocation_ftype *deprecated_frameless_function_invocation; + gdbarch_deprecated_frame_chain_ftype *deprecated_frame_chain; + gdbarch_deprecated_frame_chain_valid_ftype *deprecated_frame_chain_valid; + gdbarch_deprecated_frame_saved_pc_ftype *deprecated_frame_saved_pc; + gdbarch_unwind_pc_ftype *unwind_pc; + gdbarch_unwind_sp_ftype *unwind_sp; + gdbarch_deprecated_frame_args_address_ftype *deprecated_frame_args_address; + gdbarch_deprecated_frame_locals_address_ftype *deprecated_frame_locals_address; + gdbarch_deprecated_saved_pc_after_call_ftype *deprecated_saved_pc_after_call; + gdbarch_frame_num_args_ftype *frame_num_args; + gdbarch_deprecated_stack_align_ftype *deprecated_stack_align; + gdbarch_frame_align_ftype *frame_align; + gdbarch_deprecated_reg_struct_has_addr_ftype *deprecated_reg_struct_has_addr; + gdbarch_stabs_argument_has_addr_ftype *stabs_argument_has_addr; + int frame_red_zone_size; + const struct floatformat * float_format; + const struct floatformat * double_format; + const struct floatformat * long_double_format; + gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr; + gdbarch_addr_bits_remove_ftype *addr_bits_remove; + gdbarch_smash_text_address_ftype *smash_text_address; + gdbarch_software_single_step_ftype *software_single_step; + gdbarch_print_insn_ftype *print_insn; + gdbarch_skip_trampoline_code_ftype *skip_trampoline_code; + gdbarch_skip_solib_resolver_ftype *skip_solib_resolver; + gdbarch_in_solib_call_trampoline_ftype *in_solib_call_trampoline; + gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline; + gdbarch_in_function_epilogue_p_ftype *in_function_epilogue_p; + gdbarch_construct_inferior_arguments_ftype *construct_inferior_arguments; + gdbarch_elf_make_msymbol_special_ftype *elf_make_msymbol_special; + gdbarch_coff_make_msymbol_special_ftype *coff_make_msymbol_special; + const char * name_of_malloc; + int cannot_step_breakpoint; + int have_nonsteppable_watchpoint; + gdbarch_address_class_type_flags_ftype *address_class_type_flags; + gdbarch_address_class_type_flags_to_name_ftype *address_class_type_flags_to_name; + gdbarch_address_class_name_to_type_flags_ftype *address_class_name_to_type_flags; + gdbarch_register_reggroup_p_ftype *register_reggroup_p; + gdbarch_fetch_pointer_argument_ftype *fetch_pointer_argument; + gdbarch_regset_from_core_section_ftype *regset_from_core_section; + const struct regset * xregs_regset; + int xregs_size; + const char * xregs_name; +}; + + +/* The default architecture uses host values (for want of a better + choice). */ + +extern const struct bfd_arch_info bfd_default_arch_struct; + +struct gdbarch startup_gdbarch = +{ + 1, /* Always initialized. */ + NULL, /* The obstack. */ + /* basic architecture information */ + &bfd_default_arch_struct, /* bfd_arch_info */ + BFD_ENDIAN_BIG, /* byte_order */ + GDB_OSABI_UNKNOWN, /* osabi */ + /* target specific vector and its dump routine */ + NULL, NULL, + /*per-architecture data-pointers and swap regions */ + 0, NULL, NULL, + /* Multi-arch values */ + 8 * sizeof (short), /* short_bit */ + 8 * sizeof (int), /* int_bit */ + 8 * sizeof (long), /* long_bit */ + 8 * sizeof (LONGEST), /* long_long_bit */ + 8 * sizeof (float), /* float_bit */ + 8 * sizeof (double), /* double_bit */ + 8 * sizeof (long double), /* long_double_bit */ + 8 * sizeof (void*), /* ptr_bit */ + 8 * sizeof (void*), /* addr_bit */ + 8 * sizeof (void*), /* bfd_vma_bit */ + 1, /* char_signed */ + 0, /* read_pc */ + 0, /* write_pc */ + 0, /* read_sp */ + 0, /* virtual_frame_pointer */ + 0, /* pseudo_register_read */ + 0, /* pseudo_register_write */ + 0, /* num_regs */ + 0, /* num_pseudo_regs */ + -1, /* sp_regnum */ + -1, /* pc_regnum */ + -1, /* ps_regnum */ + 0, /* fp0_regnum */ + 0, /* stab_reg_to_regnum */ + 0, /* ecoff_reg_to_regnum */ + 0, /* dwarf_reg_to_regnum */ + 0, /* sdb_reg_to_regnum */ + 0, /* dwarf2_reg_to_regnum */ + 0, /* register_name */ + 0, /* register_type */ + 0, /* deprecated_register_virtual_type */ + 0, /* deprecated_register_bytes */ + generic_register_byte, /* deprecated_register_byte */ + generic_register_size, /* deprecated_register_raw_size */ + generic_register_size, /* deprecated_register_virtual_size */ + 0, /* unwind_dummy_id */ + 0, /* deprecated_save_dummy_frame_tos */ + -1, /* deprecated_fp_regnum */ + 0, /* deprecated_target_read_fp */ + 0, /* push_dummy_call */ + 0, /* deprecated_push_arguments */ + 0, /* deprecated_push_return_address */ + 0, /* deprecated_dummy_write_sp */ + 0, /* deprecated_register_size */ + 0, /* call_dummy_location */ + 0, /* push_dummy_code */ + 0, /* deprecated_do_registers_info */ + default_print_registers_info, /* print_registers_info */ + 0, /* print_float_info */ + 0, /* print_vector_info */ + 0, /* register_sim_regno */ + 0, /* register_bytes_ok */ + 0, /* cannot_fetch_register */ + 0, /* cannot_store_register */ + 0, /* get_longjmp_target */ + 0, /* deprecated_init_frame_pc */ + 0, /* believe_pcc_promotion */ + 0, /* deprecated_get_saved_register */ + 0, /* convert_register_p */ + 0, /* register_to_value */ + 0, /* value_to_register */ + 0, /* pointer_to_address */ + 0, /* address_to_pointer */ + 0, /* integer_to_address */ + 0, /* deprecated_pop_frame */ + 0, /* deprecated_store_struct_return */ + 0, /* return_value */ + 0, /* extract_return_value */ + 0, /* store_return_value */ + 0, /* deprecated_extract_return_value */ + 0, /* deprecated_store_return_value */ + 0, /* deprecated_use_struct_convention */ + 0, /* deprecated_extract_struct_value_address */ + 0, /* deprecated_frame_init_saved_regs */ + 0, /* deprecated_init_extra_frame_info */ + 0, /* skip_prologue */ + 0, /* inner_than */ + 0, /* breakpoint_from_pc */ + 0, /* adjust_breakpoint_address */ + 0, /* memory_insert_breakpoint */ + 0, /* memory_remove_breakpoint */ + 0, /* decr_pc_after_break */ + 0, /* deprecated_function_start_offset */ + generic_remote_translate_xfer_address, /* remote_translate_xfer_address */ + 0, /* frame_args_skip */ + 0, /* deprecated_frameless_function_invocation */ + 0, /* deprecated_frame_chain */ + 0, /* deprecated_frame_chain_valid */ + 0, /* deprecated_frame_saved_pc */ + 0, /* unwind_pc */ + 0, /* unwind_sp */ + get_frame_base, /* deprecated_frame_args_address */ + get_frame_base, /* deprecated_frame_locals_address */ + 0, /* deprecated_saved_pc_after_call */ + 0, /* frame_num_args */ + 0, /* deprecated_stack_align */ + 0, /* frame_align */ + 0, /* deprecated_reg_struct_has_addr */ + default_stabs_argument_has_addr, /* stabs_argument_has_addr */ + 0, /* frame_red_zone_size */ + 0, /* float_format */ + 0, /* double_format */ + 0, /* long_double_format */ + convert_from_func_ptr_addr_identity, /* convert_from_func_ptr_addr */ + 0, /* addr_bits_remove */ + 0, /* smash_text_address */ + 0, /* software_single_step */ + 0, /* print_insn */ + 0, /* skip_trampoline_code */ + generic_skip_solib_resolver, /* skip_solib_resolver */ + 0, /* in_solib_call_trampoline */ + 0, /* in_solib_return_trampoline */ + generic_in_function_epilogue_p, /* in_function_epilogue_p */ + construct_inferior_arguments, /* construct_inferior_arguments */ + 0, /* elf_make_msymbol_special */ + 0, /* coff_make_msymbol_special */ + "malloc", /* name_of_malloc */ + 0, /* cannot_step_breakpoint */ + 0, /* have_nonsteppable_watchpoint */ + 0, /* address_class_type_flags */ + 0, /* address_class_type_flags_to_name */ + 0, /* address_class_name_to_type_flags */ + default_register_reggroup_p, /* register_reggroup_p */ + 0, /* fetch_pointer_argument */ + 0, /* regset_from_core_section */ + 0, /* xregs_regset */ + 0, /* xregs_size */ + 0, /* xregs_name */ + /* startup_gdbarch() */ +}; + +struct gdbarch *current_gdbarch = &startup_gdbarch; + +/* Create a new ``struct gdbarch'' based on information provided by + ``struct gdbarch_info''. */ + +struct gdbarch * +gdbarch_alloc (const struct gdbarch_info *info, + struct gdbarch_tdep *tdep) +{ + /* NOTE: The new architecture variable is named ``current_gdbarch'' + so that macros such as TARGET_DOUBLE_BIT, when expanded, refer to + the current local architecture and not the previous global + architecture. This ensures that the new architectures initial + values are not influenced by the previous architecture. Once + everything is parameterised with gdbarch, this will go away. */ + struct gdbarch *current_gdbarch; + + /* Create an obstack for allocating all the per-architecture memory, + then use that to allocate the architecture vector. */ + struct obstack *obstack = XMALLOC (struct obstack); + obstack_init (obstack); + current_gdbarch = obstack_alloc (obstack, sizeof (*current_gdbarch)); + memset (current_gdbarch, 0, sizeof (*current_gdbarch)); + current_gdbarch->obstack = obstack; + + alloc_gdbarch_data (current_gdbarch); + + current_gdbarch->tdep = tdep; + + current_gdbarch->bfd_arch_info = info->bfd_arch_info; + current_gdbarch->byte_order = info->byte_order; + current_gdbarch->osabi = info->osabi; + + /* Force the explicit initialization of these. */ + current_gdbarch->short_bit = 2*TARGET_CHAR_BIT; + current_gdbarch->int_bit = 4*TARGET_CHAR_BIT; + current_gdbarch->long_bit = 4*TARGET_CHAR_BIT; + current_gdbarch->long_long_bit = 2*TARGET_LONG_BIT; + current_gdbarch->float_bit = 4*TARGET_CHAR_BIT; + current_gdbarch->double_bit = 8*TARGET_CHAR_BIT; + current_gdbarch->long_double_bit = 8*TARGET_CHAR_BIT; + current_gdbarch->ptr_bit = TARGET_INT_BIT; + current_gdbarch->bfd_vma_bit = TARGET_ARCHITECTURE->bits_per_address; + current_gdbarch->char_signed = -1; + current_gdbarch->write_pc = generic_target_write_pc; + current_gdbarch->virtual_frame_pointer = legacy_virtual_frame_pointer; + current_gdbarch->num_regs = -1; + current_gdbarch->sp_regnum = -1; + current_gdbarch->pc_regnum = -1; + current_gdbarch->ps_regnum = -1; + current_gdbarch->fp0_regnum = -1; + current_gdbarch->stab_reg_to_regnum = no_op_reg_to_regnum; + current_gdbarch->ecoff_reg_to_regnum = no_op_reg_to_regnum; + current_gdbarch->dwarf_reg_to_regnum = no_op_reg_to_regnum; + current_gdbarch->sdb_reg_to_regnum = no_op_reg_to_regnum; + current_gdbarch->dwarf2_reg_to_regnum = no_op_reg_to_regnum; + current_gdbarch->deprecated_register_byte = generic_register_byte; + current_gdbarch->deprecated_register_raw_size = generic_register_size; + current_gdbarch->deprecated_register_virtual_size = generic_register_size; + current_gdbarch->deprecated_fp_regnum = -1; + current_gdbarch->call_dummy_location = AT_ENTRY_POINT; + current_gdbarch->print_registers_info = default_print_registers_info; + current_gdbarch->register_sim_regno = legacy_register_sim_regno; + current_gdbarch->cannot_fetch_register = cannot_register_not; + current_gdbarch->cannot_store_register = cannot_register_not; + current_gdbarch->convert_register_p = generic_convert_register_p; + current_gdbarch->pointer_to_address = unsigned_pointer_to_address; + current_gdbarch->address_to_pointer = unsigned_address_to_pointer; + current_gdbarch->return_value = legacy_return_value; + current_gdbarch->extract_return_value = legacy_extract_return_value; + current_gdbarch->store_return_value = legacy_store_return_value; + current_gdbarch->deprecated_use_struct_convention = generic_use_struct_convention; + current_gdbarch->memory_insert_breakpoint = default_memory_insert_breakpoint; + current_gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint; + current_gdbarch->remote_translate_xfer_address = generic_remote_translate_xfer_address; + current_gdbarch->deprecated_frame_args_address = get_frame_base; + current_gdbarch->deprecated_frame_locals_address = get_frame_base; + current_gdbarch->stabs_argument_has_addr = default_stabs_argument_has_addr; + current_gdbarch->convert_from_func_ptr_addr = convert_from_func_ptr_addr_identity; + current_gdbarch->addr_bits_remove = core_addr_identity; + current_gdbarch->smash_text_address = core_addr_identity; + current_gdbarch->skip_trampoline_code = generic_skip_trampoline_code; + current_gdbarch->skip_solib_resolver = generic_skip_solib_resolver; + current_gdbarch->in_solib_call_trampoline = generic_in_solib_call_trampoline; + current_gdbarch->in_solib_return_trampoline = generic_in_solib_return_trampoline; + current_gdbarch->in_function_epilogue_p = generic_in_function_epilogue_p; + current_gdbarch->construct_inferior_arguments = construct_inferior_arguments; + current_gdbarch->elf_make_msymbol_special = default_elf_make_msymbol_special; + current_gdbarch->coff_make_msymbol_special = default_coff_make_msymbol_special; + current_gdbarch->name_of_malloc = "malloc"; + current_gdbarch->register_reggroup_p = default_register_reggroup_p; + /* gdbarch_alloc() */ + + return current_gdbarch; +} + + +/* Allocate extra space using the per-architecture obstack. */ + +void * +gdbarch_obstack_zalloc (struct gdbarch *arch, long size) +{ + void *data = obstack_alloc (arch->obstack, size); + memset (data, 0, size); + return data; +} + + +/* Free a gdbarch struct. This should never happen in normal + operation --- once you've created a gdbarch, you keep it around. + However, if an architecture's init function encounters an error + building the structure, it may need to clean up a partially + constructed gdbarch. */ + +void +gdbarch_free (struct gdbarch *arch) +{ + struct obstack *obstack; + gdb_assert (arch != NULL); + gdb_assert (!arch->initialized_p); + obstack = arch->obstack; + obstack_free (obstack, 0); /* Includes the ARCH. */ + xfree (obstack); +} + + +/* Ensure that all values in a GDBARCH are reasonable. */ + +/* NOTE/WARNING: The parameter is called ``current_gdbarch'' so that it + just happens to match the global variable ``current_gdbarch''. That + way macros refering to that variable get the local and not the global + version - ulgh. Once everything is parameterised with gdbarch, this + will go away. */ + +static void +verify_gdbarch (struct gdbarch *current_gdbarch) +{ + struct ui_file *log; + struct cleanup *cleanups; + long dummy; + char *buf; + log = mem_fileopen (); + cleanups = make_cleanup_ui_file_delete (log); + /* fundamental */ + if (current_gdbarch->byte_order == BFD_ENDIAN_UNKNOWN) + fprintf_unfiltered (log, "\n\tbyte-order"); + if (current_gdbarch->bfd_arch_info == NULL) + fprintf_unfiltered (log, "\n\tbfd_arch_info"); + /* Check those that need to be defined for the given multi-arch level. */ + /* Skip verify of short_bit, invalid_p == 0 */ + /* Skip verify of int_bit, invalid_p == 0 */ + /* Skip verify of long_bit, invalid_p == 0 */ + /* Skip verify of long_long_bit, invalid_p == 0 */ + /* Skip verify of float_bit, invalid_p == 0 */ + /* Skip verify of double_bit, invalid_p == 0 */ + /* Skip verify of long_double_bit, invalid_p == 0 */ + /* Skip verify of ptr_bit, invalid_p == 0 */ + if (current_gdbarch->addr_bit == 0) + current_gdbarch->addr_bit = TARGET_PTR_BIT; + /* Skip verify of bfd_vma_bit, invalid_p == 0 */ + if (current_gdbarch->char_signed == -1) + current_gdbarch->char_signed = 1; + /* Skip verify of read_pc, has predicate */ + /* Skip verify of write_pc, invalid_p == 0 */ + /* Skip verify of read_sp, has predicate */ + /* Skip verify of virtual_frame_pointer, invalid_p == 0 */ + /* Skip verify of pseudo_register_read, has predicate */ + /* Skip verify of pseudo_register_write, has predicate */ + if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) + && (current_gdbarch->num_regs == -1)) + fprintf_unfiltered (log, "\n\tnum_regs"); + /* Skip verify of num_pseudo_regs, invalid_p == 0 */ + /* Skip verify of sp_regnum, invalid_p == 0 */ + /* Skip verify of pc_regnum, invalid_p == 0 */ + /* Skip verify of ps_regnum, invalid_p == 0 */ + /* Skip verify of fp0_regnum, invalid_p == 0 */ + /* Skip verify of stab_reg_to_regnum, invalid_p == 0 */ + /* Skip verify of ecoff_reg_to_regnum, invalid_p == 0 */ + /* Skip verify of dwarf_reg_to_regnum, invalid_p == 0 */ + /* Skip verify of sdb_reg_to_regnum, invalid_p == 0 */ + /* Skip verify of dwarf2_reg_to_regnum, invalid_p == 0 */ + /* Skip verify of register_type, has predicate */ + /* Skip verify of deprecated_register_virtual_type, has predicate */ + /* Skip verify of deprecated_register_byte, has predicate */ + /* Skip verify of deprecated_register_raw_size, has predicate */ + /* Skip verify of deprecated_register_virtual_size, has predicate */ + /* Skip verify of unwind_dummy_id, has predicate */ + /* Skip verify of deprecated_save_dummy_frame_tos, has predicate */ + /* Skip verify of deprecated_fp_regnum, invalid_p == 0 */ + /* Skip verify of deprecated_target_read_fp, has predicate */ + /* Skip verify of push_dummy_call, has predicate */ + /* Skip verify of deprecated_push_arguments, has predicate */ + /* Skip verify of deprecated_push_return_address, has predicate */ + /* Skip verify of deprecated_dummy_write_sp, has predicate */ + /* Skip verify of call_dummy_location, invalid_p == 0 */ + /* Skip verify of push_dummy_code, has predicate */ + /* Skip verify of deprecated_do_registers_info, has predicate */ + /* Skip verify of print_registers_info, invalid_p == 0 */ + /* Skip verify of print_float_info, has predicate */ + /* Skip verify of print_vector_info, has predicate */ + /* Skip verify of register_sim_regno, invalid_p == 0 */ + /* Skip verify of register_bytes_ok, has predicate */ + /* Skip verify of cannot_fetch_register, invalid_p == 0 */ + /* Skip verify of cannot_store_register, invalid_p == 0 */ + /* Skip verify of get_longjmp_target, has predicate */ + /* Skip verify of deprecated_init_frame_pc, has predicate */ + /* Skip verify of deprecated_get_saved_register, has predicate */ + /* Skip verify of convert_register_p, invalid_p == 0 */ + /* Skip verify of pointer_to_address, invalid_p == 0 */ + /* Skip verify of address_to_pointer, invalid_p == 0 */ + /* Skip verify of integer_to_address, has predicate */ + /* Skip verify of deprecated_pop_frame, has predicate */ + /* Skip verify of deprecated_store_struct_return, has predicate */ + /* Skip verify of return_value, has predicate */ + /* Skip verify of extract_return_value, invalid_p == 0 */ + /* Skip verify of store_return_value, invalid_p == 0 */ + /* Skip verify of deprecated_use_struct_convention, invalid_p == 0 */ + /* Skip verify of deprecated_extract_struct_value_address, has predicate */ + /* Skip verify of deprecated_frame_init_saved_regs, has predicate */ + /* Skip verify of deprecated_init_extra_frame_info, has predicate */ + if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) + && (current_gdbarch->skip_prologue == 0)) + fprintf_unfiltered (log, "\n\tskip_prologue"); + if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) + && (current_gdbarch->inner_than == 0)) + fprintf_unfiltered (log, "\n\tinner_than"); + if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) + && (current_gdbarch->breakpoint_from_pc == 0)) + fprintf_unfiltered (log, "\n\tbreakpoint_from_pc"); + /* Skip verify of adjust_breakpoint_address, has predicate */ + /* Skip verify of memory_insert_breakpoint, invalid_p == 0 */ + /* Skip verify of memory_remove_breakpoint, invalid_p == 0 */ + /* Skip verify of decr_pc_after_break, invalid_p == 0 */ + /* Skip verify of deprecated_function_start_offset, invalid_p == 0 */ + /* Skip verify of remote_translate_xfer_address, invalid_p == 0 */ + /* Skip verify of frame_args_skip, invalid_p == 0 */ + /* Skip verify of deprecated_frameless_function_invocation, has predicate */ + /* Skip verify of deprecated_frame_chain, has predicate */ + /* Skip verify of deprecated_frame_chain_valid, has predicate */ + /* Skip verify of deprecated_frame_saved_pc, has predicate */ + /* Skip verify of unwind_pc, has predicate */ + /* Skip verify of unwind_sp, has predicate */ + /* Skip verify of deprecated_frame_args_address, has predicate */ + /* Skip verify of deprecated_frame_locals_address, has predicate */ + /* Skip verify of deprecated_saved_pc_after_call, has predicate */ + /* Skip verify of frame_num_args, has predicate */ + /* Skip verify of deprecated_stack_align, has predicate */ + /* Skip verify of frame_align, has predicate */ + /* Skip verify of deprecated_reg_struct_has_addr, has predicate */ + /* Skip verify of stabs_argument_has_addr, invalid_p == 0 */ + if (current_gdbarch->float_format == 0) + current_gdbarch->float_format = default_float_format (current_gdbarch); + if (current_gdbarch->double_format == 0) + current_gdbarch->double_format = default_double_format (current_gdbarch); + if (current_gdbarch->long_double_format == 0) + current_gdbarch->long_double_format = default_double_format (current_gdbarch); + /* Skip verify of convert_from_func_ptr_addr, invalid_p == 0 */ + /* Skip verify of addr_bits_remove, invalid_p == 0 */ + /* Skip verify of smash_text_address, invalid_p == 0 */ + /* Skip verify of software_single_step, has predicate */ + if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) + && (current_gdbarch->print_insn == 0)) + fprintf_unfiltered (log, "\n\tprint_insn"); + /* Skip verify of skip_trampoline_code, invalid_p == 0 */ + /* Skip verify of skip_solib_resolver, invalid_p == 0 */ + /* Skip verify of in_solib_call_trampoline, invalid_p == 0 */ + /* Skip verify of in_solib_return_trampoline, invalid_p == 0 */ + /* Skip verify of in_function_epilogue_p, invalid_p == 0 */ + /* Skip verify of construct_inferior_arguments, invalid_p == 0 */ + /* Skip verify of elf_make_msymbol_special, invalid_p == 0 */ + /* Skip verify of coff_make_msymbol_special, invalid_p == 0 */ + /* Skip verify of name_of_malloc, invalid_p == 0 */ + /* Skip verify of cannot_step_breakpoint, invalid_p == 0 */ + /* Skip verify of have_nonsteppable_watchpoint, invalid_p == 0 */ + /* Skip verify of address_class_type_flags, has predicate */ + /* Skip verify of address_class_type_flags_to_name, has predicate */ + /* Skip verify of address_class_name_to_type_flags, has predicate */ + /* Skip verify of register_reggroup_p, invalid_p == 0 */ + /* Skip verify of fetch_pointer_argument, has predicate */ + /* Skip verify of regset_from_core_section, has predicate */ + buf = ui_file_xstrdup (log, &dummy); + make_cleanup (xfree, buf); + if (strlen (buf) > 0) + internal_error (__FILE__, __LINE__, + "verify_gdbarch: the following are invalid ...%s", + buf); + do_cleanups (cleanups); +} + + +/* Print out the details of the current architecture. */ + +/* NOTE/WARNING: The parameter is called ``current_gdbarch'' so that it + just happens to match the global variable ``current_gdbarch''. That + way macros refering to that variable get the local and not the global + version - ulgh. Once everything is parameterised with gdbarch, this + will go away. */ + +void +gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) +{ + fprintf_unfiltered (file, + "gdbarch_dump: GDB_MULTI_ARCH = %d\n", + GDB_MULTI_ARCH); +#ifdef TARGET_ADDR_BIT + fprintf_unfiltered (file, + "gdbarch_dump: TARGET_ADDR_BIT # %s\n", + XSTRING (TARGET_ADDR_BIT)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: addr_bit = %s\n", + paddr_d (current_gdbarch->addr_bit)); +#ifdef ADDR_BITS_REMOVE + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "ADDR_BITS_REMOVE(addr)", + XSTRING (ADDR_BITS_REMOVE (addr))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: addr_bits_remove = <0x%lx>\n", + (long) current_gdbarch->addr_bits_remove); + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_address_class_name_to_type_flags_p() = %d\n", + gdbarch_address_class_name_to_type_flags_p (current_gdbarch)); + fprintf_unfiltered (file, + "gdbarch_dump: address_class_name_to_type_flags = <0x%lx>\n", + (long) current_gdbarch->address_class_name_to_type_flags); +#ifdef ADDRESS_CLASS_TYPE_FLAGS_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "ADDRESS_CLASS_TYPE_FLAGS_P()", + XSTRING (ADDRESS_CLASS_TYPE_FLAGS_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_address_class_type_flags_p() = %d\n", + gdbarch_address_class_type_flags_p (current_gdbarch)); +#ifdef ADDRESS_CLASS_TYPE_FLAGS + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "ADDRESS_CLASS_TYPE_FLAGS(byte_size, dwarf2_addr_class)", + XSTRING (ADDRESS_CLASS_TYPE_FLAGS (byte_size, dwarf2_addr_class))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: address_class_type_flags = <0x%lx>\n", + (long) current_gdbarch->address_class_type_flags); + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_address_class_type_flags_to_name_p() = %d\n", + gdbarch_address_class_type_flags_to_name_p (current_gdbarch)); + fprintf_unfiltered (file, + "gdbarch_dump: address_class_type_flags_to_name = <0x%lx>\n", + (long) current_gdbarch->address_class_type_flags_to_name); +#ifdef ADDRESS_TO_POINTER + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "ADDRESS_TO_POINTER(type, buf, addr)", + XSTRING (ADDRESS_TO_POINTER (type, buf, addr))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: address_to_pointer = <0x%lx>\n", + (long) current_gdbarch->address_to_pointer); + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_adjust_breakpoint_address_p() = %d\n", + gdbarch_adjust_breakpoint_address_p (current_gdbarch)); + fprintf_unfiltered (file, + "gdbarch_dump: adjust_breakpoint_address = <0x%lx>\n", + (long) current_gdbarch->adjust_breakpoint_address); +#ifdef BELIEVE_PCC_PROMOTION + fprintf_unfiltered (file, + "gdbarch_dump: BELIEVE_PCC_PROMOTION # %s\n", + XSTRING (BELIEVE_PCC_PROMOTION)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: believe_pcc_promotion = %s\n", + paddr_d (current_gdbarch->believe_pcc_promotion)); +#ifdef TARGET_ARCHITECTURE + fprintf_unfiltered (file, + "gdbarch_dump: TARGET_ARCHITECTURE # %s\n", + XSTRING (TARGET_ARCHITECTURE)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: bfd_arch_info = %s\n", + TARGET_ARCHITECTURE->printable_name); +#ifdef TARGET_BFD_VMA_BIT + fprintf_unfiltered (file, + "gdbarch_dump: TARGET_BFD_VMA_BIT # %s\n", + XSTRING (TARGET_BFD_VMA_BIT)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: bfd_vma_bit = %s\n", + paddr_d (current_gdbarch->bfd_vma_bit)); +#ifdef BREAKPOINT_FROM_PC + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "BREAKPOINT_FROM_PC(pcptr, lenptr)", + XSTRING (BREAKPOINT_FROM_PC (pcptr, lenptr))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: breakpoint_from_pc = <0x%lx>\n", + (long) current_gdbarch->breakpoint_from_pc); +#ifdef TARGET_BYTE_ORDER + fprintf_unfiltered (file, + "gdbarch_dump: TARGET_BYTE_ORDER # %s\n", + XSTRING (TARGET_BYTE_ORDER)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: byte_order = %s\n", + paddr_d (current_gdbarch->byte_order)); +#ifdef CALL_DUMMY_LOCATION + fprintf_unfiltered (file, + "gdbarch_dump: CALL_DUMMY_LOCATION # %s\n", + XSTRING (CALL_DUMMY_LOCATION)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: call_dummy_location = %s\n", + paddr_d (current_gdbarch->call_dummy_location)); +#ifdef CANNOT_FETCH_REGISTER + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "CANNOT_FETCH_REGISTER(regnum)", + XSTRING (CANNOT_FETCH_REGISTER (regnum))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: cannot_fetch_register = <0x%lx>\n", + (long) current_gdbarch->cannot_fetch_register); +#ifdef CANNOT_STEP_BREAKPOINT + fprintf_unfiltered (file, + "gdbarch_dump: CANNOT_STEP_BREAKPOINT # %s\n", + XSTRING (CANNOT_STEP_BREAKPOINT)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: cannot_step_breakpoint = %s\n", + paddr_d (current_gdbarch->cannot_step_breakpoint)); +#ifdef CANNOT_STORE_REGISTER + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "CANNOT_STORE_REGISTER(regnum)", + XSTRING (CANNOT_STORE_REGISTER (regnum))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: cannot_store_register = <0x%lx>\n", + (long) current_gdbarch->cannot_store_register); +#ifdef TARGET_CHAR_SIGNED + fprintf_unfiltered (file, + "gdbarch_dump: TARGET_CHAR_SIGNED # %s\n", + XSTRING (TARGET_CHAR_SIGNED)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: char_signed = %s\n", + paddr_d (current_gdbarch->char_signed)); +#ifdef COFF_MAKE_MSYMBOL_SPECIAL + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "COFF_MAKE_MSYMBOL_SPECIAL(val, msym)", + XSTRING (COFF_MAKE_MSYMBOL_SPECIAL (val, msym))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: coff_make_msymbol_special = <0x%lx>\n", + (long) current_gdbarch->coff_make_msymbol_special); + fprintf_unfiltered (file, + "gdbarch_dump: construct_inferior_arguments = <0x%lx>\n", + (long) current_gdbarch->construct_inferior_arguments); + fprintf_unfiltered (file, + "gdbarch_dump: convert_from_func_ptr_addr = <0x%lx>\n", + (long) current_gdbarch->convert_from_func_ptr_addr); +#ifdef CONVERT_REGISTER_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "CONVERT_REGISTER_P(regnum, type)", + XSTRING (CONVERT_REGISTER_P (regnum, type))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: convert_register_p = <0x%lx>\n", + (long) current_gdbarch->convert_register_p); +#ifdef DECR_PC_AFTER_BREAK + fprintf_unfiltered (file, + "gdbarch_dump: DECR_PC_AFTER_BREAK # %s\n", + XSTRING (DECR_PC_AFTER_BREAK)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: decr_pc_after_break = 0x%s\n", + paddr_nz (current_gdbarch->decr_pc_after_break)); +#ifdef DEPRECATED_DO_REGISTERS_INFO_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_DO_REGISTERS_INFO_P()", + XSTRING (DEPRECATED_DO_REGISTERS_INFO_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_deprecated_do_registers_info_p() = %d\n", + gdbarch_deprecated_do_registers_info_p (current_gdbarch)); +#ifdef DEPRECATED_DO_REGISTERS_INFO + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_DO_REGISTERS_INFO(reg_nr, fpregs)", + XSTRING (DEPRECATED_DO_REGISTERS_INFO (reg_nr, fpregs))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_do_registers_info = <0x%lx>\n", + (long) current_gdbarch->deprecated_do_registers_info); +#ifdef DEPRECATED_DUMMY_WRITE_SP_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_DUMMY_WRITE_SP_P()", + XSTRING (DEPRECATED_DUMMY_WRITE_SP_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_deprecated_dummy_write_sp_p() = %d\n", + gdbarch_deprecated_dummy_write_sp_p (current_gdbarch)); +#ifdef DEPRECATED_DUMMY_WRITE_SP + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_DUMMY_WRITE_SP(val)", + XSTRING (DEPRECATED_DUMMY_WRITE_SP (val))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_dummy_write_sp = <0x%lx>\n", + (long) current_gdbarch->deprecated_dummy_write_sp); +#ifdef DEPRECATED_EXTRACT_RETURN_VALUE + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_EXTRACT_RETURN_VALUE(type, regbuf, valbuf)", + XSTRING (DEPRECATED_EXTRACT_RETURN_VALUE (type, regbuf, valbuf))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_extract_return_value = <0x%lx>\n", + (long) current_gdbarch->deprecated_extract_return_value); +#ifdef DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P()", + XSTRING (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_deprecated_extract_struct_value_address_p() = %d\n", + gdbarch_deprecated_extract_struct_value_address_p (current_gdbarch)); +#ifdef DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(regcache)", + XSTRING (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS (regcache))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_extract_struct_value_address = <0x%lx>\n", + (long) current_gdbarch->deprecated_extract_struct_value_address); +#ifdef DEPRECATED_FP_REGNUM + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_FP_REGNUM # %s\n", + XSTRING (DEPRECATED_FP_REGNUM)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_fp_regnum = %s\n", + paddr_d (current_gdbarch->deprecated_fp_regnum)); +#ifdef DEPRECATED_FRAME_ARGS_ADDRESS_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_FRAME_ARGS_ADDRESS_P()", + XSTRING (DEPRECATED_FRAME_ARGS_ADDRESS_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_deprecated_frame_args_address_p() = %d\n", + gdbarch_deprecated_frame_args_address_p (current_gdbarch)); +#ifdef DEPRECATED_FRAME_ARGS_ADDRESS + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_FRAME_ARGS_ADDRESS(fi)", + XSTRING (DEPRECATED_FRAME_ARGS_ADDRESS (fi))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_frame_args_address = <0x%lx>\n", + (long) current_gdbarch->deprecated_frame_args_address); +#ifdef DEPRECATED_FRAME_CHAIN_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_FRAME_CHAIN_P()", + XSTRING (DEPRECATED_FRAME_CHAIN_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_deprecated_frame_chain_p() = %d\n", + gdbarch_deprecated_frame_chain_p (current_gdbarch)); +#ifdef DEPRECATED_FRAME_CHAIN + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_FRAME_CHAIN(frame)", + XSTRING (DEPRECATED_FRAME_CHAIN (frame))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_frame_chain = <0x%lx>\n", + (long) current_gdbarch->deprecated_frame_chain); +#ifdef DEPRECATED_FRAME_CHAIN_VALID_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_FRAME_CHAIN_VALID_P()", + XSTRING (DEPRECATED_FRAME_CHAIN_VALID_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_deprecated_frame_chain_valid_p() = %d\n", + gdbarch_deprecated_frame_chain_valid_p (current_gdbarch)); +#ifdef DEPRECATED_FRAME_CHAIN_VALID + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_FRAME_CHAIN_VALID(chain, thisframe)", + XSTRING (DEPRECATED_FRAME_CHAIN_VALID (chain, thisframe))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_frame_chain_valid = <0x%lx>\n", + (long) current_gdbarch->deprecated_frame_chain_valid); +#ifdef DEPRECATED_FRAME_INIT_SAVED_REGS_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_FRAME_INIT_SAVED_REGS_P()", + XSTRING (DEPRECATED_FRAME_INIT_SAVED_REGS_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_deprecated_frame_init_saved_regs_p() = %d\n", + gdbarch_deprecated_frame_init_saved_regs_p (current_gdbarch)); +#ifdef DEPRECATED_FRAME_INIT_SAVED_REGS + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_FRAME_INIT_SAVED_REGS(frame)", + XSTRING (DEPRECATED_FRAME_INIT_SAVED_REGS (frame))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_frame_init_saved_regs = <0x%lx>\n", + (long) current_gdbarch->deprecated_frame_init_saved_regs); +#ifdef DEPRECATED_FRAME_LOCALS_ADDRESS_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_FRAME_LOCALS_ADDRESS_P()", + XSTRING (DEPRECATED_FRAME_LOCALS_ADDRESS_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_deprecated_frame_locals_address_p() = %d\n", + gdbarch_deprecated_frame_locals_address_p (current_gdbarch)); +#ifdef DEPRECATED_FRAME_LOCALS_ADDRESS + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_FRAME_LOCALS_ADDRESS(fi)", + XSTRING (DEPRECATED_FRAME_LOCALS_ADDRESS (fi))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_frame_locals_address = <0x%lx>\n", + (long) current_gdbarch->deprecated_frame_locals_address); +#ifdef DEPRECATED_FRAME_SAVED_PC_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_FRAME_SAVED_PC_P()", + XSTRING (DEPRECATED_FRAME_SAVED_PC_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_deprecated_frame_saved_pc_p() = %d\n", + gdbarch_deprecated_frame_saved_pc_p (current_gdbarch)); +#ifdef DEPRECATED_FRAME_SAVED_PC + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_FRAME_SAVED_PC(fi)", + XSTRING (DEPRECATED_FRAME_SAVED_PC (fi))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_frame_saved_pc = <0x%lx>\n", + (long) current_gdbarch->deprecated_frame_saved_pc); +#ifdef DEPRECATED_FRAMELESS_FUNCTION_INVOCATION_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_FRAMELESS_FUNCTION_INVOCATION_P()", + XSTRING (DEPRECATED_FRAMELESS_FUNCTION_INVOCATION_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_deprecated_frameless_function_invocation_p() = %d\n", + gdbarch_deprecated_frameless_function_invocation_p (current_gdbarch)); +#ifdef DEPRECATED_FRAMELESS_FUNCTION_INVOCATION + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_FRAMELESS_FUNCTION_INVOCATION(fi)", + XSTRING (DEPRECATED_FRAMELESS_FUNCTION_INVOCATION (fi))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_frameless_function_invocation = <0x%lx>\n", + (long) current_gdbarch->deprecated_frameless_function_invocation); +#ifdef DEPRECATED_FUNCTION_START_OFFSET + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_FUNCTION_START_OFFSET # %s\n", + XSTRING (DEPRECATED_FUNCTION_START_OFFSET)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_function_start_offset = 0x%s\n", + paddr_nz (current_gdbarch->deprecated_function_start_offset)); +#ifdef DEPRECATED_GET_SAVED_REGISTER_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_GET_SAVED_REGISTER_P()", + XSTRING (DEPRECATED_GET_SAVED_REGISTER_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_deprecated_get_saved_register_p() = %d\n", + gdbarch_deprecated_get_saved_register_p (current_gdbarch)); +#ifdef DEPRECATED_GET_SAVED_REGISTER + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval)", + XSTRING (DEPRECATED_GET_SAVED_REGISTER (raw_buffer, optimized, addrp, frame, regnum, lval))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_get_saved_register = <0x%lx>\n", + (long) current_gdbarch->deprecated_get_saved_register); +#ifdef DEPRECATED_INIT_EXTRA_FRAME_INFO_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_INIT_EXTRA_FRAME_INFO_P()", + XSTRING (DEPRECATED_INIT_EXTRA_FRAME_INFO_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_deprecated_init_extra_frame_info_p() = %d\n", + gdbarch_deprecated_init_extra_frame_info_p (current_gdbarch)); +#ifdef DEPRECATED_INIT_EXTRA_FRAME_INFO + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_INIT_EXTRA_FRAME_INFO(fromleaf, frame)", + XSTRING (DEPRECATED_INIT_EXTRA_FRAME_INFO (fromleaf, frame))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_init_extra_frame_info = <0x%lx>\n", + (long) current_gdbarch->deprecated_init_extra_frame_info); +#ifdef DEPRECATED_INIT_FRAME_PC_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_INIT_FRAME_PC_P()", + XSTRING (DEPRECATED_INIT_FRAME_PC_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_deprecated_init_frame_pc_p() = %d\n", + gdbarch_deprecated_init_frame_pc_p (current_gdbarch)); +#ifdef DEPRECATED_INIT_FRAME_PC + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_INIT_FRAME_PC(fromleaf, prev)", + XSTRING (DEPRECATED_INIT_FRAME_PC (fromleaf, prev))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_init_frame_pc = <0x%lx>\n", + (long) current_gdbarch->deprecated_init_frame_pc); +#ifdef DEPRECATED_POP_FRAME_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_POP_FRAME_P()", + XSTRING (DEPRECATED_POP_FRAME_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_deprecated_pop_frame_p() = %d\n", + gdbarch_deprecated_pop_frame_p (current_gdbarch)); +#ifdef DEPRECATED_POP_FRAME + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_POP_FRAME(-)", + XSTRING (DEPRECATED_POP_FRAME (-))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_pop_frame = <0x%lx>\n", + (long) current_gdbarch->deprecated_pop_frame); +#ifdef DEPRECATED_PUSH_ARGUMENTS_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_PUSH_ARGUMENTS_P()", + XSTRING (DEPRECATED_PUSH_ARGUMENTS_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_deprecated_push_arguments_p() = %d\n", + gdbarch_deprecated_push_arguments_p (current_gdbarch)); +#ifdef DEPRECATED_PUSH_ARGUMENTS + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr)", + XSTRING (DEPRECATED_PUSH_ARGUMENTS (nargs, args, sp, struct_return, struct_addr))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_push_arguments = <0x%lx>\n", + (long) current_gdbarch->deprecated_push_arguments); +#ifdef DEPRECATED_PUSH_RETURN_ADDRESS_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_PUSH_RETURN_ADDRESS_P()", + XSTRING (DEPRECATED_PUSH_RETURN_ADDRESS_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_deprecated_push_return_address_p() = %d\n", + gdbarch_deprecated_push_return_address_p (current_gdbarch)); +#ifdef DEPRECATED_PUSH_RETURN_ADDRESS + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_PUSH_RETURN_ADDRESS(pc, sp)", + XSTRING (DEPRECATED_PUSH_RETURN_ADDRESS (pc, sp))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_push_return_address = <0x%lx>\n", + (long) current_gdbarch->deprecated_push_return_address); +#ifdef DEPRECATED_REG_STRUCT_HAS_ADDR_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_REG_STRUCT_HAS_ADDR_P()", + XSTRING (DEPRECATED_REG_STRUCT_HAS_ADDR_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_deprecated_reg_struct_has_addr_p() = %d\n", + gdbarch_deprecated_reg_struct_has_addr_p (current_gdbarch)); +#ifdef DEPRECATED_REG_STRUCT_HAS_ADDR + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_REG_STRUCT_HAS_ADDR(gcc_p, type)", + XSTRING (DEPRECATED_REG_STRUCT_HAS_ADDR (gcc_p, type))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_reg_struct_has_addr = <0x%lx>\n", + (long) current_gdbarch->deprecated_reg_struct_has_addr); +#ifdef DEPRECATED_REGISTER_BYTE_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_REGISTER_BYTE_P()", + XSTRING (DEPRECATED_REGISTER_BYTE_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_deprecated_register_byte_p() = %d\n", + gdbarch_deprecated_register_byte_p (current_gdbarch)); +#ifdef DEPRECATED_REGISTER_BYTE + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_REGISTER_BYTE(reg_nr)", + XSTRING (DEPRECATED_REGISTER_BYTE (reg_nr))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_register_byte = <0x%lx>\n", + (long) current_gdbarch->deprecated_register_byte); +#ifdef DEPRECATED_REGISTER_BYTES + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_REGISTER_BYTES # %s\n", + XSTRING (DEPRECATED_REGISTER_BYTES)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_register_bytes = %s\n", + paddr_d (current_gdbarch->deprecated_register_bytes)); +#ifdef DEPRECATED_REGISTER_RAW_SIZE_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_REGISTER_RAW_SIZE_P()", + XSTRING (DEPRECATED_REGISTER_RAW_SIZE_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_deprecated_register_raw_size_p() = %d\n", + gdbarch_deprecated_register_raw_size_p (current_gdbarch)); +#ifdef DEPRECATED_REGISTER_RAW_SIZE + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_REGISTER_RAW_SIZE(reg_nr)", + XSTRING (DEPRECATED_REGISTER_RAW_SIZE (reg_nr))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_register_raw_size = <0x%lx>\n", + (long) current_gdbarch->deprecated_register_raw_size); +#ifdef DEPRECATED_REGISTER_SIZE + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_REGISTER_SIZE # %s\n", + XSTRING (DEPRECATED_REGISTER_SIZE)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_register_size = %s\n", + paddr_d (current_gdbarch->deprecated_register_size)); +#ifdef DEPRECATED_REGISTER_VIRTUAL_SIZE_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_REGISTER_VIRTUAL_SIZE_P()", + XSTRING (DEPRECATED_REGISTER_VIRTUAL_SIZE_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_deprecated_register_virtual_size_p() = %d\n", + gdbarch_deprecated_register_virtual_size_p (current_gdbarch)); +#ifdef DEPRECATED_REGISTER_VIRTUAL_SIZE + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_REGISTER_VIRTUAL_SIZE(reg_nr)", + XSTRING (DEPRECATED_REGISTER_VIRTUAL_SIZE (reg_nr))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_register_virtual_size = <0x%lx>\n", + (long) current_gdbarch->deprecated_register_virtual_size); +#ifdef DEPRECATED_REGISTER_VIRTUAL_TYPE_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_REGISTER_VIRTUAL_TYPE_P()", + XSTRING (DEPRECATED_REGISTER_VIRTUAL_TYPE_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_deprecated_register_virtual_type_p() = %d\n", + gdbarch_deprecated_register_virtual_type_p (current_gdbarch)); +#ifdef DEPRECATED_REGISTER_VIRTUAL_TYPE + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_REGISTER_VIRTUAL_TYPE(reg_nr)", + XSTRING (DEPRECATED_REGISTER_VIRTUAL_TYPE (reg_nr))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_register_virtual_type = <0x%lx>\n", + (long) current_gdbarch->deprecated_register_virtual_type); +#ifdef DEPRECATED_SAVE_DUMMY_FRAME_TOS_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_SAVE_DUMMY_FRAME_TOS_P()", + XSTRING (DEPRECATED_SAVE_DUMMY_FRAME_TOS_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_deprecated_save_dummy_frame_tos_p() = %d\n", + gdbarch_deprecated_save_dummy_frame_tos_p (current_gdbarch)); +#ifdef DEPRECATED_SAVE_DUMMY_FRAME_TOS + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_SAVE_DUMMY_FRAME_TOS(sp)", + XSTRING (DEPRECATED_SAVE_DUMMY_FRAME_TOS (sp))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_save_dummy_frame_tos = <0x%lx>\n", + (long) current_gdbarch->deprecated_save_dummy_frame_tos); +#ifdef DEPRECATED_SAVED_PC_AFTER_CALL_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_SAVED_PC_AFTER_CALL_P()", + XSTRING (DEPRECATED_SAVED_PC_AFTER_CALL_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_deprecated_saved_pc_after_call_p() = %d\n", + gdbarch_deprecated_saved_pc_after_call_p (current_gdbarch)); +#ifdef DEPRECATED_SAVED_PC_AFTER_CALL + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_SAVED_PC_AFTER_CALL(frame)", + XSTRING (DEPRECATED_SAVED_PC_AFTER_CALL (frame))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_saved_pc_after_call = <0x%lx>\n", + (long) current_gdbarch->deprecated_saved_pc_after_call); +#ifdef DEPRECATED_STACK_ALIGN_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_STACK_ALIGN_P()", + XSTRING (DEPRECATED_STACK_ALIGN_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_deprecated_stack_align_p() = %d\n", + gdbarch_deprecated_stack_align_p (current_gdbarch)); +#ifdef DEPRECATED_STACK_ALIGN + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_STACK_ALIGN(sp)", + XSTRING (DEPRECATED_STACK_ALIGN (sp))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_stack_align = <0x%lx>\n", + (long) current_gdbarch->deprecated_stack_align); +#ifdef DEPRECATED_STORE_RETURN_VALUE + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_STORE_RETURN_VALUE(type, valbuf)", + XSTRING (DEPRECATED_STORE_RETURN_VALUE (type, valbuf))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_store_return_value = <0x%lx>\n", + (long) current_gdbarch->deprecated_store_return_value); +#ifdef DEPRECATED_STORE_STRUCT_RETURN_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_STORE_STRUCT_RETURN_P()", + XSTRING (DEPRECATED_STORE_STRUCT_RETURN_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_deprecated_store_struct_return_p() = %d\n", + gdbarch_deprecated_store_struct_return_p (current_gdbarch)); +#ifdef DEPRECATED_STORE_STRUCT_RETURN + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_STORE_STRUCT_RETURN(addr, sp)", + XSTRING (DEPRECATED_STORE_STRUCT_RETURN (addr, sp))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_store_struct_return = <0x%lx>\n", + (long) current_gdbarch->deprecated_store_struct_return); +#ifdef DEPRECATED_TARGET_READ_FP_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_TARGET_READ_FP_P()", + XSTRING (DEPRECATED_TARGET_READ_FP_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_deprecated_target_read_fp_p() = %d\n", + gdbarch_deprecated_target_read_fp_p (current_gdbarch)); +#ifdef DEPRECATED_TARGET_READ_FP + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_TARGET_READ_FP()", + XSTRING (DEPRECATED_TARGET_READ_FP ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_target_read_fp = <0x%lx>\n", + (long) current_gdbarch->deprecated_target_read_fp); +#ifdef DEPRECATED_USE_STRUCT_CONVENTION + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_USE_STRUCT_CONVENTION(gcc_p, value_type)", + XSTRING (DEPRECATED_USE_STRUCT_CONVENTION (gcc_p, value_type))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: deprecated_use_struct_convention = <0x%lx>\n", + (long) current_gdbarch->deprecated_use_struct_convention); +#ifdef TARGET_DOUBLE_BIT + fprintf_unfiltered (file, + "gdbarch_dump: TARGET_DOUBLE_BIT # %s\n", + XSTRING (TARGET_DOUBLE_BIT)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: double_bit = %s\n", + paddr_d (current_gdbarch->double_bit)); +#ifdef TARGET_DOUBLE_FORMAT + fprintf_unfiltered (file, + "gdbarch_dump: TARGET_DOUBLE_FORMAT # %s\n", + XSTRING (TARGET_DOUBLE_FORMAT)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: double_format = %s\n", + (TARGET_DOUBLE_FORMAT)->name); +#ifdef DWARF2_REG_TO_REGNUM + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DWARF2_REG_TO_REGNUM(dwarf2_regnr)", + XSTRING (DWARF2_REG_TO_REGNUM (dwarf2_regnr))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: dwarf2_reg_to_regnum = <0x%lx>\n", + (long) current_gdbarch->dwarf2_reg_to_regnum); +#ifdef DWARF_REG_TO_REGNUM + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DWARF_REG_TO_REGNUM(dwarf_regnr)", + XSTRING (DWARF_REG_TO_REGNUM (dwarf_regnr))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: dwarf_reg_to_regnum = <0x%lx>\n", + (long) current_gdbarch->dwarf_reg_to_regnum); +#ifdef ECOFF_REG_TO_REGNUM + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "ECOFF_REG_TO_REGNUM(ecoff_regnr)", + XSTRING (ECOFF_REG_TO_REGNUM (ecoff_regnr))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: ecoff_reg_to_regnum = <0x%lx>\n", + (long) current_gdbarch->ecoff_reg_to_regnum); +#ifdef ELF_MAKE_MSYMBOL_SPECIAL + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "ELF_MAKE_MSYMBOL_SPECIAL(sym, msym)", + XSTRING (ELF_MAKE_MSYMBOL_SPECIAL (sym, msym))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: elf_make_msymbol_special = <0x%lx>\n", + (long) current_gdbarch->elf_make_msymbol_special); +#ifdef EXTRACT_RETURN_VALUE + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "EXTRACT_RETURN_VALUE(type, regcache, valbuf)", + XSTRING (EXTRACT_RETURN_VALUE (type, regcache, valbuf))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: extract_return_value = <0x%lx>\n", + (long) current_gdbarch->extract_return_value); +#ifdef FETCH_POINTER_ARGUMENT_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "FETCH_POINTER_ARGUMENT_P()", + XSTRING (FETCH_POINTER_ARGUMENT_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_fetch_pointer_argument_p() = %d\n", + gdbarch_fetch_pointer_argument_p (current_gdbarch)); +#ifdef FETCH_POINTER_ARGUMENT + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "FETCH_POINTER_ARGUMENT(frame, argi, type)", + XSTRING (FETCH_POINTER_ARGUMENT (frame, argi, type))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: fetch_pointer_argument = <0x%lx>\n", + (long) current_gdbarch->fetch_pointer_argument); +#ifdef TARGET_FLOAT_BIT + fprintf_unfiltered (file, + "gdbarch_dump: TARGET_FLOAT_BIT # %s\n", + XSTRING (TARGET_FLOAT_BIT)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: float_bit = %s\n", + paddr_d (current_gdbarch->float_bit)); +#ifdef TARGET_FLOAT_FORMAT + fprintf_unfiltered (file, + "gdbarch_dump: TARGET_FLOAT_FORMAT # %s\n", + XSTRING (TARGET_FLOAT_FORMAT)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: float_format = %s\n", + (TARGET_FLOAT_FORMAT)->name); +#ifdef FP0_REGNUM + fprintf_unfiltered (file, + "gdbarch_dump: FP0_REGNUM # %s\n", + XSTRING (FP0_REGNUM)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: fp0_regnum = %s\n", + paddr_d (current_gdbarch->fp0_regnum)); + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_frame_align_p() = %d\n", + gdbarch_frame_align_p (current_gdbarch)); + fprintf_unfiltered (file, + "gdbarch_dump: frame_align = <0x%lx>\n", + (long) current_gdbarch->frame_align); +#ifdef FRAME_ARGS_SKIP + fprintf_unfiltered (file, + "gdbarch_dump: FRAME_ARGS_SKIP # %s\n", + XSTRING (FRAME_ARGS_SKIP)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: frame_args_skip = 0x%s\n", + paddr_nz (current_gdbarch->frame_args_skip)); +#ifdef FRAME_NUM_ARGS_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "FRAME_NUM_ARGS_P()", + XSTRING (FRAME_NUM_ARGS_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_frame_num_args_p() = %d\n", + gdbarch_frame_num_args_p (current_gdbarch)); +#ifdef FRAME_NUM_ARGS + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "FRAME_NUM_ARGS(frame)", + XSTRING (FRAME_NUM_ARGS (frame))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: frame_num_args = <0x%lx>\n", + (long) current_gdbarch->frame_num_args); +#ifdef FRAME_RED_ZONE_SIZE + fprintf_unfiltered (file, + "gdbarch_dump: FRAME_RED_ZONE_SIZE # %s\n", + XSTRING (FRAME_RED_ZONE_SIZE)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: frame_red_zone_size = %s\n", + paddr_d (current_gdbarch->frame_red_zone_size)); +#ifdef GET_LONGJMP_TARGET_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "GET_LONGJMP_TARGET_P()", + XSTRING (GET_LONGJMP_TARGET_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_get_longjmp_target_p() = %d\n", + gdbarch_get_longjmp_target_p (current_gdbarch)); +#ifdef GET_LONGJMP_TARGET + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "GET_LONGJMP_TARGET(pc)", + XSTRING (GET_LONGJMP_TARGET (pc))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: get_longjmp_target = <0x%lx>\n", + (long) current_gdbarch->get_longjmp_target); +#ifdef HAVE_NONSTEPPABLE_WATCHPOINT + fprintf_unfiltered (file, + "gdbarch_dump: HAVE_NONSTEPPABLE_WATCHPOINT # %s\n", + XSTRING (HAVE_NONSTEPPABLE_WATCHPOINT)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: have_nonsteppable_watchpoint = %s\n", + paddr_d (current_gdbarch->have_nonsteppable_watchpoint)); + fprintf_unfiltered (file, + "gdbarch_dump: in_function_epilogue_p = <0x%lx>\n", + (long) current_gdbarch->in_function_epilogue_p); +#ifdef IN_SOLIB_CALL_TRAMPOLINE + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "IN_SOLIB_CALL_TRAMPOLINE(pc, name)", + XSTRING (IN_SOLIB_CALL_TRAMPOLINE (pc, name))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: in_solib_call_trampoline = <0x%lx>\n", + (long) current_gdbarch->in_solib_call_trampoline); +#ifdef IN_SOLIB_RETURN_TRAMPOLINE + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "IN_SOLIB_RETURN_TRAMPOLINE(pc, name)", + XSTRING (IN_SOLIB_RETURN_TRAMPOLINE (pc, name))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: in_solib_return_trampoline = <0x%lx>\n", + (long) current_gdbarch->in_solib_return_trampoline); +#ifdef INNER_THAN + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "INNER_THAN(lhs, rhs)", + XSTRING (INNER_THAN (lhs, rhs))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: inner_than = <0x%lx>\n", + (long) current_gdbarch->inner_than); +#ifdef TARGET_INT_BIT + fprintf_unfiltered (file, + "gdbarch_dump: TARGET_INT_BIT # %s\n", + XSTRING (TARGET_INT_BIT)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: int_bit = %s\n", + paddr_d (current_gdbarch->int_bit)); +#ifdef INTEGER_TO_ADDRESS_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "INTEGER_TO_ADDRESS_P()", + XSTRING (INTEGER_TO_ADDRESS_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_integer_to_address_p() = %d\n", + gdbarch_integer_to_address_p (current_gdbarch)); +#ifdef INTEGER_TO_ADDRESS + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "INTEGER_TO_ADDRESS(type, buf)", + XSTRING (INTEGER_TO_ADDRESS (type, buf))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: integer_to_address = <0x%lx>\n", + (long) current_gdbarch->integer_to_address); +#ifdef TARGET_LONG_BIT + fprintf_unfiltered (file, + "gdbarch_dump: TARGET_LONG_BIT # %s\n", + XSTRING (TARGET_LONG_BIT)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: long_bit = %s\n", + paddr_d (current_gdbarch->long_bit)); +#ifdef TARGET_LONG_DOUBLE_BIT + fprintf_unfiltered (file, + "gdbarch_dump: TARGET_LONG_DOUBLE_BIT # %s\n", + XSTRING (TARGET_LONG_DOUBLE_BIT)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: long_double_bit = %s\n", + paddr_d (current_gdbarch->long_double_bit)); +#ifdef TARGET_LONG_DOUBLE_FORMAT + fprintf_unfiltered (file, + "gdbarch_dump: TARGET_LONG_DOUBLE_FORMAT # %s\n", + XSTRING (TARGET_LONG_DOUBLE_FORMAT)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: long_double_format = %s\n", + (TARGET_LONG_DOUBLE_FORMAT)->name); +#ifdef TARGET_LONG_LONG_BIT + fprintf_unfiltered (file, + "gdbarch_dump: TARGET_LONG_LONG_BIT # %s\n", + XSTRING (TARGET_LONG_LONG_BIT)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: long_long_bit = %s\n", + paddr_d (current_gdbarch->long_long_bit)); +#ifdef MEMORY_INSERT_BREAKPOINT + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "MEMORY_INSERT_BREAKPOINT(addr, contents_cache)", + XSTRING (MEMORY_INSERT_BREAKPOINT (addr, contents_cache))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: memory_insert_breakpoint = <0x%lx>\n", + (long) current_gdbarch->memory_insert_breakpoint); +#ifdef MEMORY_REMOVE_BREAKPOINT + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "MEMORY_REMOVE_BREAKPOINT(addr, contents_cache)", + XSTRING (MEMORY_REMOVE_BREAKPOINT (addr, contents_cache))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: memory_remove_breakpoint = <0x%lx>\n", + (long) current_gdbarch->memory_remove_breakpoint); +#ifdef NAME_OF_MALLOC + fprintf_unfiltered (file, + "gdbarch_dump: NAME_OF_MALLOC # %s\n", + XSTRING (NAME_OF_MALLOC)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: name_of_malloc = %s\n", + NAME_OF_MALLOC); +#ifdef NUM_PSEUDO_REGS + fprintf_unfiltered (file, + "gdbarch_dump: NUM_PSEUDO_REGS # %s\n", + XSTRING (NUM_PSEUDO_REGS)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: num_pseudo_regs = %s\n", + paddr_d (current_gdbarch->num_pseudo_regs)); +#ifdef NUM_REGS + fprintf_unfiltered (file, + "gdbarch_dump: NUM_REGS # %s\n", + XSTRING (NUM_REGS)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: num_regs = %s\n", + paddr_d (current_gdbarch->num_regs)); +#ifdef TARGET_OSABI + fprintf_unfiltered (file, + "gdbarch_dump: TARGET_OSABI # %s\n", + XSTRING (TARGET_OSABI)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: osabi = %s\n", + paddr_d (current_gdbarch->osabi)); +#ifdef PC_REGNUM + fprintf_unfiltered (file, + "gdbarch_dump: PC_REGNUM # %s\n", + XSTRING (PC_REGNUM)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: pc_regnum = %s\n", + paddr_d (current_gdbarch->pc_regnum)); +#ifdef POINTER_TO_ADDRESS + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "POINTER_TO_ADDRESS(type, buf)", + XSTRING (POINTER_TO_ADDRESS (type, buf))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: pointer_to_address = <0x%lx>\n", + (long) current_gdbarch->pointer_to_address); + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_print_float_info_p() = %d\n", + gdbarch_print_float_info_p (current_gdbarch)); + fprintf_unfiltered (file, + "gdbarch_dump: print_float_info = <0x%lx>\n", + (long) current_gdbarch->print_float_info); +#ifdef TARGET_PRINT_INSN + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "TARGET_PRINT_INSN(vma, info)", + XSTRING (TARGET_PRINT_INSN (vma, info))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: print_insn = <0x%lx>\n", + (long) current_gdbarch->print_insn); + fprintf_unfiltered (file, + "gdbarch_dump: print_registers_info = <0x%lx>\n", + (long) current_gdbarch->print_registers_info); + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_print_vector_info_p() = %d\n", + gdbarch_print_vector_info_p (current_gdbarch)); + fprintf_unfiltered (file, + "gdbarch_dump: print_vector_info = <0x%lx>\n", + (long) current_gdbarch->print_vector_info); +#ifdef PS_REGNUM + fprintf_unfiltered (file, + "gdbarch_dump: PS_REGNUM # %s\n", + XSTRING (PS_REGNUM)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: ps_regnum = %s\n", + paddr_d (current_gdbarch->ps_regnum)); + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_pseudo_register_read_p() = %d\n", + gdbarch_pseudo_register_read_p (current_gdbarch)); + fprintf_unfiltered (file, + "gdbarch_dump: pseudo_register_read = <0x%lx>\n", + (long) current_gdbarch->pseudo_register_read); + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_pseudo_register_write_p() = %d\n", + gdbarch_pseudo_register_write_p (current_gdbarch)); + fprintf_unfiltered (file, + "gdbarch_dump: pseudo_register_write = <0x%lx>\n", + (long) current_gdbarch->pseudo_register_write); +#ifdef TARGET_PTR_BIT + fprintf_unfiltered (file, + "gdbarch_dump: TARGET_PTR_BIT # %s\n", + XSTRING (TARGET_PTR_BIT)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: ptr_bit = %s\n", + paddr_d (current_gdbarch->ptr_bit)); + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_push_dummy_call_p() = %d\n", + gdbarch_push_dummy_call_p (current_gdbarch)); + fprintf_unfiltered (file, + "gdbarch_dump: push_dummy_call = <0x%lx>\n", + (long) current_gdbarch->push_dummy_call); + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_push_dummy_code_p() = %d\n", + gdbarch_push_dummy_code_p (current_gdbarch)); + fprintf_unfiltered (file, + "gdbarch_dump: push_dummy_code = <0x%lx>\n", + (long) current_gdbarch->push_dummy_code); +#ifdef TARGET_READ_PC_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "TARGET_READ_PC_P()", + XSTRING (TARGET_READ_PC_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_read_pc_p() = %d\n", + gdbarch_read_pc_p (current_gdbarch)); +#ifdef TARGET_READ_PC + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "TARGET_READ_PC(ptid)", + XSTRING (TARGET_READ_PC (ptid))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: read_pc = <0x%lx>\n", + (long) current_gdbarch->read_pc); +#ifdef TARGET_READ_SP_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "TARGET_READ_SP_P()", + XSTRING (TARGET_READ_SP_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_read_sp_p() = %d\n", + gdbarch_read_sp_p (current_gdbarch)); +#ifdef TARGET_READ_SP + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "TARGET_READ_SP()", + XSTRING (TARGET_READ_SP ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: read_sp = <0x%lx>\n", + (long) current_gdbarch->read_sp); +#ifdef REGISTER_BYTES_OK_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "REGISTER_BYTES_OK_P()", + XSTRING (REGISTER_BYTES_OK_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_register_bytes_ok_p() = %d\n", + gdbarch_register_bytes_ok_p (current_gdbarch)); +#ifdef REGISTER_BYTES_OK + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "REGISTER_BYTES_OK(nr_bytes)", + XSTRING (REGISTER_BYTES_OK (nr_bytes))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: register_bytes_ok = <0x%lx>\n", + (long) current_gdbarch->register_bytes_ok); +#ifdef REGISTER_NAME + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "REGISTER_NAME(regnr)", + XSTRING (REGISTER_NAME (regnr))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: register_name = <0x%lx>\n", + (long) current_gdbarch->register_name); + fprintf_unfiltered (file, + "gdbarch_dump: register_reggroup_p = <0x%lx>\n", + (long) current_gdbarch->register_reggroup_p); +#ifdef REGISTER_SIM_REGNO + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "REGISTER_SIM_REGNO(reg_nr)", + XSTRING (REGISTER_SIM_REGNO (reg_nr))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: register_sim_regno = <0x%lx>\n", + (long) current_gdbarch->register_sim_regno); +#ifdef REGISTER_TO_VALUE + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "REGISTER_TO_VALUE(frame, regnum, type, buf)", + XSTRING (REGISTER_TO_VALUE (frame, regnum, type, buf))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: register_to_value = <0x%lx>\n", + (long) current_gdbarch->register_to_value); + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_register_type_p() = %d\n", + gdbarch_register_type_p (current_gdbarch)); + fprintf_unfiltered (file, + "gdbarch_dump: register_type = <0x%lx>\n", + (long) current_gdbarch->register_type); + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_regset_from_core_section_p() = %d\n", + gdbarch_regset_from_core_section_p (current_gdbarch)); + fprintf_unfiltered (file, + "gdbarch_dump: regset_from_core_section = <0x%lx>\n", + (long) current_gdbarch->regset_from_core_section); + fprintf_unfiltered (file, + "gdbarch_dump: remote_translate_xfer_address = <0x%lx>\n", + (long) current_gdbarch->remote_translate_xfer_address); + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_return_value_p() = %d\n", + gdbarch_return_value_p (current_gdbarch)); + fprintf_unfiltered (file, + "gdbarch_dump: return_value = <0x%lx>\n", + (long) current_gdbarch->return_value); +#ifdef SDB_REG_TO_REGNUM + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "SDB_REG_TO_REGNUM(sdb_regnr)", + XSTRING (SDB_REG_TO_REGNUM (sdb_regnr))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: sdb_reg_to_regnum = <0x%lx>\n", + (long) current_gdbarch->sdb_reg_to_regnum); +#ifdef TARGET_SHORT_BIT + fprintf_unfiltered (file, + "gdbarch_dump: TARGET_SHORT_BIT # %s\n", + XSTRING (TARGET_SHORT_BIT)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: short_bit = %s\n", + paddr_d (current_gdbarch->short_bit)); +#ifdef SKIP_PROLOGUE + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "SKIP_PROLOGUE(ip)", + XSTRING (SKIP_PROLOGUE (ip))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: skip_prologue = <0x%lx>\n", + (long) current_gdbarch->skip_prologue); + fprintf_unfiltered (file, + "gdbarch_dump: skip_solib_resolver = <0x%lx>\n", + (long) current_gdbarch->skip_solib_resolver); +#ifdef SKIP_TRAMPOLINE_CODE + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "SKIP_TRAMPOLINE_CODE(pc)", + XSTRING (SKIP_TRAMPOLINE_CODE (pc))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: skip_trampoline_code = <0x%lx>\n", + (long) current_gdbarch->skip_trampoline_code); +#ifdef SMASH_TEXT_ADDRESS + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "SMASH_TEXT_ADDRESS(addr)", + XSTRING (SMASH_TEXT_ADDRESS (addr))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: smash_text_address = <0x%lx>\n", + (long) current_gdbarch->smash_text_address); +#ifdef SOFTWARE_SINGLE_STEP_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "SOFTWARE_SINGLE_STEP_P()", + XSTRING (SOFTWARE_SINGLE_STEP_P ())); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_software_single_step_p() = %d\n", + gdbarch_software_single_step_p (current_gdbarch)); +#ifdef SOFTWARE_SINGLE_STEP + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "SOFTWARE_SINGLE_STEP(sig, insert_breakpoints_p)", + XSTRING (SOFTWARE_SINGLE_STEP (sig, insert_breakpoints_p))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: software_single_step = <0x%lx>\n", + (long) current_gdbarch->software_single_step); +#ifdef SP_REGNUM + fprintf_unfiltered (file, + "gdbarch_dump: SP_REGNUM # %s\n", + XSTRING (SP_REGNUM)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: sp_regnum = %s\n", + paddr_d (current_gdbarch->sp_regnum)); +#ifdef STAB_REG_TO_REGNUM + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "STAB_REG_TO_REGNUM(stab_regnr)", + XSTRING (STAB_REG_TO_REGNUM (stab_regnr))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: stab_reg_to_regnum = <0x%lx>\n", + (long) current_gdbarch->stab_reg_to_regnum); + fprintf_unfiltered (file, + "gdbarch_dump: stabs_argument_has_addr = <0x%lx>\n", + (long) current_gdbarch->stabs_argument_has_addr); +#ifdef STORE_RETURN_VALUE + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "STORE_RETURN_VALUE(type, regcache, valbuf)", + XSTRING (STORE_RETURN_VALUE (type, regcache, valbuf))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: store_return_value = <0x%lx>\n", + (long) current_gdbarch->store_return_value); + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_unwind_dummy_id_p() = %d\n", + gdbarch_unwind_dummy_id_p (current_gdbarch)); + fprintf_unfiltered (file, + "gdbarch_dump: unwind_dummy_id = <0x%lx>\n", + (long) current_gdbarch->unwind_dummy_id); + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_unwind_pc_p() = %d\n", + gdbarch_unwind_pc_p (current_gdbarch)); + fprintf_unfiltered (file, + "gdbarch_dump: unwind_pc = <0x%lx>\n", + (long) current_gdbarch->unwind_pc); + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_unwind_sp_p() = %d\n", + gdbarch_unwind_sp_p (current_gdbarch)); + fprintf_unfiltered (file, + "gdbarch_dump: unwind_sp = <0x%lx>\n", + (long) current_gdbarch->unwind_sp); +#ifdef VALUE_TO_REGISTER + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "VALUE_TO_REGISTER(frame, regnum, type, buf)", + XSTRING (VALUE_TO_REGISTER (frame, regnum, type, buf))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: value_to_register = <0x%lx>\n", + (long) current_gdbarch->value_to_register); +#ifdef TARGET_VIRTUAL_FRAME_POINTER + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "TARGET_VIRTUAL_FRAME_POINTER(pc, frame_regnum, frame_offset)", + XSTRING (TARGET_VIRTUAL_FRAME_POINTER (pc, frame_regnum, frame_offset))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: virtual_frame_pointer = <0x%lx>\n", + (long) current_gdbarch->virtual_frame_pointer); +#ifdef TARGET_WRITE_PC + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "TARGET_WRITE_PC(val, ptid)", + XSTRING (TARGET_WRITE_PC (val, ptid))); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: write_pc = <0x%lx>\n", + (long) current_gdbarch->write_pc); +#ifdef XREGS_NAME + fprintf_unfiltered (file, + "gdbarch_dump: XREGS_NAME # %s\n", + XSTRING (XREGS_NAME)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: xregs_name = %s\n", + paddr_d (current_gdbarch->xregs_name)); +#ifdef XREGS_REGSET + fprintf_unfiltered (file, + "gdbarch_dump: XREGS_REGSET # %s\n", + XSTRING (XREGS_REGSET)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: xregs_regset = %s\n", + paddr_d (current_gdbarch->xregs_regset)); +#ifdef XREGS_SIZE + fprintf_unfiltered (file, + "gdbarch_dump: XREGS_SIZE # %s\n", + XSTRING (XREGS_SIZE)); +#endif + fprintf_unfiltered (file, + "gdbarch_dump: xregs_size = %s\n", + paddr_d (current_gdbarch->xregs_size)); + if (current_gdbarch->dump_tdep != NULL) + current_gdbarch->dump_tdep (current_gdbarch, file); +} + +struct gdbarch_tdep * +gdbarch_tdep (struct gdbarch *gdbarch) +{ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_tdep called\n"); + return gdbarch->tdep; +} + + +const struct bfd_arch_info * +gdbarch_bfd_arch_info (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_bfd_arch_info called\n"); + return gdbarch->bfd_arch_info; +} + +int +gdbarch_byte_order (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_byte_order called\n"); + return gdbarch->byte_order; +} + +enum gdb_osabi +gdbarch_osabi (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_osabi called\n"); + return gdbarch->osabi; +} + +int +gdbarch_short_bit (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + /* Skip verify of short_bit, invalid_p == 0 */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_short_bit called\n"); + return gdbarch->short_bit; +} + +void +set_gdbarch_short_bit (struct gdbarch *gdbarch, + int short_bit) +{ + gdbarch->short_bit = short_bit; +} + +int +gdbarch_int_bit (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + /* Skip verify of int_bit, invalid_p == 0 */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_int_bit called\n"); + return gdbarch->int_bit; +} + +void +set_gdbarch_int_bit (struct gdbarch *gdbarch, + int int_bit) +{ + gdbarch->int_bit = int_bit; +} + +int +gdbarch_long_bit (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + /* Skip verify of long_bit, invalid_p == 0 */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_long_bit called\n"); + return gdbarch->long_bit; +} + +void +set_gdbarch_long_bit (struct gdbarch *gdbarch, + int long_bit) +{ + gdbarch->long_bit = long_bit; +} + +int +gdbarch_long_long_bit (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + /* Skip verify of long_long_bit, invalid_p == 0 */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_long_long_bit called\n"); + return gdbarch->long_long_bit; +} + +void +set_gdbarch_long_long_bit (struct gdbarch *gdbarch, + int long_long_bit) +{ + gdbarch->long_long_bit = long_long_bit; +} + +int +gdbarch_float_bit (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + /* Skip verify of float_bit, invalid_p == 0 */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_float_bit called\n"); + return gdbarch->float_bit; +} + +void +set_gdbarch_float_bit (struct gdbarch *gdbarch, + int float_bit) +{ + gdbarch->float_bit = float_bit; +} + +int +gdbarch_double_bit (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + /* Skip verify of double_bit, invalid_p == 0 */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_double_bit called\n"); + return gdbarch->double_bit; +} + +void +set_gdbarch_double_bit (struct gdbarch *gdbarch, + int double_bit) +{ + gdbarch->double_bit = double_bit; +} + +int +gdbarch_long_double_bit (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + /* Skip verify of long_double_bit, invalid_p == 0 */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_long_double_bit called\n"); + return gdbarch->long_double_bit; +} + +void +set_gdbarch_long_double_bit (struct gdbarch *gdbarch, + int long_double_bit) +{ + gdbarch->long_double_bit = long_double_bit; +} + +int +gdbarch_ptr_bit (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + /* Skip verify of ptr_bit, invalid_p == 0 */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_ptr_bit called\n"); + return gdbarch->ptr_bit; +} + +void +set_gdbarch_ptr_bit (struct gdbarch *gdbarch, + int ptr_bit) +{ + gdbarch->ptr_bit = ptr_bit; +} + +int +gdbarch_addr_bit (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + /* Check variable changed from pre-default. */ + gdb_assert (gdbarch->addr_bit != 0); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_addr_bit called\n"); + return gdbarch->addr_bit; +} + +void +set_gdbarch_addr_bit (struct gdbarch *gdbarch, + int addr_bit) +{ + gdbarch->addr_bit = addr_bit; +} + +int +gdbarch_bfd_vma_bit (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + /* Skip verify of bfd_vma_bit, invalid_p == 0 */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_bfd_vma_bit called\n"); + return gdbarch->bfd_vma_bit; +} + +void +set_gdbarch_bfd_vma_bit (struct gdbarch *gdbarch, + int bfd_vma_bit) +{ + gdbarch->bfd_vma_bit = bfd_vma_bit; +} + +int +gdbarch_char_signed (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + /* Check variable changed from pre-default. */ + gdb_assert (gdbarch->char_signed != -1); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_char_signed called\n"); + return gdbarch->char_signed; +} + +void +set_gdbarch_char_signed (struct gdbarch *gdbarch, + int char_signed) +{ + gdbarch->char_signed = char_signed; +} + +int +gdbarch_read_pc_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->read_pc != NULL; +} + +CORE_ADDR +gdbarch_read_pc (struct gdbarch *gdbarch, ptid_t ptid) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->read_pc != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_read_pc called\n"); + return gdbarch->read_pc (ptid); +} + +void +set_gdbarch_read_pc (struct gdbarch *gdbarch, + gdbarch_read_pc_ftype read_pc) +{ + gdbarch->read_pc = read_pc; +} + +void +gdbarch_write_pc (struct gdbarch *gdbarch, CORE_ADDR val, ptid_t ptid) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->write_pc != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_write_pc called\n"); + gdbarch->write_pc (val, ptid); +} + +void +set_gdbarch_write_pc (struct gdbarch *gdbarch, + gdbarch_write_pc_ftype write_pc) +{ + gdbarch->write_pc = write_pc; +} + +int +gdbarch_read_sp_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->read_sp != NULL; +} + +CORE_ADDR +gdbarch_read_sp (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->read_sp != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_read_sp called\n"); + return gdbarch->read_sp (); +} + +void +set_gdbarch_read_sp (struct gdbarch *gdbarch, + gdbarch_read_sp_ftype read_sp) +{ + gdbarch->read_sp = read_sp; +} + +void +gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->virtual_frame_pointer != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_virtual_frame_pointer called\n"); + gdbarch->virtual_frame_pointer (pc, frame_regnum, frame_offset); +} + +void +set_gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch, + gdbarch_virtual_frame_pointer_ftype virtual_frame_pointer) +{ + gdbarch->virtual_frame_pointer = virtual_frame_pointer; +} + +int +gdbarch_pseudo_register_read_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->pseudo_register_read != NULL; +} + +void +gdbarch_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, void *buf) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->pseudo_register_read != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_pseudo_register_read called\n"); + gdbarch->pseudo_register_read (gdbarch, regcache, cookednum, buf); +} + +void +set_gdbarch_pseudo_register_read (struct gdbarch *gdbarch, + gdbarch_pseudo_register_read_ftype pseudo_register_read) +{ + gdbarch->pseudo_register_read = pseudo_register_read; +} + +int +gdbarch_pseudo_register_write_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->pseudo_register_write != NULL; +} + +void +gdbarch_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, const void *buf) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->pseudo_register_write != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_pseudo_register_write called\n"); + gdbarch->pseudo_register_write (gdbarch, regcache, cookednum, buf); +} + +void +set_gdbarch_pseudo_register_write (struct gdbarch *gdbarch, + gdbarch_pseudo_register_write_ftype pseudo_register_write) +{ + gdbarch->pseudo_register_write = pseudo_register_write; +} + +int +gdbarch_num_regs (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + /* Check variable changed from pre-default. */ + gdb_assert (gdbarch->num_regs != -1); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_num_regs called\n"); + return gdbarch->num_regs; +} + +void +set_gdbarch_num_regs (struct gdbarch *gdbarch, + int num_regs) +{ + gdbarch->num_regs = num_regs; +} + +int +gdbarch_num_pseudo_regs (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + /* Skip verify of num_pseudo_regs, invalid_p == 0 */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_num_pseudo_regs called\n"); + return gdbarch->num_pseudo_regs; +} + +void +set_gdbarch_num_pseudo_regs (struct gdbarch *gdbarch, + int num_pseudo_regs) +{ + gdbarch->num_pseudo_regs = num_pseudo_regs; +} + +int +gdbarch_sp_regnum (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + /* Skip verify of sp_regnum, invalid_p == 0 */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_sp_regnum called\n"); + return gdbarch->sp_regnum; +} + +void +set_gdbarch_sp_regnum (struct gdbarch *gdbarch, + int sp_regnum) +{ + gdbarch->sp_regnum = sp_regnum; +} + +int +gdbarch_pc_regnum (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + /* Skip verify of pc_regnum, invalid_p == 0 */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_pc_regnum called\n"); + return gdbarch->pc_regnum; +} + +void +set_gdbarch_pc_regnum (struct gdbarch *gdbarch, + int pc_regnum) +{ + gdbarch->pc_regnum = pc_regnum; +} + +int +gdbarch_ps_regnum (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + /* Skip verify of ps_regnum, invalid_p == 0 */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_ps_regnum called\n"); + return gdbarch->ps_regnum; +} + +void +set_gdbarch_ps_regnum (struct gdbarch *gdbarch, + int ps_regnum) +{ + gdbarch->ps_regnum = ps_regnum; +} + +int +gdbarch_fp0_regnum (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + /* Skip verify of fp0_regnum, invalid_p == 0 */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_fp0_regnum called\n"); + return gdbarch->fp0_regnum; +} + +void +set_gdbarch_fp0_regnum (struct gdbarch *gdbarch, + int fp0_regnum) +{ + gdbarch->fp0_regnum = fp0_regnum; +} + +int +gdbarch_stab_reg_to_regnum (struct gdbarch *gdbarch, int stab_regnr) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->stab_reg_to_regnum != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_stab_reg_to_regnum called\n"); + return gdbarch->stab_reg_to_regnum (stab_regnr); +} + +void +set_gdbarch_stab_reg_to_regnum (struct gdbarch *gdbarch, + gdbarch_stab_reg_to_regnum_ftype stab_reg_to_regnum) +{ + gdbarch->stab_reg_to_regnum = stab_reg_to_regnum; +} + +int +gdbarch_ecoff_reg_to_regnum (struct gdbarch *gdbarch, int ecoff_regnr) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->ecoff_reg_to_regnum != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_ecoff_reg_to_regnum called\n"); + return gdbarch->ecoff_reg_to_regnum (ecoff_regnr); +} + +void +set_gdbarch_ecoff_reg_to_regnum (struct gdbarch *gdbarch, + gdbarch_ecoff_reg_to_regnum_ftype ecoff_reg_to_regnum) +{ + gdbarch->ecoff_reg_to_regnum = ecoff_reg_to_regnum; +} + +int +gdbarch_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int dwarf_regnr) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->dwarf_reg_to_regnum != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_dwarf_reg_to_regnum called\n"); + return gdbarch->dwarf_reg_to_regnum (dwarf_regnr); +} + +void +set_gdbarch_dwarf_reg_to_regnum (struct gdbarch *gdbarch, + gdbarch_dwarf_reg_to_regnum_ftype dwarf_reg_to_regnum) +{ + gdbarch->dwarf_reg_to_regnum = dwarf_reg_to_regnum; +} + +int +gdbarch_sdb_reg_to_regnum (struct gdbarch *gdbarch, int sdb_regnr) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->sdb_reg_to_regnum != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_sdb_reg_to_regnum called\n"); + return gdbarch->sdb_reg_to_regnum (sdb_regnr); +} + +void +set_gdbarch_sdb_reg_to_regnum (struct gdbarch *gdbarch, + gdbarch_sdb_reg_to_regnum_ftype sdb_reg_to_regnum) +{ + gdbarch->sdb_reg_to_regnum = sdb_reg_to_regnum; +} + +int +gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int dwarf2_regnr) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->dwarf2_reg_to_regnum != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_dwarf2_reg_to_regnum called\n"); + return gdbarch->dwarf2_reg_to_regnum (dwarf2_regnr); +} + +void +set_gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, + gdbarch_dwarf2_reg_to_regnum_ftype dwarf2_reg_to_regnum) +{ + gdbarch->dwarf2_reg_to_regnum = dwarf2_reg_to_regnum; +} + +const char * +gdbarch_register_name (struct gdbarch *gdbarch, int regnr) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->register_name != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_register_name called\n"); + return gdbarch->register_name (regnr); +} + +void +set_gdbarch_register_name (struct gdbarch *gdbarch, + gdbarch_register_name_ftype register_name) +{ + gdbarch->register_name = register_name; +} + +int +gdbarch_register_type_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->register_type != NULL; +} + +struct type * +gdbarch_register_type (struct gdbarch *gdbarch, int reg_nr) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->register_type != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_register_type called\n"); + return gdbarch->register_type (gdbarch, reg_nr); +} + +void +set_gdbarch_register_type (struct gdbarch *gdbarch, + gdbarch_register_type_ftype register_type) +{ + gdbarch->register_type = register_type; +} + +int +gdbarch_deprecated_register_virtual_type_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_register_virtual_type != NULL; +} + +struct type * +gdbarch_deprecated_register_virtual_type (struct gdbarch *gdbarch, int reg_nr) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->deprecated_register_virtual_type != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_register_virtual_type called\n"); + return gdbarch->deprecated_register_virtual_type (reg_nr); +} + +void +set_gdbarch_deprecated_register_virtual_type (struct gdbarch *gdbarch, + gdbarch_deprecated_register_virtual_type_ftype deprecated_register_virtual_type) +{ + gdbarch->deprecated_register_virtual_type = deprecated_register_virtual_type; +} + +int +gdbarch_deprecated_register_bytes (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_register_bytes called\n"); + return gdbarch->deprecated_register_bytes; +} + +void +set_gdbarch_deprecated_register_bytes (struct gdbarch *gdbarch, + int deprecated_register_bytes) +{ + gdbarch->deprecated_register_bytes = deprecated_register_bytes; +} + +int +gdbarch_deprecated_register_byte_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_register_byte != generic_register_byte; +} + +int +gdbarch_deprecated_register_byte (struct gdbarch *gdbarch, int reg_nr) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->deprecated_register_byte != NULL); + /* Do not check predicate: gdbarch->deprecated_register_byte != generic_register_byte, allow call. */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_register_byte called\n"); + return gdbarch->deprecated_register_byte (reg_nr); +} + +void +set_gdbarch_deprecated_register_byte (struct gdbarch *gdbarch, + gdbarch_deprecated_register_byte_ftype deprecated_register_byte) +{ + gdbarch->deprecated_register_byte = deprecated_register_byte; +} + +int +gdbarch_deprecated_register_raw_size_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_register_raw_size != generic_register_size; +} + +int +gdbarch_deprecated_register_raw_size (struct gdbarch *gdbarch, int reg_nr) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->deprecated_register_raw_size != NULL); + /* Do not check predicate: gdbarch->deprecated_register_raw_size != generic_register_size, allow call. */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_register_raw_size called\n"); + return gdbarch->deprecated_register_raw_size (reg_nr); +} + +void +set_gdbarch_deprecated_register_raw_size (struct gdbarch *gdbarch, + gdbarch_deprecated_register_raw_size_ftype deprecated_register_raw_size) +{ + gdbarch->deprecated_register_raw_size = deprecated_register_raw_size; +} + +int +gdbarch_deprecated_register_virtual_size_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_register_virtual_size != generic_register_size; +} + +int +gdbarch_deprecated_register_virtual_size (struct gdbarch *gdbarch, int reg_nr) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->deprecated_register_virtual_size != NULL); + /* Do not check predicate: gdbarch->deprecated_register_virtual_size != generic_register_size, allow call. */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_register_virtual_size called\n"); + return gdbarch->deprecated_register_virtual_size (reg_nr); +} + +void +set_gdbarch_deprecated_register_virtual_size (struct gdbarch *gdbarch, + gdbarch_deprecated_register_virtual_size_ftype deprecated_register_virtual_size) +{ + gdbarch->deprecated_register_virtual_size = deprecated_register_virtual_size; +} + +int +gdbarch_unwind_dummy_id_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->unwind_dummy_id != NULL; +} + +struct frame_id +gdbarch_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *info) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->unwind_dummy_id != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_unwind_dummy_id called\n"); + return gdbarch->unwind_dummy_id (gdbarch, info); +} + +void +set_gdbarch_unwind_dummy_id (struct gdbarch *gdbarch, + gdbarch_unwind_dummy_id_ftype unwind_dummy_id) +{ + gdbarch->unwind_dummy_id = unwind_dummy_id; +} + +int +gdbarch_deprecated_save_dummy_frame_tos_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_save_dummy_frame_tos != NULL; +} + +void +gdbarch_deprecated_save_dummy_frame_tos (struct gdbarch *gdbarch, CORE_ADDR sp) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->deprecated_save_dummy_frame_tos != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_save_dummy_frame_tos called\n"); + gdbarch->deprecated_save_dummy_frame_tos (sp); +} + +void +set_gdbarch_deprecated_save_dummy_frame_tos (struct gdbarch *gdbarch, + gdbarch_deprecated_save_dummy_frame_tos_ftype deprecated_save_dummy_frame_tos) +{ + gdbarch->deprecated_save_dummy_frame_tos = deprecated_save_dummy_frame_tos; +} + +int +gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + /* Skip verify of deprecated_fp_regnum, invalid_p == 0 */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_fp_regnum called\n"); + return gdbarch->deprecated_fp_regnum; +} + +void +set_gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch, + int deprecated_fp_regnum) +{ + gdbarch->deprecated_fp_regnum = deprecated_fp_regnum; +} + +int +gdbarch_deprecated_target_read_fp_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_target_read_fp != NULL; +} + +CORE_ADDR +gdbarch_deprecated_target_read_fp (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->deprecated_target_read_fp != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_target_read_fp called\n"); + return gdbarch->deprecated_target_read_fp (); +} + +void +set_gdbarch_deprecated_target_read_fp (struct gdbarch *gdbarch, + gdbarch_deprecated_target_read_fp_ftype deprecated_target_read_fp) +{ + gdbarch->deprecated_target_read_fp = deprecated_target_read_fp; +} + +int +gdbarch_push_dummy_call_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->push_dummy_call != NULL; +} + +CORE_ADDR +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) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->push_dummy_call != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_push_dummy_call called\n"); + return gdbarch->push_dummy_call (gdbarch, function, regcache, bp_addr, nargs, args, sp, struct_return, struct_addr); +} + +void +set_gdbarch_push_dummy_call (struct gdbarch *gdbarch, + gdbarch_push_dummy_call_ftype push_dummy_call) +{ + gdbarch->push_dummy_call = push_dummy_call; +} + +int +gdbarch_deprecated_push_arguments_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_push_arguments != NULL; +} + +CORE_ADDR +gdbarch_deprecated_push_arguments (struct gdbarch *gdbarch, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->deprecated_push_arguments != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_push_arguments called\n"); + return gdbarch->deprecated_push_arguments (nargs, args, sp, struct_return, struct_addr); +} + +void +set_gdbarch_deprecated_push_arguments (struct gdbarch *gdbarch, + gdbarch_deprecated_push_arguments_ftype deprecated_push_arguments) +{ + gdbarch->deprecated_push_arguments = deprecated_push_arguments; +} + +int +gdbarch_deprecated_push_return_address_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_push_return_address != NULL; +} + +CORE_ADDR +gdbarch_deprecated_push_return_address (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->deprecated_push_return_address != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_push_return_address called\n"); + return gdbarch->deprecated_push_return_address (pc, sp); +} + +void +set_gdbarch_deprecated_push_return_address (struct gdbarch *gdbarch, + gdbarch_deprecated_push_return_address_ftype deprecated_push_return_address) +{ + gdbarch->deprecated_push_return_address = deprecated_push_return_address; +} + +int +gdbarch_deprecated_dummy_write_sp_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_dummy_write_sp != NULL; +} + +void +gdbarch_deprecated_dummy_write_sp (struct gdbarch *gdbarch, CORE_ADDR val) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->deprecated_dummy_write_sp != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_dummy_write_sp called\n"); + gdbarch->deprecated_dummy_write_sp (val); +} + +void +set_gdbarch_deprecated_dummy_write_sp (struct gdbarch *gdbarch, + gdbarch_deprecated_dummy_write_sp_ftype deprecated_dummy_write_sp) +{ + gdbarch->deprecated_dummy_write_sp = deprecated_dummy_write_sp; +} + +int +gdbarch_deprecated_register_size (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_register_size called\n"); + return gdbarch->deprecated_register_size; +} + +void +set_gdbarch_deprecated_register_size (struct gdbarch *gdbarch, + int deprecated_register_size) +{ + gdbarch->deprecated_register_size = deprecated_register_size; +} + +int +gdbarch_call_dummy_location (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + /* Skip verify of call_dummy_location, invalid_p == 0 */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_location called\n"); + return gdbarch->call_dummy_location; +} + +void +set_gdbarch_call_dummy_location (struct gdbarch *gdbarch, + int call_dummy_location) +{ + gdbarch->call_dummy_location = call_dummy_location; +} + +int +gdbarch_push_dummy_code_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->push_dummy_code != NULL; +} + +CORE_ADDR +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) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->push_dummy_code != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_push_dummy_code called\n"); + return gdbarch->push_dummy_code (gdbarch, sp, funaddr, using_gcc, args, nargs, value_type, real_pc, bp_addr); +} + +void +set_gdbarch_push_dummy_code (struct gdbarch *gdbarch, + gdbarch_push_dummy_code_ftype push_dummy_code) +{ + gdbarch->push_dummy_code = push_dummy_code; +} + +int +gdbarch_deprecated_do_registers_info_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_do_registers_info != NULL; +} + +void +gdbarch_deprecated_do_registers_info (struct gdbarch *gdbarch, int reg_nr, int fpregs) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->deprecated_do_registers_info != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_do_registers_info called\n"); + gdbarch->deprecated_do_registers_info (reg_nr, fpregs); +} + +void +set_gdbarch_deprecated_do_registers_info (struct gdbarch *gdbarch, + gdbarch_deprecated_do_registers_info_ftype deprecated_do_registers_info) +{ + gdbarch->deprecated_do_registers_info = deprecated_do_registers_info; +} + +void +gdbarch_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, int regnum, int all) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->print_registers_info != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_print_registers_info called\n"); + gdbarch->print_registers_info (gdbarch, file, frame, regnum, all); +} + +void +set_gdbarch_print_registers_info (struct gdbarch *gdbarch, + gdbarch_print_registers_info_ftype print_registers_info) +{ + gdbarch->print_registers_info = print_registers_info; +} + +int +gdbarch_print_float_info_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->print_float_info != NULL; +} + +void +gdbarch_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, const char *args) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->print_float_info != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_print_float_info called\n"); + gdbarch->print_float_info (gdbarch, file, frame, args); +} + +void +set_gdbarch_print_float_info (struct gdbarch *gdbarch, + gdbarch_print_float_info_ftype print_float_info) +{ + gdbarch->print_float_info = print_float_info; +} + +int +gdbarch_print_vector_info_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->print_vector_info != NULL; +} + +void +gdbarch_print_vector_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, const char *args) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->print_vector_info != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_print_vector_info called\n"); + gdbarch->print_vector_info (gdbarch, file, frame, args); +} + +void +set_gdbarch_print_vector_info (struct gdbarch *gdbarch, + gdbarch_print_vector_info_ftype print_vector_info) +{ + gdbarch->print_vector_info = print_vector_info; +} + +int +gdbarch_register_sim_regno (struct gdbarch *gdbarch, int reg_nr) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->register_sim_regno != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_register_sim_regno called\n"); + return gdbarch->register_sim_regno (reg_nr); +} + +void +set_gdbarch_register_sim_regno (struct gdbarch *gdbarch, + gdbarch_register_sim_regno_ftype register_sim_regno) +{ + gdbarch->register_sim_regno = register_sim_regno; +} + +int +gdbarch_register_bytes_ok_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->register_bytes_ok != NULL; +} + +int +gdbarch_register_bytes_ok (struct gdbarch *gdbarch, long nr_bytes) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->register_bytes_ok != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_register_bytes_ok called\n"); + return gdbarch->register_bytes_ok (nr_bytes); +} + +void +set_gdbarch_register_bytes_ok (struct gdbarch *gdbarch, + gdbarch_register_bytes_ok_ftype register_bytes_ok) +{ + gdbarch->register_bytes_ok = register_bytes_ok; +} + +int +gdbarch_cannot_fetch_register (struct gdbarch *gdbarch, int regnum) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->cannot_fetch_register != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_cannot_fetch_register called\n"); + return gdbarch->cannot_fetch_register (regnum); +} + +void +set_gdbarch_cannot_fetch_register (struct gdbarch *gdbarch, + gdbarch_cannot_fetch_register_ftype cannot_fetch_register) +{ + gdbarch->cannot_fetch_register = cannot_fetch_register; +} + +int +gdbarch_cannot_store_register (struct gdbarch *gdbarch, int regnum) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->cannot_store_register != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_cannot_store_register called\n"); + return gdbarch->cannot_store_register (regnum); +} + +void +set_gdbarch_cannot_store_register (struct gdbarch *gdbarch, + gdbarch_cannot_store_register_ftype cannot_store_register) +{ + gdbarch->cannot_store_register = cannot_store_register; +} + +int +gdbarch_get_longjmp_target_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->get_longjmp_target != NULL; +} + +int +gdbarch_get_longjmp_target (struct gdbarch *gdbarch, CORE_ADDR *pc) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->get_longjmp_target != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_get_longjmp_target called\n"); + return gdbarch->get_longjmp_target (pc); +} + +void +set_gdbarch_get_longjmp_target (struct gdbarch *gdbarch, + gdbarch_get_longjmp_target_ftype get_longjmp_target) +{ + gdbarch->get_longjmp_target = get_longjmp_target; +} + +int +gdbarch_deprecated_init_frame_pc_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_init_frame_pc != NULL; +} + +CORE_ADDR +gdbarch_deprecated_init_frame_pc (struct gdbarch *gdbarch, int fromleaf, struct frame_info *prev) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->deprecated_init_frame_pc != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_init_frame_pc called\n"); + return gdbarch->deprecated_init_frame_pc (fromleaf, prev); +} + +void +set_gdbarch_deprecated_init_frame_pc (struct gdbarch *gdbarch, + gdbarch_deprecated_init_frame_pc_ftype deprecated_init_frame_pc) +{ + gdbarch->deprecated_init_frame_pc = deprecated_init_frame_pc; +} + +int +gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_believe_pcc_promotion called\n"); + return gdbarch->believe_pcc_promotion; +} + +void +set_gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch, + int believe_pcc_promotion) +{ + gdbarch->believe_pcc_promotion = believe_pcc_promotion; +} + +int +gdbarch_deprecated_get_saved_register_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_get_saved_register != NULL; +} + +void +gdbarch_deprecated_get_saved_register (struct gdbarch *gdbarch, char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->deprecated_get_saved_register != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_get_saved_register called\n"); + gdbarch->deprecated_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval); +} + +void +set_gdbarch_deprecated_get_saved_register (struct gdbarch *gdbarch, + gdbarch_deprecated_get_saved_register_ftype deprecated_get_saved_register) +{ + gdbarch->deprecated_get_saved_register = deprecated_get_saved_register; +} + +int +gdbarch_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->convert_register_p != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_convert_register_p called\n"); + return gdbarch->convert_register_p (regnum, type); +} + +void +set_gdbarch_convert_register_p (struct gdbarch *gdbarch, + gdbarch_convert_register_p_ftype convert_register_p) +{ + gdbarch->convert_register_p = convert_register_p; +} + +void +gdbarch_register_to_value (struct gdbarch *gdbarch, struct frame_info *frame, int regnum, struct type *type, void *buf) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->register_to_value != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_register_to_value called\n"); + gdbarch->register_to_value (frame, regnum, type, buf); +} + +void +set_gdbarch_register_to_value (struct gdbarch *gdbarch, + gdbarch_register_to_value_ftype register_to_value) +{ + gdbarch->register_to_value = register_to_value; +} + +void +gdbarch_value_to_register (struct gdbarch *gdbarch, struct frame_info *frame, int regnum, struct type *type, const void *buf) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->value_to_register != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_value_to_register called\n"); + gdbarch->value_to_register (frame, regnum, type, buf); +} + +void +set_gdbarch_value_to_register (struct gdbarch *gdbarch, + gdbarch_value_to_register_ftype value_to_register) +{ + gdbarch->value_to_register = value_to_register; +} + +CORE_ADDR +gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, const void *buf) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->pointer_to_address != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_pointer_to_address called\n"); + return gdbarch->pointer_to_address (type, buf); +} + +void +set_gdbarch_pointer_to_address (struct gdbarch *gdbarch, + gdbarch_pointer_to_address_ftype pointer_to_address) +{ + gdbarch->pointer_to_address = pointer_to_address; +} + +void +gdbarch_address_to_pointer (struct gdbarch *gdbarch, struct type *type, void *buf, CORE_ADDR addr) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->address_to_pointer != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_address_to_pointer called\n"); + gdbarch->address_to_pointer (type, buf, addr); +} + +void +set_gdbarch_address_to_pointer (struct gdbarch *gdbarch, + gdbarch_address_to_pointer_ftype address_to_pointer) +{ + gdbarch->address_to_pointer = address_to_pointer; +} + +int +gdbarch_integer_to_address_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->integer_to_address != NULL; +} + +CORE_ADDR +gdbarch_integer_to_address (struct gdbarch *gdbarch, struct type *type, void *buf) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->integer_to_address != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_integer_to_address called\n"); + return gdbarch->integer_to_address (type, buf); +} + +void +set_gdbarch_integer_to_address (struct gdbarch *gdbarch, + gdbarch_integer_to_address_ftype integer_to_address) +{ + gdbarch->integer_to_address = integer_to_address; +} + +int +gdbarch_deprecated_pop_frame_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_pop_frame != NULL; +} + +void +gdbarch_deprecated_pop_frame (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->deprecated_pop_frame != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_pop_frame called\n"); + gdbarch->deprecated_pop_frame (); +} + +void +set_gdbarch_deprecated_pop_frame (struct gdbarch *gdbarch, + gdbarch_deprecated_pop_frame_ftype deprecated_pop_frame) +{ + gdbarch->deprecated_pop_frame = deprecated_pop_frame; +} + +int +gdbarch_deprecated_store_struct_return_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_store_struct_return != NULL; +} + +void +gdbarch_deprecated_store_struct_return (struct gdbarch *gdbarch, CORE_ADDR addr, CORE_ADDR sp) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->deprecated_store_struct_return != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_store_struct_return called\n"); + gdbarch->deprecated_store_struct_return (addr, sp); +} + +void +set_gdbarch_deprecated_store_struct_return (struct gdbarch *gdbarch, + gdbarch_deprecated_store_struct_return_ftype deprecated_store_struct_return) +{ + gdbarch->deprecated_store_struct_return = deprecated_store_struct_return; +} + +int +gdbarch_return_value_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->return_value != legacy_return_value; +} + +enum return_value_convention +gdbarch_return_value (struct gdbarch *gdbarch, struct type *valtype, struct regcache *regcache, void *readbuf, const void *writebuf) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->return_value != NULL); + /* Do not check predicate: gdbarch->return_value != legacy_return_value, allow call. */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_return_value called\n"); + return gdbarch->return_value (gdbarch, valtype, regcache, readbuf, writebuf); +} + +void +set_gdbarch_return_value (struct gdbarch *gdbarch, + gdbarch_return_value_ftype return_value) +{ + gdbarch->return_value = return_value; +} + +void +gdbarch_extract_return_value (struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, void *valbuf) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->extract_return_value != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_extract_return_value called\n"); + gdbarch->extract_return_value (type, regcache, valbuf); +} + +void +set_gdbarch_extract_return_value (struct gdbarch *gdbarch, + gdbarch_extract_return_value_ftype extract_return_value) +{ + gdbarch->extract_return_value = extract_return_value; +} + +void +gdbarch_store_return_value (struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, const void *valbuf) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->store_return_value != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_store_return_value called\n"); + gdbarch->store_return_value (type, regcache, valbuf); +} + +void +set_gdbarch_store_return_value (struct gdbarch *gdbarch, + gdbarch_store_return_value_ftype store_return_value) +{ + gdbarch->store_return_value = store_return_value; +} + +void +gdbarch_deprecated_extract_return_value (struct gdbarch *gdbarch, struct type *type, char *regbuf, char *valbuf) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->deprecated_extract_return_value != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_extract_return_value called\n"); + gdbarch->deprecated_extract_return_value (type, regbuf, valbuf); +} + +void +set_gdbarch_deprecated_extract_return_value (struct gdbarch *gdbarch, + gdbarch_deprecated_extract_return_value_ftype deprecated_extract_return_value) +{ + gdbarch->deprecated_extract_return_value = deprecated_extract_return_value; +} + +void +gdbarch_deprecated_store_return_value (struct gdbarch *gdbarch, struct type *type, char *valbuf) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->deprecated_store_return_value != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_store_return_value called\n"); + gdbarch->deprecated_store_return_value (type, valbuf); +} + +void +set_gdbarch_deprecated_store_return_value (struct gdbarch *gdbarch, + gdbarch_deprecated_store_return_value_ftype deprecated_store_return_value) +{ + gdbarch->deprecated_store_return_value = deprecated_store_return_value; +} + +int +gdbarch_deprecated_use_struct_convention (struct gdbarch *gdbarch, int gcc_p, struct type *value_type) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->deprecated_use_struct_convention != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_use_struct_convention called\n"); + return gdbarch->deprecated_use_struct_convention (gcc_p, value_type); +} + +void +set_gdbarch_deprecated_use_struct_convention (struct gdbarch *gdbarch, + gdbarch_deprecated_use_struct_convention_ftype deprecated_use_struct_convention) +{ + gdbarch->deprecated_use_struct_convention = deprecated_use_struct_convention; +} + +int +gdbarch_deprecated_extract_struct_value_address_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_extract_struct_value_address != NULL; +} + +CORE_ADDR +gdbarch_deprecated_extract_struct_value_address (struct gdbarch *gdbarch, struct regcache *regcache) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->deprecated_extract_struct_value_address != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_extract_struct_value_address called\n"); + return gdbarch->deprecated_extract_struct_value_address (regcache); +} + +void +set_gdbarch_deprecated_extract_struct_value_address (struct gdbarch *gdbarch, + gdbarch_deprecated_extract_struct_value_address_ftype deprecated_extract_struct_value_address) +{ + gdbarch->deprecated_extract_struct_value_address = deprecated_extract_struct_value_address; +} + +int +gdbarch_deprecated_frame_init_saved_regs_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_frame_init_saved_regs != NULL; +} + +void +gdbarch_deprecated_frame_init_saved_regs (struct gdbarch *gdbarch, struct frame_info *frame) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->deprecated_frame_init_saved_regs != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_frame_init_saved_regs called\n"); + gdbarch->deprecated_frame_init_saved_regs (frame); +} + +void +set_gdbarch_deprecated_frame_init_saved_regs (struct gdbarch *gdbarch, + gdbarch_deprecated_frame_init_saved_regs_ftype deprecated_frame_init_saved_regs) +{ + gdbarch->deprecated_frame_init_saved_regs = deprecated_frame_init_saved_regs; +} + +int +gdbarch_deprecated_init_extra_frame_info_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_init_extra_frame_info != NULL; +} + +void +gdbarch_deprecated_init_extra_frame_info (struct gdbarch *gdbarch, int fromleaf, struct frame_info *frame) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->deprecated_init_extra_frame_info != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_init_extra_frame_info called\n"); + gdbarch->deprecated_init_extra_frame_info (fromleaf, frame); +} + +void +set_gdbarch_deprecated_init_extra_frame_info (struct gdbarch *gdbarch, + gdbarch_deprecated_init_extra_frame_info_ftype deprecated_init_extra_frame_info) +{ + gdbarch->deprecated_init_extra_frame_info = deprecated_init_extra_frame_info; +} + +CORE_ADDR +gdbarch_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR ip) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->skip_prologue != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_prologue called\n"); + return gdbarch->skip_prologue (ip); +} + +void +set_gdbarch_skip_prologue (struct gdbarch *gdbarch, + gdbarch_skip_prologue_ftype skip_prologue) +{ + gdbarch->skip_prologue = skip_prologue; +} + +int +gdbarch_inner_than (struct gdbarch *gdbarch, CORE_ADDR lhs, CORE_ADDR rhs) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->inner_than != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_inner_than called\n"); + return gdbarch->inner_than (lhs, rhs); +} + +void +set_gdbarch_inner_than (struct gdbarch *gdbarch, + gdbarch_inner_than_ftype inner_than) +{ + gdbarch->inner_than = inner_than; +} + +const unsigned char * +gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->breakpoint_from_pc != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_breakpoint_from_pc called\n"); + return gdbarch->breakpoint_from_pc (pcptr, lenptr); +} + +void +set_gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, + gdbarch_breakpoint_from_pc_ftype breakpoint_from_pc) +{ + gdbarch->breakpoint_from_pc = breakpoint_from_pc; +} + +int +gdbarch_adjust_breakpoint_address_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->adjust_breakpoint_address != NULL; +} + +CORE_ADDR +gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->adjust_breakpoint_address != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_adjust_breakpoint_address called\n"); + return gdbarch->adjust_breakpoint_address (gdbarch, bpaddr); +} + +void +set_gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch, + gdbarch_adjust_breakpoint_address_ftype adjust_breakpoint_address) +{ + gdbarch->adjust_breakpoint_address = adjust_breakpoint_address; +} + +int +gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, CORE_ADDR addr, char *contents_cache) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->memory_insert_breakpoint != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_memory_insert_breakpoint called\n"); + return gdbarch->memory_insert_breakpoint (addr, contents_cache); +} + +void +set_gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, + gdbarch_memory_insert_breakpoint_ftype memory_insert_breakpoint) +{ + gdbarch->memory_insert_breakpoint = memory_insert_breakpoint; +} + +int +gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, CORE_ADDR addr, char *contents_cache) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->memory_remove_breakpoint != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_memory_remove_breakpoint called\n"); + return gdbarch->memory_remove_breakpoint (addr, contents_cache); +} + +void +set_gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, + gdbarch_memory_remove_breakpoint_ftype memory_remove_breakpoint) +{ + gdbarch->memory_remove_breakpoint = memory_remove_breakpoint; +} + +CORE_ADDR +gdbarch_decr_pc_after_break (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + /* Skip verify of decr_pc_after_break, invalid_p == 0 */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_decr_pc_after_break called\n"); + return gdbarch->decr_pc_after_break; +} + +void +set_gdbarch_decr_pc_after_break (struct gdbarch *gdbarch, + CORE_ADDR decr_pc_after_break) +{ + gdbarch->decr_pc_after_break = decr_pc_after_break; +} + +CORE_ADDR +gdbarch_deprecated_function_start_offset (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + /* Skip verify of deprecated_function_start_offset, invalid_p == 0 */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_function_start_offset called\n"); + return gdbarch->deprecated_function_start_offset; +} + +void +set_gdbarch_deprecated_function_start_offset (struct gdbarch *gdbarch, + CORE_ADDR deprecated_function_start_offset) +{ + gdbarch->deprecated_function_start_offset = deprecated_function_start_offset; +} + +void +gdbarch_remote_translate_xfer_address (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->remote_translate_xfer_address != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_remote_translate_xfer_address called\n"); + gdbarch->remote_translate_xfer_address (gdbarch, regcache, gdb_addr, gdb_len, rem_addr, rem_len); +} + +void +set_gdbarch_remote_translate_xfer_address (struct gdbarch *gdbarch, + gdbarch_remote_translate_xfer_address_ftype remote_translate_xfer_address) +{ + gdbarch->remote_translate_xfer_address = remote_translate_xfer_address; +} + +CORE_ADDR +gdbarch_frame_args_skip (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + /* Skip verify of frame_args_skip, invalid_p == 0 */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_args_skip called\n"); + return gdbarch->frame_args_skip; +} + +void +set_gdbarch_frame_args_skip (struct gdbarch *gdbarch, + CORE_ADDR frame_args_skip) +{ + gdbarch->frame_args_skip = frame_args_skip; +} + +int +gdbarch_deprecated_frameless_function_invocation_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_frameless_function_invocation != NULL; +} + +int +gdbarch_deprecated_frameless_function_invocation (struct gdbarch *gdbarch, struct frame_info *fi) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->deprecated_frameless_function_invocation != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_frameless_function_invocation called\n"); + return gdbarch->deprecated_frameless_function_invocation (fi); +} + +void +set_gdbarch_deprecated_frameless_function_invocation (struct gdbarch *gdbarch, + gdbarch_deprecated_frameless_function_invocation_ftype deprecated_frameless_function_invocation) +{ + gdbarch->deprecated_frameless_function_invocation = deprecated_frameless_function_invocation; +} + +int +gdbarch_deprecated_frame_chain_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_frame_chain != NULL; +} + +CORE_ADDR +gdbarch_deprecated_frame_chain (struct gdbarch *gdbarch, struct frame_info *frame) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->deprecated_frame_chain != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_frame_chain called\n"); + return gdbarch->deprecated_frame_chain (frame); +} + +void +set_gdbarch_deprecated_frame_chain (struct gdbarch *gdbarch, + gdbarch_deprecated_frame_chain_ftype deprecated_frame_chain) +{ + gdbarch->deprecated_frame_chain = deprecated_frame_chain; +} + +int +gdbarch_deprecated_frame_chain_valid_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_frame_chain_valid != NULL; +} + +int +gdbarch_deprecated_frame_chain_valid (struct gdbarch *gdbarch, CORE_ADDR chain, struct frame_info *thisframe) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->deprecated_frame_chain_valid != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_frame_chain_valid called\n"); + return gdbarch->deprecated_frame_chain_valid (chain, thisframe); +} + +void +set_gdbarch_deprecated_frame_chain_valid (struct gdbarch *gdbarch, + gdbarch_deprecated_frame_chain_valid_ftype deprecated_frame_chain_valid) +{ + gdbarch->deprecated_frame_chain_valid = deprecated_frame_chain_valid; +} + +int +gdbarch_deprecated_frame_saved_pc_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_frame_saved_pc != NULL; +} + +CORE_ADDR +gdbarch_deprecated_frame_saved_pc (struct gdbarch *gdbarch, struct frame_info *fi) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->deprecated_frame_saved_pc != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_frame_saved_pc called\n"); + return gdbarch->deprecated_frame_saved_pc (fi); +} + +void +set_gdbarch_deprecated_frame_saved_pc (struct gdbarch *gdbarch, + gdbarch_deprecated_frame_saved_pc_ftype deprecated_frame_saved_pc) +{ + gdbarch->deprecated_frame_saved_pc = deprecated_frame_saved_pc; +} + +int +gdbarch_unwind_pc_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->unwind_pc != NULL; +} + +CORE_ADDR +gdbarch_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->unwind_pc != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_unwind_pc called\n"); + return gdbarch->unwind_pc (gdbarch, next_frame); +} + +void +set_gdbarch_unwind_pc (struct gdbarch *gdbarch, + gdbarch_unwind_pc_ftype unwind_pc) +{ + gdbarch->unwind_pc = unwind_pc; +} + +int +gdbarch_unwind_sp_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->unwind_sp != NULL; +} + +CORE_ADDR +gdbarch_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->unwind_sp != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_unwind_sp called\n"); + return gdbarch->unwind_sp (gdbarch, next_frame); +} + +void +set_gdbarch_unwind_sp (struct gdbarch *gdbarch, + gdbarch_unwind_sp_ftype unwind_sp) +{ + gdbarch->unwind_sp = unwind_sp; +} + +int +gdbarch_deprecated_frame_args_address_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_frame_args_address != get_frame_base; +} + +CORE_ADDR +gdbarch_deprecated_frame_args_address (struct gdbarch *gdbarch, struct frame_info *fi) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->deprecated_frame_args_address != NULL); + /* Do not check predicate: gdbarch->deprecated_frame_args_address != get_frame_base, allow call. */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_frame_args_address called\n"); + return gdbarch->deprecated_frame_args_address (fi); +} + +void +set_gdbarch_deprecated_frame_args_address (struct gdbarch *gdbarch, + gdbarch_deprecated_frame_args_address_ftype deprecated_frame_args_address) +{ + gdbarch->deprecated_frame_args_address = deprecated_frame_args_address; +} + +int +gdbarch_deprecated_frame_locals_address_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_frame_locals_address != get_frame_base; +} + +CORE_ADDR +gdbarch_deprecated_frame_locals_address (struct gdbarch *gdbarch, struct frame_info *fi) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->deprecated_frame_locals_address != NULL); + /* Do not check predicate: gdbarch->deprecated_frame_locals_address != get_frame_base, allow call. */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_frame_locals_address called\n"); + return gdbarch->deprecated_frame_locals_address (fi); +} + +void +set_gdbarch_deprecated_frame_locals_address (struct gdbarch *gdbarch, + gdbarch_deprecated_frame_locals_address_ftype deprecated_frame_locals_address) +{ + gdbarch->deprecated_frame_locals_address = deprecated_frame_locals_address; +} + +int +gdbarch_deprecated_saved_pc_after_call_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_saved_pc_after_call != NULL; +} + +CORE_ADDR +gdbarch_deprecated_saved_pc_after_call (struct gdbarch *gdbarch, struct frame_info *frame) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->deprecated_saved_pc_after_call != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_saved_pc_after_call called\n"); + return gdbarch->deprecated_saved_pc_after_call (frame); +} + +void +set_gdbarch_deprecated_saved_pc_after_call (struct gdbarch *gdbarch, + gdbarch_deprecated_saved_pc_after_call_ftype deprecated_saved_pc_after_call) +{ + gdbarch->deprecated_saved_pc_after_call = deprecated_saved_pc_after_call; +} + +int +gdbarch_frame_num_args_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->frame_num_args != NULL; +} + +int +gdbarch_frame_num_args (struct gdbarch *gdbarch, struct frame_info *frame) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->frame_num_args != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_num_args called\n"); + return gdbarch->frame_num_args (frame); +} + +void +set_gdbarch_frame_num_args (struct gdbarch *gdbarch, + gdbarch_frame_num_args_ftype frame_num_args) +{ + gdbarch->frame_num_args = frame_num_args; +} + +int +gdbarch_deprecated_stack_align_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_stack_align != NULL; +} + +CORE_ADDR +gdbarch_deprecated_stack_align (struct gdbarch *gdbarch, CORE_ADDR sp) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->deprecated_stack_align != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_stack_align called\n"); + return gdbarch->deprecated_stack_align (sp); +} + +void +set_gdbarch_deprecated_stack_align (struct gdbarch *gdbarch, + gdbarch_deprecated_stack_align_ftype deprecated_stack_align) +{ + gdbarch->deprecated_stack_align = deprecated_stack_align; +} + +int +gdbarch_frame_align_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->frame_align != NULL; +} + +CORE_ADDR +gdbarch_frame_align (struct gdbarch *gdbarch, CORE_ADDR address) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->frame_align != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_align called\n"); + return gdbarch->frame_align (gdbarch, address); +} + +void +set_gdbarch_frame_align (struct gdbarch *gdbarch, + gdbarch_frame_align_ftype frame_align) +{ + gdbarch->frame_align = frame_align; +} + +int +gdbarch_deprecated_reg_struct_has_addr_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_reg_struct_has_addr != NULL; +} + +int +gdbarch_deprecated_reg_struct_has_addr (struct gdbarch *gdbarch, int gcc_p, struct type *type) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->deprecated_reg_struct_has_addr != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_reg_struct_has_addr called\n"); + return gdbarch->deprecated_reg_struct_has_addr (gcc_p, type); +} + +void +set_gdbarch_deprecated_reg_struct_has_addr (struct gdbarch *gdbarch, + gdbarch_deprecated_reg_struct_has_addr_ftype deprecated_reg_struct_has_addr) +{ + gdbarch->deprecated_reg_struct_has_addr = deprecated_reg_struct_has_addr; +} + +int +gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->stabs_argument_has_addr != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_stabs_argument_has_addr called\n"); + return gdbarch->stabs_argument_has_addr (gdbarch, type); +} + +void +set_gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch, + gdbarch_stabs_argument_has_addr_ftype stabs_argument_has_addr) +{ + gdbarch->stabs_argument_has_addr = stabs_argument_has_addr; +} + +int +gdbarch_frame_red_zone_size (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_red_zone_size called\n"); + return gdbarch->frame_red_zone_size; +} + +void +set_gdbarch_frame_red_zone_size (struct gdbarch *gdbarch, + int frame_red_zone_size) +{ + gdbarch->frame_red_zone_size = frame_red_zone_size; +} + +const struct floatformat * +gdbarch_float_format (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_float_format called\n"); + return gdbarch->float_format; +} + +void +set_gdbarch_float_format (struct gdbarch *gdbarch, + const struct floatformat * float_format) +{ + gdbarch->float_format = float_format; +} + +const struct floatformat * +gdbarch_double_format (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_double_format called\n"); + return gdbarch->double_format; +} + +void +set_gdbarch_double_format (struct gdbarch *gdbarch, + const struct floatformat * double_format) +{ + gdbarch->double_format = double_format; +} + +const struct floatformat * +gdbarch_long_double_format (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_long_double_format called\n"); + return gdbarch->long_double_format; +} + +void +set_gdbarch_long_double_format (struct gdbarch *gdbarch, + const struct floatformat * long_double_format) +{ + gdbarch->long_double_format = long_double_format; +} + +CORE_ADDR +gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr, struct target_ops *targ) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->convert_from_func_ptr_addr != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_convert_from_func_ptr_addr called\n"); + return gdbarch->convert_from_func_ptr_addr (gdbarch, addr, targ); +} + +void +set_gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, + gdbarch_convert_from_func_ptr_addr_ftype convert_from_func_ptr_addr) +{ + gdbarch->convert_from_func_ptr_addr = convert_from_func_ptr_addr; +} + +CORE_ADDR +gdbarch_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->addr_bits_remove != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_addr_bits_remove called\n"); + return gdbarch->addr_bits_remove (addr); +} + +void +set_gdbarch_addr_bits_remove (struct gdbarch *gdbarch, + gdbarch_addr_bits_remove_ftype addr_bits_remove) +{ + gdbarch->addr_bits_remove = addr_bits_remove; +} + +CORE_ADDR +gdbarch_smash_text_address (struct gdbarch *gdbarch, CORE_ADDR addr) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->smash_text_address != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_smash_text_address called\n"); + return gdbarch->smash_text_address (addr); +} + +void +set_gdbarch_smash_text_address (struct gdbarch *gdbarch, + gdbarch_smash_text_address_ftype smash_text_address) +{ + gdbarch->smash_text_address = smash_text_address; +} + +int +gdbarch_software_single_step_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->software_single_step != NULL; +} + +void +gdbarch_software_single_step (struct gdbarch *gdbarch, enum target_signal sig, int insert_breakpoints_p) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->software_single_step != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_software_single_step called\n"); + gdbarch->software_single_step (sig, insert_breakpoints_p); +} + +void +set_gdbarch_software_single_step (struct gdbarch *gdbarch, + gdbarch_software_single_step_ftype software_single_step) +{ + gdbarch->software_single_step = software_single_step; +} + +int +gdbarch_print_insn (struct gdbarch *gdbarch, bfd_vma vma, struct disassemble_info *info) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->print_insn != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_print_insn called\n"); + return gdbarch->print_insn (vma, info); +} + +void +set_gdbarch_print_insn (struct gdbarch *gdbarch, + gdbarch_print_insn_ftype print_insn) +{ + gdbarch->print_insn = print_insn; +} + +CORE_ADDR +gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, CORE_ADDR pc) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->skip_trampoline_code != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_trampoline_code called\n"); + return gdbarch->skip_trampoline_code (pc); +} + +void +set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, + gdbarch_skip_trampoline_code_ftype skip_trampoline_code) +{ + gdbarch->skip_trampoline_code = skip_trampoline_code; +} + +CORE_ADDR +gdbarch_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->skip_solib_resolver != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_solib_resolver called\n"); + return gdbarch->skip_solib_resolver (gdbarch, pc); +} + +void +set_gdbarch_skip_solib_resolver (struct gdbarch *gdbarch, + gdbarch_skip_solib_resolver_ftype skip_solib_resolver) +{ + gdbarch->skip_solib_resolver = skip_solib_resolver; +} + +int +gdbarch_in_solib_call_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, char *name) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->in_solib_call_trampoline != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_in_solib_call_trampoline called\n"); + return gdbarch->in_solib_call_trampoline (pc, name); +} + +void +set_gdbarch_in_solib_call_trampoline (struct gdbarch *gdbarch, + gdbarch_in_solib_call_trampoline_ftype in_solib_call_trampoline) +{ + gdbarch->in_solib_call_trampoline = in_solib_call_trampoline; +} + +int +gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, char *name) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->in_solib_return_trampoline != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_in_solib_return_trampoline called\n"); + return gdbarch->in_solib_return_trampoline (pc, name); +} + +void +set_gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, + gdbarch_in_solib_return_trampoline_ftype in_solib_return_trampoline) +{ + gdbarch->in_solib_return_trampoline = in_solib_return_trampoline; +} + +int +gdbarch_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR addr) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->in_function_epilogue_p != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_in_function_epilogue_p called\n"); + return gdbarch->in_function_epilogue_p (gdbarch, addr); +} + +void +set_gdbarch_in_function_epilogue_p (struct gdbarch *gdbarch, + gdbarch_in_function_epilogue_p_ftype in_function_epilogue_p) +{ + gdbarch->in_function_epilogue_p = in_function_epilogue_p; +} + +char * +gdbarch_construct_inferior_arguments (struct gdbarch *gdbarch, int argc, char **argv) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->construct_inferior_arguments != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_construct_inferior_arguments called\n"); + return gdbarch->construct_inferior_arguments (gdbarch, argc, argv); +} + +void +set_gdbarch_construct_inferior_arguments (struct gdbarch *gdbarch, + gdbarch_construct_inferior_arguments_ftype construct_inferior_arguments) +{ + gdbarch->construct_inferior_arguments = construct_inferior_arguments; +} + +void +gdbarch_elf_make_msymbol_special (struct gdbarch *gdbarch, asymbol *sym, struct minimal_symbol *msym) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->elf_make_msymbol_special != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_elf_make_msymbol_special called\n"); + gdbarch->elf_make_msymbol_special (sym, msym); +} + +void +set_gdbarch_elf_make_msymbol_special (struct gdbarch *gdbarch, + gdbarch_elf_make_msymbol_special_ftype elf_make_msymbol_special) +{ + gdbarch->elf_make_msymbol_special = elf_make_msymbol_special; +} + +void +gdbarch_coff_make_msymbol_special (struct gdbarch *gdbarch, int val, struct minimal_symbol *msym) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->coff_make_msymbol_special != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_coff_make_msymbol_special called\n"); + gdbarch->coff_make_msymbol_special (val, msym); +} + +void +set_gdbarch_coff_make_msymbol_special (struct gdbarch *gdbarch, + gdbarch_coff_make_msymbol_special_ftype coff_make_msymbol_special) +{ + gdbarch->coff_make_msymbol_special = coff_make_msymbol_special; +} + +const char * +gdbarch_name_of_malloc (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + /* Skip verify of name_of_malloc, invalid_p == 0 */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_name_of_malloc called\n"); + return gdbarch->name_of_malloc; +} + +void +set_gdbarch_name_of_malloc (struct gdbarch *gdbarch, + const char * name_of_malloc) +{ + gdbarch->name_of_malloc = name_of_malloc; +} + +int +gdbarch_cannot_step_breakpoint (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + /* Skip verify of cannot_step_breakpoint, invalid_p == 0 */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_cannot_step_breakpoint called\n"); + return gdbarch->cannot_step_breakpoint; +} + +void +set_gdbarch_cannot_step_breakpoint (struct gdbarch *gdbarch, + int cannot_step_breakpoint) +{ + gdbarch->cannot_step_breakpoint = cannot_step_breakpoint; +} + +int +gdbarch_have_nonsteppable_watchpoint (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + /* Skip verify of have_nonsteppable_watchpoint, invalid_p == 0 */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_have_nonsteppable_watchpoint called\n"); + return gdbarch->have_nonsteppable_watchpoint; +} + +void +set_gdbarch_have_nonsteppable_watchpoint (struct gdbarch *gdbarch, + int have_nonsteppable_watchpoint) +{ + gdbarch->have_nonsteppable_watchpoint = have_nonsteppable_watchpoint; +} + +int +gdbarch_address_class_type_flags_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->address_class_type_flags != NULL; +} + +int +gdbarch_address_class_type_flags (struct gdbarch *gdbarch, int byte_size, int dwarf2_addr_class) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->address_class_type_flags != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_address_class_type_flags called\n"); + return gdbarch->address_class_type_flags (byte_size, dwarf2_addr_class); +} + +void +set_gdbarch_address_class_type_flags (struct gdbarch *gdbarch, + gdbarch_address_class_type_flags_ftype address_class_type_flags) +{ + gdbarch->address_class_type_flags = address_class_type_flags; +} + +int +gdbarch_address_class_type_flags_to_name_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->address_class_type_flags_to_name != NULL; +} + +const char * +gdbarch_address_class_type_flags_to_name (struct gdbarch *gdbarch, int type_flags) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->address_class_type_flags_to_name != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_address_class_type_flags_to_name called\n"); + return gdbarch->address_class_type_flags_to_name (gdbarch, type_flags); +} + +void +set_gdbarch_address_class_type_flags_to_name (struct gdbarch *gdbarch, + gdbarch_address_class_type_flags_to_name_ftype address_class_type_flags_to_name) +{ + gdbarch->address_class_type_flags_to_name = address_class_type_flags_to_name; +} + +int +gdbarch_address_class_name_to_type_flags_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->address_class_name_to_type_flags != NULL; +} + +int +gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarch, const char *name, int *type_flags_ptr) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->address_class_name_to_type_flags != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_address_class_name_to_type_flags called\n"); + return gdbarch->address_class_name_to_type_flags (gdbarch, name, type_flags_ptr); +} + +void +set_gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarch, + gdbarch_address_class_name_to_type_flags_ftype address_class_name_to_type_flags) +{ + gdbarch->address_class_name_to_type_flags = address_class_name_to_type_flags; +} + +int +gdbarch_register_reggroup_p (struct gdbarch *gdbarch, int regnum, struct reggroup *reggroup) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->register_reggroup_p != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_register_reggroup_p called\n"); + return gdbarch->register_reggroup_p (gdbarch, regnum, reggroup); +} + +void +set_gdbarch_register_reggroup_p (struct gdbarch *gdbarch, + gdbarch_register_reggroup_p_ftype register_reggroup_p) +{ + gdbarch->register_reggroup_p = register_reggroup_p; +} + +int +gdbarch_fetch_pointer_argument_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->fetch_pointer_argument != NULL; +} + +CORE_ADDR +gdbarch_fetch_pointer_argument (struct gdbarch *gdbarch, struct frame_info *frame, int argi, struct type *type) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->fetch_pointer_argument != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_fetch_pointer_argument called\n"); + return gdbarch->fetch_pointer_argument (frame, argi, type); +} + +void +set_gdbarch_fetch_pointer_argument (struct gdbarch *gdbarch, + gdbarch_fetch_pointer_argument_ftype fetch_pointer_argument) +{ + gdbarch->fetch_pointer_argument = fetch_pointer_argument; +} + +int +gdbarch_regset_from_core_section_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->regset_from_core_section != NULL; +} + +const struct regset * +gdbarch_regset_from_core_section (struct gdbarch *gdbarch, const char *sect_name, size_t sect_size) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->regset_from_core_section != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_regset_from_core_section called\n"); + return gdbarch->regset_from_core_section (gdbarch, sect_name, sect_size); +} + +void +set_gdbarch_regset_from_core_section (struct gdbarch *gdbarch, + gdbarch_regset_from_core_section_ftype regset_from_core_section) +{ + gdbarch->regset_from_core_section = regset_from_core_section; +} + +const struct regset * +gdbarch_xregs_regset (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_xregs_regset called\n"); + return gdbarch->xregs_regset; +} + +void +set_gdbarch_xregs_regset (struct gdbarch *gdbarch, + const struct regset * xregs_regset) +{ + gdbarch->xregs_regset = xregs_regset; +} + +int +gdbarch_xregs_size (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_xregs_size called\n"); + return gdbarch->xregs_size; +} + +void +set_gdbarch_xregs_size (struct gdbarch *gdbarch, + int xregs_size) +{ + gdbarch->xregs_size = xregs_size; +} + +const char * +gdbarch_xregs_name (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_xregs_name called\n"); + return gdbarch->xregs_name; +} + +void +set_gdbarch_xregs_name (struct gdbarch *gdbarch, + const char * xregs_name) +{ + gdbarch->xregs_name = xregs_name; +} + + +/* Keep a registry of per-architecture data-pointers required by GDB + modules. */ + +struct gdbarch_data +{ + unsigned index; + int init_p; + gdbarch_data_pre_init_ftype *pre_init; + gdbarch_data_post_init_ftype *post_init; +}; + +struct gdbarch_data_registration +{ + struct gdbarch_data *data; + struct gdbarch_data_registration *next; +}; + +struct gdbarch_data_registry +{ + unsigned nr; + struct gdbarch_data_registration *registrations; +}; + +struct gdbarch_data_registry gdbarch_data_registry = +{ + 0, NULL, +}; + +static struct gdbarch_data * +gdbarch_data_register (gdbarch_data_pre_init_ftype *pre_init, + gdbarch_data_post_init_ftype *post_init) +{ + struct gdbarch_data_registration **curr; + /* Append the new registraration. */ + for (curr = &gdbarch_data_registry.registrations; + (*curr) != NULL; + curr = &(*curr)->next); + (*curr) = XMALLOC (struct gdbarch_data_registration); + (*curr)->next = NULL; + (*curr)->data = XMALLOC (struct gdbarch_data); + (*curr)->data->index = gdbarch_data_registry.nr++; + (*curr)->data->pre_init = pre_init; + (*curr)->data->post_init = post_init; + (*curr)->data->init_p = 1; + return (*curr)->data; +} + +struct gdbarch_data * +gdbarch_data_register_pre_init (gdbarch_data_pre_init_ftype *pre_init) +{ + return gdbarch_data_register (pre_init, NULL); +} + +struct gdbarch_data * +gdbarch_data_register_post_init (gdbarch_data_post_init_ftype *post_init) +{ + return gdbarch_data_register (NULL, post_init); +} + +/* Create/delete the gdbarch data vector. */ + +static void +alloc_gdbarch_data (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch->data == NULL); + gdbarch->nr_data = gdbarch_data_registry.nr; + gdbarch->data = GDBARCH_OBSTACK_CALLOC (gdbarch, gdbarch->nr_data, void *); +} + +/* Initialize the current value of the specified per-architecture + data-pointer. */ + +void +deprecated_set_gdbarch_data (struct gdbarch *gdbarch, + struct gdbarch_data *data, + void *pointer) +{ + gdb_assert (data->index < gdbarch->nr_data); + gdb_assert (gdbarch->data[data->index] == NULL); + gdb_assert (data->pre_init == NULL); + gdbarch->data[data->index] = pointer; +} + +/* Return the current value of the specified per-architecture + data-pointer. */ + +void * +gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *data) +{ + gdb_assert (data->index < gdbarch->nr_data); + if (gdbarch->data[data->index] == NULL) + { + /* The data-pointer isn't initialized, call init() to get a + value. */ + if (data->pre_init != NULL) + /* Mid architecture creation: pass just the obstack, and not + the entire architecture, as that way it isn't possible for + pre-init code to refer to undefined architecture + fields. */ + gdbarch->data[data->index] = data->pre_init (gdbarch->obstack); + else if (gdbarch->initialized_p + && data->post_init != NULL) + /* Post architecture creation: pass the entire architecture + (as all fields are valid), but be careful to also detect + recursive references. */ + { + gdb_assert (data->init_p); + data->init_p = 0; + gdbarch->data[data->index] = data->post_init (gdbarch); + data->init_p = 1; + } + else + /* The architecture initialization hasn't completed - punt - + hope that the caller knows what they are doing. Once + deprecated_set_gdbarch_data has been initialized, this can be + changed to an internal error. */ + return NULL; + gdb_assert (gdbarch->data[data->index] != NULL); + } + return gdbarch->data[data->index]; +} + + + +/* Keep a registry of swapped data required by GDB modules. */ + +struct gdbarch_swap +{ + void *swap; + struct gdbarch_swap_registration *source; + struct gdbarch_swap *next; +}; + +struct gdbarch_swap_registration +{ + void *data; + unsigned long sizeof_data; + gdbarch_swap_ftype *init; + struct gdbarch_swap_registration *next; +}; + +struct gdbarch_swap_registry +{ + int nr; + struct gdbarch_swap_registration *registrations; +}; + +struct gdbarch_swap_registry gdbarch_swap_registry = +{ + 0, NULL, +}; + +void +deprecated_register_gdbarch_swap (void *data, + unsigned long sizeof_data, + gdbarch_swap_ftype *init) +{ + struct gdbarch_swap_registration **rego; + for (rego = &gdbarch_swap_registry.registrations; + (*rego) != NULL; + rego = &(*rego)->next); + (*rego) = XMALLOC (struct gdbarch_swap_registration); + (*rego)->next = NULL; + (*rego)->init = init; + (*rego)->data = data; + (*rego)->sizeof_data = sizeof_data; +} + +static void +current_gdbarch_swap_init_hack (void) +{ + struct gdbarch_swap_registration *rego; + struct gdbarch_swap **curr = ¤t_gdbarch->swap; + for (rego = gdbarch_swap_registry.registrations; + rego != NULL; + rego = rego->next) + { + if (rego->data != NULL) + { + (*curr) = GDBARCH_OBSTACK_ZALLOC (current_gdbarch, + struct gdbarch_swap); + (*curr)->source = rego; + (*curr)->swap = gdbarch_obstack_zalloc (current_gdbarch, + rego->sizeof_data); + (*curr)->next = NULL; + curr = &(*curr)->next; + } + if (rego->init != NULL) + rego->init (); + } +} + +static struct gdbarch * +current_gdbarch_swap_out_hack (void) +{ + struct gdbarch *old_gdbarch = current_gdbarch; + struct gdbarch_swap *curr; + + gdb_assert (old_gdbarch != NULL); + for (curr = old_gdbarch->swap; + curr != NULL; + curr = curr->next) + { + memcpy (curr->swap, curr->source->data, curr->source->sizeof_data); + memset (curr->source->data, 0, curr->source->sizeof_data); + } + current_gdbarch = NULL; + return old_gdbarch; +} + +static void +current_gdbarch_swap_in_hack (struct gdbarch *new_gdbarch) +{ + struct gdbarch_swap *curr; + + gdb_assert (current_gdbarch == NULL); + for (curr = new_gdbarch->swap; + curr != NULL; + curr = curr->next) + memcpy (curr->source->data, curr->swap, curr->source->sizeof_data); + current_gdbarch = new_gdbarch; +} + + +/* Keep a registry of the architectures known by GDB. */ + +struct gdbarch_registration +{ + enum bfd_architecture bfd_architecture; + gdbarch_init_ftype *init; + gdbarch_dump_tdep_ftype *dump_tdep; + struct gdbarch_list *arches; + struct gdbarch_registration *next; +}; + +static struct gdbarch_registration *gdbarch_registry = NULL; + +static void +append_name (const char ***buf, int *nr, const char *name) +{ + *buf = xrealloc (*buf, sizeof (char**) * (*nr + 1)); + (*buf)[*nr] = name; + *nr += 1; +} + +const char ** +gdbarch_printable_names (void) +{ + /* Accumulate a list of names based on the registed list of + architectures. */ + enum bfd_architecture a; + int nr_arches = 0; + const char **arches = NULL; + struct gdbarch_registration *rego; + for (rego = gdbarch_registry; + rego != NULL; + rego = rego->next) + { + const struct bfd_arch_info *ap; + ap = bfd_lookup_arch (rego->bfd_architecture, 0); + if (ap == NULL) + internal_error (__FILE__, __LINE__, + "gdbarch_architecture_names: multi-arch unknown"); + do + { + append_name (&arches, &nr_arches, ap->printable_name); + ap = ap->next; + } + while (ap != NULL); + } + append_name (&arches, &nr_arches, NULL); + return arches; +} + + +void +gdbarch_register (enum bfd_architecture bfd_architecture, + gdbarch_init_ftype *init, + gdbarch_dump_tdep_ftype *dump_tdep) +{ + struct gdbarch_registration **curr; + const struct bfd_arch_info *bfd_arch_info; + /* Check that BFD recognizes this architecture */ + bfd_arch_info = bfd_lookup_arch (bfd_architecture, 0); + if (bfd_arch_info == NULL) + { + internal_error (__FILE__, __LINE__, + "gdbarch: Attempt to register unknown architecture (%d)", + bfd_architecture); + } + /* Check that we haven't seen this architecture before */ + for (curr = &gdbarch_registry; + (*curr) != NULL; + curr = &(*curr)->next) + { + if (bfd_architecture == (*curr)->bfd_architecture) + internal_error (__FILE__, __LINE__, + "gdbarch: Duplicate registraration of architecture (%s)", + bfd_arch_info->printable_name); + } + /* log it */ + if (gdbarch_debug) + fprintf_unfiltered (gdb_stdlog, "register_gdbarch_init (%s, 0x%08lx)\n", + bfd_arch_info->printable_name, + (long) init); + /* Append it */ + (*curr) = XMALLOC (struct gdbarch_registration); + (*curr)->bfd_architecture = bfd_architecture; + (*curr)->init = init; + (*curr)->dump_tdep = dump_tdep; + (*curr)->arches = NULL; + (*curr)->next = NULL; +} + +void +register_gdbarch_init (enum bfd_architecture bfd_architecture, + gdbarch_init_ftype *init) +{ + gdbarch_register (bfd_architecture, init, NULL); +} + + +/* Look for an architecture using gdbarch_info. Base search on only + BFD_ARCH_INFO and BYTE_ORDER. */ + +struct gdbarch_list * +gdbarch_list_lookup_by_info (struct gdbarch_list *arches, + const struct gdbarch_info *info) +{ + for (; arches != NULL; arches = arches->next) + { + if (info->bfd_arch_info != arches->gdbarch->bfd_arch_info) + continue; + if (info->byte_order != arches->gdbarch->byte_order) + continue; + if (info->osabi != arches->gdbarch->osabi) + continue; + return arches; + } + return NULL; +} + + +/* Find an architecture that matches the specified INFO. Create a new + architecture if needed. Return that new architecture. Assumes + that there is no current architecture. */ + +static struct gdbarch * +find_arch_by_info (struct gdbarch *old_gdbarch, struct gdbarch_info info) +{ + struct gdbarch *new_gdbarch; + struct gdbarch_registration *rego; + + /* The existing architecture has been swapped out - all this code + works from a clean slate. */ + gdb_assert (current_gdbarch == NULL); + + /* Fill in missing parts of the INFO struct using a number of + sources: "set ..."; INFOabfd supplied; and the existing + architecture. */ + gdbarch_info_fill (old_gdbarch, &info); + + /* Must have found some sort of architecture. */ + gdb_assert (info.bfd_arch_info != NULL); + + if (gdbarch_debug) + { + fprintf_unfiltered (gdb_stdlog, + "find_arch_by_info: info.bfd_arch_info %s\n", + (info.bfd_arch_info != NULL + ? info.bfd_arch_info->printable_name + : "(null)")); + fprintf_unfiltered (gdb_stdlog, + "find_arch_by_info: info.byte_order %d (%s)\n", + info.byte_order, + (info.byte_order == BFD_ENDIAN_BIG ? "big" + : info.byte_order == BFD_ENDIAN_LITTLE ? "little" + : "default")); + fprintf_unfiltered (gdb_stdlog, + "find_arch_by_info: info.osabi %d (%s)\n", + info.osabi, gdbarch_osabi_name (info.osabi)); + fprintf_unfiltered (gdb_stdlog, + "find_arch_by_info: info.abfd 0x%lx\n", + (long) info.abfd); + fprintf_unfiltered (gdb_stdlog, + "find_arch_by_info: info.tdep_info 0x%lx\n", + (long) info.tdep_info); + } + + /* Find the tdep code that knows about this architecture. */ + for (rego = gdbarch_registry; + rego != NULL; + rego = rego->next) + if (rego->bfd_architecture == info.bfd_arch_info->arch) + break; + if (rego == NULL) + { + if (gdbarch_debug) + fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: " + "No matching architecture\n"); + return 0; + } + + /* Ask the tdep code for an architecture that matches "info". */ + new_gdbarch = rego->init (info, rego->arches); + + /* Did the tdep code like it? No. Reject the change and revert to + the old architecture. */ + if (new_gdbarch == NULL) + { + if (gdbarch_debug) + fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: " + "Target rejected architecture\n"); + return NULL; + } + + /* Is this a pre-existing architecture (as determined by already + being initialized)? Move it to the front of the architecture + list (keeping the list sorted Most Recently Used). */ + if (new_gdbarch->initialized_p) + { + struct gdbarch_list **list; + struct gdbarch_list *this; + if (gdbarch_debug) + fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: " + "Previous architecture 0x%08lx (%s) selected\n", + (long) new_gdbarch, + new_gdbarch->bfd_arch_info->printable_name); + /* Find the existing arch in the list. */ + for (list = ®o->arches; + (*list) != NULL && (*list)->gdbarch != new_gdbarch; + list = &(*list)->next); + /* It had better be in the list of architectures. */ + gdb_assert ((*list) != NULL && (*list)->gdbarch == new_gdbarch); + /* Unlink THIS. */ + this = (*list); + (*list) = this->next; + /* Insert THIS at the front. */ + this->next = rego->arches; + rego->arches = this; + /* Return it. */ + return new_gdbarch; + } + + /* It's a new architecture. */ + if (gdbarch_debug) + fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: " + "New architecture 0x%08lx (%s) selected\n", + (long) new_gdbarch, + new_gdbarch->bfd_arch_info->printable_name); + + /* Insert the new architecture into the front of the architecture + list (keep the list sorted Most Recently Used). */ + { + struct gdbarch_list *this = XMALLOC (struct gdbarch_list); + this->next = rego->arches; + this->gdbarch = new_gdbarch; + rego->arches = this; + } + + /* Check that the newly installed architecture is valid. Plug in + any post init values. */ + new_gdbarch->dump_tdep = rego->dump_tdep; + verify_gdbarch (new_gdbarch); + new_gdbarch->initialized_p = 1; + + /* Initialize any per-architecture swap areas. This phase requires + a valid global CURRENT_GDBARCH. Set it momentarially, and then + swap the entire architecture out. */ + current_gdbarch = new_gdbarch; + current_gdbarch_swap_init_hack (); + current_gdbarch_swap_out_hack (); + + if (gdbarch_debug) + gdbarch_dump (new_gdbarch, gdb_stdlog); + + return new_gdbarch; +} + +struct gdbarch * +gdbarch_find_by_info (struct gdbarch_info info) +{ + /* Save the previously selected architecture, setting the global to + NULL. This stops things like gdbarch->init() trying to use the + previous architecture's configuration. The previous architecture + may not even be of the same architecture family. The most recent + architecture of the same family is found at the head of the + rego->arches list. */ + struct gdbarch *old_gdbarch = current_gdbarch_swap_out_hack (); + + /* Find the specified architecture. */ + struct gdbarch *new_gdbarch = find_arch_by_info (old_gdbarch, info); + + /* Restore the existing architecture. */ + gdb_assert (current_gdbarch == NULL); + current_gdbarch_swap_in_hack (old_gdbarch); + + return new_gdbarch; +} + +/* Make the specified architecture current, swapping the existing one + out. */ + +void +deprecated_current_gdbarch_select_hack (struct gdbarch *new_gdbarch) +{ + gdb_assert (new_gdbarch != NULL); + gdb_assert (current_gdbarch != NULL); + gdb_assert (new_gdbarch->initialized_p); + current_gdbarch_swap_out_hack (); + current_gdbarch_swap_in_hack (new_gdbarch); + architecture_changed_event (); +} + +extern void _initialize_gdbarch (void); + +void +_initialize_gdbarch (void) +{ + struct cmd_list_element *c; + + add_show_from_set (add_set_cmd ("arch", + class_maintenance, + var_zinteger, + (char *)&gdbarch_debug, + "Set architecture debugging.\n\ +When non-zero, architecture debugging is enabled.", &setdebuglist), + &showdebuglist); + c = add_set_cmd ("archdebug", + class_maintenance, + var_zinteger, + (char *)&gdbarch_debug, + "Set architecture debugging.\n\ +When non-zero, architecture debugging is enabled.", &setlist); + + deprecate_cmd (c, "set debug arch"); + deprecate_cmd (add_show_from_set (c, &showlist), "show debug arch"); +} diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h new file mode 100644 index 00000000000..cf460b86840 --- /dev/null +++ b/gdb/gdbarch.h @@ -0,0 +1,2248 @@ +/* *INDENT-OFF* */ /* THIS FILE IS GENERATED */ + +/* Dynamic architecture support for GDB, the GNU debugger. + + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free + Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* This file was created with the aid of ``gdbarch.sh''. + + The Bourne shell script ``gdbarch.sh'' creates the files + ``new-gdbarch.c'' and ``new-gdbarch.h and then compares them + against the existing ``gdbarch.[hc]''. Any differences found + being reported. + + If editing this file, please also run gdbarch.sh and merge any + changes into that script. Conversely, when making sweeping changes + to this file, modifying gdbarch.sh and using its output may prove + easier. */ + +#ifndef GDBARCH_H +#define GDBARCH_H + +struct floatformat; +struct ui_file; +struct frame_info; +struct value; +struct objfile; +struct minimal_symbol; +struct regcache; +struct reggroup; +struct regset; +struct disassemble_info; +struct target_ops; +struct obstack; + +extern struct gdbarch *current_gdbarch; + +/* If any of the following are defined, the target wasn't correctly + converted. */ + +#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PURE) && defined (GDB_TM_FILE) +#error "GDB_TM_FILE: Pure multi-arch targets do not have a tm.h file." +#endif + + +/* The following are pre-initialized by GDBARCH. */ + +extern const struct bfd_arch_info * gdbarch_bfd_arch_info (struct gdbarch *gdbarch); +/* set_gdbarch_bfd_arch_info() - not applicable - pre-initialized. */ +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_ARCHITECTURE) +#error "Non multi-arch definition of TARGET_ARCHITECTURE" +#endif +#if !defined (TARGET_ARCHITECTURE) +#define TARGET_ARCHITECTURE (gdbarch_bfd_arch_info (current_gdbarch)) +#endif + +extern int gdbarch_byte_order (struct gdbarch *gdbarch); +/* set_gdbarch_byte_order() - not applicable - pre-initialized. */ +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_BYTE_ORDER) +#error "Non multi-arch definition of TARGET_BYTE_ORDER" +#endif +#if !defined (TARGET_BYTE_ORDER) +#define TARGET_BYTE_ORDER (gdbarch_byte_order (current_gdbarch)) +#endif + +extern enum gdb_osabi gdbarch_osabi (struct gdbarch *gdbarch); +/* set_gdbarch_osabi() - not applicable - pre-initialized. */ +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_OSABI) +#error "Non multi-arch definition of TARGET_OSABI" +#endif +#if !defined (TARGET_OSABI) +#define TARGET_OSABI (gdbarch_osabi (current_gdbarch)) +#endif + + +/* The following are initialized by the target dependent code. */ + +/* Number of bits in a char or unsigned char for the target machine. + Just like CHAR_BIT in but describes the target machine. + v:TARGET_CHAR_BIT:int:char_bit::::8 * sizeof (char):8::0: + + Number of bits in a short or unsigned short for the target machine. */ + +extern int gdbarch_short_bit (struct gdbarch *gdbarch); +extern void set_gdbarch_short_bit (struct gdbarch *gdbarch, int short_bit); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_SHORT_BIT) +#error "Non multi-arch definition of TARGET_SHORT_BIT" +#endif +#if !defined (TARGET_SHORT_BIT) +#define TARGET_SHORT_BIT (gdbarch_short_bit (current_gdbarch)) +#endif + +/* Number of bits in an int or unsigned int for the target machine. */ + +extern int gdbarch_int_bit (struct gdbarch *gdbarch); +extern void set_gdbarch_int_bit (struct gdbarch *gdbarch, int int_bit); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_INT_BIT) +#error "Non multi-arch definition of TARGET_INT_BIT" +#endif +#if !defined (TARGET_INT_BIT) +#define TARGET_INT_BIT (gdbarch_int_bit (current_gdbarch)) +#endif + +/* Number of bits in a long or unsigned long for the target machine. */ + +extern int gdbarch_long_bit (struct gdbarch *gdbarch); +extern void set_gdbarch_long_bit (struct gdbarch *gdbarch, int long_bit); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_LONG_BIT) +#error "Non multi-arch definition of TARGET_LONG_BIT" +#endif +#if !defined (TARGET_LONG_BIT) +#define TARGET_LONG_BIT (gdbarch_long_bit (current_gdbarch)) +#endif + +/* Number of bits in a long long or unsigned long long for the target + machine. */ + +extern int gdbarch_long_long_bit (struct gdbarch *gdbarch); +extern void set_gdbarch_long_long_bit (struct gdbarch *gdbarch, int long_long_bit); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_LONG_LONG_BIT) +#error "Non multi-arch definition of TARGET_LONG_LONG_BIT" +#endif +#if !defined (TARGET_LONG_LONG_BIT) +#define TARGET_LONG_LONG_BIT (gdbarch_long_long_bit (current_gdbarch)) +#endif + +/* Number of bits in a float for the target machine. */ + +extern int gdbarch_float_bit (struct gdbarch *gdbarch); +extern void set_gdbarch_float_bit (struct gdbarch *gdbarch, int float_bit); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_FLOAT_BIT) +#error "Non multi-arch definition of TARGET_FLOAT_BIT" +#endif +#if !defined (TARGET_FLOAT_BIT) +#define TARGET_FLOAT_BIT (gdbarch_float_bit (current_gdbarch)) +#endif + +/* Number of bits in a double for the target machine. */ + +extern int gdbarch_double_bit (struct gdbarch *gdbarch); +extern void set_gdbarch_double_bit (struct gdbarch *gdbarch, int double_bit); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_DOUBLE_BIT) +#error "Non multi-arch definition of TARGET_DOUBLE_BIT" +#endif +#if !defined (TARGET_DOUBLE_BIT) +#define TARGET_DOUBLE_BIT (gdbarch_double_bit (current_gdbarch)) +#endif + +/* Number of bits in a long double for the target machine. */ + +extern int gdbarch_long_double_bit (struct gdbarch *gdbarch); +extern void set_gdbarch_long_double_bit (struct gdbarch *gdbarch, int long_double_bit); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_LONG_DOUBLE_BIT) +#error "Non multi-arch definition of TARGET_LONG_DOUBLE_BIT" +#endif +#if !defined (TARGET_LONG_DOUBLE_BIT) +#define TARGET_LONG_DOUBLE_BIT (gdbarch_long_double_bit (current_gdbarch)) +#endif + +/* For most targets, a pointer on the target and its representation as an + address in GDB have the same size and "look the same". For such a + target, you need only set TARGET_PTR_BIT / ptr_bit and TARGET_ADDR_BIT + / addr_bit will be set from it. + + If TARGET_PTR_BIT and TARGET_ADDR_BIT are different, you'll probably + also need to set POINTER_TO_ADDRESS and ADDRESS_TO_POINTER as well. + + ptr_bit is the size of a pointer on the target */ + +extern int gdbarch_ptr_bit (struct gdbarch *gdbarch); +extern void set_gdbarch_ptr_bit (struct gdbarch *gdbarch, int ptr_bit); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_PTR_BIT) +#error "Non multi-arch definition of TARGET_PTR_BIT" +#endif +#if !defined (TARGET_PTR_BIT) +#define TARGET_PTR_BIT (gdbarch_ptr_bit (current_gdbarch)) +#endif + +/* addr_bit is the size of a target address as represented in gdb */ + +extern int gdbarch_addr_bit (struct gdbarch *gdbarch); +extern void set_gdbarch_addr_bit (struct gdbarch *gdbarch, int addr_bit); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_ADDR_BIT) +#error "Non multi-arch definition of TARGET_ADDR_BIT" +#endif +#if !defined (TARGET_ADDR_BIT) +#define TARGET_ADDR_BIT (gdbarch_addr_bit (current_gdbarch)) +#endif + +/* Number of bits in a BFD_VMA for the target object file format. */ + +extern int gdbarch_bfd_vma_bit (struct gdbarch *gdbarch); +extern void set_gdbarch_bfd_vma_bit (struct gdbarch *gdbarch, int bfd_vma_bit); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_BFD_VMA_BIT) +#error "Non multi-arch definition of TARGET_BFD_VMA_BIT" +#endif +#if !defined (TARGET_BFD_VMA_BIT) +#define TARGET_BFD_VMA_BIT (gdbarch_bfd_vma_bit (current_gdbarch)) +#endif + +/* One if `char' acts like `signed char', zero if `unsigned char'. */ + +extern int gdbarch_char_signed (struct gdbarch *gdbarch); +extern void set_gdbarch_char_signed (struct gdbarch *gdbarch, int char_signed); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_CHAR_SIGNED) +#error "Non multi-arch definition of TARGET_CHAR_SIGNED" +#endif +#if !defined (TARGET_CHAR_SIGNED) +#define TARGET_CHAR_SIGNED (gdbarch_char_signed (current_gdbarch)) +#endif + +#if defined (TARGET_READ_PC) +/* Legacy for systems yet to multi-arch TARGET_READ_PC */ +#if !defined (TARGET_READ_PC_P) +#define TARGET_READ_PC_P() (1) +#endif +#endif + +extern int gdbarch_read_pc_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_READ_PC_P) +#error "Non multi-arch definition of TARGET_READ_PC" +#endif +#if !defined (TARGET_READ_PC_P) +#define TARGET_READ_PC_P() (gdbarch_read_pc_p (current_gdbarch)) +#endif + +typedef CORE_ADDR (gdbarch_read_pc_ftype) (ptid_t ptid); +extern CORE_ADDR gdbarch_read_pc (struct gdbarch *gdbarch, ptid_t ptid); +extern void set_gdbarch_read_pc (struct gdbarch *gdbarch, gdbarch_read_pc_ftype *read_pc); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_READ_PC) +#error "Non multi-arch definition of TARGET_READ_PC" +#endif +#if !defined (TARGET_READ_PC) +#define TARGET_READ_PC(ptid) (gdbarch_read_pc (current_gdbarch, ptid)) +#endif + +typedef void (gdbarch_write_pc_ftype) (CORE_ADDR val, ptid_t ptid); +extern void gdbarch_write_pc (struct gdbarch *gdbarch, CORE_ADDR val, ptid_t ptid); +extern void set_gdbarch_write_pc (struct gdbarch *gdbarch, gdbarch_write_pc_ftype *write_pc); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_WRITE_PC) +#error "Non multi-arch definition of TARGET_WRITE_PC" +#endif +#if !defined (TARGET_WRITE_PC) +#define TARGET_WRITE_PC(val, ptid) (gdbarch_write_pc (current_gdbarch, val, ptid)) +#endif + +/* UNWIND_SP is a direct replacement for TARGET_READ_SP. */ + +#if defined (TARGET_READ_SP) +/* Legacy for systems yet to multi-arch TARGET_READ_SP */ +#if !defined (TARGET_READ_SP_P) +#define TARGET_READ_SP_P() (1) +#endif +#endif + +extern int gdbarch_read_sp_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_READ_SP_P) +#error "Non multi-arch definition of TARGET_READ_SP" +#endif +#if !defined (TARGET_READ_SP_P) +#define TARGET_READ_SP_P() (gdbarch_read_sp_p (current_gdbarch)) +#endif + +typedef CORE_ADDR (gdbarch_read_sp_ftype) (void); +extern CORE_ADDR gdbarch_read_sp (struct gdbarch *gdbarch); +extern void set_gdbarch_read_sp (struct gdbarch *gdbarch, gdbarch_read_sp_ftype *read_sp); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_READ_SP) +#error "Non multi-arch definition of TARGET_READ_SP" +#endif +#if !defined (TARGET_READ_SP) +#define TARGET_READ_SP() (gdbarch_read_sp (current_gdbarch)) +#endif + +/* Function for getting target's idea of a frame pointer. FIXME: GDB's + whole scheme for dealing with "frames" and "frame pointers" needs a + serious shakedown. */ + +typedef void (gdbarch_virtual_frame_pointer_ftype) (CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset); +extern void gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset); +extern void set_gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch, gdbarch_virtual_frame_pointer_ftype *virtual_frame_pointer); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_VIRTUAL_FRAME_POINTER) +#error "Non multi-arch definition of TARGET_VIRTUAL_FRAME_POINTER" +#endif +#if !defined (TARGET_VIRTUAL_FRAME_POINTER) +#define TARGET_VIRTUAL_FRAME_POINTER(pc, frame_regnum, frame_offset) (gdbarch_virtual_frame_pointer (current_gdbarch, pc, frame_regnum, frame_offset)) +#endif + +extern int gdbarch_pseudo_register_read_p (struct gdbarch *gdbarch); + +typedef void (gdbarch_pseudo_register_read_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, void *buf); +extern void gdbarch_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, void *buf); +extern void set_gdbarch_pseudo_register_read (struct gdbarch *gdbarch, gdbarch_pseudo_register_read_ftype *pseudo_register_read); + +extern int gdbarch_pseudo_register_write_p (struct gdbarch *gdbarch); + +typedef void (gdbarch_pseudo_register_write_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, const void *buf); +extern void gdbarch_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, const void *buf); +extern void set_gdbarch_pseudo_register_write (struct gdbarch *gdbarch, gdbarch_pseudo_register_write_ftype *pseudo_register_write); + +extern int gdbarch_num_regs (struct gdbarch *gdbarch); +extern void set_gdbarch_num_regs (struct gdbarch *gdbarch, int num_regs); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (NUM_REGS) +#error "Non multi-arch definition of NUM_REGS" +#endif +#if !defined (NUM_REGS) +#define NUM_REGS (gdbarch_num_regs (current_gdbarch)) +#endif + +/* This macro gives the number of pseudo-registers that live in the + register namespace but do not get fetched or stored on the target. + These pseudo-registers may be aliases for other registers, + combinations of other registers, or they may be computed by GDB. */ + +extern int gdbarch_num_pseudo_regs (struct gdbarch *gdbarch); +extern void set_gdbarch_num_pseudo_regs (struct gdbarch *gdbarch, int num_pseudo_regs); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (NUM_PSEUDO_REGS) +#error "Non multi-arch definition of NUM_PSEUDO_REGS" +#endif +#if !defined (NUM_PSEUDO_REGS) +#define NUM_PSEUDO_REGS (gdbarch_num_pseudo_regs (current_gdbarch)) +#endif + +/* GDB's standard (or well known) register numbers. These can map onto + a real register or a pseudo (computed) register or not be defined at + all (-1). + SP_REGNUM will hopefully be replaced by UNWIND_SP. */ + +extern int gdbarch_sp_regnum (struct gdbarch *gdbarch); +extern void set_gdbarch_sp_regnum (struct gdbarch *gdbarch, int sp_regnum); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (SP_REGNUM) +#error "Non multi-arch definition of SP_REGNUM" +#endif +#if !defined (SP_REGNUM) +#define SP_REGNUM (gdbarch_sp_regnum (current_gdbarch)) +#endif + +extern int gdbarch_pc_regnum (struct gdbarch *gdbarch); +extern void set_gdbarch_pc_regnum (struct gdbarch *gdbarch, int pc_regnum); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (PC_REGNUM) +#error "Non multi-arch definition of PC_REGNUM" +#endif +#if !defined (PC_REGNUM) +#define PC_REGNUM (gdbarch_pc_regnum (current_gdbarch)) +#endif + +extern int gdbarch_ps_regnum (struct gdbarch *gdbarch); +extern void set_gdbarch_ps_regnum (struct gdbarch *gdbarch, int ps_regnum); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (PS_REGNUM) +#error "Non multi-arch definition of PS_REGNUM" +#endif +#if !defined (PS_REGNUM) +#define PS_REGNUM (gdbarch_ps_regnum (current_gdbarch)) +#endif + +extern int gdbarch_fp0_regnum (struct gdbarch *gdbarch); +extern void set_gdbarch_fp0_regnum (struct gdbarch *gdbarch, int fp0_regnum); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FP0_REGNUM) +#error "Non multi-arch definition of FP0_REGNUM" +#endif +#if !defined (FP0_REGNUM) +#define FP0_REGNUM (gdbarch_fp0_regnum (current_gdbarch)) +#endif + +/* Convert stab register number (from `r' declaration) to a gdb REGNUM. */ + +typedef int (gdbarch_stab_reg_to_regnum_ftype) (int stab_regnr); +extern int gdbarch_stab_reg_to_regnum (struct gdbarch *gdbarch, int stab_regnr); +extern void set_gdbarch_stab_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_stab_reg_to_regnum_ftype *stab_reg_to_regnum); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (STAB_REG_TO_REGNUM) +#error "Non multi-arch definition of STAB_REG_TO_REGNUM" +#endif +#if !defined (STAB_REG_TO_REGNUM) +#define STAB_REG_TO_REGNUM(stab_regnr) (gdbarch_stab_reg_to_regnum (current_gdbarch, stab_regnr)) +#endif + +/* Provide a default mapping from a ecoff register number to a gdb REGNUM. */ + +typedef int (gdbarch_ecoff_reg_to_regnum_ftype) (int ecoff_regnr); +extern int gdbarch_ecoff_reg_to_regnum (struct gdbarch *gdbarch, int ecoff_regnr); +extern void set_gdbarch_ecoff_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_ecoff_reg_to_regnum_ftype *ecoff_reg_to_regnum); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (ECOFF_REG_TO_REGNUM) +#error "Non multi-arch definition of ECOFF_REG_TO_REGNUM" +#endif +#if !defined (ECOFF_REG_TO_REGNUM) +#define ECOFF_REG_TO_REGNUM(ecoff_regnr) (gdbarch_ecoff_reg_to_regnum (current_gdbarch, ecoff_regnr)) +#endif + +/* Provide a default mapping from a DWARF register number to a gdb REGNUM. */ + +typedef int (gdbarch_dwarf_reg_to_regnum_ftype) (int dwarf_regnr); +extern int gdbarch_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int dwarf_regnr); +extern void set_gdbarch_dwarf_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_dwarf_reg_to_regnum_ftype *dwarf_reg_to_regnum); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DWARF_REG_TO_REGNUM) +#error "Non multi-arch definition of DWARF_REG_TO_REGNUM" +#endif +#if !defined (DWARF_REG_TO_REGNUM) +#define DWARF_REG_TO_REGNUM(dwarf_regnr) (gdbarch_dwarf_reg_to_regnum (current_gdbarch, dwarf_regnr)) +#endif + +/* Convert from an sdb register number to an internal gdb register number. */ + +typedef int (gdbarch_sdb_reg_to_regnum_ftype) (int sdb_regnr); +extern int gdbarch_sdb_reg_to_regnum (struct gdbarch *gdbarch, int sdb_regnr); +extern void set_gdbarch_sdb_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_sdb_reg_to_regnum_ftype *sdb_reg_to_regnum); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (SDB_REG_TO_REGNUM) +#error "Non multi-arch definition of SDB_REG_TO_REGNUM" +#endif +#if !defined (SDB_REG_TO_REGNUM) +#define SDB_REG_TO_REGNUM(sdb_regnr) (gdbarch_sdb_reg_to_regnum (current_gdbarch, sdb_regnr)) +#endif + +typedef int (gdbarch_dwarf2_reg_to_regnum_ftype) (int dwarf2_regnr); +extern int gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int dwarf2_regnr); +extern void set_gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_dwarf2_reg_to_regnum_ftype *dwarf2_reg_to_regnum); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DWARF2_REG_TO_REGNUM) +#error "Non multi-arch definition of DWARF2_REG_TO_REGNUM" +#endif +#if !defined (DWARF2_REG_TO_REGNUM) +#define DWARF2_REG_TO_REGNUM(dwarf2_regnr) (gdbarch_dwarf2_reg_to_regnum (current_gdbarch, dwarf2_regnr)) +#endif + +typedef const char * (gdbarch_register_name_ftype) (int regnr); +extern const char * gdbarch_register_name (struct gdbarch *gdbarch, int regnr); +extern void set_gdbarch_register_name (struct gdbarch *gdbarch, gdbarch_register_name_ftype *register_name); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_NAME) +#error "Non multi-arch definition of REGISTER_NAME" +#endif +#if !defined (REGISTER_NAME) +#define REGISTER_NAME(regnr) (gdbarch_register_name (current_gdbarch, regnr)) +#endif + +/* REGISTER_TYPE is a direct replacement for DEPRECATED_REGISTER_VIRTUAL_TYPE. */ + +extern int gdbarch_register_type_p (struct gdbarch *gdbarch); + +typedef struct type * (gdbarch_register_type_ftype) (struct gdbarch *gdbarch, int reg_nr); +extern struct type * gdbarch_register_type (struct gdbarch *gdbarch, int reg_nr); +extern void set_gdbarch_register_type (struct gdbarch *gdbarch, gdbarch_register_type_ftype *register_type); + +/* REGISTER_TYPE is a direct replacement for DEPRECATED_REGISTER_VIRTUAL_TYPE. */ + +#if defined (DEPRECATED_REGISTER_VIRTUAL_TYPE) +/* Legacy for systems yet to multi-arch DEPRECATED_REGISTER_VIRTUAL_TYPE */ +#if !defined (DEPRECATED_REGISTER_VIRTUAL_TYPE_P) +#define DEPRECATED_REGISTER_VIRTUAL_TYPE_P() (1) +#endif +#endif + +extern int gdbarch_deprecated_register_virtual_type_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_REGISTER_VIRTUAL_TYPE_P) +#error "Non multi-arch definition of DEPRECATED_REGISTER_VIRTUAL_TYPE" +#endif +#if !defined (DEPRECATED_REGISTER_VIRTUAL_TYPE_P) +#define DEPRECATED_REGISTER_VIRTUAL_TYPE_P() (gdbarch_deprecated_register_virtual_type_p (current_gdbarch)) +#endif + +typedef struct type * (gdbarch_deprecated_register_virtual_type_ftype) (int reg_nr); +extern struct type * gdbarch_deprecated_register_virtual_type (struct gdbarch *gdbarch, int reg_nr); +extern void set_gdbarch_deprecated_register_virtual_type (struct gdbarch *gdbarch, gdbarch_deprecated_register_virtual_type_ftype *deprecated_register_virtual_type); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_REGISTER_VIRTUAL_TYPE) +#error "Non multi-arch definition of DEPRECATED_REGISTER_VIRTUAL_TYPE" +#endif +#if !defined (DEPRECATED_REGISTER_VIRTUAL_TYPE) +#define DEPRECATED_REGISTER_VIRTUAL_TYPE(reg_nr) (gdbarch_deprecated_register_virtual_type (current_gdbarch, reg_nr)) +#endif + +/* DEPRECATED_REGISTER_BYTES can be deleted. The value is computed + from REGISTER_TYPE. */ + +extern int gdbarch_deprecated_register_bytes (struct gdbarch *gdbarch); +extern void set_gdbarch_deprecated_register_bytes (struct gdbarch *gdbarch, int deprecated_register_bytes); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_REGISTER_BYTES) +#error "Non multi-arch definition of DEPRECATED_REGISTER_BYTES" +#endif +#if !defined (DEPRECATED_REGISTER_BYTES) +#define DEPRECATED_REGISTER_BYTES (gdbarch_deprecated_register_bytes (current_gdbarch)) +#endif + +/* If the value returned by DEPRECATED_REGISTER_BYTE agrees with the + register offsets computed using just REGISTER_TYPE, this can be + deleted. See: maint print registers. NOTE: cagney/2002-05-02: This + function with predicate has a valid (callable) initial value. As a + consequence, even when the predicate is false, the corresponding + function works. This simplifies the migration process - old code, + calling DEPRECATED_REGISTER_BYTE, doesn't need to be modified. */ + +#if defined (DEPRECATED_REGISTER_BYTE) +/* Legacy for systems yet to multi-arch DEPRECATED_REGISTER_BYTE */ +#if !defined (DEPRECATED_REGISTER_BYTE_P) +#define DEPRECATED_REGISTER_BYTE_P() (1) +#endif +#endif + +extern int gdbarch_deprecated_register_byte_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_REGISTER_BYTE_P) +#error "Non multi-arch definition of DEPRECATED_REGISTER_BYTE" +#endif +#if !defined (DEPRECATED_REGISTER_BYTE_P) +#define DEPRECATED_REGISTER_BYTE_P() (gdbarch_deprecated_register_byte_p (current_gdbarch)) +#endif + +typedef int (gdbarch_deprecated_register_byte_ftype) (int reg_nr); +extern int gdbarch_deprecated_register_byte (struct gdbarch *gdbarch, int reg_nr); +extern void set_gdbarch_deprecated_register_byte (struct gdbarch *gdbarch, gdbarch_deprecated_register_byte_ftype *deprecated_register_byte); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_REGISTER_BYTE) +#error "Non multi-arch definition of DEPRECATED_REGISTER_BYTE" +#endif +#if !defined (DEPRECATED_REGISTER_BYTE) +#define DEPRECATED_REGISTER_BYTE(reg_nr) (gdbarch_deprecated_register_byte (current_gdbarch, reg_nr)) +#endif + +/* If all registers have identical raw and virtual sizes and those + sizes agree with the value computed from REGISTER_TYPE, + DEPRECATED_REGISTER_RAW_SIZE can be deleted. See: maint print + registers. */ + +#if defined (DEPRECATED_REGISTER_RAW_SIZE) +/* Legacy for systems yet to multi-arch DEPRECATED_REGISTER_RAW_SIZE */ +#if !defined (DEPRECATED_REGISTER_RAW_SIZE_P) +#define DEPRECATED_REGISTER_RAW_SIZE_P() (1) +#endif +#endif + +extern int gdbarch_deprecated_register_raw_size_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_REGISTER_RAW_SIZE_P) +#error "Non multi-arch definition of DEPRECATED_REGISTER_RAW_SIZE" +#endif +#if !defined (DEPRECATED_REGISTER_RAW_SIZE_P) +#define DEPRECATED_REGISTER_RAW_SIZE_P() (gdbarch_deprecated_register_raw_size_p (current_gdbarch)) +#endif + +typedef int (gdbarch_deprecated_register_raw_size_ftype) (int reg_nr); +extern int gdbarch_deprecated_register_raw_size (struct gdbarch *gdbarch, int reg_nr); +extern void set_gdbarch_deprecated_register_raw_size (struct gdbarch *gdbarch, gdbarch_deprecated_register_raw_size_ftype *deprecated_register_raw_size); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_REGISTER_RAW_SIZE) +#error "Non multi-arch definition of DEPRECATED_REGISTER_RAW_SIZE" +#endif +#if !defined (DEPRECATED_REGISTER_RAW_SIZE) +#define DEPRECATED_REGISTER_RAW_SIZE(reg_nr) (gdbarch_deprecated_register_raw_size (current_gdbarch, reg_nr)) +#endif + +/* If all registers have identical raw and virtual sizes and those + sizes agree with the value computed from REGISTER_TYPE, + DEPRECATED_REGISTER_VIRTUAL_SIZE can be deleted. See: maint print + registers. */ + +#if defined (DEPRECATED_REGISTER_VIRTUAL_SIZE) +/* Legacy for systems yet to multi-arch DEPRECATED_REGISTER_VIRTUAL_SIZE */ +#if !defined (DEPRECATED_REGISTER_VIRTUAL_SIZE_P) +#define DEPRECATED_REGISTER_VIRTUAL_SIZE_P() (1) +#endif +#endif + +extern int gdbarch_deprecated_register_virtual_size_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_REGISTER_VIRTUAL_SIZE_P) +#error "Non multi-arch definition of DEPRECATED_REGISTER_VIRTUAL_SIZE" +#endif +#if !defined (DEPRECATED_REGISTER_VIRTUAL_SIZE_P) +#define DEPRECATED_REGISTER_VIRTUAL_SIZE_P() (gdbarch_deprecated_register_virtual_size_p (current_gdbarch)) +#endif + +typedef int (gdbarch_deprecated_register_virtual_size_ftype) (int reg_nr); +extern int gdbarch_deprecated_register_virtual_size (struct gdbarch *gdbarch, int reg_nr); +extern void set_gdbarch_deprecated_register_virtual_size (struct gdbarch *gdbarch, gdbarch_deprecated_register_virtual_size_ftype *deprecated_register_virtual_size); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_REGISTER_VIRTUAL_SIZE) +#error "Non multi-arch definition of DEPRECATED_REGISTER_VIRTUAL_SIZE" +#endif +#if !defined (DEPRECATED_REGISTER_VIRTUAL_SIZE) +#define DEPRECATED_REGISTER_VIRTUAL_SIZE(reg_nr) (gdbarch_deprecated_register_virtual_size (current_gdbarch, reg_nr)) +#endif + +/* See gdbint.texinfo, and PUSH_DUMMY_CALL. */ + +extern int gdbarch_unwind_dummy_id_p (struct gdbarch *gdbarch); + +typedef struct frame_id (gdbarch_unwind_dummy_id_ftype) (struct gdbarch *gdbarch, struct frame_info *info); +extern struct frame_id gdbarch_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *info); +extern void set_gdbarch_unwind_dummy_id (struct gdbarch *gdbarch, gdbarch_unwind_dummy_id_ftype *unwind_dummy_id); + +/* Implement UNWIND_DUMMY_ID and PUSH_DUMMY_CALL, then delete + SAVE_DUMMY_FRAME_TOS. */ + +#if defined (DEPRECATED_SAVE_DUMMY_FRAME_TOS) +/* Legacy for systems yet to multi-arch DEPRECATED_SAVE_DUMMY_FRAME_TOS */ +#if !defined (DEPRECATED_SAVE_DUMMY_FRAME_TOS_P) +#define DEPRECATED_SAVE_DUMMY_FRAME_TOS_P() (1) +#endif +#endif + +extern int gdbarch_deprecated_save_dummy_frame_tos_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_SAVE_DUMMY_FRAME_TOS_P) +#error "Non multi-arch definition of DEPRECATED_SAVE_DUMMY_FRAME_TOS" +#endif +#if !defined (DEPRECATED_SAVE_DUMMY_FRAME_TOS_P) +#define DEPRECATED_SAVE_DUMMY_FRAME_TOS_P() (gdbarch_deprecated_save_dummy_frame_tos_p (current_gdbarch)) +#endif + +typedef void (gdbarch_deprecated_save_dummy_frame_tos_ftype) (CORE_ADDR sp); +extern void gdbarch_deprecated_save_dummy_frame_tos (struct gdbarch *gdbarch, CORE_ADDR sp); +extern void set_gdbarch_deprecated_save_dummy_frame_tos (struct gdbarch *gdbarch, gdbarch_deprecated_save_dummy_frame_tos_ftype *deprecated_save_dummy_frame_tos); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_SAVE_DUMMY_FRAME_TOS) +#error "Non multi-arch definition of DEPRECATED_SAVE_DUMMY_FRAME_TOS" +#endif +#if !defined (DEPRECATED_SAVE_DUMMY_FRAME_TOS) +#define DEPRECATED_SAVE_DUMMY_FRAME_TOS(sp) (gdbarch_deprecated_save_dummy_frame_tos (current_gdbarch, sp)) +#endif + +/* Implement UNWIND_DUMMY_ID and PUSH_DUMMY_CALL, then delete + DEPRECATED_FP_REGNUM. */ + +extern int gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch); +extern void set_gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch, int deprecated_fp_regnum); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FP_REGNUM) +#error "Non multi-arch definition of DEPRECATED_FP_REGNUM" +#endif +#if !defined (DEPRECATED_FP_REGNUM) +#define DEPRECATED_FP_REGNUM (gdbarch_deprecated_fp_regnum (current_gdbarch)) +#endif + +/* Implement UNWIND_DUMMY_ID and PUSH_DUMMY_CALL, then delete + DEPRECATED_TARGET_READ_FP. */ + +#if defined (DEPRECATED_TARGET_READ_FP) +/* Legacy for systems yet to multi-arch DEPRECATED_TARGET_READ_FP */ +#if !defined (DEPRECATED_TARGET_READ_FP_P) +#define DEPRECATED_TARGET_READ_FP_P() (1) +#endif +#endif + +extern int gdbarch_deprecated_target_read_fp_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_TARGET_READ_FP_P) +#error "Non multi-arch definition of DEPRECATED_TARGET_READ_FP" +#endif +#if !defined (DEPRECATED_TARGET_READ_FP_P) +#define DEPRECATED_TARGET_READ_FP_P() (gdbarch_deprecated_target_read_fp_p (current_gdbarch)) +#endif + +typedef CORE_ADDR (gdbarch_deprecated_target_read_fp_ftype) (void); +extern CORE_ADDR gdbarch_deprecated_target_read_fp (struct gdbarch *gdbarch); +extern void set_gdbarch_deprecated_target_read_fp (struct gdbarch *gdbarch, gdbarch_deprecated_target_read_fp_ftype *deprecated_target_read_fp); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_TARGET_READ_FP) +#error "Non multi-arch definition of DEPRECATED_TARGET_READ_FP" +#endif +#if !defined (DEPRECATED_TARGET_READ_FP) +#define DEPRECATED_TARGET_READ_FP() (gdbarch_deprecated_target_read_fp (current_gdbarch)) +#endif + +/* See gdbint.texinfo. See infcall.c. New, all singing all dancing, + replacement for DEPRECATED_PUSH_ARGUMENTS. */ + +extern int gdbarch_push_dummy_call_p (struct gdbarch *gdbarch); + +typedef CORE_ADDR (gdbarch_push_dummy_call_ftype) (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); +extern CORE_ADDR 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); +extern void set_gdbarch_push_dummy_call (struct gdbarch *gdbarch, gdbarch_push_dummy_call_ftype *push_dummy_call); + +/* PUSH_DUMMY_CALL is a direct replacement for DEPRECATED_PUSH_ARGUMENTS. */ + +#if defined (DEPRECATED_PUSH_ARGUMENTS) +/* Legacy for systems yet to multi-arch DEPRECATED_PUSH_ARGUMENTS */ +#if !defined (DEPRECATED_PUSH_ARGUMENTS_P) +#define DEPRECATED_PUSH_ARGUMENTS_P() (1) +#endif +#endif + +extern int gdbarch_deprecated_push_arguments_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_ARGUMENTS_P) +#error "Non multi-arch definition of DEPRECATED_PUSH_ARGUMENTS" +#endif +#if !defined (DEPRECATED_PUSH_ARGUMENTS_P) +#define DEPRECATED_PUSH_ARGUMENTS_P() (gdbarch_deprecated_push_arguments_p (current_gdbarch)) +#endif + +typedef CORE_ADDR (gdbarch_deprecated_push_arguments_ftype) (int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr); +extern CORE_ADDR gdbarch_deprecated_push_arguments (struct gdbarch *gdbarch, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr); +extern void set_gdbarch_deprecated_push_arguments (struct gdbarch *gdbarch, gdbarch_deprecated_push_arguments_ftype *deprecated_push_arguments); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_ARGUMENTS) +#error "Non multi-arch definition of DEPRECATED_PUSH_ARGUMENTS" +#endif +#if !defined (DEPRECATED_PUSH_ARGUMENTS) +#define DEPRECATED_PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) (gdbarch_deprecated_push_arguments (current_gdbarch, nargs, args, sp, struct_return, struct_addr)) +#endif + +/* Implement PUSH_RETURN_ADDRESS, and then merge in + DEPRECATED_PUSH_RETURN_ADDRESS. */ + +#if defined (DEPRECATED_PUSH_RETURN_ADDRESS) +/* Legacy for systems yet to multi-arch DEPRECATED_PUSH_RETURN_ADDRESS */ +#if !defined (DEPRECATED_PUSH_RETURN_ADDRESS_P) +#define DEPRECATED_PUSH_RETURN_ADDRESS_P() (1) +#endif +#endif + +extern int gdbarch_deprecated_push_return_address_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_RETURN_ADDRESS_P) +#error "Non multi-arch definition of DEPRECATED_PUSH_RETURN_ADDRESS" +#endif +#if !defined (DEPRECATED_PUSH_RETURN_ADDRESS_P) +#define DEPRECATED_PUSH_RETURN_ADDRESS_P() (gdbarch_deprecated_push_return_address_p (current_gdbarch)) +#endif + +typedef CORE_ADDR (gdbarch_deprecated_push_return_address_ftype) (CORE_ADDR pc, CORE_ADDR sp); +extern CORE_ADDR gdbarch_deprecated_push_return_address (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp); +extern void set_gdbarch_deprecated_push_return_address (struct gdbarch *gdbarch, gdbarch_deprecated_push_return_address_ftype *deprecated_push_return_address); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_RETURN_ADDRESS) +#error "Non multi-arch definition of DEPRECATED_PUSH_RETURN_ADDRESS" +#endif +#if !defined (DEPRECATED_PUSH_RETURN_ADDRESS) +#define DEPRECATED_PUSH_RETURN_ADDRESS(pc, sp) (gdbarch_deprecated_push_return_address (current_gdbarch, pc, sp)) +#endif + +/* Implement PUSH_DUMMY_CALL, then merge in DEPRECATED_DUMMY_WRITE_SP. */ + +#if defined (DEPRECATED_DUMMY_WRITE_SP) +/* Legacy for systems yet to multi-arch DEPRECATED_DUMMY_WRITE_SP */ +#if !defined (DEPRECATED_DUMMY_WRITE_SP_P) +#define DEPRECATED_DUMMY_WRITE_SP_P() (1) +#endif +#endif + +extern int gdbarch_deprecated_dummy_write_sp_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_DUMMY_WRITE_SP_P) +#error "Non multi-arch definition of DEPRECATED_DUMMY_WRITE_SP" +#endif +#if !defined (DEPRECATED_DUMMY_WRITE_SP_P) +#define DEPRECATED_DUMMY_WRITE_SP_P() (gdbarch_deprecated_dummy_write_sp_p (current_gdbarch)) +#endif + +typedef void (gdbarch_deprecated_dummy_write_sp_ftype) (CORE_ADDR val); +extern void gdbarch_deprecated_dummy_write_sp (struct gdbarch *gdbarch, CORE_ADDR val); +extern void set_gdbarch_deprecated_dummy_write_sp (struct gdbarch *gdbarch, gdbarch_deprecated_dummy_write_sp_ftype *deprecated_dummy_write_sp); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_DUMMY_WRITE_SP) +#error "Non multi-arch definition of DEPRECATED_DUMMY_WRITE_SP" +#endif +#if !defined (DEPRECATED_DUMMY_WRITE_SP) +#define DEPRECATED_DUMMY_WRITE_SP(val) (gdbarch_deprecated_dummy_write_sp (current_gdbarch, val)) +#endif + +/* DEPRECATED_REGISTER_SIZE can be deleted. */ + +extern int gdbarch_deprecated_register_size (struct gdbarch *gdbarch); +extern void set_gdbarch_deprecated_register_size (struct gdbarch *gdbarch, int deprecated_register_size); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_REGISTER_SIZE) +#error "Non multi-arch definition of DEPRECATED_REGISTER_SIZE" +#endif +#if !defined (DEPRECATED_REGISTER_SIZE) +#define DEPRECATED_REGISTER_SIZE (gdbarch_deprecated_register_size (current_gdbarch)) +#endif + +extern int gdbarch_call_dummy_location (struct gdbarch *gdbarch); +extern void set_gdbarch_call_dummy_location (struct gdbarch *gdbarch, int call_dummy_location); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_LOCATION) +#error "Non multi-arch definition of CALL_DUMMY_LOCATION" +#endif +#if !defined (CALL_DUMMY_LOCATION) +#define CALL_DUMMY_LOCATION (gdbarch_call_dummy_location (current_gdbarch)) +#endif + +extern int gdbarch_push_dummy_code_p (struct gdbarch *gdbarch); + +typedef CORE_ADDR (gdbarch_push_dummy_code_ftype) (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); +extern CORE_ADDR 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); +extern void set_gdbarch_push_dummy_code (struct gdbarch *gdbarch, gdbarch_push_dummy_code_ftype *push_dummy_code); + +#if defined (DEPRECATED_DO_REGISTERS_INFO) +/* Legacy for systems yet to multi-arch DEPRECATED_DO_REGISTERS_INFO */ +#if !defined (DEPRECATED_DO_REGISTERS_INFO_P) +#define DEPRECATED_DO_REGISTERS_INFO_P() (1) +#endif +#endif + +extern int gdbarch_deprecated_do_registers_info_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_DO_REGISTERS_INFO_P) +#error "Non multi-arch definition of DEPRECATED_DO_REGISTERS_INFO" +#endif +#if !defined (DEPRECATED_DO_REGISTERS_INFO_P) +#define DEPRECATED_DO_REGISTERS_INFO_P() (gdbarch_deprecated_do_registers_info_p (current_gdbarch)) +#endif + +typedef void (gdbarch_deprecated_do_registers_info_ftype) (int reg_nr, int fpregs); +extern void gdbarch_deprecated_do_registers_info (struct gdbarch *gdbarch, int reg_nr, int fpregs); +extern void set_gdbarch_deprecated_do_registers_info (struct gdbarch *gdbarch, gdbarch_deprecated_do_registers_info_ftype *deprecated_do_registers_info); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_DO_REGISTERS_INFO) +#error "Non multi-arch definition of DEPRECATED_DO_REGISTERS_INFO" +#endif +#if !defined (DEPRECATED_DO_REGISTERS_INFO) +#define DEPRECATED_DO_REGISTERS_INFO(reg_nr, fpregs) (gdbarch_deprecated_do_registers_info (current_gdbarch, reg_nr, fpregs)) +#endif + +typedef void (gdbarch_print_registers_info_ftype) (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, int regnum, int all); +extern void gdbarch_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, int regnum, int all); +extern void set_gdbarch_print_registers_info (struct gdbarch *gdbarch, gdbarch_print_registers_info_ftype *print_registers_info); + +extern int gdbarch_print_float_info_p (struct gdbarch *gdbarch); + +typedef void (gdbarch_print_float_info_ftype) (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, const char *args); +extern void gdbarch_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, const char *args); +extern void set_gdbarch_print_float_info (struct gdbarch *gdbarch, gdbarch_print_float_info_ftype *print_float_info); + +extern int gdbarch_print_vector_info_p (struct gdbarch *gdbarch); + +typedef void (gdbarch_print_vector_info_ftype) (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, const char *args); +extern void gdbarch_print_vector_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, const char *args); +extern void set_gdbarch_print_vector_info (struct gdbarch *gdbarch, gdbarch_print_vector_info_ftype *print_vector_info); + +/* MAP a GDB RAW register number onto a simulator register number. See + also include/...-sim.h. */ + +typedef int (gdbarch_register_sim_regno_ftype) (int reg_nr); +extern int gdbarch_register_sim_regno (struct gdbarch *gdbarch, int reg_nr); +extern void set_gdbarch_register_sim_regno (struct gdbarch *gdbarch, gdbarch_register_sim_regno_ftype *register_sim_regno); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_SIM_REGNO) +#error "Non multi-arch definition of REGISTER_SIM_REGNO" +#endif +#if !defined (REGISTER_SIM_REGNO) +#define REGISTER_SIM_REGNO(reg_nr) (gdbarch_register_sim_regno (current_gdbarch, reg_nr)) +#endif + +#if defined (REGISTER_BYTES_OK) +/* Legacy for systems yet to multi-arch REGISTER_BYTES_OK */ +#if !defined (REGISTER_BYTES_OK_P) +#define REGISTER_BYTES_OK_P() (1) +#endif +#endif + +extern int gdbarch_register_bytes_ok_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_BYTES_OK_P) +#error "Non multi-arch definition of REGISTER_BYTES_OK" +#endif +#if !defined (REGISTER_BYTES_OK_P) +#define REGISTER_BYTES_OK_P() (gdbarch_register_bytes_ok_p (current_gdbarch)) +#endif + +typedef int (gdbarch_register_bytes_ok_ftype) (long nr_bytes); +extern int gdbarch_register_bytes_ok (struct gdbarch *gdbarch, long nr_bytes); +extern void set_gdbarch_register_bytes_ok (struct gdbarch *gdbarch, gdbarch_register_bytes_ok_ftype *register_bytes_ok); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_BYTES_OK) +#error "Non multi-arch definition of REGISTER_BYTES_OK" +#endif +#if !defined (REGISTER_BYTES_OK) +#define REGISTER_BYTES_OK(nr_bytes) (gdbarch_register_bytes_ok (current_gdbarch, nr_bytes)) +#endif + +typedef int (gdbarch_cannot_fetch_register_ftype) (int regnum); +extern int gdbarch_cannot_fetch_register (struct gdbarch *gdbarch, int regnum); +extern void set_gdbarch_cannot_fetch_register (struct gdbarch *gdbarch, gdbarch_cannot_fetch_register_ftype *cannot_fetch_register); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CANNOT_FETCH_REGISTER) +#error "Non multi-arch definition of CANNOT_FETCH_REGISTER" +#endif +#if !defined (CANNOT_FETCH_REGISTER) +#define CANNOT_FETCH_REGISTER(regnum) (gdbarch_cannot_fetch_register (current_gdbarch, regnum)) +#endif + +typedef int (gdbarch_cannot_store_register_ftype) (int regnum); +extern int gdbarch_cannot_store_register (struct gdbarch *gdbarch, int regnum); +extern void set_gdbarch_cannot_store_register (struct gdbarch *gdbarch, gdbarch_cannot_store_register_ftype *cannot_store_register); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CANNOT_STORE_REGISTER) +#error "Non multi-arch definition of CANNOT_STORE_REGISTER" +#endif +#if !defined (CANNOT_STORE_REGISTER) +#define CANNOT_STORE_REGISTER(regnum) (gdbarch_cannot_store_register (current_gdbarch, regnum)) +#endif + +/* setjmp/longjmp support. */ + +#if defined (GET_LONGJMP_TARGET) +/* Legacy for systems yet to multi-arch GET_LONGJMP_TARGET */ +#if !defined (GET_LONGJMP_TARGET_P) +#define GET_LONGJMP_TARGET_P() (1) +#endif +#endif + +extern int gdbarch_get_longjmp_target_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (GET_LONGJMP_TARGET_P) +#error "Non multi-arch definition of GET_LONGJMP_TARGET" +#endif +#if !defined (GET_LONGJMP_TARGET_P) +#define GET_LONGJMP_TARGET_P() (gdbarch_get_longjmp_target_p (current_gdbarch)) +#endif + +typedef int (gdbarch_get_longjmp_target_ftype) (CORE_ADDR *pc); +extern int gdbarch_get_longjmp_target (struct gdbarch *gdbarch, CORE_ADDR *pc); +extern void set_gdbarch_get_longjmp_target (struct gdbarch *gdbarch, gdbarch_get_longjmp_target_ftype *get_longjmp_target); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (GET_LONGJMP_TARGET) +#error "Non multi-arch definition of GET_LONGJMP_TARGET" +#endif +#if !defined (GET_LONGJMP_TARGET) +#define GET_LONGJMP_TARGET(pc) (gdbarch_get_longjmp_target (current_gdbarch, pc)) +#endif + +#if defined (DEPRECATED_INIT_FRAME_PC) +/* Legacy for systems yet to multi-arch DEPRECATED_INIT_FRAME_PC */ +#if !defined (DEPRECATED_INIT_FRAME_PC_P) +#define DEPRECATED_INIT_FRAME_PC_P() (1) +#endif +#endif + +extern int gdbarch_deprecated_init_frame_pc_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_INIT_FRAME_PC_P) +#error "Non multi-arch definition of DEPRECATED_INIT_FRAME_PC" +#endif +#if !defined (DEPRECATED_INIT_FRAME_PC_P) +#define DEPRECATED_INIT_FRAME_PC_P() (gdbarch_deprecated_init_frame_pc_p (current_gdbarch)) +#endif + +typedef CORE_ADDR (gdbarch_deprecated_init_frame_pc_ftype) (int fromleaf, struct frame_info *prev); +extern CORE_ADDR gdbarch_deprecated_init_frame_pc (struct gdbarch *gdbarch, int fromleaf, struct frame_info *prev); +extern void set_gdbarch_deprecated_init_frame_pc (struct gdbarch *gdbarch, gdbarch_deprecated_init_frame_pc_ftype *deprecated_init_frame_pc); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_INIT_FRAME_PC) +#error "Non multi-arch definition of DEPRECATED_INIT_FRAME_PC" +#endif +#if !defined (DEPRECATED_INIT_FRAME_PC) +#define DEPRECATED_INIT_FRAME_PC(fromleaf, prev) (gdbarch_deprecated_init_frame_pc (current_gdbarch, fromleaf, prev)) +#endif + +extern int gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch); +extern void set_gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch, int believe_pcc_promotion); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (BELIEVE_PCC_PROMOTION) +#error "Non multi-arch definition of BELIEVE_PCC_PROMOTION" +#endif +#if !defined (BELIEVE_PCC_PROMOTION) +#define BELIEVE_PCC_PROMOTION (gdbarch_believe_pcc_promotion (current_gdbarch)) +#endif + +#if defined (DEPRECATED_GET_SAVED_REGISTER) +/* Legacy for systems yet to multi-arch DEPRECATED_GET_SAVED_REGISTER */ +#if !defined (DEPRECATED_GET_SAVED_REGISTER_P) +#define DEPRECATED_GET_SAVED_REGISTER_P() (1) +#endif +#endif + +extern int gdbarch_deprecated_get_saved_register_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_GET_SAVED_REGISTER_P) +#error "Non multi-arch definition of DEPRECATED_GET_SAVED_REGISTER" +#endif +#if !defined (DEPRECATED_GET_SAVED_REGISTER_P) +#define DEPRECATED_GET_SAVED_REGISTER_P() (gdbarch_deprecated_get_saved_register_p (current_gdbarch)) +#endif + +typedef void (gdbarch_deprecated_get_saved_register_ftype) (char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval); +extern void gdbarch_deprecated_get_saved_register (struct gdbarch *gdbarch, char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval); +extern void set_gdbarch_deprecated_get_saved_register (struct gdbarch *gdbarch, gdbarch_deprecated_get_saved_register_ftype *deprecated_get_saved_register); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_GET_SAVED_REGISTER) +#error "Non multi-arch definition of DEPRECATED_GET_SAVED_REGISTER" +#endif +#if !defined (DEPRECATED_GET_SAVED_REGISTER) +#define DEPRECATED_GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) (gdbarch_deprecated_get_saved_register (current_gdbarch, raw_buffer, optimized, addrp, frame, regnum, lval)) +#endif + +typedef int (gdbarch_convert_register_p_ftype) (int regnum, struct type *type); +extern int gdbarch_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type); +extern void set_gdbarch_convert_register_p (struct gdbarch *gdbarch, gdbarch_convert_register_p_ftype *convert_register_p); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CONVERT_REGISTER_P) +#error "Non multi-arch definition of CONVERT_REGISTER_P" +#endif +#if !defined (CONVERT_REGISTER_P) +#define CONVERT_REGISTER_P(regnum, type) (gdbarch_convert_register_p (current_gdbarch, regnum, type)) +#endif + +typedef void (gdbarch_register_to_value_ftype) (struct frame_info *frame, int regnum, struct type *type, void *buf); +extern void gdbarch_register_to_value (struct gdbarch *gdbarch, struct frame_info *frame, int regnum, struct type *type, void *buf); +extern void set_gdbarch_register_to_value (struct gdbarch *gdbarch, gdbarch_register_to_value_ftype *register_to_value); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_TO_VALUE) +#error "Non multi-arch definition of REGISTER_TO_VALUE" +#endif +#if !defined (REGISTER_TO_VALUE) +#define REGISTER_TO_VALUE(frame, regnum, type, buf) (gdbarch_register_to_value (current_gdbarch, frame, regnum, type, buf)) +#endif + +typedef void (gdbarch_value_to_register_ftype) (struct frame_info *frame, int regnum, struct type *type, const void *buf); +extern void gdbarch_value_to_register (struct gdbarch *gdbarch, struct frame_info *frame, int regnum, struct type *type, const void *buf); +extern void set_gdbarch_value_to_register (struct gdbarch *gdbarch, gdbarch_value_to_register_ftype *value_to_register); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (VALUE_TO_REGISTER) +#error "Non multi-arch definition of VALUE_TO_REGISTER" +#endif +#if !defined (VALUE_TO_REGISTER) +#define VALUE_TO_REGISTER(frame, regnum, type, buf) (gdbarch_value_to_register (current_gdbarch, frame, regnum, type, buf)) +#endif + +typedef CORE_ADDR (gdbarch_pointer_to_address_ftype) (struct type *type, const void *buf); +extern CORE_ADDR gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, const void *buf); +extern void set_gdbarch_pointer_to_address (struct gdbarch *gdbarch, gdbarch_pointer_to_address_ftype *pointer_to_address); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (POINTER_TO_ADDRESS) +#error "Non multi-arch definition of POINTER_TO_ADDRESS" +#endif +#if !defined (POINTER_TO_ADDRESS) +#define POINTER_TO_ADDRESS(type, buf) (gdbarch_pointer_to_address (current_gdbarch, type, buf)) +#endif + +typedef void (gdbarch_address_to_pointer_ftype) (struct type *type, void *buf, CORE_ADDR addr); +extern void gdbarch_address_to_pointer (struct gdbarch *gdbarch, struct type *type, void *buf, CORE_ADDR addr); +extern void set_gdbarch_address_to_pointer (struct gdbarch *gdbarch, gdbarch_address_to_pointer_ftype *address_to_pointer); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (ADDRESS_TO_POINTER) +#error "Non multi-arch definition of ADDRESS_TO_POINTER" +#endif +#if !defined (ADDRESS_TO_POINTER) +#define ADDRESS_TO_POINTER(type, buf, addr) (gdbarch_address_to_pointer (current_gdbarch, type, buf, addr)) +#endif + +#if defined (INTEGER_TO_ADDRESS) +/* Legacy for systems yet to multi-arch INTEGER_TO_ADDRESS */ +#if !defined (INTEGER_TO_ADDRESS_P) +#define INTEGER_TO_ADDRESS_P() (1) +#endif +#endif + +extern int gdbarch_integer_to_address_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (INTEGER_TO_ADDRESS_P) +#error "Non multi-arch definition of INTEGER_TO_ADDRESS" +#endif +#if !defined (INTEGER_TO_ADDRESS_P) +#define INTEGER_TO_ADDRESS_P() (gdbarch_integer_to_address_p (current_gdbarch)) +#endif + +typedef CORE_ADDR (gdbarch_integer_to_address_ftype) (struct type *type, void *buf); +extern CORE_ADDR gdbarch_integer_to_address (struct gdbarch *gdbarch, struct type *type, void *buf); +extern void set_gdbarch_integer_to_address (struct gdbarch *gdbarch, gdbarch_integer_to_address_ftype *integer_to_address); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (INTEGER_TO_ADDRESS) +#error "Non multi-arch definition of INTEGER_TO_ADDRESS" +#endif +#if !defined (INTEGER_TO_ADDRESS) +#define INTEGER_TO_ADDRESS(type, buf) (gdbarch_integer_to_address (current_gdbarch, type, buf)) +#endif + +#if defined (DEPRECATED_POP_FRAME) +/* Legacy for systems yet to multi-arch DEPRECATED_POP_FRAME */ +#if !defined (DEPRECATED_POP_FRAME_P) +#define DEPRECATED_POP_FRAME_P() (1) +#endif +#endif + +extern int gdbarch_deprecated_pop_frame_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_POP_FRAME_P) +#error "Non multi-arch definition of DEPRECATED_POP_FRAME" +#endif +#if !defined (DEPRECATED_POP_FRAME_P) +#define DEPRECATED_POP_FRAME_P() (gdbarch_deprecated_pop_frame_p (current_gdbarch)) +#endif + +typedef void (gdbarch_deprecated_pop_frame_ftype) (void); +extern void gdbarch_deprecated_pop_frame (struct gdbarch *gdbarch); +extern void set_gdbarch_deprecated_pop_frame (struct gdbarch *gdbarch, gdbarch_deprecated_pop_frame_ftype *deprecated_pop_frame); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_POP_FRAME) +#error "Non multi-arch definition of DEPRECATED_POP_FRAME" +#endif +#if !defined (DEPRECATED_POP_FRAME) +#define DEPRECATED_POP_FRAME (gdbarch_deprecated_pop_frame (current_gdbarch)) +#endif + +/* NOTE: cagney/2003-03-24: Replaced by PUSH_ARGUMENTS. */ + +#if defined (DEPRECATED_STORE_STRUCT_RETURN) +/* Legacy for systems yet to multi-arch DEPRECATED_STORE_STRUCT_RETURN */ +#if !defined (DEPRECATED_STORE_STRUCT_RETURN_P) +#define DEPRECATED_STORE_STRUCT_RETURN_P() (1) +#endif +#endif + +extern int gdbarch_deprecated_store_struct_return_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_STORE_STRUCT_RETURN_P) +#error "Non multi-arch definition of DEPRECATED_STORE_STRUCT_RETURN" +#endif +#if !defined (DEPRECATED_STORE_STRUCT_RETURN_P) +#define DEPRECATED_STORE_STRUCT_RETURN_P() (gdbarch_deprecated_store_struct_return_p (current_gdbarch)) +#endif + +typedef void (gdbarch_deprecated_store_struct_return_ftype) (CORE_ADDR addr, CORE_ADDR sp); +extern void gdbarch_deprecated_store_struct_return (struct gdbarch *gdbarch, CORE_ADDR addr, CORE_ADDR sp); +extern void set_gdbarch_deprecated_store_struct_return (struct gdbarch *gdbarch, gdbarch_deprecated_store_struct_return_ftype *deprecated_store_struct_return); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_STORE_STRUCT_RETURN) +#error "Non multi-arch definition of DEPRECATED_STORE_STRUCT_RETURN" +#endif +#if !defined (DEPRECATED_STORE_STRUCT_RETURN) +#define DEPRECATED_STORE_STRUCT_RETURN(addr, sp) (gdbarch_deprecated_store_struct_return (current_gdbarch, addr, sp)) +#endif + +/* It has been suggested that this, well actually its predecessor, + should take the type/value of the function to be called and not the + return type. This is left as an exercise for the reader. + NOTE: cagney/2004-06-13: The function stack.c:return_command uses + the predicate with default hack to avoid calling STORE_RETURN_VALUE + (via legacy_return_value), when a small struct is involved. */ + +extern int gdbarch_return_value_p (struct gdbarch *gdbarch); + +typedef enum return_value_convention (gdbarch_return_value_ftype) (struct gdbarch *gdbarch, struct type *valtype, struct regcache *regcache, void *readbuf, const void *writebuf); +extern enum return_value_convention gdbarch_return_value (struct gdbarch *gdbarch, struct type *valtype, struct regcache *regcache, void *readbuf, const void *writebuf); +extern void set_gdbarch_return_value (struct gdbarch *gdbarch, gdbarch_return_value_ftype *return_value); + +/* The deprecated methods EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, + DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS and + DEPRECATED_USE_STRUCT_CONVENTION have all been folded into + RETURN_VALUE. */ + +typedef void (gdbarch_extract_return_value_ftype) (struct type *type, struct regcache *regcache, void *valbuf); +extern void gdbarch_extract_return_value (struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, void *valbuf); +extern void set_gdbarch_extract_return_value (struct gdbarch *gdbarch, gdbarch_extract_return_value_ftype *extract_return_value); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (EXTRACT_RETURN_VALUE) +#error "Non multi-arch definition of EXTRACT_RETURN_VALUE" +#endif +#if !defined (EXTRACT_RETURN_VALUE) +#define EXTRACT_RETURN_VALUE(type, regcache, valbuf) (gdbarch_extract_return_value (current_gdbarch, type, regcache, valbuf)) +#endif + +typedef void (gdbarch_store_return_value_ftype) (struct type *type, struct regcache *regcache, const void *valbuf); +extern void gdbarch_store_return_value (struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, const void *valbuf); +extern void set_gdbarch_store_return_value (struct gdbarch *gdbarch, gdbarch_store_return_value_ftype *store_return_value); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (STORE_RETURN_VALUE) +#error "Non multi-arch definition of STORE_RETURN_VALUE" +#endif +#if !defined (STORE_RETURN_VALUE) +#define STORE_RETURN_VALUE(type, regcache, valbuf) (gdbarch_store_return_value (current_gdbarch, type, regcache, valbuf)) +#endif + +typedef void (gdbarch_deprecated_extract_return_value_ftype) (struct type *type, char *regbuf, char *valbuf); +extern void gdbarch_deprecated_extract_return_value (struct gdbarch *gdbarch, struct type *type, char *regbuf, char *valbuf); +extern void set_gdbarch_deprecated_extract_return_value (struct gdbarch *gdbarch, gdbarch_deprecated_extract_return_value_ftype *deprecated_extract_return_value); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_EXTRACT_RETURN_VALUE) +#error "Non multi-arch definition of DEPRECATED_EXTRACT_RETURN_VALUE" +#endif +#if !defined (DEPRECATED_EXTRACT_RETURN_VALUE) +#define DEPRECATED_EXTRACT_RETURN_VALUE(type, regbuf, valbuf) (gdbarch_deprecated_extract_return_value (current_gdbarch, type, regbuf, valbuf)) +#endif + +typedef void (gdbarch_deprecated_store_return_value_ftype) (struct type *type, char *valbuf); +extern void gdbarch_deprecated_store_return_value (struct gdbarch *gdbarch, struct type *type, char *valbuf); +extern void set_gdbarch_deprecated_store_return_value (struct gdbarch *gdbarch, gdbarch_deprecated_store_return_value_ftype *deprecated_store_return_value); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_STORE_RETURN_VALUE) +#error "Non multi-arch definition of DEPRECATED_STORE_RETURN_VALUE" +#endif +#if !defined (DEPRECATED_STORE_RETURN_VALUE) +#define DEPRECATED_STORE_RETURN_VALUE(type, valbuf) (gdbarch_deprecated_store_return_value (current_gdbarch, type, valbuf)) +#endif + +typedef int (gdbarch_deprecated_use_struct_convention_ftype) (int gcc_p, struct type *value_type); +extern int gdbarch_deprecated_use_struct_convention (struct gdbarch *gdbarch, int gcc_p, struct type *value_type); +extern void set_gdbarch_deprecated_use_struct_convention (struct gdbarch *gdbarch, gdbarch_deprecated_use_struct_convention_ftype *deprecated_use_struct_convention); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_USE_STRUCT_CONVENTION) +#error "Non multi-arch definition of DEPRECATED_USE_STRUCT_CONVENTION" +#endif +#if !defined (DEPRECATED_USE_STRUCT_CONVENTION) +#define DEPRECATED_USE_STRUCT_CONVENTION(gcc_p, value_type) (gdbarch_deprecated_use_struct_convention (current_gdbarch, gcc_p, value_type)) +#endif + +/* As of 2004-01-17 only the 32-bit SPARC ABI has been identified as an + ABI suitable for the implementation of a robust extract + struct-convention return-value address method (the sparc saves the + address in the callers frame). All the other cases so far examined, + the DEPRECATED_EXTRACT_STRUCT_VALUE implementation has been + erreneous - the code was incorrectly assuming that the return-value + address, stored in a register, was preserved across the entire + function call. + For the moment retain DEPRECATED_EXTRACT_STRUCT_VALUE as a marker of + the ABIs that are still to be analyzed - perhaps this should simply + be deleted. The commented out extract_returned_value_address method + is provided as a starting point for the 32-bit SPARC. It, or + something like it, along with changes to both infcmd.c and stack.c + will be needed for that case to work. NB: It is passed the callers + frame since it is only after the callee has returned that this + function is used. + M::CORE_ADDR:extract_returned_value_address:struct frame_info *caller_frame:caller_frame */ + +#if defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS) +/* Legacy for systems yet to multi-arch DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS */ +#if !defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P) +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P() (1) +#endif +#endif + +extern int gdbarch_deprecated_extract_struct_value_address_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P) +#error "Non multi-arch definition of DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS" +#endif +#if !defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P) +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P() (gdbarch_deprecated_extract_struct_value_address_p (current_gdbarch)) +#endif + +typedef CORE_ADDR (gdbarch_deprecated_extract_struct_value_address_ftype) (struct regcache *regcache); +extern CORE_ADDR gdbarch_deprecated_extract_struct_value_address (struct gdbarch *gdbarch, struct regcache *regcache); +extern void set_gdbarch_deprecated_extract_struct_value_address (struct gdbarch *gdbarch, gdbarch_deprecated_extract_struct_value_address_ftype *deprecated_extract_struct_value_address); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS) +#error "Non multi-arch definition of DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS" +#endif +#if !defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS) +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(regcache) (gdbarch_deprecated_extract_struct_value_address (current_gdbarch, regcache)) +#endif + +#if defined (DEPRECATED_FRAME_INIT_SAVED_REGS) +/* Legacy for systems yet to multi-arch DEPRECATED_FRAME_INIT_SAVED_REGS */ +#if !defined (DEPRECATED_FRAME_INIT_SAVED_REGS_P) +#define DEPRECATED_FRAME_INIT_SAVED_REGS_P() (1) +#endif +#endif + +extern int gdbarch_deprecated_frame_init_saved_regs_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FRAME_INIT_SAVED_REGS_P) +#error "Non multi-arch definition of DEPRECATED_FRAME_INIT_SAVED_REGS" +#endif +#if !defined (DEPRECATED_FRAME_INIT_SAVED_REGS_P) +#define DEPRECATED_FRAME_INIT_SAVED_REGS_P() (gdbarch_deprecated_frame_init_saved_regs_p (current_gdbarch)) +#endif + +typedef void (gdbarch_deprecated_frame_init_saved_regs_ftype) (struct frame_info *frame); +extern void gdbarch_deprecated_frame_init_saved_regs (struct gdbarch *gdbarch, struct frame_info *frame); +extern void set_gdbarch_deprecated_frame_init_saved_regs (struct gdbarch *gdbarch, gdbarch_deprecated_frame_init_saved_regs_ftype *deprecated_frame_init_saved_regs); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FRAME_INIT_SAVED_REGS) +#error "Non multi-arch definition of DEPRECATED_FRAME_INIT_SAVED_REGS" +#endif +#if !defined (DEPRECATED_FRAME_INIT_SAVED_REGS) +#define DEPRECATED_FRAME_INIT_SAVED_REGS(frame) (gdbarch_deprecated_frame_init_saved_regs (current_gdbarch, frame)) +#endif + +#if defined (DEPRECATED_INIT_EXTRA_FRAME_INFO) +/* Legacy for systems yet to multi-arch DEPRECATED_INIT_EXTRA_FRAME_INFO */ +#if !defined (DEPRECATED_INIT_EXTRA_FRAME_INFO_P) +#define DEPRECATED_INIT_EXTRA_FRAME_INFO_P() (1) +#endif +#endif + +extern int gdbarch_deprecated_init_extra_frame_info_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_INIT_EXTRA_FRAME_INFO_P) +#error "Non multi-arch definition of DEPRECATED_INIT_EXTRA_FRAME_INFO" +#endif +#if !defined (DEPRECATED_INIT_EXTRA_FRAME_INFO_P) +#define DEPRECATED_INIT_EXTRA_FRAME_INFO_P() (gdbarch_deprecated_init_extra_frame_info_p (current_gdbarch)) +#endif + +typedef void (gdbarch_deprecated_init_extra_frame_info_ftype) (int fromleaf, struct frame_info *frame); +extern void gdbarch_deprecated_init_extra_frame_info (struct gdbarch *gdbarch, int fromleaf, struct frame_info *frame); +extern void set_gdbarch_deprecated_init_extra_frame_info (struct gdbarch *gdbarch, gdbarch_deprecated_init_extra_frame_info_ftype *deprecated_init_extra_frame_info); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_INIT_EXTRA_FRAME_INFO) +#error "Non multi-arch definition of DEPRECATED_INIT_EXTRA_FRAME_INFO" +#endif +#if !defined (DEPRECATED_INIT_EXTRA_FRAME_INFO) +#define DEPRECATED_INIT_EXTRA_FRAME_INFO(fromleaf, frame) (gdbarch_deprecated_init_extra_frame_info (current_gdbarch, fromleaf, frame)) +#endif + +typedef CORE_ADDR (gdbarch_skip_prologue_ftype) (CORE_ADDR ip); +extern CORE_ADDR gdbarch_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR ip); +extern void set_gdbarch_skip_prologue (struct gdbarch *gdbarch, gdbarch_skip_prologue_ftype *skip_prologue); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (SKIP_PROLOGUE) +#error "Non multi-arch definition of SKIP_PROLOGUE" +#endif +#if !defined (SKIP_PROLOGUE) +#define SKIP_PROLOGUE(ip) (gdbarch_skip_prologue (current_gdbarch, ip)) +#endif + +typedef int (gdbarch_inner_than_ftype) (CORE_ADDR lhs, CORE_ADDR rhs); +extern int gdbarch_inner_than (struct gdbarch *gdbarch, CORE_ADDR lhs, CORE_ADDR rhs); +extern void set_gdbarch_inner_than (struct gdbarch *gdbarch, gdbarch_inner_than_ftype *inner_than); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (INNER_THAN) +#error "Non multi-arch definition of INNER_THAN" +#endif +#if !defined (INNER_THAN) +#define INNER_THAN(lhs, rhs) (gdbarch_inner_than (current_gdbarch, lhs, rhs)) +#endif + +typedef const unsigned char * (gdbarch_breakpoint_from_pc_ftype) (CORE_ADDR *pcptr, int *lenptr); +extern const unsigned char * gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr); +extern void set_gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (BREAKPOINT_FROM_PC) +#error "Non multi-arch definition of BREAKPOINT_FROM_PC" +#endif +#if !defined (BREAKPOINT_FROM_PC) +#define BREAKPOINT_FROM_PC(pcptr, lenptr) (gdbarch_breakpoint_from_pc (current_gdbarch, pcptr, lenptr)) +#endif + +extern int gdbarch_adjust_breakpoint_address_p (struct gdbarch *gdbarch); + +typedef CORE_ADDR (gdbarch_adjust_breakpoint_address_ftype) (struct gdbarch *gdbarch, CORE_ADDR bpaddr); +extern CORE_ADDR gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr); +extern void set_gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch, gdbarch_adjust_breakpoint_address_ftype *adjust_breakpoint_address); + +typedef int (gdbarch_memory_insert_breakpoint_ftype) (CORE_ADDR addr, char *contents_cache); +extern int gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, CORE_ADDR addr, char *contents_cache); +extern void set_gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (MEMORY_INSERT_BREAKPOINT) +#error "Non multi-arch definition of MEMORY_INSERT_BREAKPOINT" +#endif +#if !defined (MEMORY_INSERT_BREAKPOINT) +#define MEMORY_INSERT_BREAKPOINT(addr, contents_cache) (gdbarch_memory_insert_breakpoint (current_gdbarch, addr, contents_cache)) +#endif + +typedef int (gdbarch_memory_remove_breakpoint_ftype) (CORE_ADDR addr, char *contents_cache); +extern int gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, CORE_ADDR addr, char *contents_cache); +extern void set_gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, gdbarch_memory_remove_breakpoint_ftype *memory_remove_breakpoint); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (MEMORY_REMOVE_BREAKPOINT) +#error "Non multi-arch definition of MEMORY_REMOVE_BREAKPOINT" +#endif +#if !defined (MEMORY_REMOVE_BREAKPOINT) +#define MEMORY_REMOVE_BREAKPOINT(addr, contents_cache) (gdbarch_memory_remove_breakpoint (current_gdbarch, addr, contents_cache)) +#endif + +extern CORE_ADDR gdbarch_decr_pc_after_break (struct gdbarch *gdbarch); +extern void set_gdbarch_decr_pc_after_break (struct gdbarch *gdbarch, CORE_ADDR decr_pc_after_break); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DECR_PC_AFTER_BREAK) +#error "Non multi-arch definition of DECR_PC_AFTER_BREAK" +#endif +#if !defined (DECR_PC_AFTER_BREAK) +#define DECR_PC_AFTER_BREAK (gdbarch_decr_pc_after_break (current_gdbarch)) +#endif + +/* A function can be addressed by either it's "pointer" (possibly a + descriptor address) or "entry point" (first executable instruction). + The method "convert_from_func_ptr_addr" converting the former to the + latter. DEPRECATED_FUNCTION_START_OFFSET is being used to implement + a simplified subset of that functionality - the function's address + corresponds to the "function pointer" and the function's start + corresponds to the "function entry point" - and hence is redundant. */ + +extern CORE_ADDR gdbarch_deprecated_function_start_offset (struct gdbarch *gdbarch); +extern void set_gdbarch_deprecated_function_start_offset (struct gdbarch *gdbarch, CORE_ADDR deprecated_function_start_offset); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FUNCTION_START_OFFSET) +#error "Non multi-arch definition of DEPRECATED_FUNCTION_START_OFFSET" +#endif +#if !defined (DEPRECATED_FUNCTION_START_OFFSET) +#define DEPRECATED_FUNCTION_START_OFFSET (gdbarch_deprecated_function_start_offset (current_gdbarch)) +#endif + +typedef void (gdbarch_remote_translate_xfer_address_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len); +extern void gdbarch_remote_translate_xfer_address (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len); +extern void set_gdbarch_remote_translate_xfer_address (struct gdbarch *gdbarch, gdbarch_remote_translate_xfer_address_ftype *remote_translate_xfer_address); + +extern CORE_ADDR gdbarch_frame_args_skip (struct gdbarch *gdbarch); +extern void set_gdbarch_frame_args_skip (struct gdbarch *gdbarch, CORE_ADDR frame_args_skip); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FRAME_ARGS_SKIP) +#error "Non multi-arch definition of FRAME_ARGS_SKIP" +#endif +#if !defined (FRAME_ARGS_SKIP) +#define FRAME_ARGS_SKIP (gdbarch_frame_args_skip (current_gdbarch)) +#endif + +/* DEPRECATED_FRAMELESS_FUNCTION_INVOCATION is not needed. The new + frame code works regardless of the type of frame - frameless, + stackless, or normal. */ + +#if defined (DEPRECATED_FRAMELESS_FUNCTION_INVOCATION) +/* Legacy for systems yet to multi-arch DEPRECATED_FRAMELESS_FUNCTION_INVOCATION */ +#if !defined (DEPRECATED_FRAMELESS_FUNCTION_INVOCATION_P) +#define DEPRECATED_FRAMELESS_FUNCTION_INVOCATION_P() (1) +#endif +#endif + +extern int gdbarch_deprecated_frameless_function_invocation_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FRAMELESS_FUNCTION_INVOCATION_P) +#error "Non multi-arch definition of DEPRECATED_FRAMELESS_FUNCTION_INVOCATION" +#endif +#if !defined (DEPRECATED_FRAMELESS_FUNCTION_INVOCATION_P) +#define DEPRECATED_FRAMELESS_FUNCTION_INVOCATION_P() (gdbarch_deprecated_frameless_function_invocation_p (current_gdbarch)) +#endif + +typedef int (gdbarch_deprecated_frameless_function_invocation_ftype) (struct frame_info *fi); +extern int gdbarch_deprecated_frameless_function_invocation (struct gdbarch *gdbarch, struct frame_info *fi); +extern void set_gdbarch_deprecated_frameless_function_invocation (struct gdbarch *gdbarch, gdbarch_deprecated_frameless_function_invocation_ftype *deprecated_frameless_function_invocation); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FRAMELESS_FUNCTION_INVOCATION) +#error "Non multi-arch definition of DEPRECATED_FRAMELESS_FUNCTION_INVOCATION" +#endif +#if !defined (DEPRECATED_FRAMELESS_FUNCTION_INVOCATION) +#define DEPRECATED_FRAMELESS_FUNCTION_INVOCATION(fi) (gdbarch_deprecated_frameless_function_invocation (current_gdbarch, fi)) +#endif + +#if defined (DEPRECATED_FRAME_CHAIN) +/* Legacy for systems yet to multi-arch DEPRECATED_FRAME_CHAIN */ +#if !defined (DEPRECATED_FRAME_CHAIN_P) +#define DEPRECATED_FRAME_CHAIN_P() (1) +#endif +#endif + +extern int gdbarch_deprecated_frame_chain_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FRAME_CHAIN_P) +#error "Non multi-arch definition of DEPRECATED_FRAME_CHAIN" +#endif +#if !defined (DEPRECATED_FRAME_CHAIN_P) +#define DEPRECATED_FRAME_CHAIN_P() (gdbarch_deprecated_frame_chain_p (current_gdbarch)) +#endif + +typedef CORE_ADDR (gdbarch_deprecated_frame_chain_ftype) (struct frame_info *frame); +extern CORE_ADDR gdbarch_deprecated_frame_chain (struct gdbarch *gdbarch, struct frame_info *frame); +extern void set_gdbarch_deprecated_frame_chain (struct gdbarch *gdbarch, gdbarch_deprecated_frame_chain_ftype *deprecated_frame_chain); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FRAME_CHAIN) +#error "Non multi-arch definition of DEPRECATED_FRAME_CHAIN" +#endif +#if !defined (DEPRECATED_FRAME_CHAIN) +#define DEPRECATED_FRAME_CHAIN(frame) (gdbarch_deprecated_frame_chain (current_gdbarch, frame)) +#endif + +#if defined (DEPRECATED_FRAME_CHAIN_VALID) +/* Legacy for systems yet to multi-arch DEPRECATED_FRAME_CHAIN_VALID */ +#if !defined (DEPRECATED_FRAME_CHAIN_VALID_P) +#define DEPRECATED_FRAME_CHAIN_VALID_P() (1) +#endif +#endif + +extern int gdbarch_deprecated_frame_chain_valid_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FRAME_CHAIN_VALID_P) +#error "Non multi-arch definition of DEPRECATED_FRAME_CHAIN_VALID" +#endif +#if !defined (DEPRECATED_FRAME_CHAIN_VALID_P) +#define DEPRECATED_FRAME_CHAIN_VALID_P() (gdbarch_deprecated_frame_chain_valid_p (current_gdbarch)) +#endif + +typedef int (gdbarch_deprecated_frame_chain_valid_ftype) (CORE_ADDR chain, struct frame_info *thisframe); +extern int gdbarch_deprecated_frame_chain_valid (struct gdbarch *gdbarch, CORE_ADDR chain, struct frame_info *thisframe); +extern void set_gdbarch_deprecated_frame_chain_valid (struct gdbarch *gdbarch, gdbarch_deprecated_frame_chain_valid_ftype *deprecated_frame_chain_valid); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FRAME_CHAIN_VALID) +#error "Non multi-arch definition of DEPRECATED_FRAME_CHAIN_VALID" +#endif +#if !defined (DEPRECATED_FRAME_CHAIN_VALID) +#define DEPRECATED_FRAME_CHAIN_VALID(chain, thisframe) (gdbarch_deprecated_frame_chain_valid (current_gdbarch, chain, thisframe)) +#endif + +/* DEPRECATED_FRAME_SAVED_PC has been replaced by UNWIND_PC. Please + note, per UNWIND_PC's doco, that while the two have similar + interfaces they have very different underlying implementations. */ + +#if defined (DEPRECATED_FRAME_SAVED_PC) +/* Legacy for systems yet to multi-arch DEPRECATED_FRAME_SAVED_PC */ +#if !defined (DEPRECATED_FRAME_SAVED_PC_P) +#define DEPRECATED_FRAME_SAVED_PC_P() (1) +#endif +#endif + +extern int gdbarch_deprecated_frame_saved_pc_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FRAME_SAVED_PC_P) +#error "Non multi-arch definition of DEPRECATED_FRAME_SAVED_PC" +#endif +#if !defined (DEPRECATED_FRAME_SAVED_PC_P) +#define DEPRECATED_FRAME_SAVED_PC_P() (gdbarch_deprecated_frame_saved_pc_p (current_gdbarch)) +#endif + +typedef CORE_ADDR (gdbarch_deprecated_frame_saved_pc_ftype) (struct frame_info *fi); +extern CORE_ADDR gdbarch_deprecated_frame_saved_pc (struct gdbarch *gdbarch, struct frame_info *fi); +extern void set_gdbarch_deprecated_frame_saved_pc (struct gdbarch *gdbarch, gdbarch_deprecated_frame_saved_pc_ftype *deprecated_frame_saved_pc); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FRAME_SAVED_PC) +#error "Non multi-arch definition of DEPRECATED_FRAME_SAVED_PC" +#endif +#if !defined (DEPRECATED_FRAME_SAVED_PC) +#define DEPRECATED_FRAME_SAVED_PC(fi) (gdbarch_deprecated_frame_saved_pc (current_gdbarch, fi)) +#endif + +extern int gdbarch_unwind_pc_p (struct gdbarch *gdbarch); + +typedef CORE_ADDR (gdbarch_unwind_pc_ftype) (struct gdbarch *gdbarch, struct frame_info *next_frame); +extern CORE_ADDR gdbarch_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame); +extern void set_gdbarch_unwind_pc (struct gdbarch *gdbarch, gdbarch_unwind_pc_ftype *unwind_pc); + +extern int gdbarch_unwind_sp_p (struct gdbarch *gdbarch); + +typedef CORE_ADDR (gdbarch_unwind_sp_ftype) (struct gdbarch *gdbarch, struct frame_info *next_frame); +extern CORE_ADDR gdbarch_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame); +extern void set_gdbarch_unwind_sp (struct gdbarch *gdbarch, gdbarch_unwind_sp_ftype *unwind_sp); + +/* DEPRECATED_FRAME_ARGS_ADDRESS as been replaced by the per-frame + frame-base. Enable frame-base before frame-unwind. */ + +#if defined (DEPRECATED_FRAME_ARGS_ADDRESS) +/* Legacy for systems yet to multi-arch DEPRECATED_FRAME_ARGS_ADDRESS */ +#if !defined (DEPRECATED_FRAME_ARGS_ADDRESS_P) +#define DEPRECATED_FRAME_ARGS_ADDRESS_P() (1) +#endif +#endif + +extern int gdbarch_deprecated_frame_args_address_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FRAME_ARGS_ADDRESS_P) +#error "Non multi-arch definition of DEPRECATED_FRAME_ARGS_ADDRESS" +#endif +#if !defined (DEPRECATED_FRAME_ARGS_ADDRESS_P) +#define DEPRECATED_FRAME_ARGS_ADDRESS_P() (gdbarch_deprecated_frame_args_address_p (current_gdbarch)) +#endif + +typedef CORE_ADDR (gdbarch_deprecated_frame_args_address_ftype) (struct frame_info *fi); +extern CORE_ADDR gdbarch_deprecated_frame_args_address (struct gdbarch *gdbarch, struct frame_info *fi); +extern void set_gdbarch_deprecated_frame_args_address (struct gdbarch *gdbarch, gdbarch_deprecated_frame_args_address_ftype *deprecated_frame_args_address); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FRAME_ARGS_ADDRESS) +#error "Non multi-arch definition of DEPRECATED_FRAME_ARGS_ADDRESS" +#endif +#if !defined (DEPRECATED_FRAME_ARGS_ADDRESS) +#define DEPRECATED_FRAME_ARGS_ADDRESS(fi) (gdbarch_deprecated_frame_args_address (current_gdbarch, fi)) +#endif + +/* DEPRECATED_FRAME_LOCALS_ADDRESS as been replaced by the per-frame + frame-base. Enable frame-base before frame-unwind. */ + +#if defined (DEPRECATED_FRAME_LOCALS_ADDRESS) +/* Legacy for systems yet to multi-arch DEPRECATED_FRAME_LOCALS_ADDRESS */ +#if !defined (DEPRECATED_FRAME_LOCALS_ADDRESS_P) +#define DEPRECATED_FRAME_LOCALS_ADDRESS_P() (1) +#endif +#endif + +extern int gdbarch_deprecated_frame_locals_address_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FRAME_LOCALS_ADDRESS_P) +#error "Non multi-arch definition of DEPRECATED_FRAME_LOCALS_ADDRESS" +#endif +#if !defined (DEPRECATED_FRAME_LOCALS_ADDRESS_P) +#define DEPRECATED_FRAME_LOCALS_ADDRESS_P() (gdbarch_deprecated_frame_locals_address_p (current_gdbarch)) +#endif + +typedef CORE_ADDR (gdbarch_deprecated_frame_locals_address_ftype) (struct frame_info *fi); +extern CORE_ADDR gdbarch_deprecated_frame_locals_address (struct gdbarch *gdbarch, struct frame_info *fi); +extern void set_gdbarch_deprecated_frame_locals_address (struct gdbarch *gdbarch, gdbarch_deprecated_frame_locals_address_ftype *deprecated_frame_locals_address); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FRAME_LOCALS_ADDRESS) +#error "Non multi-arch definition of DEPRECATED_FRAME_LOCALS_ADDRESS" +#endif +#if !defined (DEPRECATED_FRAME_LOCALS_ADDRESS) +#define DEPRECATED_FRAME_LOCALS_ADDRESS(fi) (gdbarch_deprecated_frame_locals_address (current_gdbarch, fi)) +#endif + +#if defined (DEPRECATED_SAVED_PC_AFTER_CALL) +/* Legacy for systems yet to multi-arch DEPRECATED_SAVED_PC_AFTER_CALL */ +#if !defined (DEPRECATED_SAVED_PC_AFTER_CALL_P) +#define DEPRECATED_SAVED_PC_AFTER_CALL_P() (1) +#endif +#endif + +extern int gdbarch_deprecated_saved_pc_after_call_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_SAVED_PC_AFTER_CALL_P) +#error "Non multi-arch definition of DEPRECATED_SAVED_PC_AFTER_CALL" +#endif +#if !defined (DEPRECATED_SAVED_PC_AFTER_CALL_P) +#define DEPRECATED_SAVED_PC_AFTER_CALL_P() (gdbarch_deprecated_saved_pc_after_call_p (current_gdbarch)) +#endif + +typedef CORE_ADDR (gdbarch_deprecated_saved_pc_after_call_ftype) (struct frame_info *frame); +extern CORE_ADDR gdbarch_deprecated_saved_pc_after_call (struct gdbarch *gdbarch, struct frame_info *frame); +extern void set_gdbarch_deprecated_saved_pc_after_call (struct gdbarch *gdbarch, gdbarch_deprecated_saved_pc_after_call_ftype *deprecated_saved_pc_after_call); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_SAVED_PC_AFTER_CALL) +#error "Non multi-arch definition of DEPRECATED_SAVED_PC_AFTER_CALL" +#endif +#if !defined (DEPRECATED_SAVED_PC_AFTER_CALL) +#define DEPRECATED_SAVED_PC_AFTER_CALL(frame) (gdbarch_deprecated_saved_pc_after_call (current_gdbarch, frame)) +#endif + +#if defined (FRAME_NUM_ARGS) +/* Legacy for systems yet to multi-arch FRAME_NUM_ARGS */ +#if !defined (FRAME_NUM_ARGS_P) +#define FRAME_NUM_ARGS_P() (1) +#endif +#endif + +extern int gdbarch_frame_num_args_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FRAME_NUM_ARGS_P) +#error "Non multi-arch definition of FRAME_NUM_ARGS" +#endif +#if !defined (FRAME_NUM_ARGS_P) +#define FRAME_NUM_ARGS_P() (gdbarch_frame_num_args_p (current_gdbarch)) +#endif + +typedef int (gdbarch_frame_num_args_ftype) (struct frame_info *frame); +extern int gdbarch_frame_num_args (struct gdbarch *gdbarch, struct frame_info *frame); +extern void set_gdbarch_frame_num_args (struct gdbarch *gdbarch, gdbarch_frame_num_args_ftype *frame_num_args); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FRAME_NUM_ARGS) +#error "Non multi-arch definition of FRAME_NUM_ARGS" +#endif +#if !defined (FRAME_NUM_ARGS) +#define FRAME_NUM_ARGS(frame) (gdbarch_frame_num_args (current_gdbarch, frame)) +#endif + +/* DEPRECATED_STACK_ALIGN has been replaced by an initial aligning call + to frame_align and the requirement that methods such as + push_dummy_call and frame_red_zone_size maintain correct stack/frame + alignment. */ + +#if defined (DEPRECATED_STACK_ALIGN) +/* Legacy for systems yet to multi-arch DEPRECATED_STACK_ALIGN */ +#if !defined (DEPRECATED_STACK_ALIGN_P) +#define DEPRECATED_STACK_ALIGN_P() (1) +#endif +#endif + +extern int gdbarch_deprecated_stack_align_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_STACK_ALIGN_P) +#error "Non multi-arch definition of DEPRECATED_STACK_ALIGN" +#endif +#if !defined (DEPRECATED_STACK_ALIGN_P) +#define DEPRECATED_STACK_ALIGN_P() (gdbarch_deprecated_stack_align_p (current_gdbarch)) +#endif + +typedef CORE_ADDR (gdbarch_deprecated_stack_align_ftype) (CORE_ADDR sp); +extern CORE_ADDR gdbarch_deprecated_stack_align (struct gdbarch *gdbarch, CORE_ADDR sp); +extern void set_gdbarch_deprecated_stack_align (struct gdbarch *gdbarch, gdbarch_deprecated_stack_align_ftype *deprecated_stack_align); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_STACK_ALIGN) +#error "Non multi-arch definition of DEPRECATED_STACK_ALIGN" +#endif +#if !defined (DEPRECATED_STACK_ALIGN) +#define DEPRECATED_STACK_ALIGN(sp) (gdbarch_deprecated_stack_align (current_gdbarch, sp)) +#endif + +extern int gdbarch_frame_align_p (struct gdbarch *gdbarch); + +typedef CORE_ADDR (gdbarch_frame_align_ftype) (struct gdbarch *gdbarch, CORE_ADDR address); +extern CORE_ADDR gdbarch_frame_align (struct gdbarch *gdbarch, CORE_ADDR address); +extern void set_gdbarch_frame_align (struct gdbarch *gdbarch, gdbarch_frame_align_ftype *frame_align); + +/* DEPRECATED_REG_STRUCT_HAS_ADDR has been replaced by + stabs_argument_has_addr. */ + +#if defined (DEPRECATED_REG_STRUCT_HAS_ADDR) +/* Legacy for systems yet to multi-arch DEPRECATED_REG_STRUCT_HAS_ADDR */ +#if !defined (DEPRECATED_REG_STRUCT_HAS_ADDR_P) +#define DEPRECATED_REG_STRUCT_HAS_ADDR_P() (1) +#endif +#endif + +extern int gdbarch_deprecated_reg_struct_has_addr_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_REG_STRUCT_HAS_ADDR_P) +#error "Non multi-arch definition of DEPRECATED_REG_STRUCT_HAS_ADDR" +#endif +#if !defined (DEPRECATED_REG_STRUCT_HAS_ADDR_P) +#define DEPRECATED_REG_STRUCT_HAS_ADDR_P() (gdbarch_deprecated_reg_struct_has_addr_p (current_gdbarch)) +#endif + +typedef int (gdbarch_deprecated_reg_struct_has_addr_ftype) (int gcc_p, struct type *type); +extern int gdbarch_deprecated_reg_struct_has_addr (struct gdbarch *gdbarch, int gcc_p, struct type *type); +extern void set_gdbarch_deprecated_reg_struct_has_addr (struct gdbarch *gdbarch, gdbarch_deprecated_reg_struct_has_addr_ftype *deprecated_reg_struct_has_addr); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_REG_STRUCT_HAS_ADDR) +#error "Non multi-arch definition of DEPRECATED_REG_STRUCT_HAS_ADDR" +#endif +#if !defined (DEPRECATED_REG_STRUCT_HAS_ADDR) +#define DEPRECATED_REG_STRUCT_HAS_ADDR(gcc_p, type) (gdbarch_deprecated_reg_struct_has_addr (current_gdbarch, gcc_p, type)) +#endif + +typedef int (gdbarch_stabs_argument_has_addr_ftype) (struct gdbarch *gdbarch, struct type *type); +extern int gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type); +extern void set_gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch, gdbarch_stabs_argument_has_addr_ftype *stabs_argument_has_addr); + +extern int gdbarch_frame_red_zone_size (struct gdbarch *gdbarch); +extern void set_gdbarch_frame_red_zone_size (struct gdbarch *gdbarch, int frame_red_zone_size); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FRAME_RED_ZONE_SIZE) +#error "Non multi-arch definition of FRAME_RED_ZONE_SIZE" +#endif +#if !defined (FRAME_RED_ZONE_SIZE) +#define FRAME_RED_ZONE_SIZE (gdbarch_frame_red_zone_size (current_gdbarch)) +#endif + +extern const struct floatformat * gdbarch_float_format (struct gdbarch *gdbarch); +extern void set_gdbarch_float_format (struct gdbarch *gdbarch, const struct floatformat * float_format); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_FLOAT_FORMAT) +#error "Non multi-arch definition of TARGET_FLOAT_FORMAT" +#endif +#if !defined (TARGET_FLOAT_FORMAT) +#define TARGET_FLOAT_FORMAT (gdbarch_float_format (current_gdbarch)) +#endif + +extern const struct floatformat * gdbarch_double_format (struct gdbarch *gdbarch); +extern void set_gdbarch_double_format (struct gdbarch *gdbarch, const struct floatformat * double_format); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_DOUBLE_FORMAT) +#error "Non multi-arch definition of TARGET_DOUBLE_FORMAT" +#endif +#if !defined (TARGET_DOUBLE_FORMAT) +#define TARGET_DOUBLE_FORMAT (gdbarch_double_format (current_gdbarch)) +#endif + +extern const struct floatformat * gdbarch_long_double_format (struct gdbarch *gdbarch); +extern void set_gdbarch_long_double_format (struct gdbarch *gdbarch, const struct floatformat * long_double_format); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_LONG_DOUBLE_FORMAT) +#error "Non multi-arch definition of TARGET_LONG_DOUBLE_FORMAT" +#endif +#if !defined (TARGET_LONG_DOUBLE_FORMAT) +#define TARGET_LONG_DOUBLE_FORMAT (gdbarch_long_double_format (current_gdbarch)) +#endif + +typedef CORE_ADDR (gdbarch_convert_from_func_ptr_addr_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr, struct target_ops *targ); +extern CORE_ADDR gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr, struct target_ops *targ); +extern void set_gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr); + +/* On some machines there are bits in addresses which are not really + part of the address, but are used by the kernel, the hardware, etc. + for special purposes. ADDR_BITS_REMOVE takes out any such bits so + we get a "real" address such as one would find in a symbol table. + This is used only for addresses of instructions, and even then I'm + not sure it's used in all contexts. It exists to deal with there + being a few stray bits in the PC which would mislead us, not as some + sort of generic thing to handle alignment or segmentation (it's + possible it should be in TARGET_READ_PC instead). */ + +typedef CORE_ADDR (gdbarch_addr_bits_remove_ftype) (CORE_ADDR addr); +extern CORE_ADDR gdbarch_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr); +extern void set_gdbarch_addr_bits_remove (struct gdbarch *gdbarch, gdbarch_addr_bits_remove_ftype *addr_bits_remove); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (ADDR_BITS_REMOVE) +#error "Non multi-arch definition of ADDR_BITS_REMOVE" +#endif +#if !defined (ADDR_BITS_REMOVE) +#define ADDR_BITS_REMOVE(addr) (gdbarch_addr_bits_remove (current_gdbarch, addr)) +#endif + +/* It is not at all clear why SMASH_TEXT_ADDRESS is not folded into + ADDR_BITS_REMOVE. */ + +typedef CORE_ADDR (gdbarch_smash_text_address_ftype) (CORE_ADDR addr); +extern CORE_ADDR gdbarch_smash_text_address (struct gdbarch *gdbarch, CORE_ADDR addr); +extern void set_gdbarch_smash_text_address (struct gdbarch *gdbarch, gdbarch_smash_text_address_ftype *smash_text_address); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (SMASH_TEXT_ADDRESS) +#error "Non multi-arch definition of SMASH_TEXT_ADDRESS" +#endif +#if !defined (SMASH_TEXT_ADDRESS) +#define SMASH_TEXT_ADDRESS(addr) (gdbarch_smash_text_address (current_gdbarch, addr)) +#endif + +/* FIXME/cagney/2001-01-18: This should be split in two. A target method that indicates if + the target needs software single step. An ISA method to implement it. + + FIXME/cagney/2001-01-18: This should be replaced with something that inserts breakpoints + using the breakpoint system instead of blatting memory directly (as with rs6000). + + FIXME/cagney/2001-01-18: The logic is backwards. It should be asking if the target can + single step. If not, then implement single step using breakpoints. */ + +#if defined (SOFTWARE_SINGLE_STEP) +/* Legacy for systems yet to multi-arch SOFTWARE_SINGLE_STEP */ +#if !defined (SOFTWARE_SINGLE_STEP_P) +#define SOFTWARE_SINGLE_STEP_P() (1) +#endif +#endif + +extern int gdbarch_software_single_step_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (SOFTWARE_SINGLE_STEP_P) +#error "Non multi-arch definition of SOFTWARE_SINGLE_STEP" +#endif +#if !defined (SOFTWARE_SINGLE_STEP_P) +#define SOFTWARE_SINGLE_STEP_P() (gdbarch_software_single_step_p (current_gdbarch)) +#endif + +typedef void (gdbarch_software_single_step_ftype) (enum target_signal sig, int insert_breakpoints_p); +extern void gdbarch_software_single_step (struct gdbarch *gdbarch, enum target_signal sig, int insert_breakpoints_p); +extern void set_gdbarch_software_single_step (struct gdbarch *gdbarch, gdbarch_software_single_step_ftype *software_single_step); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (SOFTWARE_SINGLE_STEP) +#error "Non multi-arch definition of SOFTWARE_SINGLE_STEP" +#endif +#if !defined (SOFTWARE_SINGLE_STEP) +#define SOFTWARE_SINGLE_STEP(sig, insert_breakpoints_p) (gdbarch_software_single_step (current_gdbarch, sig, insert_breakpoints_p)) +#endif + +/* FIXME: cagney/2003-08-28: Need to find a better way of selecting the + disassembler. Perhaphs objdump can handle it? */ + +typedef int (gdbarch_print_insn_ftype) (bfd_vma vma, struct disassemble_info *info); +extern int gdbarch_print_insn (struct gdbarch *gdbarch, bfd_vma vma, struct disassemble_info *info); +extern void set_gdbarch_print_insn (struct gdbarch *gdbarch, gdbarch_print_insn_ftype *print_insn); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_PRINT_INSN) +#error "Non multi-arch definition of TARGET_PRINT_INSN" +#endif +#if !defined (TARGET_PRINT_INSN) +#define TARGET_PRINT_INSN(vma, info) (gdbarch_print_insn (current_gdbarch, vma, info)) +#endif + +typedef CORE_ADDR (gdbarch_skip_trampoline_code_ftype) (CORE_ADDR pc); +extern CORE_ADDR gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, CORE_ADDR pc); +extern void set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, gdbarch_skip_trampoline_code_ftype *skip_trampoline_code); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (SKIP_TRAMPOLINE_CODE) +#error "Non multi-arch definition of SKIP_TRAMPOLINE_CODE" +#endif +#if !defined (SKIP_TRAMPOLINE_CODE) +#define SKIP_TRAMPOLINE_CODE(pc) (gdbarch_skip_trampoline_code (current_gdbarch, pc)) +#endif + +/* If IN_SOLIB_DYNSYM_RESOLVE_CODE returns true, and SKIP_SOLIB_RESOLVER + evaluates non-zero, this is the address where the debugger will place + a step-resume breakpoint to get us past the dynamic linker. */ + +typedef CORE_ADDR (gdbarch_skip_solib_resolver_ftype) (struct gdbarch *gdbarch, CORE_ADDR pc); +extern CORE_ADDR gdbarch_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc); +extern void set_gdbarch_skip_solib_resolver (struct gdbarch *gdbarch, gdbarch_skip_solib_resolver_ftype *skip_solib_resolver); + +/* For SVR4 shared libraries, each call goes through a small piece of + trampoline code in the ".plt" section. IN_SOLIB_CALL_TRAMPOLINE evaluates + to nonzero if we are currently stopped in one of these. */ + +typedef int (gdbarch_in_solib_call_trampoline_ftype) (CORE_ADDR pc, char *name); +extern int gdbarch_in_solib_call_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, char *name); +extern void set_gdbarch_in_solib_call_trampoline (struct gdbarch *gdbarch, gdbarch_in_solib_call_trampoline_ftype *in_solib_call_trampoline); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (IN_SOLIB_CALL_TRAMPOLINE) +#error "Non multi-arch definition of IN_SOLIB_CALL_TRAMPOLINE" +#endif +#if !defined (IN_SOLIB_CALL_TRAMPOLINE) +#define IN_SOLIB_CALL_TRAMPOLINE(pc, name) (gdbarch_in_solib_call_trampoline (current_gdbarch, pc, name)) +#endif + +/* Some systems also have trampoline code for returning from shared libs. */ + +typedef int (gdbarch_in_solib_return_trampoline_ftype) (CORE_ADDR pc, char *name); +extern int gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, char *name); +extern void set_gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (IN_SOLIB_RETURN_TRAMPOLINE) +#error "Non multi-arch definition of IN_SOLIB_RETURN_TRAMPOLINE" +#endif +#if !defined (IN_SOLIB_RETURN_TRAMPOLINE) +#define IN_SOLIB_RETURN_TRAMPOLINE(pc, name) (gdbarch_in_solib_return_trampoline (current_gdbarch, pc, name)) +#endif + +/* A target might have problems with watchpoints as soon as the stack + frame of the current function has been destroyed. This mostly happens + as the first action in a funtion's epilogue. in_function_epilogue_p() + is defined to return a non-zero value if either the given addr is one + instruction after the stack destroying instruction up to the trailing + return instruction or if we can figure out that the stack frame has + already been invalidated regardless of the value of addr. Targets + which don't suffer from that problem could just let this functionality + untouched. */ + +typedef int (gdbarch_in_function_epilogue_p_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr); +extern int gdbarch_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR addr); +extern void set_gdbarch_in_function_epilogue_p (struct gdbarch *gdbarch, gdbarch_in_function_epilogue_p_ftype *in_function_epilogue_p); + +/* Given a vector of command-line arguments, return a newly allocated + string which, when passed to the create_inferior function, will be + parsed (on Unix systems, by the shell) to yield the same vector. + This function should call error() if the argument vector is not + representable for this target or if this target does not support + command-line arguments. + ARGC is the number of elements in the vector. + ARGV is an array of strings, one per argument. */ + +typedef char * (gdbarch_construct_inferior_arguments_ftype) (struct gdbarch *gdbarch, int argc, char **argv); +extern char * gdbarch_construct_inferior_arguments (struct gdbarch *gdbarch, int argc, char **argv); +extern void set_gdbarch_construct_inferior_arguments (struct gdbarch *gdbarch, gdbarch_construct_inferior_arguments_ftype *construct_inferior_arguments); + +typedef void (gdbarch_elf_make_msymbol_special_ftype) (asymbol *sym, struct minimal_symbol *msym); +extern void gdbarch_elf_make_msymbol_special (struct gdbarch *gdbarch, asymbol *sym, struct minimal_symbol *msym); +extern void set_gdbarch_elf_make_msymbol_special (struct gdbarch *gdbarch, gdbarch_elf_make_msymbol_special_ftype *elf_make_msymbol_special); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (ELF_MAKE_MSYMBOL_SPECIAL) +#error "Non multi-arch definition of ELF_MAKE_MSYMBOL_SPECIAL" +#endif +#if !defined (ELF_MAKE_MSYMBOL_SPECIAL) +#define ELF_MAKE_MSYMBOL_SPECIAL(sym, msym) (gdbarch_elf_make_msymbol_special (current_gdbarch, sym, msym)) +#endif + +typedef void (gdbarch_coff_make_msymbol_special_ftype) (int val, struct minimal_symbol *msym); +extern void gdbarch_coff_make_msymbol_special (struct gdbarch *gdbarch, int val, struct minimal_symbol *msym); +extern void set_gdbarch_coff_make_msymbol_special (struct gdbarch *gdbarch, gdbarch_coff_make_msymbol_special_ftype *coff_make_msymbol_special); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (COFF_MAKE_MSYMBOL_SPECIAL) +#error "Non multi-arch definition of COFF_MAKE_MSYMBOL_SPECIAL" +#endif +#if !defined (COFF_MAKE_MSYMBOL_SPECIAL) +#define COFF_MAKE_MSYMBOL_SPECIAL(val, msym) (gdbarch_coff_make_msymbol_special (current_gdbarch, val, msym)) +#endif + +extern const char * gdbarch_name_of_malloc (struct gdbarch *gdbarch); +extern void set_gdbarch_name_of_malloc (struct gdbarch *gdbarch, const char * name_of_malloc); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (NAME_OF_MALLOC) +#error "Non multi-arch definition of NAME_OF_MALLOC" +#endif +#if !defined (NAME_OF_MALLOC) +#define NAME_OF_MALLOC (gdbarch_name_of_malloc (current_gdbarch)) +#endif + +extern int gdbarch_cannot_step_breakpoint (struct gdbarch *gdbarch); +extern void set_gdbarch_cannot_step_breakpoint (struct gdbarch *gdbarch, int cannot_step_breakpoint); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CANNOT_STEP_BREAKPOINT) +#error "Non multi-arch definition of CANNOT_STEP_BREAKPOINT" +#endif +#if !defined (CANNOT_STEP_BREAKPOINT) +#define CANNOT_STEP_BREAKPOINT (gdbarch_cannot_step_breakpoint (current_gdbarch)) +#endif + +extern int gdbarch_have_nonsteppable_watchpoint (struct gdbarch *gdbarch); +extern void set_gdbarch_have_nonsteppable_watchpoint (struct gdbarch *gdbarch, int have_nonsteppable_watchpoint); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (HAVE_NONSTEPPABLE_WATCHPOINT) +#error "Non multi-arch definition of HAVE_NONSTEPPABLE_WATCHPOINT" +#endif +#if !defined (HAVE_NONSTEPPABLE_WATCHPOINT) +#define HAVE_NONSTEPPABLE_WATCHPOINT (gdbarch_have_nonsteppable_watchpoint (current_gdbarch)) +#endif + +#if defined (ADDRESS_CLASS_TYPE_FLAGS) +/* Legacy for systems yet to multi-arch ADDRESS_CLASS_TYPE_FLAGS */ +#if !defined (ADDRESS_CLASS_TYPE_FLAGS_P) +#define ADDRESS_CLASS_TYPE_FLAGS_P() (1) +#endif +#endif + +extern int gdbarch_address_class_type_flags_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (ADDRESS_CLASS_TYPE_FLAGS_P) +#error "Non multi-arch definition of ADDRESS_CLASS_TYPE_FLAGS" +#endif +#if !defined (ADDRESS_CLASS_TYPE_FLAGS_P) +#define ADDRESS_CLASS_TYPE_FLAGS_P() (gdbarch_address_class_type_flags_p (current_gdbarch)) +#endif + +typedef int (gdbarch_address_class_type_flags_ftype) (int byte_size, int dwarf2_addr_class); +extern int gdbarch_address_class_type_flags (struct gdbarch *gdbarch, int byte_size, int dwarf2_addr_class); +extern void set_gdbarch_address_class_type_flags (struct gdbarch *gdbarch, gdbarch_address_class_type_flags_ftype *address_class_type_flags); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (ADDRESS_CLASS_TYPE_FLAGS) +#error "Non multi-arch definition of ADDRESS_CLASS_TYPE_FLAGS" +#endif +#if !defined (ADDRESS_CLASS_TYPE_FLAGS) +#define ADDRESS_CLASS_TYPE_FLAGS(byte_size, dwarf2_addr_class) (gdbarch_address_class_type_flags (current_gdbarch, byte_size, dwarf2_addr_class)) +#endif + +extern int gdbarch_address_class_type_flags_to_name_p (struct gdbarch *gdbarch); + +typedef const char * (gdbarch_address_class_type_flags_to_name_ftype) (struct gdbarch *gdbarch, int type_flags); +extern const char * gdbarch_address_class_type_flags_to_name (struct gdbarch *gdbarch, int type_flags); +extern void set_gdbarch_address_class_type_flags_to_name (struct gdbarch *gdbarch, gdbarch_address_class_type_flags_to_name_ftype *address_class_type_flags_to_name); + +extern int gdbarch_address_class_name_to_type_flags_p (struct gdbarch *gdbarch); + +typedef int (gdbarch_address_class_name_to_type_flags_ftype) (struct gdbarch *gdbarch, const char *name, int *type_flags_ptr); +extern int gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarch, const char *name, int *type_flags_ptr); +extern void set_gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarch, gdbarch_address_class_name_to_type_flags_ftype *address_class_name_to_type_flags); + +/* Is a register in a group */ + +typedef int (gdbarch_register_reggroup_p_ftype) (struct gdbarch *gdbarch, int regnum, struct reggroup *reggroup); +extern int gdbarch_register_reggroup_p (struct gdbarch *gdbarch, int regnum, struct reggroup *reggroup); +extern void set_gdbarch_register_reggroup_p (struct gdbarch *gdbarch, gdbarch_register_reggroup_p_ftype *register_reggroup_p); + +/* Fetch the pointer to the ith function argument. */ + +#if defined (FETCH_POINTER_ARGUMENT) +/* Legacy for systems yet to multi-arch FETCH_POINTER_ARGUMENT */ +#if !defined (FETCH_POINTER_ARGUMENT_P) +#define FETCH_POINTER_ARGUMENT_P() (1) +#endif +#endif + +extern int gdbarch_fetch_pointer_argument_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FETCH_POINTER_ARGUMENT_P) +#error "Non multi-arch definition of FETCH_POINTER_ARGUMENT" +#endif +#if !defined (FETCH_POINTER_ARGUMENT_P) +#define FETCH_POINTER_ARGUMENT_P() (gdbarch_fetch_pointer_argument_p (current_gdbarch)) +#endif + +typedef CORE_ADDR (gdbarch_fetch_pointer_argument_ftype) (struct frame_info *frame, int argi, struct type *type); +extern CORE_ADDR gdbarch_fetch_pointer_argument (struct gdbarch *gdbarch, struct frame_info *frame, int argi, struct type *type); +extern void set_gdbarch_fetch_pointer_argument (struct gdbarch *gdbarch, gdbarch_fetch_pointer_argument_ftype *fetch_pointer_argument); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FETCH_POINTER_ARGUMENT) +#error "Non multi-arch definition of FETCH_POINTER_ARGUMENT" +#endif +#if !defined (FETCH_POINTER_ARGUMENT) +#define FETCH_POINTER_ARGUMENT(frame, argi, type) (gdbarch_fetch_pointer_argument (current_gdbarch, frame, argi, type)) +#endif + +/* Return the appropriate register set for a core file section with + name SECT_NAME and size SECT_SIZE. */ + +extern int gdbarch_regset_from_core_section_p (struct gdbarch *gdbarch); + +typedef const struct regset * (gdbarch_regset_from_core_section_ftype) (struct gdbarch *gdbarch, const char *sect_name, size_t sect_size); +extern const struct regset * gdbarch_regset_from_core_section (struct gdbarch *gdbarch, const char *sect_name, size_t sect_size); +extern void set_gdbarch_regset_from_core_section (struct gdbarch *gdbarch, gdbarch_regset_from_core_section_ftype *regset_from_core_section); + +/* The libthread_db interface passes registers in and out using the same + structures that appear in core files: gregset_t and fpregset_t. + Whether reading or writing: + - GDB first moves data out of the regcache into a struct (using + fill_gregset or fill_fpregset), + - crosses the thread_db boundary (for writing, calls + td_thr_setregs; for reading, returns from td_thr_getregs), and + - moves the data from the struct back into the regcache (using + supply_gregset or supply_fpregset). + + Some platforms define even more register sets; for example, + members of the PowerPC family supporting the Signal Processing + Extension ("SPE") have 'struct speregset'. These need to be passed + back and forth across the thread_db boundary. + + An architecture that has such a register set should: + - choose a structure to hold the extra registers, + - set gdbarch_xregs_regset to a 'struct regset' that can move register + values into and out of that structure, + - set gdbarch_xregs_size to the structure's size, in bytes, and + - set gdbarch_xregs_name to a string that can be used to refer to the + structure in error messages and the like. + + Architectures without such a register set should leave + gdbarch_xregs_regset set to zero. */ + +extern const struct regset * gdbarch_xregs_regset (struct gdbarch *gdbarch); +extern void set_gdbarch_xregs_regset (struct gdbarch *gdbarch, const struct regset * xregs_regset); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (XREGS_REGSET) +#error "Non multi-arch definition of XREGS_REGSET" +#endif +#if !defined (XREGS_REGSET) +#define XREGS_REGSET (gdbarch_xregs_regset (current_gdbarch)) +#endif + +extern int gdbarch_xregs_size (struct gdbarch *gdbarch); +extern void set_gdbarch_xregs_size (struct gdbarch *gdbarch, int xregs_size); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (XREGS_SIZE) +#error "Non multi-arch definition of XREGS_SIZE" +#endif +#if !defined (XREGS_SIZE) +#define XREGS_SIZE (gdbarch_xregs_size (current_gdbarch)) +#endif + +extern const char * gdbarch_xregs_name (struct gdbarch *gdbarch); +extern void set_gdbarch_xregs_name (struct gdbarch *gdbarch, const char * xregs_name); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (XREGS_NAME) +#error "Non multi-arch definition of XREGS_NAME" +#endif +#if !defined (XREGS_NAME) +#define XREGS_NAME (gdbarch_xregs_name (current_gdbarch)) +#endif + +extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch); + + +/* Mechanism for co-ordinating the selection of a specific + architecture. + + GDB targets (*-tdep.c) can register an interest in a specific + architecture. Other GDB components can register a need to maintain + per-architecture data. + + The mechanisms below ensures that there is only a loose connection + between the set-architecture command and the various GDB + components. Each component can independently register their need + to maintain architecture specific data with gdbarch. + + Pragmatics: + + Previously, a single TARGET_ARCHITECTURE_HOOK was provided. It + didn't scale. + + The more traditional mega-struct containing architecture specific + data for all the various GDB components was also considered. Since + GDB is built from a variable number of (fairly independent) + components it was determined that the global aproach was not + applicable. */ + + +/* Register a new architectural family with GDB. + + Register support for the specified ARCHITECTURE with GDB. When + gdbarch determines that the specified architecture has been + selected, the corresponding INIT function is called. + + -- + + The INIT function takes two parameters: INFO which contains the + information available to gdbarch about the (possibly new) + architecture; ARCHES which is a list of the previously created + ``struct gdbarch'' for this architecture. + + The INFO parameter is, as far as possible, be pre-initialized with + information obtained from INFO.ABFD or the previously selected + architecture. + + The ARCHES parameter is a linked list (sorted most recently used) + of all the previously created architures for this architecture + family. The (possibly NULL) ARCHES->gdbarch can used to access + values from the previously selected architecture for this + architecture family. The global ``current_gdbarch'' shall not be + used. + + The INIT function shall return any of: NULL - indicating that it + doesn't recognize the selected architecture; an existing ``struct + gdbarch'' from the ARCHES list - indicating that the new + architecture is just a synonym for an earlier architecture (see + gdbarch_list_lookup_by_info()); a newly created ``struct gdbarch'' + - that describes the selected architecture (see gdbarch_alloc()). + + The DUMP_TDEP function shall print out all target specific values. + Care should be taken to ensure that the function works in both the + multi-arch and non- multi-arch cases. */ + +struct gdbarch_list +{ + struct gdbarch *gdbarch; + struct gdbarch_list *next; +}; + +struct gdbarch_info +{ + /* Use default: NULL (ZERO). */ + const struct bfd_arch_info *bfd_arch_info; + + /* Use default: BFD_ENDIAN_UNKNOWN (NB: is not ZERO). */ + int byte_order; + + /* Use default: NULL (ZERO). */ + bfd *abfd; + + /* Use default: NULL (ZERO). */ + struct gdbarch_tdep_info *tdep_info; + + /* Use default: GDB_OSABI_UNINITIALIZED (-1). */ + enum gdb_osabi osabi; +}; + +typedef struct gdbarch *(gdbarch_init_ftype) (struct gdbarch_info info, struct gdbarch_list *arches); +typedef void (gdbarch_dump_tdep_ftype) (struct gdbarch *gdbarch, struct ui_file *file); + +/* DEPRECATED - use gdbarch_register() */ +extern void register_gdbarch_init (enum bfd_architecture architecture, gdbarch_init_ftype *); + +extern void gdbarch_register (enum bfd_architecture architecture, + gdbarch_init_ftype *, + gdbarch_dump_tdep_ftype *); + + +/* Return a freshly allocated, NULL terminated, array of the valid + architecture names. Since architectures are registered during the + _initialize phase this function only returns useful information + once initialization has been completed. */ + +extern const char **gdbarch_printable_names (void); + + +/* Helper function. Search the list of ARCHES for a GDBARCH that + matches the information provided by INFO. */ + +extern struct gdbarch_list *gdbarch_list_lookup_by_info (struct gdbarch_list *arches, const struct gdbarch_info *info); + + +/* Helper function. Create a preliminary ``struct gdbarch''. Perform + basic initialization using values obtained from the INFO andTDEP + parameters. set_gdbarch_*() functions are called to complete the + initialization of the object. */ + +extern struct gdbarch *gdbarch_alloc (const struct gdbarch_info *info, struct gdbarch_tdep *tdep); + + +/* Helper function. Free a partially-constructed ``struct gdbarch''. + It is assumed that the caller freeds the ``struct + gdbarch_tdep''. */ + +extern void gdbarch_free (struct gdbarch *); + + +/* Helper function. Allocate memory from the ``struct gdbarch'' + obstack. The memory is freed when the corresponding architecture + is also freed. */ + +extern void *gdbarch_obstack_zalloc (struct gdbarch *gdbarch, long size); +#define GDBARCH_OBSTACK_CALLOC(GDBARCH, NR, TYPE) ((TYPE *) gdbarch_obstack_zalloc ((GDBARCH), (NR) * sizeof (TYPE))) +#define GDBARCH_OBSTACK_ZALLOC(GDBARCH, TYPE) ((TYPE *) gdbarch_obstack_zalloc ((GDBARCH), sizeof (TYPE))) + + +/* Helper function. Force an update of the current architecture. + + The actual architecture selected is determined by INFO, ``(gdb) set + architecture'' et.al., the existing architecture and BFD's default + architecture. INFO should be initialized to zero and then selected + fields should be updated. + + Returns non-zero if the update succeeds */ + +extern int gdbarch_update_p (struct gdbarch_info info); + + +/* Helper function. Find an architecture matching info. + + INFO should be initialized using gdbarch_info_init, relevant fields + set, and then finished using gdbarch_info_fill. + + Returns the corresponding architecture, or NULL if no matching + architecture was found. "current_gdbarch" is not updated. */ + +extern struct gdbarch *gdbarch_find_by_info (struct gdbarch_info info); + + +/* Helper function. Set the global "current_gdbarch" to "gdbarch". + + FIXME: kettenis/20031124: Of the functions that follow, only + gdbarch_from_bfd is supposed to survive. The others will + dissappear since in the future GDB will (hopefully) be truly + multi-arch. However, for now we're still stuck with the concept of + a single active architecture. */ + +extern void deprecated_current_gdbarch_select_hack (struct gdbarch *gdbarch); + + +/* Register per-architecture data-pointer. + + Reserve space for a per-architecture data-pointer. An identifier + for the reserved data-pointer is returned. That identifer should + be saved in a local static variable. + + Memory for the per-architecture data shall be allocated using + gdbarch_obstack_zalloc. That memory will be deleted when the + corresponding architecture object is deleted. + + When a previously created architecture is re-selected, the + per-architecture data-pointer for that previous architecture is + restored. INIT() is not re-called. + + Multiple registrarants for any architecture are allowed (and + strongly encouraged). */ + +struct gdbarch_data; + +typedef void *(gdbarch_data_pre_init_ftype) (struct obstack *obstack); +extern struct gdbarch_data *gdbarch_data_register_pre_init (gdbarch_data_pre_init_ftype *init); +typedef void *(gdbarch_data_post_init_ftype) (struct gdbarch *gdbarch); +extern struct gdbarch_data *gdbarch_data_register_post_init (gdbarch_data_post_init_ftype *init); +extern void deprecated_set_gdbarch_data (struct gdbarch *gdbarch, + struct gdbarch_data *data, + void *pointer); + +extern void *gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *); + + + +/* Register per-architecture memory region. + + Provide a memory-region swap mechanism. Per-architecture memory + region are created. These memory regions are swapped whenever the + architecture is changed. For a new architecture, the memory region + is initialized with zero (0) and the INIT function is called. + + Memory regions are swapped / initialized in the order that they are + registered. NULL DATA and/or INIT values can be specified. + + New code should use gdbarch_data_register_*(). */ + +typedef void (gdbarch_swap_ftype) (void); +extern void deprecated_register_gdbarch_swap (void *data, unsigned long size, gdbarch_swap_ftype *init); +#define DEPRECATED_REGISTER_GDBARCH_SWAP(VAR) deprecated_register_gdbarch_swap (&(VAR), sizeof ((VAR)), NULL) + + + +/* Set the dynamic target-system-dependent parameters (architecture, + byte-order, ...) using information found in the BFD */ + +extern void set_gdbarch_from_file (bfd *); + + +/* Initialize the current architecture to the "first" one we find on + our list. */ + +extern void initialize_current_architecture (void); + +/* gdbarch trace variable */ +extern int gdbarch_debug; + +extern void gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file); + +#endif diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh new file mode 100755 index 00000000000..4cb1bc9d423 --- /dev/null +++ b/gdb/gdbarch.sh @@ -0,0 +1,2312 @@ +#!/bin/sh -u + +# Architecture commands for GDB, the GNU debugger. +# +# Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software +# Foundation, Inc. +# +# +# This file is part of GDB. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Make certain that the script is running in an internationalized +# environment. +LANG=c ; export LANG +LC_ALL=c ; export LC_ALL + + +compare_new () +{ + file=$1 + if test ! -r ${file} + then + echo "${file} missing? cp new-${file} ${file}" 1>&2 + elif diff -u ${file} new-${file} + then + echo "${file} unchanged" 1>&2 + else + echo "${file} has changed? cp new-${file} ${file}" 1>&2 + fi +} + + +# Format of the input table +read="class macro returntype function formal actual attrib staticdefault predefault postdefault invalid_p fmt print garbage_at_eol" + +do_read () +{ + comment="" + class="" + while read line + do + if test "${line}" = "" + then + continue + elif test "${line}" = "#" -a "${comment}" = "" + then + continue + elif expr "${line}" : "#" > /dev/null + then + comment="${comment} +${line}" + else + + # The semantics of IFS varies between different SH's. Some + # treat ``::' as three fields while some treat it as just too. + # Work around this by eliminating ``::'' .... + line="`echo "${line}" | sed -e 's/::/: :/g' -e 's/::/: :/g'`" + + OFS="${IFS}" ; IFS="[:]" + eval read ${read} <&2 + kill $$ + exit 1 + fi + + # .... and then going back through each field and strip out those + # that ended up with just that space character. + for r in ${read} + do + if eval test \"\${${r}}\" = \"\ \" + then + eval ${r}="" + fi + done + + FUNCTION=`echo ${function} | tr '[a-z]' '[A-Z]'` + if test "x${macro}" = "x=" + then + # Provide a UCASE version of function (for when there isn't MACRO) + macro="${FUNCTION}" + elif test "${macro}" = "${FUNCTION}" + then + echo "${function}: Specify = for macro field" 1>&2 + kill $$ + exit 1 + fi + + # Check that macro definition wasn't supplied for multi-arch + case "${class}" in + [mM] ) + if test "${macro}" != "" + then + echo "${macro}: Multi-arch yet macro" 1>&2 + kill $$ + exit 1 + fi + esac + + case "${class}" in + m ) staticdefault="${predefault}" ;; + M ) staticdefault="0" ;; + * ) test "${staticdefault}" || staticdefault=0 ;; + esac + + case "${class}" in + F | V | M ) + case "${invalid_p}" in + "" ) + if test -n "${predefault}" + then + #invalid_p="gdbarch->${function} == ${predefault}" + predicate="gdbarch->${function} != ${predefault}" + elif class_is_variable_p + then + predicate="gdbarch->${function} != 0" + elif class_is_function_p + then + predicate="gdbarch->${function} != NULL" + fi + ;; + * ) + echo "Predicate function ${function} with invalid_p." 1>&2 + kill $$ + exit 1 + ;; + esac + esac + + # PREDEFAULT is a valid fallback definition of MEMBER when + # multi-arch is not enabled. This ensures that the + # default value, when multi-arch is the same as the + # default value when not multi-arch. POSTDEFAULT is + # always a valid definition of MEMBER as this again + # ensures consistency. + + if [ -n "${postdefault}" ] + then + fallbackdefault="${postdefault}" + elif [ -n "${predefault}" ] + then + fallbackdefault="${predefault}" + else + fallbackdefault="0" + fi + + #NOT YET: See gdbarch.log for basic verification of + # database + + break + fi + done + if [ -n "${class}" ] + then + true + else + false + fi +} + + +fallback_default_p () +{ + [ -n "${postdefault}" -a "x${invalid_p}" != "x0" ] \ + || [ -n "${predefault}" -a "x${invalid_p}" = "x0" ] +} + +class_is_variable_p () +{ + case "${class}" in + *v* | *V* ) true ;; + * ) false ;; + esac +} + +class_is_function_p () +{ + case "${class}" in + *f* | *F* | *m* | *M* ) true ;; + * ) false ;; + esac +} + +class_is_multiarch_p () +{ + case "${class}" in + *m* | *M* ) true ;; + * ) false ;; + esac +} + +class_is_predicate_p () +{ + case "${class}" in + *F* | *V* | *M* ) true ;; + * ) false ;; + esac +} + +class_is_info_p () +{ + case "${class}" in + *i* ) true ;; + * ) false ;; + esac +} + + +# dump out/verify the doco +for field in ${read} +do + case ${field} in + + class ) : ;; + + # # -> line disable + # f -> function + # hiding a function + # F -> function + predicate + # hiding a function + predicate to test function validity + # v -> variable + # hiding a variable + # V -> variable + predicate + # hiding a variable + predicate to test variables validity + # i -> set from info + # hiding something from the ``struct info'' object + # m -> multi-arch function + # hiding a multi-arch function (parameterised with the architecture) + # M -> multi-arch function + predicate + # hiding a multi-arch function + predicate to test function validity + + macro ) : ;; + + # The name of the legacy C macro by which this method can be + # accessed. If empty, no macro is defined. If "=", a macro + # formed from the upper-case function name is used. + + returntype ) : ;; + + # For functions, the return type; for variables, the data type + + function ) : ;; + + # For functions, the member function name; for variables, the + # variable name. Member function names are always prefixed with + # ``gdbarch_'' for name-space purity. + + formal ) : ;; + + # The formal argument list. It is assumed that the formal + # argument list includes the actual name of each list element. + # A function with no arguments shall have ``void'' as the + # formal argument list. + + actual ) : ;; + + # The list of actual arguments. The arguments specified shall + # match the FORMAL list given above. Functions with out + # arguments leave this blank. + + attrib ) : ;; + + # Any GCC attributes that should be attached to the function + # declaration. At present this field is unused. + + staticdefault ) : ;; + + # To help with the GDB startup a static gdbarch object is + # created. STATICDEFAULT is the value to insert into that + # static gdbarch object. Since this a static object only + # simple expressions can be used. + + # If STATICDEFAULT is empty, zero is used. + + predefault ) : ;; + + # An initial value to assign to MEMBER of the freshly + # malloc()ed gdbarch object. After initialization, the + # freshly malloc()ed object is passed to the target + # architecture code for further updates. + + # If PREDEFAULT is empty, zero is used. + + # A non-empty PREDEFAULT, an empty POSTDEFAULT and a zero + # INVALID_P are specified, PREDEFAULT will be used as the + # default for the non- multi-arch target. + + # A zero PREDEFAULT function will force the fallback to call + # internal_error(). + + # Variable declarations can refer to ``gdbarch'' which will + # contain the current architecture. Care should be taken. + + postdefault ) : ;; + + # A value to assign to MEMBER of the new gdbarch object should + # the target architecture code fail to change the PREDEFAULT + # value. + + # If POSTDEFAULT is empty, no post update is performed. + + # If both INVALID_P and POSTDEFAULT are non-empty then + # INVALID_P will be used to determine if MEMBER should be + # changed to POSTDEFAULT. + + # If a non-empty POSTDEFAULT and a zero INVALID_P are + # specified, POSTDEFAULT will be used as the default for the + # non- multi-arch target (regardless of the value of + # PREDEFAULT). + + # You cannot specify both a zero INVALID_P and a POSTDEFAULT. + + # Variable declarations can refer to ``current_gdbarch'' which + # will contain the current architecture. Care should be + # taken. + + invalid_p ) : ;; + + # A predicate equation that validates MEMBER. Non-zero is + # returned if the code creating the new architecture failed to + # initialize MEMBER or the initialized the member is invalid. + # If POSTDEFAULT is non-empty then MEMBER will be updated to + # that value. If POSTDEFAULT is empty then internal_error() + # is called. + + # If INVALID_P is empty, a check that MEMBER is no longer + # equal to PREDEFAULT is used. + + # The expression ``0'' disables the INVALID_P check making + # PREDEFAULT a legitimate value. + + # See also PREDEFAULT and POSTDEFAULT. + + fmt ) : ;; + + # printf style format string that can be used to print out the + # MEMBER. Sometimes "%s" is useful. For functions, this is + # ignored and the function address is printed. + + # If FMT is empty, ``%ld'' is used. + + print ) : ;; + + # An optional equation that casts MEMBER to a value suitable + # for formatting by FMT. + + # If PRINT is empty, ``(long)'' is used. + + garbage_at_eol ) : ;; + + # Catches stray fields. + + *) + echo "Bad field ${field}" + exit 1;; + esac +done + + +function_list () +{ + # See below (DOCO) for description of each field + cat <printable_name +# +i:TARGET_BYTE_ORDER:int:byte_order::::BFD_ENDIAN_BIG +# +i:TARGET_OSABI:enum gdb_osabi:osabi::::GDB_OSABI_UNKNOWN +# Number of bits in a char or unsigned char for the target machine. +# Just like CHAR_BIT in but describes the target machine. +# v:TARGET_CHAR_BIT:int:char_bit::::8 * sizeof (char):8::0: +# +# Number of bits in a short or unsigned short for the target machine. +v:TARGET_SHORT_BIT:int:short_bit::::8 * sizeof (short):2*TARGET_CHAR_BIT::0 +# Number of bits in an int or unsigned int for the target machine. +v:TARGET_INT_BIT:int:int_bit::::8 * sizeof (int):4*TARGET_CHAR_BIT::0 +# Number of bits in a long or unsigned long for the target machine. +v:TARGET_LONG_BIT:int:long_bit::::8 * sizeof (long):4*TARGET_CHAR_BIT::0 +# Number of bits in a long long or unsigned long long for the target +# machine. +v:TARGET_LONG_LONG_BIT:int:long_long_bit::::8 * sizeof (LONGEST):2*TARGET_LONG_BIT::0 +# Number of bits in a float for the target machine. +v:TARGET_FLOAT_BIT:int:float_bit::::8 * sizeof (float):4*TARGET_CHAR_BIT::0 +# Number of bits in a double for the target machine. +v:TARGET_DOUBLE_BIT:int:double_bit::::8 * sizeof (double):8*TARGET_CHAR_BIT::0 +# Number of bits in a long double for the target machine. +v:TARGET_LONG_DOUBLE_BIT:int:long_double_bit::::8 * sizeof (long double):8*TARGET_CHAR_BIT::0 +# For most targets, a pointer on the target and its representation as an +# address in GDB have the same size and "look the same". For such a +# target, you need only set TARGET_PTR_BIT / ptr_bit and TARGET_ADDR_BIT +# / addr_bit will be set from it. +# +# If TARGET_PTR_BIT and TARGET_ADDR_BIT are different, you'll probably +# also need to set POINTER_TO_ADDRESS and ADDRESS_TO_POINTER as well. +# +# ptr_bit is the size of a pointer on the target +v:TARGET_PTR_BIT:int:ptr_bit::::8 * sizeof (void*):TARGET_INT_BIT::0 +# addr_bit is the size of a target address as represented in gdb +v:TARGET_ADDR_BIT:int:addr_bit::::8 * sizeof (void*):0:TARGET_PTR_BIT: +# Number of bits in a BFD_VMA for the target object file format. +v:TARGET_BFD_VMA_BIT:int:bfd_vma_bit::::8 * sizeof (void*):TARGET_ARCHITECTURE->bits_per_address::0 +# +# One if \`char' acts like \`signed char', zero if \`unsigned char'. +v:TARGET_CHAR_SIGNED:int:char_signed::::1:-1:1:::: +# +F:TARGET_READ_PC:CORE_ADDR:read_pc:ptid_t ptid:ptid +f:TARGET_WRITE_PC:void:write_pc:CORE_ADDR val, ptid_t ptid:val, ptid::0:generic_target_write_pc::0 +# UNWIND_SP is a direct replacement for TARGET_READ_SP. +F:TARGET_READ_SP:CORE_ADDR:read_sp:void +# Function for getting target's idea of a frame pointer. FIXME: GDB's +# whole scheme for dealing with "frames" and "frame pointers" needs a +# serious shakedown. +f:TARGET_VIRTUAL_FRAME_POINTER:void:virtual_frame_pointer:CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset:pc, frame_regnum, frame_offset::0:legacy_virtual_frame_pointer::0 +# +M::void:pseudo_register_read:struct regcache *regcache, int cookednum, void *buf:regcache, cookednum, buf +M::void:pseudo_register_write:struct regcache *regcache, int cookednum, const void *buf:regcache, cookednum, buf +# +v:=:int:num_regs::::0:-1 +# This macro gives the number of pseudo-registers that live in the +# register namespace but do not get fetched or stored on the target. +# These pseudo-registers may be aliases for other registers, +# combinations of other registers, or they may be computed by GDB. +v:=:int:num_pseudo_regs::::0:0::0::: + +# GDB's standard (or well known) register numbers. These can map onto +# a real register or a pseudo (computed) register or not be defined at +# all (-1). +# SP_REGNUM will hopefully be replaced by UNWIND_SP. +v:=:int:sp_regnum::::-1:-1::0 +v:=:int:pc_regnum::::-1:-1::0 +v:=:int:ps_regnum::::-1:-1::0 +v:=:int:fp0_regnum::::0:-1::0 +# Convert stab register number (from \`r\' declaration) to a gdb REGNUM. +f:=:int:stab_reg_to_regnum:int stab_regnr:stab_regnr:::no_op_reg_to_regnum::0 +# Provide a default mapping from a ecoff register number to a gdb REGNUM. +f:=:int:ecoff_reg_to_regnum:int ecoff_regnr:ecoff_regnr:::no_op_reg_to_regnum::0 +# Provide a default mapping from a DWARF register number to a gdb REGNUM. +f:=:int:dwarf_reg_to_regnum:int dwarf_regnr:dwarf_regnr:::no_op_reg_to_regnum::0 +# Convert from an sdb register number to an internal gdb register number. +f:=:int:sdb_reg_to_regnum:int sdb_regnr:sdb_regnr:::no_op_reg_to_regnum::0 +f:=:int:dwarf2_reg_to_regnum:int dwarf2_regnr:dwarf2_regnr:::no_op_reg_to_regnum::0 +f:=:const char *:register_name:int regnr:regnr + +# REGISTER_TYPE is a direct replacement for DEPRECATED_REGISTER_VIRTUAL_TYPE. +M::struct type *:register_type:int reg_nr:reg_nr +# REGISTER_TYPE is a direct replacement for DEPRECATED_REGISTER_VIRTUAL_TYPE. +F:=:struct type *:deprecated_register_virtual_type:int reg_nr:reg_nr +# DEPRECATED_REGISTER_BYTES can be deleted. The value is computed +# from REGISTER_TYPE. +v:=:int:deprecated_register_bytes +# If the value returned by DEPRECATED_REGISTER_BYTE agrees with the +# register offsets computed using just REGISTER_TYPE, this can be +# deleted. See: maint print registers. NOTE: cagney/2002-05-02: This +# function with predicate has a valid (callable) initial value. As a +# consequence, even when the predicate is false, the corresponding +# function works. This simplifies the migration process - old code, +# calling DEPRECATED_REGISTER_BYTE, doesn't need to be modified. +F:=:int:deprecated_register_byte:int reg_nr:reg_nr::generic_register_byte:generic_register_byte +# If all registers have identical raw and virtual sizes and those +# sizes agree with the value computed from REGISTER_TYPE, +# DEPRECATED_REGISTER_RAW_SIZE can be deleted. See: maint print +# registers. +F:=:int:deprecated_register_raw_size:int reg_nr:reg_nr::generic_register_size:generic_register_size +# If all registers have identical raw and virtual sizes and those +# sizes agree with the value computed from REGISTER_TYPE, +# DEPRECATED_REGISTER_VIRTUAL_SIZE can be deleted. See: maint print +# registers. +F:=:int:deprecated_register_virtual_size:int reg_nr:reg_nr::generic_register_size:generic_register_size + +# See gdbint.texinfo, and PUSH_DUMMY_CALL. +M::struct frame_id:unwind_dummy_id:struct frame_info *info:info +# Implement UNWIND_DUMMY_ID and PUSH_DUMMY_CALL, then delete +# SAVE_DUMMY_FRAME_TOS. +F:=:void:deprecated_save_dummy_frame_tos:CORE_ADDR sp:sp +# Implement UNWIND_DUMMY_ID and PUSH_DUMMY_CALL, then delete +# DEPRECATED_FP_REGNUM. +v:=:int:deprecated_fp_regnum::::-1:-1::0 +# Implement UNWIND_DUMMY_ID and PUSH_DUMMY_CALL, then delete +# DEPRECATED_TARGET_READ_FP. +F:=:CORE_ADDR:deprecated_target_read_fp:void + +# See gdbint.texinfo. See infcall.c. New, all singing all dancing, +# replacement for DEPRECATED_PUSH_ARGUMENTS. +M::CORE_ADDR:push_dummy_call: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:function, regcache, bp_addr, nargs, args, sp, struct_return, struct_addr +# PUSH_DUMMY_CALL is a direct replacement for DEPRECATED_PUSH_ARGUMENTS. +F:=:CORE_ADDR:deprecated_push_arguments:int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:nargs, args, sp, struct_return, struct_addr +# Implement PUSH_RETURN_ADDRESS, and then merge in +# DEPRECATED_PUSH_RETURN_ADDRESS. +F:=:CORE_ADDR:deprecated_push_return_address:CORE_ADDR pc, CORE_ADDR sp:pc, sp +# Implement PUSH_DUMMY_CALL, then merge in DEPRECATED_DUMMY_WRITE_SP. +F:=:void:deprecated_dummy_write_sp:CORE_ADDR val:val +# DEPRECATED_REGISTER_SIZE can be deleted. +v:=:int:deprecated_register_size +v:=:int:call_dummy_location:::::AT_ENTRY_POINT::0 +M::CORE_ADDR:push_dummy_code: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:sp, funaddr, using_gcc, args, nargs, value_type, real_pc, bp_addr + +F:=:void:deprecated_do_registers_info:int reg_nr, int fpregs:reg_nr, fpregs +m::void:print_registers_info:struct ui_file *file, struct frame_info *frame, int regnum, int all:file, frame, regnum, all:::default_print_registers_info::0 +M::void:print_float_info:struct ui_file *file, struct frame_info *frame, const char *args:file, frame, args +M::void:print_vector_info:struct ui_file *file, struct frame_info *frame, const char *args:file, frame, args +# MAP a GDB RAW register number onto a simulator register number. See +# also include/...-sim.h. +f:=:int:register_sim_regno:int reg_nr:reg_nr:::legacy_register_sim_regno::0 +F:=:int:register_bytes_ok:long nr_bytes:nr_bytes +f:=:int:cannot_fetch_register:int regnum:regnum:::cannot_register_not::0 +f:=:int:cannot_store_register:int regnum:regnum:::cannot_register_not::0 +# setjmp/longjmp support. +F:=:int:get_longjmp_target:CORE_ADDR *pc:pc +F:=:CORE_ADDR:deprecated_init_frame_pc:int fromleaf, struct frame_info *prev:fromleaf, prev +# +v:=:int:believe_pcc_promotion::::::: +F:=:void:deprecated_get_saved_register:char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval:raw_buffer, optimized, addrp, frame, regnum, lval +# +f:=:int:convert_register_p:int regnum, struct type *type:regnum, type::0:generic_convert_register_p::0 +f:=:void:register_to_value:struct frame_info *frame, int regnum, struct type *type, void *buf:frame, regnum, type, buf::0 +f:=:void:value_to_register:struct frame_info *frame, int regnum, struct type *type, const void *buf:frame, regnum, type, buf::0 +# +f:=:CORE_ADDR:pointer_to_address:struct type *type, const void *buf:type, buf:::unsigned_pointer_to_address::0 +f:=:void:address_to_pointer:struct type *type, void *buf, CORE_ADDR addr:type, buf, addr:::unsigned_address_to_pointer::0 +F:=:CORE_ADDR:integer_to_address:struct type *type, void *buf:type, buf +# +F:=:void:deprecated_pop_frame:void:- +# NOTE: cagney/2003-03-24: Replaced by PUSH_ARGUMENTS. +F:=:void:deprecated_store_struct_return:CORE_ADDR addr, CORE_ADDR sp:addr, sp + +# It has been suggested that this, well actually its predecessor, +# should take the type/value of the function to be called and not the +# return type. This is left as an exercise for the reader. + +# NOTE: cagney/2004-06-13: The function stack.c:return_command uses +# the predicate with default hack to avoid calling STORE_RETURN_VALUE +# (via legacy_return_value), when a small struct is involved. + +M::enum return_value_convention:return_value:struct type *valtype, struct regcache *regcache, void *readbuf, const void *writebuf:valtype, regcache, readbuf, writebuf:::legacy_return_value + +# The deprecated methods EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, +# DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS and +# DEPRECATED_USE_STRUCT_CONVENTION have all been folded into +# RETURN_VALUE. + +f:=:void:extract_return_value:struct type *type, struct regcache *regcache, void *valbuf:type, regcache, valbuf:::legacy_extract_return_value::0 +f:=:void:store_return_value:struct type *type, struct regcache *regcache, const void *valbuf:type, regcache, valbuf:::legacy_store_return_value::0 +f:=:void:deprecated_extract_return_value:struct type *type, char *regbuf, char *valbuf:type, regbuf, valbuf +f:=:void:deprecated_store_return_value:struct type *type, char *valbuf:type, valbuf +f:=:int:deprecated_use_struct_convention:int gcc_p, struct type *value_type:gcc_p, value_type:::generic_use_struct_convention::0 + +# As of 2004-01-17 only the 32-bit SPARC ABI has been identified as an +# ABI suitable for the implementation of a robust extract +# struct-convention return-value address method (the sparc saves the +# address in the callers frame). All the other cases so far examined, +# the DEPRECATED_EXTRACT_STRUCT_VALUE implementation has been +# erreneous - the code was incorrectly assuming that the return-value +# address, stored in a register, was preserved across the entire +# function call. + +# For the moment retain DEPRECATED_EXTRACT_STRUCT_VALUE as a marker of +# the ABIs that are still to be analyzed - perhaps this should simply +# be deleted. The commented out extract_returned_value_address method +# is provided as a starting point for the 32-bit SPARC. It, or +# something like it, along with changes to both infcmd.c and stack.c +# will be needed for that case to work. NB: It is passed the callers +# frame since it is only after the callee has returned that this +# function is used. + +#M::CORE_ADDR:extract_returned_value_address:struct frame_info *caller_frame:caller_frame +F:=:CORE_ADDR:deprecated_extract_struct_value_address:struct regcache *regcache:regcache + +F:=:void:deprecated_frame_init_saved_regs:struct frame_info *frame:frame +F:=:void:deprecated_init_extra_frame_info:int fromleaf, struct frame_info *frame:fromleaf, frame +# +f:=:CORE_ADDR:skip_prologue:CORE_ADDR ip:ip::0:0 +f:=:int:inner_than:CORE_ADDR lhs, CORE_ADDR rhs:lhs, rhs::0:0 +f:=:const unsigned char *:breakpoint_from_pc:CORE_ADDR *pcptr, int *lenptr:pcptr, lenptr:::0: +M::CORE_ADDR:adjust_breakpoint_address:CORE_ADDR bpaddr:bpaddr +f:=:int:memory_insert_breakpoint:CORE_ADDR addr, char *contents_cache:addr, contents_cache::0:default_memory_insert_breakpoint::0 +f:=:int:memory_remove_breakpoint:CORE_ADDR addr, char *contents_cache:addr, contents_cache::0:default_memory_remove_breakpoint::0 +v:=:CORE_ADDR:decr_pc_after_break::::0:::0 + +# A function can be addressed by either it's "pointer" (possibly a +# descriptor address) or "entry point" (first executable instruction). +# The method "convert_from_func_ptr_addr" converting the former to the +# latter. DEPRECATED_FUNCTION_START_OFFSET is being used to implement +# a simplified subset of that functionality - the function's address +# corresponds to the "function pointer" and the function's start +# corresponds to the "function entry point" - and hence is redundant. + +v:=:CORE_ADDR:deprecated_function_start_offset::::0:::0 + +m::void:remote_translate_xfer_address:struct regcache *regcache, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len:regcache, gdb_addr, gdb_len, rem_addr, rem_len:::generic_remote_translate_xfer_address::0 +# +v:=:CORE_ADDR:frame_args_skip::::0:::0 +# DEPRECATED_FRAMELESS_FUNCTION_INVOCATION is not needed. The new +# frame code works regardless of the type of frame - frameless, +# stackless, or normal. +F:=:int:deprecated_frameless_function_invocation:struct frame_info *fi:fi +F:=:CORE_ADDR:deprecated_frame_chain:struct frame_info *frame:frame +F:=:int:deprecated_frame_chain_valid:CORE_ADDR chain, struct frame_info *thisframe:chain, thisframe +# DEPRECATED_FRAME_SAVED_PC has been replaced by UNWIND_PC. Please +# note, per UNWIND_PC's doco, that while the two have similar +# interfaces they have very different underlying implementations. +F:=:CORE_ADDR:deprecated_frame_saved_pc:struct frame_info *fi:fi +M::CORE_ADDR:unwind_pc:struct frame_info *next_frame:next_frame +M::CORE_ADDR:unwind_sp:struct frame_info *next_frame:next_frame +# DEPRECATED_FRAME_ARGS_ADDRESS as been replaced by the per-frame +# frame-base. Enable frame-base before frame-unwind. +F:=:CORE_ADDR:deprecated_frame_args_address:struct frame_info *fi:fi::get_frame_base:get_frame_base +# DEPRECATED_FRAME_LOCALS_ADDRESS as been replaced by the per-frame +# frame-base. Enable frame-base before frame-unwind. +F:=:CORE_ADDR:deprecated_frame_locals_address:struct frame_info *fi:fi::get_frame_base:get_frame_base +F:=:CORE_ADDR:deprecated_saved_pc_after_call:struct frame_info *frame:frame +F:=:int:frame_num_args:struct frame_info *frame:frame +# +# DEPRECATED_STACK_ALIGN has been replaced by an initial aligning call +# to frame_align and the requirement that methods such as +# push_dummy_call and frame_red_zone_size maintain correct stack/frame +# alignment. +F:=:CORE_ADDR:deprecated_stack_align:CORE_ADDR sp:sp +M::CORE_ADDR:frame_align:CORE_ADDR address:address +# DEPRECATED_REG_STRUCT_HAS_ADDR has been replaced by +# stabs_argument_has_addr. +F:=:int:deprecated_reg_struct_has_addr:int gcc_p, struct type *type:gcc_p, type +m::int:stabs_argument_has_addr:struct type *type:type:::default_stabs_argument_has_addr::0 +v:=:int:frame_red_zone_size +# +v:TARGET_FLOAT_FORMAT:const struct floatformat *:float_format::::::default_float_format (current_gdbarch)::%s:(TARGET_FLOAT_FORMAT)->name +v:TARGET_DOUBLE_FORMAT:const struct floatformat *:double_format::::::default_double_format (current_gdbarch)::%s:(TARGET_DOUBLE_FORMAT)->name +v:TARGET_LONG_DOUBLE_FORMAT:const struct floatformat *:long_double_format::::::default_double_format (current_gdbarch)::%s:(TARGET_LONG_DOUBLE_FORMAT)->name +m::CORE_ADDR:convert_from_func_ptr_addr:CORE_ADDR addr, struct target_ops *targ:addr, targ:::convert_from_func_ptr_addr_identity::0 +# On some machines there are bits in addresses which are not really +# part of the address, but are used by the kernel, the hardware, etc. +# for special purposes. ADDR_BITS_REMOVE takes out any such bits so +# we get a "real" address such as one would find in a symbol table. +# This is used only for addresses of instructions, and even then I'm +# not sure it's used in all contexts. It exists to deal with there +# being a few stray bits in the PC which would mislead us, not as some +# sort of generic thing to handle alignment or segmentation (it's +# possible it should be in TARGET_READ_PC instead). +f:=:CORE_ADDR:addr_bits_remove:CORE_ADDR addr:addr:::core_addr_identity::0 +# It is not at all clear why SMASH_TEXT_ADDRESS is not folded into +# ADDR_BITS_REMOVE. +f:=:CORE_ADDR:smash_text_address:CORE_ADDR addr:addr:::core_addr_identity::0 +# FIXME/cagney/2001-01-18: This should be split in two. A target method that indicates if +# the target needs software single step. An ISA method to implement it. +# +# FIXME/cagney/2001-01-18: This should be replaced with something that inserts breakpoints +# using the breakpoint system instead of blatting memory directly (as with rs6000). +# +# FIXME/cagney/2001-01-18: The logic is backwards. It should be asking if the target can +# single step. If not, then implement single step using breakpoints. +F:=:void:software_single_step:enum target_signal sig, int insert_breakpoints_p:sig, insert_breakpoints_p +# FIXME: cagney/2003-08-28: Need to find a better way of selecting the +# disassembler. Perhaphs objdump can handle it? +f:TARGET_PRINT_INSN:int:print_insn:bfd_vma vma, struct disassemble_info *info:vma, info:::0: +f:=:CORE_ADDR:skip_trampoline_code:CORE_ADDR pc:pc:::generic_skip_trampoline_code::0 + + +# If IN_SOLIB_DYNSYM_RESOLVE_CODE returns true, and SKIP_SOLIB_RESOLVER +# evaluates non-zero, this is the address where the debugger will place +# a step-resume breakpoint to get us past the dynamic linker. +m::CORE_ADDR:skip_solib_resolver:CORE_ADDR pc:pc:::generic_skip_solib_resolver::0 +# For SVR4 shared libraries, each call goes through a small piece of +# trampoline code in the ".plt" section. IN_SOLIB_CALL_TRAMPOLINE evaluates +# to nonzero if we are currently stopped in one of these. +f:=:int:in_solib_call_trampoline:CORE_ADDR pc, char *name:pc, name:::generic_in_solib_call_trampoline::0 + +# Some systems also have trampoline code for returning from shared libs. +f:=:int:in_solib_return_trampoline:CORE_ADDR pc, char *name:pc, name:::generic_in_solib_return_trampoline::0 + +# A target might have problems with watchpoints as soon as the stack +# frame of the current function has been destroyed. This mostly happens +# as the first action in a funtion's epilogue. in_function_epilogue_p() +# is defined to return a non-zero value if either the given addr is one +# instruction after the stack destroying instruction up to the trailing +# return instruction or if we can figure out that the stack frame has +# already been invalidated regardless of the value of addr. Targets +# which don't suffer from that problem could just let this functionality +# untouched. +m::int:in_function_epilogue_p:CORE_ADDR addr:addr::0:generic_in_function_epilogue_p::0 +# Given a vector of command-line arguments, return a newly allocated +# string which, when passed to the create_inferior function, will be +# parsed (on Unix systems, by the shell) to yield the same vector. +# This function should call error() if the argument vector is not +# representable for this target or if this target does not support +# command-line arguments. +# ARGC is the number of elements in the vector. +# ARGV is an array of strings, one per argument. +m::char *:construct_inferior_arguments:int argc, char **argv:argc, argv:::construct_inferior_arguments::0 +f:=:void:elf_make_msymbol_special:asymbol *sym, struct minimal_symbol *msym:sym, msym:::default_elf_make_msymbol_special::0 +f:=:void:coff_make_msymbol_special:int val, struct minimal_symbol *msym:val, msym:::default_coff_make_msymbol_special::0 +v:=:const char *:name_of_malloc::::"malloc":"malloc"::0:%s:NAME_OF_MALLOC +v:=:int:cannot_step_breakpoint::::0:0::0 +v:=:int:have_nonsteppable_watchpoint::::0:0::0 +F:=:int:address_class_type_flags:int byte_size, int dwarf2_addr_class:byte_size, dwarf2_addr_class +M::const char *:address_class_type_flags_to_name:int type_flags:type_flags +M::int:address_class_name_to_type_flags:const char *name, int *type_flags_ptr:name, type_flags_ptr +# Is a register in a group +m::int:register_reggroup_p:int regnum, struct reggroup *reggroup:regnum, reggroup:::default_register_reggroup_p::0 +# Fetch the pointer to the ith function argument. +F:=:CORE_ADDR:fetch_pointer_argument:struct frame_info *frame, int argi, struct type *type:frame, argi, type + +# Return the appropriate register set for a core file section with +# name SECT_NAME and size SECT_SIZE. +M::const struct regset *:regset_from_core_section:const char *sect_name, size_t sect_size:sect_name, sect_size + +# The libthread_db interface passes registers in and out using the same +# structures that appear in core files: gregset_t and fpregset_t. +# Whether reading or writing: +# - GDB first moves data out of the regcache into a struct (using +# fill_gregset or fill_fpregset), +# - crosses the thread_db boundary (for writing, calls +# td_thr_setregs; for reading, returns from td_thr_getregs), and +# - moves the data from the struct back into the regcache (using +# supply_gregset or supply_fpregset). +# +# Some platforms define even more register sets; for example, +# members of the PowerPC family supporting the Signal Processing +# Extension ("SPE") have 'struct speregset'. These need to be passed +# back and forth across the thread_db boundary. +# +# An architecture that has such a register set should: +# - choose a structure to hold the extra registers, +# - set gdbarch_xregs_regset to a 'struct regset' that can move register +# values into and out of that structure, +# - set gdbarch_xregs_size to the structure's size, in bytes, and +# - set gdbarch_xregs_name to a string that can be used to refer to the +# structure in error messages and the like. +# +# Architectures without such a register set should leave +# gdbarch_xregs_regset set to zero. +v:=:const struct regset *:xregs_regset:::0 +v:=:int:xregs_size:::0 +v:=:const char *:xregs_name:::0 + +EOF +} + +# +# The .log file +# +exec > new-gdbarch.log +function_list | while do_read +do + cat <&2 + kill $$ + exit 1 + fi + if [ "x${invalid_p}" = "x0" -a -n "${postdefault}" ] + then + echo "Error: postdefault is useless when invalid_p=0" 1>&2 + kill $$ + exit 1 + fi + if class_is_multiarch_p + then + if class_is_predicate_p ; then : + elif test "x${predefault}" = "x" + then + echo "Error: pure multi-arch function must have a predefault" 1>&2 + kill $$ + exit 1 + fi + fi + echo "" +done + +exec 1>&2 +compare_new gdbarch.log + + +copyright () +{ +cat < new-gdbarch.h +copyright +cat <= GDB_MULTI_ARCH_PURE) && defined (GDB_TM_FILE) +#error "GDB_TM_FILE: Pure multi-arch targets do not have a tm.h file." +#endif +EOF + +# function typedef's +printf "\n" +printf "\n" +printf "/* The following are pre-initialized by GDBARCH. */\n" +function_list | while do_read +do + if class_is_info_p + then + printf "\n" + printf "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);\n" + printf "/* set_gdbarch_${function}() - not applicable - pre-initialized. */\n" + if test -n "${macro}" + then + printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (${macro})\n" + printf "#error \"Non multi-arch definition of ${macro}\"\n" + printf "#endif\n" + printf "#if !defined (${macro})\n" + printf "#define ${macro} (gdbarch_${function} (current_gdbarch))\n" + printf "#endif\n" + fi + fi +done + +# function typedef's +printf "\n" +printf "\n" +printf "/* The following are initialized by the target dependent code. */\n" +function_list | while do_read +do + if [ -n "${comment}" ] + then + echo "${comment}" | sed \ + -e '2 s,#,/*,' \ + -e '3,$ s,#, ,' \ + -e '$ s,$, */,' + fi + + if class_is_predicate_p + then + if test -n "${macro}" + then + printf "\n" + printf "#if defined (${macro})\n" + printf "/* Legacy for systems yet to multi-arch ${macro} */\n" + printf "#if !defined (${macro}_P)\n" + printf "#define ${macro}_P() (1)\n" + printf "#endif\n" + printf "#endif\n" + fi + printf "\n" + printf "extern int gdbarch_${function}_p (struct gdbarch *gdbarch);\n" + if test -n "${macro}" + then + printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (${macro}_P)\n" + printf "#error \"Non multi-arch definition of ${macro}\"\n" + printf "#endif\n" + printf "#if !defined (${macro}_P)\n" + printf "#define ${macro}_P() (gdbarch_${function}_p (current_gdbarch))\n" + printf "#endif\n" + fi + fi + if class_is_variable_p + then + printf "\n" + printf "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);\n" + printf "extern void set_gdbarch_${function} (struct gdbarch *gdbarch, ${returntype} ${function});\n" + if test -n "${macro}" + then + printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (${macro})\n" + printf "#error \"Non multi-arch definition of ${macro}\"\n" + printf "#endif\n" + printf "#if !defined (${macro})\n" + printf "#define ${macro} (gdbarch_${function} (current_gdbarch))\n" + printf "#endif\n" + fi + fi + if class_is_function_p + then + printf "\n" + if [ "x${formal}" = "xvoid" ] && class_is_multiarch_p + then + printf "typedef ${returntype} (gdbarch_${function}_ftype) (struct gdbarch *gdbarch);\n" + elif class_is_multiarch_p + then + printf "typedef ${returntype} (gdbarch_${function}_ftype) (struct gdbarch *gdbarch, ${formal});\n" + else + printf "typedef ${returntype} (gdbarch_${function}_ftype) (${formal});\n" + fi + if [ "x${formal}" = "xvoid" ] + then + printf "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);\n" + else + printf "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch, ${formal});\n" + fi + printf "extern void set_gdbarch_${function} (struct gdbarch *gdbarch, gdbarch_${function}_ftype *${function});\n" + if test -n "${macro}" + then + printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (${macro})\n" + printf "#error \"Non multi-arch definition of ${macro}\"\n" + printf "#endif\n" + if [ "x${actual}" = "x" ] + then + d="#define ${macro}() (gdbarch_${function} (current_gdbarch))" + elif [ "x${actual}" = "x-" ] + then + d="#define ${macro} (gdbarch_${function} (current_gdbarch))" + else + d="#define ${macro}(${actual}) (gdbarch_${function} (current_gdbarch, ${actual}))" + fi + printf "#if !defined (${macro})\n" + if [ "x${actual}" = "x" ] + then + printf "#define ${macro}() (gdbarch_${function} (current_gdbarch))\n" + elif [ "x${actual}" = "x-" ] + then + printf "#define ${macro} (gdbarch_${function} (current_gdbarch))\n" + else + printf "#define ${macro}(${actual}) (gdbarch_${function} (current_gdbarch, ${actual}))\n" + fi + printf "#endif\n" + fi + fi +done + +# close it off +cat <gdbarch can used to access + values from the previously selected architecture for this + architecture family. The global \`\`current_gdbarch'' shall not be + used. + + The INIT function shall return any of: NULL - indicating that it + doesn't recognize the selected architecture; an existing \`\`struct + gdbarch'' from the ARCHES list - indicating that the new + architecture is just a synonym for an earlier architecture (see + gdbarch_list_lookup_by_info()); a newly created \`\`struct gdbarch'' + - that describes the selected architecture (see gdbarch_alloc()). + + The DUMP_TDEP function shall print out all target specific values. + Care should be taken to ensure that the function works in both the + multi-arch and non- multi-arch cases. */ + +struct gdbarch_list +{ + struct gdbarch *gdbarch; + struct gdbarch_list *next; +}; + +struct gdbarch_info +{ + /* Use default: NULL (ZERO). */ + const struct bfd_arch_info *bfd_arch_info; + + /* Use default: BFD_ENDIAN_UNKNOWN (NB: is not ZERO). */ + int byte_order; + + /* Use default: NULL (ZERO). */ + bfd *abfd; + + /* Use default: NULL (ZERO). */ + struct gdbarch_tdep_info *tdep_info; + + /* Use default: GDB_OSABI_UNINITIALIZED (-1). */ + enum gdb_osabi osabi; +}; + +typedef struct gdbarch *(gdbarch_init_ftype) (struct gdbarch_info info, struct gdbarch_list *arches); +typedef void (gdbarch_dump_tdep_ftype) (struct gdbarch *gdbarch, struct ui_file *file); + +/* DEPRECATED - use gdbarch_register() */ +extern void register_gdbarch_init (enum bfd_architecture architecture, gdbarch_init_ftype *); + +extern void gdbarch_register (enum bfd_architecture architecture, + gdbarch_init_ftype *, + gdbarch_dump_tdep_ftype *); + + +/* Return a freshly allocated, NULL terminated, array of the valid + architecture names. Since architectures are registered during the + _initialize phase this function only returns useful information + once initialization has been completed. */ + +extern const char **gdbarch_printable_names (void); + + +/* Helper function. Search the list of ARCHES for a GDBARCH that + matches the information provided by INFO. */ + +extern struct gdbarch_list *gdbarch_list_lookup_by_info (struct gdbarch_list *arches, const struct gdbarch_info *info); + + +/* Helper function. Create a preliminary \`\`struct gdbarch''. Perform + basic initialization using values obtained from the INFO andTDEP + parameters. set_gdbarch_*() functions are called to complete the + initialization of the object. */ + +extern struct gdbarch *gdbarch_alloc (const struct gdbarch_info *info, struct gdbarch_tdep *tdep); + + +/* Helper function. Free a partially-constructed \`\`struct gdbarch''. + It is assumed that the caller freeds the \`\`struct + gdbarch_tdep''. */ + +extern void gdbarch_free (struct gdbarch *); + + +/* Helper function. Allocate memory from the \`\`struct gdbarch'' + obstack. The memory is freed when the corresponding architecture + is also freed. */ + +extern void *gdbarch_obstack_zalloc (struct gdbarch *gdbarch, long size); +#define GDBARCH_OBSTACK_CALLOC(GDBARCH, NR, TYPE) ((TYPE *) gdbarch_obstack_zalloc ((GDBARCH), (NR) * sizeof (TYPE))) +#define GDBARCH_OBSTACK_ZALLOC(GDBARCH, TYPE) ((TYPE *) gdbarch_obstack_zalloc ((GDBARCH), sizeof (TYPE))) + + +/* Helper function. Force an update of the current architecture. + + The actual architecture selected is determined by INFO, \`\`(gdb) set + architecture'' et.al., the existing architecture and BFD's default + architecture. INFO should be initialized to zero and then selected + fields should be updated. + + Returns non-zero if the update succeeds */ + +extern int gdbarch_update_p (struct gdbarch_info info); + + +/* Helper function. Find an architecture matching info. + + INFO should be initialized using gdbarch_info_init, relevant fields + set, and then finished using gdbarch_info_fill. + + Returns the corresponding architecture, or NULL if no matching + architecture was found. "current_gdbarch" is not updated. */ + +extern struct gdbarch *gdbarch_find_by_info (struct gdbarch_info info); + + +/* Helper function. Set the global "current_gdbarch" to "gdbarch". + + FIXME: kettenis/20031124: Of the functions that follow, only + gdbarch_from_bfd is supposed to survive. The others will + dissappear since in the future GDB will (hopefully) be truly + multi-arch. However, for now we're still stuck with the concept of + a single active architecture. */ + +extern void deprecated_current_gdbarch_select_hack (struct gdbarch *gdbarch); + + +/* Register per-architecture data-pointer. + + Reserve space for a per-architecture data-pointer. An identifier + for the reserved data-pointer is returned. That identifer should + be saved in a local static variable. + + Memory for the per-architecture data shall be allocated using + gdbarch_obstack_zalloc. That memory will be deleted when the + corresponding architecture object is deleted. + + When a previously created architecture is re-selected, the + per-architecture data-pointer for that previous architecture is + restored. INIT() is not re-called. + + Multiple registrarants for any architecture are allowed (and + strongly encouraged). */ + +struct gdbarch_data; + +typedef void *(gdbarch_data_pre_init_ftype) (struct obstack *obstack); +extern struct gdbarch_data *gdbarch_data_register_pre_init (gdbarch_data_pre_init_ftype *init); +typedef void *(gdbarch_data_post_init_ftype) (struct gdbarch *gdbarch); +extern struct gdbarch_data *gdbarch_data_register_post_init (gdbarch_data_post_init_ftype *init); +extern void deprecated_set_gdbarch_data (struct gdbarch *gdbarch, + struct gdbarch_data *data, + void *pointer); + +extern void *gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *); + + + +/* Register per-architecture memory region. + + Provide a memory-region swap mechanism. Per-architecture memory + region are created. These memory regions are swapped whenever the + architecture is changed. For a new architecture, the memory region + is initialized with zero (0) and the INIT function is called. + + Memory regions are swapped / initialized in the order that they are + registered. NULL DATA and/or INIT values can be specified. + + New code should use gdbarch_data_register_*(). */ + +typedef void (gdbarch_swap_ftype) (void); +extern void deprecated_register_gdbarch_swap (void *data, unsigned long size, gdbarch_swap_ftype *init); +#define DEPRECATED_REGISTER_GDBARCH_SWAP(VAR) deprecated_register_gdbarch_swap (&(VAR), sizeof ((VAR)), NULL) + + + +/* Set the dynamic target-system-dependent parameters (architecture, + byte-order, ...) using information found in the BFD */ + +extern void set_gdbarch_from_file (bfd *); + + +/* Initialize the current architecture to the "first" one we find on + our list. */ + +extern void initialize_current_architecture (void); + +/* gdbarch trace variable */ +extern int gdbarch_debug; + +extern void gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file); + +#endif +EOF +exec 1>&2 +#../move-if-change new-gdbarch.h gdbarch.h +compare_new gdbarch.h + + +# +# C file +# + +exec > new-gdbarch.c +copyright +cat <obstack = obstack; + + alloc_gdbarch_data (current_gdbarch); + + current_gdbarch->tdep = tdep; +EOF +printf "\n" +function_list | while do_read +do + if class_is_info_p + then + printf " current_gdbarch->${function} = info->${function};\n" + fi +done +printf "\n" +printf " /* Force the explicit initialization of these. */\n" +function_list | while do_read +do + if class_is_function_p || class_is_variable_p + then + if [ -n "${predefault}" -a "x${predefault}" != "x0" ] + then + printf " current_gdbarch->${function} = ${predefault};\n" + fi + fi +done +cat <obstack, size); + memset (data, 0, size); + return data; +} + + +/* Free a gdbarch struct. This should never happen in normal + operation --- once you've created a gdbarch, you keep it around. + However, if an architecture's init function encounters an error + building the structure, it may need to clean up a partially + constructed gdbarch. */ + +void +gdbarch_free (struct gdbarch *arch) +{ + struct obstack *obstack; + gdb_assert (arch != NULL); + gdb_assert (!arch->initialized_p); + obstack = arch->obstack; + obstack_free (obstack, 0); /* Includes the ARCH. */ + xfree (obstack); +} +EOF + +# verify a new architecture +cat <byte_order == BFD_ENDIAN_UNKNOWN) + fprintf_unfiltered (log, "\n\tbyte-order"); + if (current_gdbarch->bfd_arch_info == NULL) + fprintf_unfiltered (log, "\n\tbfd_arch_info"); + /* Check those that need to be defined for the given multi-arch level. */ +EOF +function_list | while do_read +do + if class_is_function_p || class_is_variable_p + then + if [ "x${invalid_p}" = "x0" ] + then + printf " /* Skip verify of ${function}, invalid_p == 0 */\n" + elif class_is_predicate_p + then + printf " /* Skip verify of ${function}, has predicate */\n" + # FIXME: See do_read for potential simplification + elif [ -n "${invalid_p}" -a -n "${postdefault}" ] + then + printf " if (${invalid_p})\n" + printf " current_gdbarch->${function} = ${postdefault};\n" + elif [ -n "${predefault}" -a -n "${postdefault}" ] + then + printf " if (current_gdbarch->${function} == ${predefault})\n" + printf " current_gdbarch->${function} = ${postdefault};\n" + elif [ -n "${postdefault}" ] + then + printf " if (current_gdbarch->${function} == 0)\n" + printf " current_gdbarch->${function} = ${postdefault};\n" + elif [ -n "${invalid_p}" ] + then + printf " if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)\n" + printf " && (${invalid_p}))\n" + printf " fprintf_unfiltered (log, \"\\\\n\\\\t${function}\");\n" + elif [ -n "${predefault}" ] + then + printf " if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)\n" + printf " && (current_gdbarch->${function} == ${predefault}))\n" + printf " fprintf_unfiltered (log, \"\\\\n\\\\t${function}\");\n" + fi + fi +done +cat < 0) + internal_error (__FILE__, __LINE__, + "verify_gdbarch: the following are invalid ...%s", + buf); + do_cleanups (cleanups); +} +EOF + +# dump the structure +printf "\n" +printf "\n" +cat <\\\\n\",\n" + printf " (long) current_gdbarch->${function});\n" + else + # It is a variable + case "${fmt}:${print}:${returntype}" in + ::CORE_ADDR ) + fmt="0x%s" + print="paddr_nz (current_gdbarch->${function})" + ;; + ::* ) + fmt="%s" + print="paddr_d (current_gdbarch->${function})" + ;; + * ) + test "${fmt}" || fmt="%ld" + test "${print}" || print="(long) (current_gdbarch->${function})" + ;; + esac + printf " fprintf_unfiltered (file,\n" + printf " \"gdbarch_dump: ${function} = %s\\\\n\",\n" "${fmt}" + printf " ${print});\n" + fi +done +cat <dump_tdep != NULL) + current_gdbarch->dump_tdep (current_gdbarch, file); +} +EOF + + +# GET/SET +printf "\n" +cat <= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_tdep called\\n"); + return gdbarch->tdep; +} +EOF +printf "\n" +function_list | while do_read +do + if class_is_predicate_p + then + printf "\n" + printf "int\n" + printf "gdbarch_${function}_p (struct gdbarch *gdbarch)\n" + printf "{\n" + printf " gdb_assert (gdbarch != NULL);\n" + printf " return ${predicate};\n" + printf "}\n" + fi + if class_is_function_p + then + printf "\n" + printf "${returntype}\n" + if [ "x${formal}" = "xvoid" ] + then + printf "gdbarch_${function} (struct gdbarch *gdbarch)\n" + else + printf "gdbarch_${function} (struct gdbarch *gdbarch, ${formal})\n" + fi + printf "{\n" + printf " gdb_assert (gdbarch != NULL);\n" + printf " gdb_assert (gdbarch->${function} != NULL);\n" + if class_is_predicate_p && test -n "${predefault}" + then + # Allow a call to a function with a predicate. + printf " /* Do not check predicate: ${predicate}, allow call. */\n" + fi + printf " if (gdbarch_debug >= 2)\n" + printf " fprintf_unfiltered (gdb_stdlog, \"gdbarch_${function} called\\\\n\");\n" + if [ "x${actual}" = "x-" -o "x${actual}" = "x" ] + then + if class_is_multiarch_p + then + params="gdbarch" + else + params="" + fi + else + if class_is_multiarch_p + then + params="gdbarch, ${actual}" + else + params="${actual}" + fi + fi + if [ "x${returntype}" = "xvoid" ] + then + printf " gdbarch->${function} (${params});\n" + else + printf " return gdbarch->${function} (${params});\n" + fi + printf "}\n" + printf "\n" + printf "void\n" + printf "set_gdbarch_${function} (struct gdbarch *gdbarch,\n" + printf " `echo ${function} | sed -e 's/./ /g'` gdbarch_${function}_ftype ${function})\n" + printf "{\n" + printf " gdbarch->${function} = ${function};\n" + printf "}\n" + elif class_is_variable_p + then + printf "\n" + printf "${returntype}\n" + printf "gdbarch_${function} (struct gdbarch *gdbarch)\n" + printf "{\n" + printf " gdb_assert (gdbarch != NULL);\n" + if [ "x${invalid_p}" = "x0" ] + then + printf " /* Skip verify of ${function}, invalid_p == 0 */\n" + elif [ -n "${invalid_p}" ] + then + printf " /* Check variable is valid. */\n" + printf " gdb_assert (!(${invalid_p}));\n" + elif [ -n "${predefault}" ] + then + printf " /* Check variable changed from pre-default. */\n" + printf " gdb_assert (gdbarch->${function} != ${predefault});\n" + fi + printf " if (gdbarch_debug >= 2)\n" + printf " fprintf_unfiltered (gdb_stdlog, \"gdbarch_${function} called\\\\n\");\n" + printf " return gdbarch->${function};\n" + printf "}\n" + printf "\n" + printf "void\n" + printf "set_gdbarch_${function} (struct gdbarch *gdbarch,\n" + printf " `echo ${function} | sed -e 's/./ /g'` ${returntype} ${function})\n" + printf "{\n" + printf " gdbarch->${function} = ${function};\n" + printf "}\n" + elif class_is_info_p + then + printf "\n" + printf "${returntype}\n" + printf "gdbarch_${function} (struct gdbarch *gdbarch)\n" + printf "{\n" + printf " gdb_assert (gdbarch != NULL);\n" + printf " if (gdbarch_debug >= 2)\n" + printf " fprintf_unfiltered (gdb_stdlog, \"gdbarch_${function} called\\\\n\");\n" + printf " return gdbarch->${function};\n" + printf "}\n" + fi +done + +# All the trailing guff +cat <next); + (*curr) = XMALLOC (struct gdbarch_data_registration); + (*curr)->next = NULL; + (*curr)->data = XMALLOC (struct gdbarch_data); + (*curr)->data->index = gdbarch_data_registry.nr++; + (*curr)->data->pre_init = pre_init; + (*curr)->data->post_init = post_init; + (*curr)->data->init_p = 1; + return (*curr)->data; +} + +struct gdbarch_data * +gdbarch_data_register_pre_init (gdbarch_data_pre_init_ftype *pre_init) +{ + return gdbarch_data_register (pre_init, NULL); +} + +struct gdbarch_data * +gdbarch_data_register_post_init (gdbarch_data_post_init_ftype *post_init) +{ + return gdbarch_data_register (NULL, post_init); +} + +/* Create/delete the gdbarch data vector. */ + +static void +alloc_gdbarch_data (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch->data == NULL); + gdbarch->nr_data = gdbarch_data_registry.nr; + gdbarch->data = GDBARCH_OBSTACK_CALLOC (gdbarch, gdbarch->nr_data, void *); +} + +/* Initialize the current value of the specified per-architecture + data-pointer. */ + +void +deprecated_set_gdbarch_data (struct gdbarch *gdbarch, + struct gdbarch_data *data, + void *pointer) +{ + gdb_assert (data->index < gdbarch->nr_data); + gdb_assert (gdbarch->data[data->index] == NULL); + gdb_assert (data->pre_init == NULL); + gdbarch->data[data->index] = pointer; +} + +/* Return the current value of the specified per-architecture + data-pointer. */ + +void * +gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *data) +{ + gdb_assert (data->index < gdbarch->nr_data); + if (gdbarch->data[data->index] == NULL) + { + /* The data-pointer isn't initialized, call init() to get a + value. */ + if (data->pre_init != NULL) + /* Mid architecture creation: pass just the obstack, and not + the entire architecture, as that way it isn't possible for + pre-init code to refer to undefined architecture + fields. */ + gdbarch->data[data->index] = data->pre_init (gdbarch->obstack); + else if (gdbarch->initialized_p + && data->post_init != NULL) + /* Post architecture creation: pass the entire architecture + (as all fields are valid), but be careful to also detect + recursive references. */ + { + gdb_assert (data->init_p); + data->init_p = 0; + gdbarch->data[data->index] = data->post_init (gdbarch); + data->init_p = 1; + } + else + /* The architecture initialization hasn't completed - punt - + hope that the caller knows what they are doing. Once + deprecated_set_gdbarch_data has been initialized, this can be + changed to an internal error. */ + return NULL; + gdb_assert (gdbarch->data[data->index] != NULL); + } + return gdbarch->data[data->index]; +} + + + +/* Keep a registry of swapped data required by GDB modules. */ + +struct gdbarch_swap +{ + void *swap; + struct gdbarch_swap_registration *source; + struct gdbarch_swap *next; +}; + +struct gdbarch_swap_registration +{ + void *data; + unsigned long sizeof_data; + gdbarch_swap_ftype *init; + struct gdbarch_swap_registration *next; +}; + +struct gdbarch_swap_registry +{ + int nr; + struct gdbarch_swap_registration *registrations; +}; + +struct gdbarch_swap_registry gdbarch_swap_registry = +{ + 0, NULL, +}; + +void +deprecated_register_gdbarch_swap (void *data, + unsigned long sizeof_data, + gdbarch_swap_ftype *init) +{ + struct gdbarch_swap_registration **rego; + for (rego = &gdbarch_swap_registry.registrations; + (*rego) != NULL; + rego = &(*rego)->next); + (*rego) = XMALLOC (struct gdbarch_swap_registration); + (*rego)->next = NULL; + (*rego)->init = init; + (*rego)->data = data; + (*rego)->sizeof_data = sizeof_data; +} + +static void +current_gdbarch_swap_init_hack (void) +{ + struct gdbarch_swap_registration *rego; + struct gdbarch_swap **curr = ¤t_gdbarch->swap; + for (rego = gdbarch_swap_registry.registrations; + rego != NULL; + rego = rego->next) + { + if (rego->data != NULL) + { + (*curr) = GDBARCH_OBSTACK_ZALLOC (current_gdbarch, + struct gdbarch_swap); + (*curr)->source = rego; + (*curr)->swap = gdbarch_obstack_zalloc (current_gdbarch, + rego->sizeof_data); + (*curr)->next = NULL; + curr = &(*curr)->next; + } + if (rego->init != NULL) + rego->init (); + } +} + +static struct gdbarch * +current_gdbarch_swap_out_hack (void) +{ + struct gdbarch *old_gdbarch = current_gdbarch; + struct gdbarch_swap *curr; + + gdb_assert (old_gdbarch != NULL); + for (curr = old_gdbarch->swap; + curr != NULL; + curr = curr->next) + { + memcpy (curr->swap, curr->source->data, curr->source->sizeof_data); + memset (curr->source->data, 0, curr->source->sizeof_data); + } + current_gdbarch = NULL; + return old_gdbarch; +} + +static void +current_gdbarch_swap_in_hack (struct gdbarch *new_gdbarch) +{ + struct gdbarch_swap *curr; + + gdb_assert (current_gdbarch == NULL); + for (curr = new_gdbarch->swap; + curr != NULL; + curr = curr->next) + memcpy (curr->source->data, curr->swap, curr->source->sizeof_data); + current_gdbarch = new_gdbarch; +} + + +/* Keep a registry of the architectures known by GDB. */ + +struct gdbarch_registration +{ + enum bfd_architecture bfd_architecture; + gdbarch_init_ftype *init; + gdbarch_dump_tdep_ftype *dump_tdep; + struct gdbarch_list *arches; + struct gdbarch_registration *next; +}; + +static struct gdbarch_registration *gdbarch_registry = NULL; + +static void +append_name (const char ***buf, int *nr, const char *name) +{ + *buf = xrealloc (*buf, sizeof (char**) * (*nr + 1)); + (*buf)[*nr] = name; + *nr += 1; +} + +const char ** +gdbarch_printable_names (void) +{ + /* Accumulate a list of names based on the registed list of + architectures. */ + enum bfd_architecture a; + int nr_arches = 0; + const char **arches = NULL; + struct gdbarch_registration *rego; + for (rego = gdbarch_registry; + rego != NULL; + rego = rego->next) + { + const struct bfd_arch_info *ap; + ap = bfd_lookup_arch (rego->bfd_architecture, 0); + if (ap == NULL) + internal_error (__FILE__, __LINE__, + "gdbarch_architecture_names: multi-arch unknown"); + do + { + append_name (&arches, &nr_arches, ap->printable_name); + ap = ap->next; + } + while (ap != NULL); + } + append_name (&arches, &nr_arches, NULL); + return arches; +} + + +void +gdbarch_register (enum bfd_architecture bfd_architecture, + gdbarch_init_ftype *init, + gdbarch_dump_tdep_ftype *dump_tdep) +{ + struct gdbarch_registration **curr; + const struct bfd_arch_info *bfd_arch_info; + /* Check that BFD recognizes this architecture */ + bfd_arch_info = bfd_lookup_arch (bfd_architecture, 0); + if (bfd_arch_info == NULL) + { + internal_error (__FILE__, __LINE__, + "gdbarch: Attempt to register unknown architecture (%d)", + bfd_architecture); + } + /* Check that we haven't seen this architecture before */ + for (curr = &gdbarch_registry; + (*curr) != NULL; + curr = &(*curr)->next) + { + if (bfd_architecture == (*curr)->bfd_architecture) + internal_error (__FILE__, __LINE__, + "gdbarch: Duplicate registraration of architecture (%s)", + bfd_arch_info->printable_name); + } + /* log it */ + if (gdbarch_debug) + fprintf_unfiltered (gdb_stdlog, "register_gdbarch_init (%s, 0x%08lx)\n", + bfd_arch_info->printable_name, + (long) init); + /* Append it */ + (*curr) = XMALLOC (struct gdbarch_registration); + (*curr)->bfd_architecture = bfd_architecture; + (*curr)->init = init; + (*curr)->dump_tdep = dump_tdep; + (*curr)->arches = NULL; + (*curr)->next = NULL; +} + +void +register_gdbarch_init (enum bfd_architecture bfd_architecture, + gdbarch_init_ftype *init) +{ + gdbarch_register (bfd_architecture, init, NULL); +} + + +/* Look for an architecture using gdbarch_info. Base search on only + BFD_ARCH_INFO and BYTE_ORDER. */ + +struct gdbarch_list * +gdbarch_list_lookup_by_info (struct gdbarch_list *arches, + const struct gdbarch_info *info) +{ + for (; arches != NULL; arches = arches->next) + { + if (info->bfd_arch_info != arches->gdbarch->bfd_arch_info) + continue; + if (info->byte_order != arches->gdbarch->byte_order) + continue; + if (info->osabi != arches->gdbarch->osabi) + continue; + return arches; + } + return NULL; +} + + +/* Find an architecture that matches the specified INFO. Create a new + architecture if needed. Return that new architecture. Assumes + that there is no current architecture. */ + +static struct gdbarch * +find_arch_by_info (struct gdbarch *old_gdbarch, struct gdbarch_info info) +{ + struct gdbarch *new_gdbarch; + struct gdbarch_registration *rego; + + /* The existing architecture has been swapped out - all this code + works from a clean slate. */ + gdb_assert (current_gdbarch == NULL); + + /* Fill in missing parts of the INFO struct using a number of + sources: "set ..."; INFOabfd supplied; and the existing + architecture. */ + gdbarch_info_fill (old_gdbarch, &info); + + /* Must have found some sort of architecture. */ + gdb_assert (info.bfd_arch_info != NULL); + + if (gdbarch_debug) + { + fprintf_unfiltered (gdb_stdlog, + "find_arch_by_info: info.bfd_arch_info %s\n", + (info.bfd_arch_info != NULL + ? info.bfd_arch_info->printable_name + : "(null)")); + fprintf_unfiltered (gdb_stdlog, + "find_arch_by_info: info.byte_order %d (%s)\n", + info.byte_order, + (info.byte_order == BFD_ENDIAN_BIG ? "big" + : info.byte_order == BFD_ENDIAN_LITTLE ? "little" + : "default")); + fprintf_unfiltered (gdb_stdlog, + "find_arch_by_info: info.osabi %d (%s)\n", + info.osabi, gdbarch_osabi_name (info.osabi)); + fprintf_unfiltered (gdb_stdlog, + "find_arch_by_info: info.abfd 0x%lx\n", + (long) info.abfd); + fprintf_unfiltered (gdb_stdlog, + "find_arch_by_info: info.tdep_info 0x%lx\n", + (long) info.tdep_info); + } + + /* Find the tdep code that knows about this architecture. */ + for (rego = gdbarch_registry; + rego != NULL; + rego = rego->next) + if (rego->bfd_architecture == info.bfd_arch_info->arch) + break; + if (rego == NULL) + { + if (gdbarch_debug) + fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: " + "No matching architecture\n"); + return 0; + } + + /* Ask the tdep code for an architecture that matches "info". */ + new_gdbarch = rego->init (info, rego->arches); + + /* Did the tdep code like it? No. Reject the change and revert to + the old architecture. */ + if (new_gdbarch == NULL) + { + if (gdbarch_debug) + fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: " + "Target rejected architecture\n"); + return NULL; + } + + /* Is this a pre-existing architecture (as determined by already + being initialized)? Move it to the front of the architecture + list (keeping the list sorted Most Recently Used). */ + if (new_gdbarch->initialized_p) + { + struct gdbarch_list **list; + struct gdbarch_list *this; + if (gdbarch_debug) + fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: " + "Previous architecture 0x%08lx (%s) selected\n", + (long) new_gdbarch, + new_gdbarch->bfd_arch_info->printable_name); + /* Find the existing arch in the list. */ + for (list = ®o->arches; + (*list) != NULL && (*list)->gdbarch != new_gdbarch; + list = &(*list)->next); + /* It had better be in the list of architectures. */ + gdb_assert ((*list) != NULL && (*list)->gdbarch == new_gdbarch); + /* Unlink THIS. */ + this = (*list); + (*list) = this->next; + /* Insert THIS at the front. */ + this->next = rego->arches; + rego->arches = this; + /* Return it. */ + return new_gdbarch; + } + + /* It's a new architecture. */ + if (gdbarch_debug) + fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: " + "New architecture 0x%08lx (%s) selected\n", + (long) new_gdbarch, + new_gdbarch->bfd_arch_info->printable_name); + + /* Insert the new architecture into the front of the architecture + list (keep the list sorted Most Recently Used). */ + { + struct gdbarch_list *this = XMALLOC (struct gdbarch_list); + this->next = rego->arches; + this->gdbarch = new_gdbarch; + rego->arches = this; + } + + /* Check that the newly installed architecture is valid. Plug in + any post init values. */ + new_gdbarch->dump_tdep = rego->dump_tdep; + verify_gdbarch (new_gdbarch); + new_gdbarch->initialized_p = 1; + + /* Initialize any per-architecture swap areas. This phase requires + a valid global CURRENT_GDBARCH. Set it momentarially, and then + swap the entire architecture out. */ + current_gdbarch = new_gdbarch; + current_gdbarch_swap_init_hack (); + current_gdbarch_swap_out_hack (); + + if (gdbarch_debug) + gdbarch_dump (new_gdbarch, gdb_stdlog); + + return new_gdbarch; +} + +struct gdbarch * +gdbarch_find_by_info (struct gdbarch_info info) +{ + /* Save the previously selected architecture, setting the global to + NULL. This stops things like gdbarch->init() trying to use the + previous architecture's configuration. The previous architecture + may not even be of the same architecture family. The most recent + architecture of the same family is found at the head of the + rego->arches list. */ + struct gdbarch *old_gdbarch = current_gdbarch_swap_out_hack (); + + /* Find the specified architecture. */ + struct gdbarch *new_gdbarch = find_arch_by_info (old_gdbarch, info); + + /* Restore the existing architecture. */ + gdb_assert (current_gdbarch == NULL); + current_gdbarch_swap_in_hack (old_gdbarch); + + return new_gdbarch; +} + +/* Make the specified architecture current, swapping the existing one + out. */ + +void +deprecated_current_gdbarch_select_hack (struct gdbarch *new_gdbarch) +{ + gdb_assert (new_gdbarch != NULL); + gdb_assert (current_gdbarch != NULL); + gdb_assert (new_gdbarch->initialized_p); + current_gdbarch_swap_out_hack (); + current_gdbarch_swap_in_hack (new_gdbarch); + architecture_changed_event (); +} + +extern void _initialize_gdbarch (void); + +void +_initialize_gdbarch (void) +{ + struct cmd_list_element *c; + + add_show_from_set (add_set_cmd ("arch", + class_maintenance, + var_zinteger, + (char *)&gdbarch_debug, + "Set architecture debugging.\\n\\ +When non-zero, architecture debugging is enabled.", &setdebuglist), + &showdebuglist); + c = add_set_cmd ("archdebug", + class_maintenance, + var_zinteger, + (char *)&gdbarch_debug, + "Set architecture debugging.\\n\\ +When non-zero, architecture debugging is enabled.", &setlist); + + deprecate_cmd (c, "set debug arch"); + deprecate_cmd (add_show_from_set (c, &showlist), "show debug arch"); +} +EOF + +# close things off +exec 1>&2 +#../move-if-change new-gdbarch.c gdbarch.c +compare_new gdbarch.c diff --git a/gdb/ppc-tdep.h b/gdb/ppc-tdep.h index 1a5bc6fbf05..7d2996d76b7 100644 --- a/gdb/ppc-tdep.h +++ b/gdb/ppc-tdep.h @@ -373,4 +373,16 @@ enum ppc_spr_pbu2 = 1023 }; + +/* The ABI for Motorola's PowerPC Signal Processing Extension (SPE) + APU specifies this structure for holding SPE registers in core files. + + At the moment, the kernel doesn't actually dump these, but we use + this for passing those registers through libthread_db. */ +struct speregset { + unsigned char gpr[32][8]; /* The full 64-bit general-purpose registers */ + unsigned char acc[8]; /* accumulator */ + unsigned char spefscr[4]; /* SPR 512: SPE float status control reg */ +}; + #endif diff --git a/gdb/proc-service.c b/gdb/proc-service.c index d7cd1aaf91b..5c5b40843aa 100644 --- a/gdb/proc-service.c +++ b/gdb/proc-service.c @@ -27,6 +27,8 @@ #include "inferior.h" #include "symtab.h" #include "target.h" +#include "regset.h" +#include "regcache.h" /* Prototypes for supply_gregset etc. */ #include "gregset.h" @@ -131,7 +133,11 @@ ps_lcontinue (gdb_ps_prochandle_t ph, lwpid_t lwpid) ps_err_e ps_lgetxregsize (gdb_ps_prochandle_t ph, lwpid_t lwpid, int *xregsize) { - /* FIXME: Not supported yet. */ + if (! gdbarch_xregs_regset (current_gdbarch)) + /* This architecture has no extra registers. */ + return PS_ERR; + + *xregsize = gdbarch_xregs_size (current_gdbarch); return PS_OK; } @@ -141,7 +147,21 @@ ps_lgetxregsize (gdb_ps_prochandle_t ph, lwpid_t lwpid, int *xregsize) ps_err_e ps_lgetxregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, caddr_t xregset) { - /* FIXME: Not supported yet. */ + struct cleanup *old_chain = save_inferior_ptid (); + struct regset *xregs_regset = gdbarch_xregs_regset (current_gdbarch); + + if (! xregs_regset) + /* This target has no extra registers. */ + return PS_OK; + + inferior_ptid = BUILD_LWP (lwpid, ph->pid); + + target_fetch_registers (-1); + xregs_regset->collect_regset (xregs_regset, current_regcache, -1, + (void *) xregset, + gdbarch_xregs_size (current_gdbarch)); + + do_cleanups (old_chain); return PS_OK; } @@ -151,7 +171,23 @@ ps_lgetxregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, caddr_t xregset) ps_err_e ps_lsetxregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, caddr_t xregset) { - /* FIXME: Not supported yet. */ + struct cleanup *old_chain = save_inferior_ptid (); + struct regset *xregs_regset = gdbarch_xregs_regset (current_gdbarch); + + if (! xregs_regset) + /* This architecture has no extended register set. */ + return PS_OK; + + inferior_ptid = BUILD_LWP (lwpid, ph->pid); + + xregs_regset->supply_regset (xregs_regset, current_regcache, -1, + (void *) xregset, + gdbarch_xregs_size (current_gdbarch)); + + target_store_registers (-1); + + do_cleanups (old_chain); + return PS_OK; } diff --git a/gdb/thread-db.c b/gdb/thread-db.c new file mode 100644 index 00000000000..e7262153d47 --- /dev/null +++ b/gdb/thread-db.c @@ -0,0 +1,1501 @@ +/* libthread_db assisted debugging support, generic parts. + + Copyright 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "defs.h" + +#include "gdb_assert.h" +#include +#include "gdb_proc_service.h" +#include "gdb_thread_db.h" + +#include "bfd.h" +#include "gdbthread.h" +#include "inferior.h" +#include "symfile.h" +#include "objfiles.h" +#include "target.h" +#include "regset.h" +#include "regcache.h" +#include "solib-svr4.h" + +#ifdef HAVE_GNU_LIBC_VERSION_H +#include +#endif + +#ifndef LIBTHREAD_DB_SO +#define LIBTHREAD_DB_SO "libthread_db.so.1" +#endif + +/* If we're running on GNU/Linux, we must explicitly attach to any new + threads. */ + +/* FIXME: There is certainly some room for improvements: + - Cache LWP ids. + - Bypass libthread_db when fetching or storing registers for + threads bound to a LWP. */ + +/* This module's target vector. */ +static struct target_ops thread_db_ops; + +/* The target vector that we call for things this module can't handle. */ +static struct target_ops *target_beneath; + +/* Pointer to the next function on the objfile event chain. */ +static void (*target_new_objfile_chain) (struct objfile * objfile); + +/* Non-zero if we're using this module's target vector. */ +static int using_thread_db; + +/* Non-zero if we have to keep this module's target vector active + across re-runs. */ +static int keep_thread_db; + +/* Non-zero if we have determined the signals used by the threads + library. */ +static int thread_signals; +static sigset_t thread_stop_set; +static sigset_t thread_print_set; + +/* Structure that identifies the child process for the + interface. */ +static struct ps_prochandle proc_handle; + +/* Connection to the libthread_db library. */ +static td_thragent_t *thread_agent; + +/* Pointers to the libthread_db functions. */ + +static td_err_e (*td_init_p) (void); + +static td_err_e (*td_ta_new_p) (struct ps_prochandle * ps, + td_thragent_t **ta); +static td_err_e (*td_ta_map_id2thr_p) (const td_thragent_t *ta, thread_t pt, + td_thrhandle_t *__th); +static td_err_e (*td_ta_map_lwp2thr_p) (const td_thragent_t *ta, + lwpid_t lwpid, td_thrhandle_t *th); +static td_err_e (*td_ta_thr_iter_p) (const td_thragent_t *ta, + td_thr_iter_f *callback, void *cbdata_p, + td_thr_state_e state, int ti_pri, + sigset_t *ti_sigmask_p, + unsigned int ti_user_flags); +static td_err_e (*td_ta_event_addr_p) (const td_thragent_t *ta, + td_event_e event, td_notify_t *ptr); +static td_err_e (*td_ta_set_event_p) (const td_thragent_t *ta, + td_thr_events_t *event); +static td_err_e (*td_ta_event_getmsg_p) (const td_thragent_t *ta, + td_event_msg_t *msg); + +static td_err_e (*td_thr_validate_p) (const td_thrhandle_t *th); +static td_err_e (*td_thr_get_info_p) (const td_thrhandle_t *th, + td_thrinfo_t *infop); +static td_err_e (*td_thr_getxregsize_p) (const td_thrhandle_t *__th, + int *__sizep); +static td_err_e (*td_thr_getfpregs_p) (const td_thrhandle_t *th, + gdb_prfpregset_t *regset); +static td_err_e (*td_thr_getgregs_p) (const td_thrhandle_t *th, + prgregset_t gregs); +static td_err_e (*td_thr_getxregs_p) (const td_thrhandle_t *__th, + void *__xregs); +static td_err_e (*td_thr_setfpregs_p) (const td_thrhandle_t *th, + const gdb_prfpregset_t *fpregs); +static td_err_e (*td_thr_setgregs_p) (const td_thrhandle_t *th, + prgregset_t gregs); +static td_err_e (*td_thr_setxregs_p) (const td_thrhandle_t *__th, + const void *__addr); +static td_err_e (*td_thr_event_enable_p) (const td_thrhandle_t *th, + int event); + +static td_err_e (*td_thr_tls_get_addr_p) (const td_thrhandle_t *th, + void *map_address, + size_t offset, void **address); + +/* Location of the thread creation event breakpoint. The code at this + location in the child process will be called by the pthread library + whenever a new thread is created. By setting a special breakpoint + at this location, GDB can detect when a new thread is created. We + obtain this location via the td_ta_event_addr call. */ +static CORE_ADDR td_create_bp_addr; + +/* Location of the thread death event breakpoint. */ +static CORE_ADDR td_death_bp_addr; + +/* On some architectures, there are additional regs beyond the gregset + and fpregset. The libthread_db interface has functions to access + these, but on some versions of libthread_db they are not + implemented. We want to warn the user about this, but not treat it + as a fatal error, since you can still access the other + registers. */ +static int warned_xregs_not_implemented; + +/* Prototypes for local functions. */ +static void thread_db_find_new_threads (void); +static void attach_thread (ptid_t ptid, const td_thrhandle_t *th_p, + const td_thrinfo_t *ti_p, int verbose); +static void detach_thread (ptid_t ptid, int verbose); + + +/* Building process ids. */ + +#define GET_PID(ptid) ptid_get_pid (ptid) +#define GET_LWP(ptid) ptid_get_lwp (ptid) +#define GET_THREAD(ptid) ptid_get_tid (ptid) + +#define is_lwp(ptid) (GET_LWP (ptid) != 0) +#define is_thread(ptid) (GET_THREAD (ptid) != 0) + +#define BUILD_LWP(lwp, pid) ptid_build (pid, lwp, 0) +#define BUILD_THREAD(tid, pid) ptid_build (pid, 0, tid) + + +/* Use "struct private_thread_info" to cache thread state. This is + a substantial optimization. */ + +struct private_thread_info +{ + /* Flag set when we see a TD_DEATH event for this thread. */ + unsigned int dying:1; + + /* Cached thread state. */ + unsigned int th_valid:1; + unsigned int ti_valid:1; + + td_thrhandle_t th; + td_thrinfo_t ti; +}; + + +static char * +thread_db_err_str (td_err_e err) +{ + static char buf[64]; + + switch (err) + { + case TD_OK: + return "generic 'call succeeded'"; + case TD_ERR: + return "generic error"; + case TD_NOTHR: + return "no thread to satisfy query"; + case TD_NOSV: + return "no sync handle to satisfy query"; + case TD_NOLWP: + return "no LWP to satisfy query"; + case TD_BADPH: + return "invalid process handle"; + case TD_BADTH: + return "invalid thread handle"; + case TD_BADSH: + return "invalid synchronization handle"; + case TD_BADTA: + return "invalid thread agent"; + case TD_BADKEY: + return "invalid key"; + case TD_NOMSG: + return "no event message for getmsg"; + case TD_NOFPREGS: + return "FPU register set not available"; + case TD_NOLIBTHREAD: + return "application not linked with libthread"; + case TD_NOEVENT: + return "requested event is not supported"; + case TD_NOCAPAB: + return "capability not available"; + case TD_DBERR: + return "debugger service failed"; + case TD_NOAPLIC: + return "operation not applicable to"; + case TD_NOTSD: + return "no thread-specific data for this thread"; + case TD_MALLOC: + return "malloc failed"; + case TD_PARTIALREG: + return "only part of register set was written/read"; + case TD_NOXREGS: + return "X register set not available for this thread"; + default: + snprintf (buf, sizeof (buf), "unknown thread_db error '%d'", err); + return buf; + } +} + +static char * +thread_db_state_str (td_thr_state_e state) +{ + static char buf[64]; + + switch (state) + { + case TD_THR_STOPPED: + return "stopped by debugger"; + case TD_THR_RUN: + return "runnable"; + case TD_THR_ACTIVE: + return "active"; + case TD_THR_ZOMBIE: + return "zombie"; + case TD_THR_SLEEP: + return "sleeping"; + case TD_THR_STOPPED_ASLEEP: + return "stopped by debugger AND blocked"; + default: + snprintf (buf, sizeof (buf), "unknown thread_db state %d", state); + return buf; + } +} + +/* A callback function for td_ta_thr_iter, which we use to map all + threads to LWPs. + + THP is a handle to the current thread; if INFOP is not NULL, the + struct thread_info associated with this thread is returned in + *INFOP. + + If the thread is a zombie, TD_THR_ZOMBIE is returned. Otherwise, + zero is returned to indicate success. */ + +static int +thread_get_info_callback (const td_thrhandle_t *thp, void *infop) +{ + td_thrinfo_t ti; + td_err_e err; + struct thread_info *thread_info; + ptid_t thread_ptid; + + err = td_thr_get_info_p (thp, &ti); + if (err != TD_OK) + error ("thread_get_info_callback: cannot get thread info: %s", + thread_db_err_str (err)); + + /* Fill the cache. */ + thread_ptid = BUILD_THREAD (ti.ti_tid, GET_PID (inferior_ptid)); + thread_info = find_thread_pid (thread_ptid); + + /* In the case of a zombie thread, don't continue. We don't want to + attach to it thinking it is a new thread. */ + if (ti.ti_state == TD_THR_UNKNOWN || ti.ti_state == TD_THR_ZOMBIE) + { + if (infop != NULL) + *(struct thread_info **) infop = thread_info; + if (thread_info != NULL) + { + memcpy (&thread_info->private->th, thp, sizeof (*thp)); + thread_info->private->th_valid = 1; + memcpy (&thread_info->private->ti, &ti, sizeof (ti)); + thread_info->private->ti_valid = 1; + } + return TD_THR_ZOMBIE; + } + + if (thread_info == NULL) + { + /* New thread. Attach to it now (why wait?). */ + attach_thread (thread_ptid, thp, &ti, 1); + thread_info = find_thread_pid (thread_ptid); + gdb_assert (thread_info != NULL); + } + + memcpy (&thread_info->private->th, thp, sizeof (*thp)); + thread_info->private->th_valid = 1; + memcpy (&thread_info->private->ti, &ti, sizeof (ti)); + thread_info->private->ti_valid = 1; + + if (infop != NULL) + *(struct thread_info **) infop = thread_info; + + return 0; +} + +/* Accessor functions for the thread_db information, with caching. */ + +static void +thread_db_map_id2thr (struct thread_info *thread_info, int fatal) +{ + td_err_e err; + + if (thread_info->private->th_valid) + return; + + err = td_ta_map_id2thr_p (thread_agent, GET_THREAD (thread_info->ptid), + &thread_info->private->th); + if (err != TD_OK) + { + if (fatal) + error ("Cannot find thread %ld: %s", + (long) GET_THREAD (thread_info->ptid), + thread_db_err_str (err)); + } + else + thread_info->private->th_valid = 1; +} + +static td_thrinfo_t * +thread_db_get_info (struct thread_info *thread_info) +{ + td_err_e err; + + if (thread_info->private->ti_valid) + return &thread_info->private->ti; + + if (!thread_info->private->th_valid) + thread_db_map_id2thr (thread_info, 1); + + err = + td_thr_get_info_p (&thread_info->private->th, &thread_info->private->ti); + if (err != TD_OK) + error ("thread_db_get_info: cannot get thread info: %s", + thread_db_err_str (err)); + + thread_info->private->ti_valid = 1; + return &thread_info->private->ti; +} + +/* Convert between user-level thread ids and LWP ids. */ + +static ptid_t +thread_from_lwp (ptid_t ptid) +{ + td_thrhandle_t th; + td_err_e err; + struct thread_info *thread_info; + ptid_t thread_ptid; + + if (GET_LWP (ptid) == 0) + ptid = BUILD_LWP (GET_PID (ptid), GET_PID (ptid)); + + gdb_assert (is_lwp (ptid)); + + err = td_ta_map_lwp2thr_p (thread_agent, GET_LWP (ptid), &th); + if (err != TD_OK) + error ("Cannot find user-level thread for LWP %ld: %s", + GET_LWP (ptid), thread_db_err_str (err)); + + thread_info = NULL; + + /* Fetch the thread info. If we get back TD_THR_ZOMBIE, then the + event thread has already died. If another gdb interface has called + thread_alive() previously, the thread won't be found on the thread list + anymore. In that case, we don't want to process this ptid anymore + to avoid the possibility of later treating it as a newly + discovered thread id that we should add to the list. Thus, + we return a -1 ptid which is also how the thread list marks a + dead thread. */ + if (thread_get_info_callback (&th, &thread_info) == TD_THR_ZOMBIE + && thread_info == NULL) + return pid_to_ptid (-1); + + gdb_assert (thread_info && thread_info->private->ti_valid); + + return BUILD_THREAD (thread_info->private->ti.ti_tid, GET_PID (ptid)); +} + +static ptid_t +lwp_from_thread (ptid_t ptid) +{ + struct thread_info *thread_info; + ptid_t thread_ptid; + + if (!is_thread (ptid)) + return ptid; + + thread_info = find_thread_pid (ptid); + thread_db_get_info (thread_info); + + return BUILD_LWP (thread_info->private->ti.ti_lid, GET_PID (ptid)); +} + + +void +thread_db_init (struct target_ops *target) +{ + target_beneath = target; +} + +static void * +verbose_dlsym (void *handle, const char *name) +{ + void *sym = dlsym (handle, name); + if (sym == NULL) + warning ("Symbol \"%s\" not found in libthread_db: %s", name, dlerror ()); + return sym; +} + +static int +thread_db_load (void) +{ + void *handle; + td_err_e err; + + handle = dlopen (LIBTHREAD_DB_SO, RTLD_NOW); + if (handle == NULL) + { + fprintf_filtered (gdb_stderr, "\n\ndlopen failed on '%s' - %s\n", + LIBTHREAD_DB_SO, dlerror ()); + fprintf_filtered (gdb_stderr, + "GDB will not be able to debug pthreads.\n\n"); + return 0; + } + + /* Initialize pointers to the dynamic library functions we will use. + Essential functions first. */ + + td_init_p = verbose_dlsym (handle, "td_init"); + if (td_init_p == NULL) + return 0; + + td_ta_new_p = verbose_dlsym (handle, "td_ta_new"); + if (td_ta_new_p == NULL) + return 0; + + td_ta_map_id2thr_p = verbose_dlsym (handle, "td_ta_map_id2thr"); + if (td_ta_map_id2thr_p == NULL) + return 0; + + td_ta_map_lwp2thr_p = verbose_dlsym (handle, "td_ta_map_lwp2thr"); + if (td_ta_map_lwp2thr_p == NULL) + return 0; + + td_ta_thr_iter_p = verbose_dlsym (handle, "td_ta_thr_iter"); + if (td_ta_thr_iter_p == NULL) + return 0; + + td_thr_validate_p = verbose_dlsym (handle, "td_thr_validate"); + if (td_thr_validate_p == NULL) + return 0; + + td_thr_get_info_p = verbose_dlsym (handle, "td_thr_get_info"); + if (td_thr_get_info_p == NULL) + return 0; + + td_thr_getxregsize_p = verbose_dlsym (handle, "td_thr_getxregsize"); + if (td_thr_getxregsize_p == NULL) + return 0; + + td_thr_getfpregs_p = verbose_dlsym (handle, "td_thr_getfpregs"); + if (td_thr_getfpregs_p == NULL) + return 0; + + td_thr_getgregs_p = verbose_dlsym (handle, "td_thr_getgregs"); + if (td_thr_getgregs_p == NULL) + return 0; + + td_thr_getxregs_p = verbose_dlsym (handle, "td_thr_getxregs"); + if (td_thr_getxregs_p == NULL) + return 0; + + td_thr_setfpregs_p = verbose_dlsym (handle, "td_thr_setfpregs"); + if (td_thr_setfpregs_p == NULL) + return 0; + + td_thr_setgregs_p = verbose_dlsym (handle, "td_thr_setgregs"); + if (td_thr_setgregs_p == NULL) + return 0; + + td_thr_setxregs_p = verbose_dlsym (handle, "td_thr_setxregs"); + if (td_thr_setxregs_p == NULL) + return 0; + + /* Initialize the library. */ + err = td_init_p (); + if (err != TD_OK) + { + warning ("Cannot initialize libthread_db: %s", thread_db_err_str (err)); + return 0; + } + + /* These are not essential. */ + td_ta_event_addr_p = dlsym (handle, "td_ta_event_addr"); + td_ta_set_event_p = dlsym (handle, "td_ta_set_event"); + td_ta_event_getmsg_p = dlsym (handle, "td_ta_event_getmsg"); + td_thr_event_enable_p = dlsym (handle, "td_thr_event_enable"); + td_thr_tls_get_addr_p = dlsym (handle, "td_thr_tls_get_addr"); + + return 1; +} + +static td_err_e +enable_thread_event (td_thragent_t *thread_agent, int event, CORE_ADDR *bp) +{ + td_notify_t notify; + td_err_e err; + + /* Get the breakpoint address for thread EVENT. */ + err = td_ta_event_addr_p (thread_agent, event, ¬ify); + if (err != TD_OK) + return err; + + /* Set up the breakpoint. */ + (*bp) = gdbarch_convert_from_func_ptr_addr (current_gdbarch, + (CORE_ADDR) notify.u.bptaddr, + ¤t_target); + create_thread_event_breakpoint ((*bp)); + + return TD_OK; +} + +static void +enable_thread_event_reporting (void) +{ + td_thr_events_t events; + td_notify_t notify; + td_err_e err; +#ifdef HAVE_GNU_LIBC_VERSION_H + const char *libc_version; + int libc_major, libc_minor; +#endif + + /* We cannot use the thread event reporting facility if these + functions aren't available. */ + if (td_ta_event_addr_p == NULL || td_ta_set_event_p == NULL + || td_ta_event_getmsg_p == NULL || td_thr_event_enable_p == NULL) + return; + + /* Set the process wide mask saying which events we're interested in. */ + td_event_emptyset (&events); + td_event_addset (&events, TD_CREATE); + +#ifdef HAVE_GNU_LIBC_VERSION_H + /* FIXME: kettenis/2000-04-23: The event reporting facility is + broken for TD_DEATH events in glibc 2.1.3, so don't enable it for + now. */ + libc_version = gnu_get_libc_version (); + if (sscanf (libc_version, "%d.%d", &libc_major, &libc_minor) == 2 + && (libc_major > 2 || (libc_major == 2 && libc_minor > 1))) +#endif + td_event_addset (&events, TD_DEATH); + + err = td_ta_set_event_p (thread_agent, &events); + if (err != TD_OK) + { + warning ("Unable to set global thread event mask: %s", + thread_db_err_str (err)); + return; + } + + /* Delete previous thread event breakpoints, if any. */ + remove_thread_event_breakpoints (); + td_create_bp_addr = 0; + td_death_bp_addr = 0; + + /* Set up the thread creation event. */ + err = enable_thread_event (thread_agent, TD_CREATE, &td_create_bp_addr); + if (err != TD_OK) + { + warning ("Unable to get location for thread creation breakpoint: %s", + thread_db_err_str (err)); + return; + } + + /* Set up the thread death event. */ + err = enable_thread_event (thread_agent, TD_DEATH, &td_death_bp_addr); + if (err != TD_OK) + { + warning ("Unable to get location for thread death breakpoint: %s", + thread_db_err_str (err)); + return; + } +} + +static void +disable_thread_event_reporting (void) +{ + td_thr_events_t events; + + /* Set the process wide mask saying we aren't interested in any + events anymore. */ + td_event_emptyset (&events); + td_ta_set_event_p (thread_agent, &events); + + /* Delete thread event breakpoints, if any. */ + remove_thread_event_breakpoints (); + td_create_bp_addr = 0; + td_death_bp_addr = 0; +} + +static void +check_thread_signals (void) +{ +#ifdef GET_THREAD_SIGNALS + if (!thread_signals) + { + sigset_t mask; + int i; + + GET_THREAD_SIGNALS (&mask); + sigemptyset (&thread_stop_set); + sigemptyset (&thread_print_set); + + for (i = 1; i < NSIG; i++) + { + if (sigismember (&mask, i)) + { + if (signal_stop_update (target_signal_from_host (i), 0)) + sigaddset (&thread_stop_set, i); + if (signal_print_update (target_signal_from_host (i), 0)) + sigaddset (&thread_print_set, i); + thread_signals = 1; + } + } + } +#endif +} + +static void +thread_db_new_objfile (struct objfile *objfile) +{ + td_err_e err; + + /* First time through, report that libthread_db was successfuly + loaded. Can't print this in in thread_db_load as, at that stage, + the interpreter and it's console haven't started. The real + problem here is that libthread_db is loaded too early - it should + only be loaded when there is a program to debug. */ + { + static int dejavu; + if (!dejavu) + { + Dl_info info; + const char *library = NULL; + /* Try dladdr. */ + if (dladdr ((*td_ta_new_p), &info) != 0) + library = info.dli_fname; + /* Try dlinfo? */ + if (library == NULL) + /* Paranoid - don't let a NULL path slip through. */ + library = LIBTHREAD_DB_SO; + printf_unfiltered ("Using host libthread_db library \"%s\".\n", + library); + dejavu = 1; + } + } + + /* Don't attempt to use thread_db on targets which can not run + (core files). */ + if (objfile == NULL || !target_has_execution) + { + /* All symbols have been discarded. If the thread_db target is + active, deactivate it now. */ + if (using_thread_db) + { + gdb_assert (proc_handle.pid == 0); + unpush_target (&thread_db_ops); + using_thread_db = 0; + } + + keep_thread_db = 0; + + goto quit; + } + + if (using_thread_db) + /* Nothing to do. The thread library was already detected and the + target vector was already activated. */ + goto quit; + + /* Initialize the structure that identifies the child process. Note + that at this point there is no guarantee that we actually have a + child process. */ + proc_handle.pid = GET_PID (inferior_ptid); + + /* Now attempt to open a connection to the thread library. */ + err = td_ta_new_p (&proc_handle, &thread_agent); + switch (err) + { + case TD_NOLIBTHREAD: + /* No thread library was detected. */ + break; + + case TD_OK: + printf_unfiltered ("[Thread debugging using libthread_db enabled]\n"); + + /* The thread library was detected. Activate the thread_db target. */ + push_target (&thread_db_ops); + using_thread_db = 1; + + /* If the gdbarch says we have an extended register set, but we are + unable to access them via libthread_db, we want to issue one + warning each time we active libthread_db. */ + warned_xregs_not_implemented = 0; + + /* If the thread library was detected in the main symbol file + itself, we assume that the program was statically linked + against the thread library and well have to keep this + module's target vector activated until forever... Well, at + least until all symbols have been discarded anyway (see + above). */ + if (objfile == symfile_objfile) + { + gdb_assert (proc_handle.pid == 0); + keep_thread_db = 1; + } + + /* We can only poke around if there actually is a child process. + If there is no child process alive, postpone the steps below + until one has been created. */ + if (proc_handle.pid != 0) + { + enable_thread_event_reporting (); + thread_db_find_new_threads (); + } + break; + + default: + warning ("Cannot initialize thread debugging library: %s", + thread_db_err_str (err)); + break; + } + +quit: + if (target_new_objfile_chain) + target_new_objfile_chain (objfile); +} + +/* Attach to a new thread. This function is called when we receive a + TD_CREATE event or when we iterate over all threads and find one + that wasn't already in our list. */ + +static void +attach_thread (ptid_t ptid, const td_thrhandle_t *th_p, + const td_thrinfo_t *ti_p, int verbose) +{ + struct thread_info *tp; + td_err_e err; + + /* If we're being called after a TD_CREATE event, we may already + know about this thread. There are two ways this can happen. We + may have iterated over all threads between the thread creation + and the TD_CREATE event, for instance when the user has issued + the `info threads' command before the SIGTRAP for hitting the + thread creation breakpoint was reported. Alternatively, the + thread may have exited and a new one been created with the same + thread ID. In the first case we don't need to do anything; in + the second case we should discard information about the dead + thread and attach to the new one. */ + if (in_thread_list (ptid)) + { + tp = find_thread_pid (ptid); + gdb_assert (tp != NULL); + + if (!tp->private->dying) + return; + + delete_thread (ptid); + } + + check_thread_signals (); + + /* Add the thread to GDB's thread list. */ + tp = add_thread (ptid); + tp->private = xmalloc (sizeof (struct private_thread_info)); + memset (tp->private, 0, sizeof (struct private_thread_info)); + + if (verbose) + printf_unfiltered ("[New %s]\n", target_pid_to_str (ptid)); + + if (ti_p->ti_state == TD_THR_UNKNOWN || ti_p->ti_state == TD_THR_ZOMBIE) + return; /* A zombie thread -- do not attach. */ + + /* Under GNU/Linux, we have to attach to each and every thread. */ +#ifdef ATTACH_LWP + ATTACH_LWP (BUILD_LWP (ti_p->ti_lid, GET_PID (ptid)), 0); +#endif + + /* Enable thread event reporting for this thread. */ + err = td_thr_event_enable_p (th_p, 1); + if (err != TD_OK) + error ("Cannot enable thread event reporting for %s: %s", + target_pid_to_str (ptid), thread_db_err_str (err)); +} + +static void +thread_db_attach (char *args, int from_tty) +{ + target_beneath->to_attach (args, from_tty); + + /* Destroy thread info; it's no longer valid. */ + init_thread_list (); + + /* The child process is now the actual multi-threaded + program. Snatch its process ID... */ + proc_handle.pid = GET_PID (inferior_ptid); + + /* ...and perform the remaining initialization steps. */ + enable_thread_event_reporting (); + thread_db_find_new_threads (); +} + +static void +detach_thread (ptid_t ptid, int verbose) +{ + struct thread_info *thread_info; + + if (verbose) + printf_unfiltered ("[%s exited]\n", target_pid_to_str (ptid)); + + /* Don't delete the thread now, because it still reports as active + until it has executed a few instructions after the event + breakpoint - if we deleted it now, "info threads" would cause us + to re-attach to it. Just mark it as having had a TD_DEATH + event. This means that we won't delete it from our thread list + until we notice that it's dead (via prune_threads), or until + something re-uses its thread ID. */ + thread_info = find_thread_pid (ptid); + gdb_assert (thread_info != NULL); + thread_info->private->dying = 1; +} + +static void +thread_db_detach (char *args, int from_tty) +{ + disable_thread_event_reporting (); + + /* There's no need to save & restore inferior_ptid here, since the + inferior is supposed to be survive this function call. */ + inferior_ptid = lwp_from_thread (inferior_ptid); + + /* Forget about the child's process ID. We shouldn't need it + anymore. */ + proc_handle.pid = 0; + + target_beneath->to_detach (args, from_tty); +} + +static int +clear_lwpid_callback (struct thread_info *thread, void *dummy) +{ + /* If we know that our thread implementation is 1-to-1, we could save + a certain amount of information; it's not clear how much, so we + are always conservative. */ + + thread->private->th_valid = 0; + thread->private->ti_valid = 0; + + return 0; +} + +static void +thread_db_resume (ptid_t ptid, int step, enum target_signal signo) +{ + struct cleanup *old_chain = save_inferior_ptid (); + + if (GET_PID (ptid) == -1) + inferior_ptid = lwp_from_thread (inferior_ptid); + else if (is_thread (ptid)) + ptid = lwp_from_thread (ptid); + + /* Clear cached data which may not be valid after the resume. */ + iterate_over_threads (clear_lwpid_callback, NULL); + + target_beneath->to_resume (ptid, step, signo); + + do_cleanups (old_chain); +} + +/* Check if PID is currently stopped at the location of a thread event + breakpoint location. If it is, read the event message and act upon + the event. */ + +static void +check_event (ptid_t ptid) +{ + td_event_msg_t msg; + td_thrinfo_t ti; + td_err_e err; + CORE_ADDR stop_pc; + int loop = 0; + + /* Bail out early if we're not at a thread event breakpoint. */ + stop_pc = read_pc_pid (ptid) - DECR_PC_AFTER_BREAK; + if (stop_pc != td_create_bp_addr && stop_pc != td_death_bp_addr) + return; + + /* If we are at a create breakpoint, we do not know what new lwp + was created and cannot specifically locate the event message for it. + We have to call td_ta_event_getmsg() to get + the latest message. Since we have no way of correlating whether + the event message we get back corresponds to our breakpoint, we must + loop and read all event messages, processing them appropriately. + This guarantees we will process the correct message before continuing + from the breakpoint. + + Currently, death events are not enabled. If they are enabled, + the death event can use the td_thr_event_getmsg() interface to + get the message specifically for that lwp and avoid looping + below. */ + + loop = 1; + + do + { + err = td_ta_event_getmsg_p (thread_agent, &msg); + if (err != TD_OK) + { + if (err == TD_NOMSG) + return; + + error ("Cannot get thread event message: %s", + thread_db_err_str (err)); + } + + err = td_thr_get_info_p (msg.th_p, &ti); + if (err != TD_OK) + error ("Cannot get thread info: %s", thread_db_err_str (err)); + + ptid = BUILD_THREAD (ti.ti_tid, GET_PID (ptid)); + + switch (msg.event) + { + case TD_CREATE: + /* Call attach_thread whether or not we already know about a + thread with this thread ID. */ + attach_thread (ptid, msg.th_p, &ti, 1); + + break; + + case TD_DEATH: + + if (!in_thread_list (ptid)) + error ("Spurious thread death event."); + + detach_thread (ptid, 1); + + break; + + default: + error ("Spurious thread event."); + } + } + while (loop); +} + +static ptid_t +thread_db_wait (ptid_t ptid, struct target_waitstatus *ourstatus) +{ + extern ptid_t trap_ptid; + + if (GET_PID (ptid) != -1 && is_thread (ptid)) + ptid = lwp_from_thread (ptid); + + ptid = target_beneath->to_wait (ptid, ourstatus); + + if (proc_handle.pid == 0) + /* The current child process isn't the actual multi-threaded + program yet, so don't try to do any special thread-specific + post-processing and bail out early. */ + return ptid; + + if (ourstatus->kind == TARGET_WAITKIND_EXITED) + return pid_to_ptid (-1); + + if (ourstatus->kind == TARGET_WAITKIND_STOPPED + && ourstatus->value.sig == TARGET_SIGNAL_TRAP) + /* Check for a thread event. */ + check_event (ptid); + + if (!ptid_equal (trap_ptid, null_ptid)) + trap_ptid = thread_from_lwp (trap_ptid); + + /* Change the ptid back into the higher level PID + TID format. + If the thread is dead and no longer on the thread list, we will + get back a dead ptid. This can occur if the thread death event + gets postponed by other simultaneous events. In such a case, + we want to just ignore the event and continue on. */ + ptid = thread_from_lwp (ptid); + if (GET_PID (ptid) == -1) + ourstatus->kind = TARGET_WAITKIND_SPURIOUS; + + return ptid; +} + +static int +thread_db_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, + struct mem_attrib *attrib, struct target_ops *target) +{ + struct cleanup *old_chain = save_inferior_ptid (); + int xfer; + + if (is_thread (inferior_ptid)) + { + /* FIXME: This seems to be necessary to make sure breakpoints + are removed. */ + if (!target_thread_alive (inferior_ptid)) + inferior_ptid = pid_to_ptid (GET_PID (inferior_ptid)); + else + inferior_ptid = lwp_from_thread (inferior_ptid); + } + + xfer = + target_beneath->to_xfer_memory (memaddr, myaddr, len, write, attrib, + target); + + do_cleanups (old_chain); + return xfer; +} + +static void +thread_db_fetch_registers (int regno) +{ + struct thread_info *thread_info; + prgregset_t gregset; + gdb_prfpregset_t fpregset; + void *xregs = 0; + int fetched_xregs = 0; + struct regset *xregs_regset = gdbarch_xregs_regset (current_gdbarch); + td_err_e err; + + if (!is_thread (inferior_ptid)) + { + /* Pass the request to the target beneath us. */ + target_beneath->to_fetch_registers (regno); + return; + } + + thread_info = find_thread_pid (inferior_ptid); + thread_db_map_id2thr (thread_info, 1); + + if (xregs_regset) + xregs = alloca (gdbarch_xregs_size (current_gdbarch)); + + err = td_thr_getgregs_p (&thread_info->private->th, gregset); + if (err != TD_OK) + error ("Cannot fetch general-purpose registers for thread %ld: %s", + (long) GET_THREAD (inferior_ptid), thread_db_err_str (err)); + + err = td_thr_getfpregs_p (&thread_info->private->th, &fpregset); + if (err != TD_OK) + error ("Cannot get floating-point registers for thread %ld: %s", + (long) GET_THREAD (inferior_ptid), thread_db_err_str (err)); + + if (xregs_regset) + { + err = td_thr_getxregs_p (&thread_info->private->th, xregs); + switch (err) + { + case TD_OK: + fetched_xregs = 1; + break; + + case TD_NOXREGS: + if (! warned_xregs_not_implemented) + { + warning ("thread debugging library is too old to access " + "%s registers.", + gdbarch_xregs_name (current_gdbarch)); + warned_xregs_not_implemented = 1; + } + break; + + default: + error ("Cannot get %s registers for thread %ld: %s", + gdbarch_xregs_name (current_gdbarch), + (long) GET_THREAD (inferior_ptid), thread_db_err_str (err)); + } + } + + /* Note that we must call supply_gregset after calling the thread_db + routines because the thread_db routines call ps_lgetgregs and + friends which clobber GDB's register cache. */ + supply_gregset ((gdb_gregset_t *) gregset); + supply_fpregset (&fpregset); + + if (fetched_xregs) + xregs_regset->supply_regset (xregs_regset, current_regcache, -1, xregs, + gdbarch_xregs_size (current_gdbarch)); +} + +static void +thread_db_store_registers (int regno) +{ + prgregset_t gregset; + gdb_prfpregset_t fpregset; + void *xregs = 0; + struct regset *xregs_regset = gdbarch_xregs_regset (current_gdbarch); + td_err_e err; + struct thread_info *thread_info; + + if (!is_thread (inferior_ptid)) + { + /* Pass the request to the target beneath us. */ + target_beneath->to_store_registers (regno); + return; + } + + thread_info = find_thread_pid (inferior_ptid); + thread_db_map_id2thr (thread_info, 1); + + if (xregs_regset) + xregs = alloca (gdbarch_xregs_size (current_gdbarch)); + + if (regno != -1) + { + char raw[MAX_REGISTER_SIZE]; + + deprecated_read_register_gen (regno, raw); + thread_db_fetch_registers (-1); + supply_register (regno, raw); + } + + fill_gregset ((gdb_gregset_t *) gregset, -1); + fill_fpregset (&fpregset, -1); + if (xregs_regset) + xregs_regset->collect_regset (xregs_regset, current_regcache, -1, + (void *) xregs, + gdbarch_xregs_size (current_gdbarch)); + + err = td_thr_setgregs_p (&thread_info->private->th, gregset); + if (err != TD_OK) + error ("Cannot store general-purpose registers for thread %ld: %s", + (long) GET_THREAD (inferior_ptid), thread_db_err_str (err)); + err = td_thr_setfpregs_p (&thread_info->private->th, &fpregset); + if (err != TD_OK) + error ("Cannot store floating-point registers for thread %ld: %s", + (long) GET_THREAD (inferior_ptid), thread_db_err_str (err)); + if (xregs_regset) + { + err = td_thr_setxregs_p (&thread_info->private->th, xregs); + if (err == TD_NOXREGS) + { + if (! warned_xregs_not_implemented) + { + warning ("thread debugging library is too old to access" + " %s registers.", + gdbarch_xregs_name (current_gdbarch)); + warned_xregs_not_implemented = 1; + } + } + else if (err != TD_OK) + error ("Cannot store %s registers for thread %ld: %s", + gdbarch_xregs_name (current_gdbarch), + (long) GET_THREAD (inferior_ptid), thread_db_err_str (err)); + } +} + +static void +thread_db_kill (void) +{ + /* There's no need to save & restore inferior_ptid here, since the + inferior isn't supposed to survive this function call. */ + inferior_ptid = lwp_from_thread (inferior_ptid); + target_beneath->to_kill (); +} + +static void +thread_db_create_inferior (char *exec_file, char *allargs, char **env, + int from_tty) +{ + if (!keep_thread_db) + { + unpush_target (&thread_db_ops); + using_thread_db = 0; + } + + target_beneath->to_create_inferior (exec_file, allargs, env, from_tty); +} + +static void +thread_db_post_startup_inferior (ptid_t ptid) +{ + if (proc_handle.pid == 0) + { + /* The child process is now the actual multi-threaded + program. Snatch its process ID... */ + proc_handle.pid = GET_PID (ptid); + + /* ...and perform the remaining initialization steps. */ + enable_thread_event_reporting (); + thread_db_find_new_threads (); + } +} + +static void +thread_db_mourn_inferior (void) +{ + remove_thread_event_breakpoints (); + + /* Forget about the child's process ID. We shouldn't need it + anymore. */ + proc_handle.pid = 0; + + target_beneath->to_mourn_inferior (); + + /* Detach thread_db target ops if not dealing with a statically + linked threaded program. This allows a corefile to be debugged + after finishing debugging of a threaded program. At present, + debugging a statically-linked threaded program is broken, but + the check is added below in the event that it is fixed in the + future. */ + if (!keep_thread_db) + { + unpush_target (&thread_db_ops); + using_thread_db = 0; + } +} + +static int +thread_db_thread_alive (ptid_t ptid) +{ + td_thrhandle_t th; + td_err_e err; + + if (is_thread (ptid)) + { + struct thread_info *thread_info; + thread_info = find_thread_pid (ptid); + + thread_db_map_id2thr (thread_info, 0); + if (!thread_info->private->th_valid) + return 0; + + err = td_thr_validate_p (&thread_info->private->th); + if (err != TD_OK) + return 0; + + if (!thread_info->private->ti_valid) + { + err = + td_thr_get_info_p (&thread_info->private->th, + &thread_info->private->ti); + if (err != TD_OK) + return 0; + thread_info->private->ti_valid = 1; + } + + if (thread_info->private->ti.ti_state == TD_THR_UNKNOWN + || thread_info->private->ti.ti_state == TD_THR_ZOMBIE) + return 0; /* A zombie thread. */ + + return 1; + } + + if (target_beneath->to_thread_alive) + return target_beneath->to_thread_alive (ptid); + + return 0; +} + +static int +find_new_threads_callback (const td_thrhandle_t *th_p, void *data) +{ + td_thrinfo_t ti; + td_err_e err; + ptid_t ptid; + + err = td_thr_get_info_p (th_p, &ti); + if (err != TD_OK) + error ("find_new_threads_callback: cannot get thread info: %s", + thread_db_err_str (err)); + + if (ti.ti_state == TD_THR_UNKNOWN || ti.ti_state == TD_THR_ZOMBIE) + return 0; /* A zombie -- ignore. */ + + ptid = BUILD_THREAD (ti.ti_tid, GET_PID (inferior_ptid)); + + if (!in_thread_list (ptid)) + attach_thread (ptid, th_p, &ti, 1); + + return 0; +} + +static void +thread_db_find_new_threads (void) +{ + td_err_e err; + + /* Iterate over all user-space threads to discover new threads. */ + err = td_ta_thr_iter_p (thread_agent, find_new_threads_callback, NULL, + TD_THR_ANY_STATE, TD_THR_LOWEST_PRIORITY, + TD_SIGNO_MASK, TD_THR_ANY_USER_FLAGS); + if (err != TD_OK) + error ("Cannot find new threads: %s", thread_db_err_str (err)); +} + +static char * +thread_db_pid_to_str (ptid_t ptid) +{ + if (is_thread (ptid)) + { + static char buf[64]; + td_thrinfo_t *ti_p; + td_err_e err; + struct thread_info *thread_info; + + thread_info = find_thread_pid (ptid); + thread_db_map_id2thr (thread_info, 0); + if (!thread_info->private->th_valid) + { + snprintf (buf, sizeof (buf), "Thread %ld (Missing)", + GET_THREAD (ptid)); + return buf; + } + + ti_p = thread_db_get_info (thread_info); + + if (ti_p->ti_state == TD_THR_ACTIVE && ti_p->ti_lid != 0) + { + snprintf (buf, sizeof (buf), "Thread %ld (LWP %d)", + (long) ti_p->ti_tid, ti_p->ti_lid); + } + else + { + snprintf (buf, sizeof (buf), "Thread %ld (%s)", + (long) ti_p->ti_tid, + thread_db_state_str (ti_p->ti_state)); + } + + return buf; + } + + if (target_beneath->to_pid_to_str (ptid)) + return target_beneath->to_pid_to_str (ptid); + + return normal_pid_to_str (ptid); +} + +/* Get the address of the thread local variable in OBJFILE which is + stored at OFFSET within the thread local storage for thread PTID. */ + +static CORE_ADDR +thread_db_get_thread_local_address (ptid_t ptid, struct objfile *objfile, + CORE_ADDR offset) +{ + if (is_thread (ptid)) + { + int objfile_is_library = (objfile->flags & OBJF_SHARED); + td_err_e err; + void *address; + CORE_ADDR lm; + struct thread_info *thread_info; + + /* glibc doesn't provide the needed interface. */ + if (!td_thr_tls_get_addr_p) + error ("Cannot find thread-local variables in this thread library."); + + /* Get the address of the link map for this objfile. */ + lm = svr4_fetch_objfile_link_map (objfile); + + /* Whoops, we couldn't find one. Bail out. */ + if (!lm) + { + if (objfile_is_library) + error ("Cannot find shared library `%s' link_map in dynamic" + " linker's module list", objfile->name); + else + error ("Cannot find executable file `%s' link_map in dynamic" + " linker's module list", objfile->name); + } + + /* Get info about the thread. */ + thread_info = find_thread_pid (ptid); + thread_db_map_id2thr (thread_info, 1); + + /* Finally, get the address of the variable. */ + err = td_thr_tls_get_addr_p (&thread_info->private->th, (void *) lm, + offset, &address); + +#ifdef THREAD_DB_HAS_TD_NOTALLOC + /* The memory hasn't been allocated, yet. */ + if (err == TD_NOTALLOC) + { + /* Now, if libthread_db provided the initialization image's + address, we *could* try to build a non-lvalue value from + the initialization image. */ + if (objfile_is_library) + error ("The inferior has not yet allocated storage for" + " thread-local variables in\n" + "the shared library `%s'\n" + "for the thread %ld", + objfile->name, (long) GET_THREAD (ptid)); + else + error ("The inferior has not yet allocated storage for" + " thread-local variables in\n" + "the executable `%s'\n" + "for the thread %ld", + objfile->name, (long) GET_THREAD (ptid)); + } +#endif + + /* Something else went wrong. */ + if (err != TD_OK) + { + if (objfile_is_library) + error ("Cannot find thread-local storage for thread %ld, " + "shared library %s:\n%s", + (long) GET_THREAD (ptid), + objfile->name, thread_db_err_str (err)); + else + error ("Cannot find thread-local storage for thread %ld, " + "executable file %s:\n%s", + (long) GET_THREAD (ptid), + objfile->name, thread_db_err_str (err)); + } + + /* Cast assuming host == target. Joy. */ + return (CORE_ADDR) address; + } + + if (target_beneath->to_get_thread_local_address) + return target_beneath->to_get_thread_local_address (ptid, objfile, + offset); + + error ("Cannot find thread-local values on this target."); +} + +static void +init_thread_db_ops (void) +{ + thread_db_ops.to_shortname = "multi-thread"; + thread_db_ops.to_longname = "multi-threaded child process."; + thread_db_ops.to_doc = "Threads and pthreads support."; + thread_db_ops.to_attach = thread_db_attach; + thread_db_ops.to_detach = thread_db_detach; + thread_db_ops.to_resume = thread_db_resume; + thread_db_ops.to_wait = thread_db_wait; + thread_db_ops.to_fetch_registers = thread_db_fetch_registers; + thread_db_ops.to_store_registers = thread_db_store_registers; + thread_db_ops.to_xfer_memory = thread_db_xfer_memory; + thread_db_ops.to_kill = thread_db_kill; + thread_db_ops.to_create_inferior = thread_db_create_inferior; + thread_db_ops.to_post_startup_inferior = thread_db_post_startup_inferior; + thread_db_ops.to_mourn_inferior = thread_db_mourn_inferior; + thread_db_ops.to_thread_alive = thread_db_thread_alive; + thread_db_ops.to_find_new_threads = thread_db_find_new_threads; + thread_db_ops.to_pid_to_str = thread_db_pid_to_str; + thread_db_ops.to_stratum = thread_stratum; + thread_db_ops.to_has_thread_control = tc_schedlock; + thread_db_ops.to_get_thread_local_address + = thread_db_get_thread_local_address; + thread_db_ops.to_magic = OPS_MAGIC; +} + +void +_initialize_thread_db (void) +{ + /* Only initialize the module if we can load libthread_db. */ + if (thread_db_load ()) + { + init_thread_db_ops (); + add_target (&thread_db_ops); + + /* Add ourselves to objfile event chain. */ + target_new_objfile_chain = deprecated_target_new_objfile_hook; + deprecated_target_new_objfile_hook = thread_db_new_objfile; + } +} -- cgit v1.2.1