binutils-gdb/gdb/gdbarch.sh

2486 lines
86 KiB
Bash
Raw Normal View History

2000-08-11 04:55:38 +02:00
#!/bin/sh -u
1999-08-31 03:14:27 +02:00
# Architecture commands for GDB, the GNU debugger.
#
# Copyright (C) 1998-2015 Free Software Foundation, Inc.
1999-08-31 03:14:27 +02:00
#
# 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 3 of the License, or
1999-08-31 03:14:27 +02:00
# (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, see <http://www.gnu.org/licenses/>.
1999-08-31 03:14:27 +02:00
# Make certain that the script is not running in an internationalized
2002-04-17 20:47:54 +02:00
# environment.
LANG=C ; export LANG
LC_ALL=C ; export LC_ALL
2002-04-17 20:47:54 +02:00
2000-03-30 07:32:23 +02:00
compare_new ()
{
file=$1
2000-08-11 04:55:38 +02:00
if test ! -r ${file}
2000-03-30 07:32:23 +02:00
then
echo "${file} missing? cp new-${file} ${file}" 1>&2
elif diff -u ${file} new-${file}
2000-03-30 07:32:23 +02:00
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 returntype function formal actual staticdefault predefault postdefault invalid_p print garbage_at_eol"
do_read ()
{
comment=""
class=""
# On some SH's, 'read' trims leading and trailing whitespace by
# default (e.g., bash), while on others (e.g., dash), it doesn't.
# Set IFS to empty to disable the trimming everywhere.
while IFS='' 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} <<EOF
${line}
EOF
IFS="${OFS}"
if test -n "${garbage_at_eol}"
then
echo "Garbage at end-of-line in ${line}" 1>&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
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
}
1999-08-31 03:14:27 +02:00
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
}
1999-09-13 23:40:00 +02:00
# dump out/verify the doco
for field in ${read}
do
case ${field} in
class ) : ;;
1999-12-14 02:06:04 +01:00
# # -> 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
1999-09-13 23:40:00 +02:00
returntype ) : ;;
# For functions, the return type; for variables, the data type
1999-09-13 23:40:00 +02:00
function ) : ;;
# For functions, the member function name; for variables, the
# variable name. Member function names are always prefixed with
# ``gdbarch_'' for name-space purity.
1999-09-13 23:40:00 +02:00
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.
1999-09-13 23:40:00 +02:00
actual ) : ;;
# The list of actual arguments. The arguments specified shall
# match the FORMAL list given above. Functions with out
# arguments leave this blank.
1999-09-13 23:40:00 +02:00
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.
1999-09-13 23:40:00 +02:00
# If STATICDEFAULT is empty, zero is used.
predefault ) : ;;
1999-09-13 23:40:00 +02:00
# 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.
1999-09-13 23:40:00 +02:00
# 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 ``gdbarch'' which
# will contain the current architecture. Care should be
# taken.
1999-09-13 23:40:00 +02:00
1999-12-14 02:06:04 +01:00
invalid_p ) : ;;
1999-09-13 23:40:00 +02:00
# 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.
1999-09-13 23:40:00 +02:00
print ) : ;;
# An optional expression that convers MEMBER to a value
# suitable for formatting using %s.
# If PRINT is empty, core_addr_to_string_nz (for CORE_ADDR)
# or plongest (anything else) is used.
1999-09-13 23:40:00 +02:00
garbage_at_eol ) : ;;
# Catches stray fields.
1999-09-13 23:40:00 +02:00
*)
echo "Bad field ${field}"
exit 1;;
1999-09-13 23:40:00 +02:00
esac
done
1999-08-31 03:14:27 +02:00
function_list ()
{
1999-09-13 23:40:00 +02:00
# See below (DOCO) for description of each field
cat <<EOF
i:const struct bfd_arch_info *:bfd_arch_info:::&bfd_default_arch_struct::::gdbarch_bfd_arch_info (gdbarch)->printable_name
1999-08-31 03:14:27 +02:00
#
i:enum bfd_endian:byte_order:::BFD_ENDIAN_BIG
i:enum bfd_endian:byte_order_for_code:::BFD_ENDIAN_BIG
#
i:enum gdb_osabi:osabi:::GDB_OSABI_UNKNOWN
#
i:const struct target_desc *:target_desc:::::::host_address_to_string (gdbarch->target_desc)
# The bit byte-order has to do just with numbering of bits in debugging symbols
# and such. Conceptually, it's quite separate from byte/word byte order.
v:int:bits_big_endian:::1:(gdbarch->byte_order == BFD_ENDIAN_BIG)::0
2000-08-11 04:55:38 +02:00
# Number of bits in a char or unsigned char for the target machine.
# Just like CHAR_BIT in <limits.h> but describes the target machine.
# v:TARGET_CHAR_BIT:int:char_bit::::8 * sizeof (char):8::0:
2000-08-11 04:55:38 +02:00
#
# Number of bits in a short or unsigned short for the target machine.
v:int:short_bit:::8 * sizeof (short):2*TARGET_CHAR_BIT::0
2000-08-11 04:55:38 +02:00
# Number of bits in an int or unsigned int for the target machine.
v:int:int_bit:::8 * sizeof (int):4*TARGET_CHAR_BIT::0
2000-08-11 04:55:38 +02:00
# Number of bits in a long or unsigned long for the target machine.
v:int:long_bit:::8 * sizeof (long):4*TARGET_CHAR_BIT::0
2000-08-11 04:55:38 +02:00
# Number of bits in a long long or unsigned long long for the target
# machine.
v:int:long_long_bit:::8 * sizeof (LONGEST):2*gdbarch->long_bit::0
# Alignment of a long long or unsigned long long for the target
# machine.
v:int:long_long_align_bit:::8 * sizeof (LONGEST):2*gdbarch->long_bit::0
# The ABI default bit-size and format for "half", "float", "double", and
# "long double". These bit/format pairs should eventually be combined
# into a single object. For the moment, just initialize them as a pair.
* doublest.c (floatformat_from_length): Use the right element from gdbarch floatformats. (floatformat_from_type, extract_typed_floating) (store_typed_floating): Likewise. * doublest.h: Remove declarations for undefined floatformat arrays. * gdbarch.sh (float_format, double_format, long_double_format): Change to pairs. (pformat): Update for pairs. * gdbarch.c, gdbarch.h: Regenerated. * gdbtypes.c (floatformats_ieee_single, floatformats_ieee_double) (floatformats_ieee_double_littlebyte_bigword) (floatformats_i387_ext, floatformats_m68881_ext, floatformats_arm_ext) (floatformats_ia64_spill, floatformats_ia64_quad, floatformats_vax_f) (floatformats_vax_d): New variables. (builtin_type_ieee_single, builtin_type_ieee_double) (builtin_type_arm_ext, builtin_type_ia64_spill) (builtin_type_ia64_quad): Replace arrays with individual types. (builtin_type_ieee_single_big, builtin_type_ieee_single_little) (builtin_type_ieee_double_big, builtin_type_ieee_double_little) (builtin_type_ieee_double_littlebyte_bigword, builtin_type_i960_ext) (builtin_type_m88110_ext, builtin_type_m88110_harris_ext) (builtin_type_arm_ext_big, builtin_type_arm_ext_littlebyte_bigword) (builtin_type_ia64_spill_big, builtin_type_ia64_spill_little) (builtin_type_ia64_quad_big, builtin_type_ia64_quad_little): Delete unused and endian-specific types. (recursive_dump_type): Update for floatformat pairs. (build_flt): Move higher. Handle bit == -1. Take a floatformat pair. (build_gdbtypes): Use build_flt. (_initialize_gdbtypes): Update set of initialized types. * gdbtypes.h: Update declarations to match gdbtypes.c. (struct main_type): Store a pointer to two floatformats. * arch-utils.c (default_float_format, default_double_format): Delete. * arch-utils.h (default_float_format, default_double_format): Delete. * arm-tdep.c, avr-tdep.c, hppa-tdep.c, hppabsd-tdep.c, i386-tdep.c, ia64-tdep.c, iq2000-tdep.c, m68k-tdep.c, m88k-tdep.c, mips-linux-tdep.c, mips-tdep.c, mt-tdep.c, ppcobsd-tdep.c, sparc-linux-tdep.c, sparc-tdep.c, sparcnbsd-tdep.c, spu-tdep.c, vax-tdep.c, alpha-tdep.c, ppc-sysv-tdep.c: Update.
2007-01-29 18:31:06 +01:00
# Each format describes both the big and little endian layouts (if
# useful).
v:int:half_bit:::16:2*TARGET_CHAR_BIT::0
v:const struct floatformat **:half_format:::::floatformats_ieee_half::pformat (gdbarch->half_format)
v:int:float_bit:::8 * sizeof (float):4*TARGET_CHAR_BIT::0
v:const struct floatformat **:float_format:::::floatformats_ieee_single::pformat (gdbarch->float_format)
v:int:double_bit:::8 * sizeof (double):8*TARGET_CHAR_BIT::0
v:const struct floatformat **:double_format:::::floatformats_ieee_double::pformat (gdbarch->double_format)
v:int:long_double_bit:::8 * sizeof (long double):8*TARGET_CHAR_BIT::0
v:const struct floatformat **:long_double_format:::::floatformats_ieee_double::pformat (gdbarch->long_double_format)
# 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 gdbarch_ptr_bit and gdbarch_addr_bit
# / addr_bit will be set from it.
#
# If gdbarch_ptr_bit and gdbarch_addr_bit are different, you'll probably
# also need to set gdbarch_dwarf2_addr_size, gdbarch_pointer_to_address and
# gdbarch_address_to_pointer as well.
#
# ptr_bit is the size of a pointer on the target
v:int:ptr_bit:::8 * sizeof (void*):gdbarch->int_bit::0
# addr_bit is the size of a target address as represented in gdb
v:int:addr_bit:::8 * sizeof (void*):0:gdbarch_ptr_bit (gdbarch):
1999-08-31 03:14:27 +02:00
#
# dwarf2_addr_size is the target address size as used in the Dwarf debug
# info. For .debug_frame FDEs, this is supposed to be the target address
# size from the associated CU header, and which is equivalent to the
# DWARF2_ADDR_SIZE as defined by the target specific GCC back-end.
# Unfortunately there is no good way to determine this value. Therefore
# dwarf2_addr_size simply defaults to the target pointer size.
#
# dwarf2_addr_size is not used for .eh_frame FDEs, which are generally
# defined using the target's pointer size so far.
#
# Note that dwarf2_addr_size only needs to be redefined by a target if the
# GCC back-end defines a DWARF2_ADDR_SIZE other than the target pointer size,
# and if Dwarf versions < 4 need to be supported.
v:int:dwarf2_addr_size:::sizeof (void*):0:gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT:
#
# One if \`char' acts like \`signed char', zero if \`unsigned char'.
v:int:char_signed:::1:-1:1
#
F:CORE_ADDR:read_pc:struct regcache *regcache:regcache
F:void:write_pc:struct regcache *regcache, CORE_ADDR val:regcache, val
# 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.
m:void:virtual_frame_pointer:CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset:pc, frame_regnum, frame_offset:0:legacy_virtual_frame_pointer::0
2000-08-11 04:55:38 +02:00
#
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
M:enum register_status:pseudo_register_read:struct regcache *regcache, int cookednum, gdb_byte *buf:regcache, cookednum, buf
# Read a register into a new struct value. If the register is wholly
# or partly unavailable, this should call mark_value_bytes_unavailable
# as appropriate. If this is defined, then pseudo_register_read will
# never be called.
M:struct value *:pseudo_register_read_value:struct regcache *regcache, int cookednum:regcache, cookednum
M:void:pseudo_register_write:struct regcache *regcache, int cookednum, const gdb_byte *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
# Assemble agent expression bytecode to collect pseudo-register REG.
# Return -1 if something goes wrong, 0 otherwise.
M:int:ax_pseudo_register_collect:struct agent_expr *ax, int reg:ax, reg
# Assemble agent expression bytecode to push the value of pseudo-register
# REG on the interpreter stack.
# Return -1 if something goes wrong, 0 otherwise.
M:int:ax_pseudo_register_push_stack:struct agent_expr *ax, int reg:ax, reg
# 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).
2007-06-18 Markus Deuling <deuling@de.ibm.com> * gdbarch.sh (SP_REGNUM): Replace by gdbarch_sp_regnum. * v850-tdep.c (v850_unwind_sp): Likewise. * std-regs.c (value_of_builtin_frame_sp_reg): Likewise. * stack.c (frame_info): Likewise. * stabsread.c (define_symbol): Likewise. * sh-tdep.c (sh_push_dummy_call_fpu, sh_push_dummy_call_nofpu) (sh_dwarf2_frame_init_reg, sh_frame_cache, sh_frame_prev_register) (sh_unwind_sp): Likewise. * sh64-tdep.c (sh64_push_dummy_call, sh64_frame_cache) (sh64_frame_prev_register, sh64_unwind_sp): Likewise. * rs6000-tdep.c (rs6000_push_dummy_call, rs6000_unwind_dummy_id) (rs6000_frame_cache): Likewise. * rs6000-nat.c (store_register): Likewise. * remote-mips.c (mips_wait): Likewise. * procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise. * ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call) (ppc64_sysv_abi_push_dummy_call): Likewise. * ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise. * ppcobsd-nat.c (ppcobsd_supply_pcb): Likewise. * ppcnbsd-tdep.c (ppcnbsd_sigtramp_cache_init): Likewise. * ppc-linux-tdep.c (ppc_linux_sigtramp_cache): Likewise. * m32r-rom.c (m32r_supply_register): Likewise. * frame.c (frame_sp_unwind): Likewise. * mips-tdep.c (mips_insn16_frame_cache) (mips_insn32_frame_cache): Likewise (comment). * m68klinux-nat.c (supply_gregset): Likewise. * m68k-tdep.c (m68k_get_longjmp_target): Likewise. * ia64-tdep.c (ia64_frame_prev_register): Likewise. * i386-tdep.c (i386_get_longjmp_target): Likewise. * dwarf2-frame.c (dwarf2_frame_default_init_reg): Likewise. * cris-tdep.c (cris_regnums, cris_sigcontext_addr) (cris_sigtramp_frame_unwind_cache, cris_push_dummy_call) (cris_scan_prologue, crisv32_scan_prologue, cris_unwind_sp) (cris_register_type, crisv32_register_type) (cris_dwarf2_frame_init_reg): Likewise. * arch-utils.c (legacy_virtual_frame_pointer): Likewise. * amd64-tdep.c (amd64_frame_prev_register): Likewise. * amd64-linux-tdep.c (amd64_linux_sigcontext_addr): Likewise. * libunwind-frame.c (libunwind_frame_cache): Likewise. * gdbarch.sh (PC_REGNUM): Replace by gdbarch_pc_regnum. * regcache.c (read_pc_pid, generic_target_write_pc): Likewise. * xtensa-tdep.c (xtensa_register_type, xtensa_supply_gregset) (xtensa_unwind_pc, xtensa_frame_cache, xtensa_frame_prev_register) (xtensa_extract_return_value, xtensa_store_return_value): Likewise. * v850-tdep.c (v850_unwind_pc): Likewise. * stack.c (frame_info): Likewise. * sh-tdep.c (sh_generic_show_regs, sh3_show_regs, sh2e_show_regs) (sh2a_show_regs, sh2a_nofpu_show_regs, sh3e_show_regs) (sh3_dsp_show_regs, sh4_show_regs, sh4_nofpu_show_regs) (sh_dwarf2_frame_init_reg, sh_frame_prev_register, sh_unwind_pc) (sh_dsp_show_regs): Likewise. * shnbsd-tdep.c (shnbsd_supply_gregset) (shnbsd_collect_gregset): Likewise. * shnbsd-nat.c (GETREGS_SUPPLIES): Likewise. * sh64-tdep.c (sh64_compact_reg_base_num, sh64_show_media_regs) (sh64_frame_prev_register, sh64_unwind_pc): Likewise. * rs6000-tdep.c (ppc_supply_gregset, ppc_collect_gregset) (6000_register_reggroup_p, rs6000_unwind_pc) (rs6000_frame_cache): Likewise. * rs6000-nat.c (regmap, rs6000_fetch_inferior_registers) (rs6000_store_inferior_registers): Likewise. * remote-mips.c (mips_wait, mips_load): Likewise. * procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise. * ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise. * ppcobsd-nat.c (ppcobsd_supply_pcb): Likewise. * ppcnbsd-tdep.c (ppcnbsd_sigtramp_cache_init): Likewise. * ppcnbsd-nat.c (getregs_supplies, ppcnbsd_supply_pcb): Likewise. * ppc-linux-tdep.c (ppc_linux_sigtramp_cache): Likewise. * ppc-linux-nat.c (ppc_register_u_addr, fetch_ppc_registers) (store_ppc_registers, fill_gregset): Likewise. * mips-tdep.c (mips_stub_frame_cache, mips_gdbarch_init): Likewise. * mipsnbsd-tdep.c (mipsnbsd_supply_reg, mipsnbsd_fill_reg): Likewise. * mipsnbsd-nat.c (getregs_supplies): Likewise. * m68k-tdep.c (m68k_register_type, m68k_unwind_pc): Likewise. * m68klinux-nat.c (supply_gregset): Likewise. * irix5-nat.c (fill_gregset): Likewise. * i386-tdep.c (i386_unwind_pc): Likewise. * i386-linux-nat.c (i386_linux_resume): Likewise. * frame.c (get_prev_frame_1): Likewise. * dwarf2-frame.c (dwarf2_frame_default_init_reg): Likewise. * dbug-rom.c (dbug_supply_register): Likewise. * cris-tdep.c (cris_sigtramp_frame_unwind_cache, cris_scan_prologue) (crisv32_scan_prologue, cris_unwind_pc, cris_register_size) (cris_register_type, crisv32_register_type, crisv32_register_name) (cris_dwarf2_frame_init_reg, find_step_target) (cris_software_single_step, cris_supply_gregset) (cris_regnums): Likewise. * alpha-linux-nat.c (alpha_linux_register_u_offset): Likewise. * aix-thread.c (special_register_p, supply_sprs64, supply_sprs32) (fill_sprs64, fill_sprs32, store_regs_user_thread): Likewise. * mips-linux-tdep.c (mips_linux_write_pc): Likewise. * gdbarch.sh (PS_REGNUM): Replace by gdbarch_ps_regnum. * dbug-rom.c (dbug_supply_register): Likewise. * xtensa-tdep.c (xtensa_supply_gregset, xtensa_frame_cache) (xtensa_frame_prev_register, xtensa_push_dummy_call): Likewise. * win32-nat.c (win32_resume): Likewise. * std-regs.c (value_of_builtin_frame_ps_reg) (value_of_builtin_frame_pc_reg): Likewise. * m68k-tdep.c (m68k_register_type): Likewise. * m68klinux-nat.c (supply_gregset): Likewise. * gdbarch.sh (FP0_REGNUM): Replace by gdbarch_fp0_regnum. * sh-tdep.c (sh_extract_return_value_fpu, sh_store_return_value_fpu) (sh2e_show_regs, sh2a_show_regs, sh3e_show_regs, sh4_show_regs) (sh_sh2a_register_type, sh_sh3e_register_type, sh_sh4_register_type) (fv_reg_base_num, dr_reg_base_num): Likewise. * sh64-tdep.c (sh64_fv_reg_base_num, sh64_dr_reg_base_num) (sh64_fpp_reg_base_num, sh64_compact_reg_base_num, sh64_push_dummy_call) (sh64_extract_return_value, sh64_store_return_value) (sh64_show_media_regs, sh64_show_compact_regs, sh64_register_type) (sh64_do_fp_register, sh64_media_print_registers_info): Likewise. * procfs.c (procfs_fetch_registers, procfs_store_registers) (invalidate_cache): Likewise. * ppc-linux-tdep.c (ppc_linux_sigtramp_cache): Likewise. * mipsnbsd-tdep.c (mipsnbsd_supply_fpreg) (mipsnbsd_fill_fpreg): Likewise. * mipsnbsd-nat.c (mipsnbsd_fetch_inferior_registers) (mipsnbsd_store_inferior_registers): Likewise. * mips-linux-tdep.c (mips_supply_fpregset, mips_fill_fpregset) (mips64_supply_fpregset, mips64_fill_fpregset): Likewise. * mips-linux-nat.c (mips64_linux_register_addr): Likewise. * m68k-tdep.c (m68k_register_type, m68k_convert_register_p): Likewise. * m68klinux-nat.c (getfpregs_supplies, supply_fpregset) (fill_fpregset): Likewise. * irix5-nat.c (supply_fpregset, fill_fpregset): Likewise. * i386-tdep.h (struct_return): Likewise (comment). * i386-nto-tdep.c (i386nto_register_area): Likewise. * go32-nat.c (fetch_register, go32_fetch_registers, store_register) (go32_store_registers): Likewise. * alpha-tdep.c (alpha_next_pc): Likewise. * alpha-linux-nat.c (alpha_linux_register_u_offset): Likewise. * alphabsd-nat.c (alphabsd_fetch_inferior_registers) (alphabsd_store_inferior_registers): Likewise. * core-regset.c (fetch_core_registers): Likewise. * i386v4-nat.c (supply_fpregset, fill_fpregset): Likewise. * gdbarch.c, gdbarch.h: Regenerate.
2007-06-18 19:45:26 +02:00
# gdbarch_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.
m: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.
m:int:ecoff_reg_to_regnum:int ecoff_regnr:ecoff_regnr::no_op_reg_to_regnum::0
# Convert from an sdb register number to an internal gdb register number.
m:int:sdb_reg_to_regnum:int sdb_regnr:sdb_regnr::no_op_reg_to_regnum::0
# Provide a default mapping from a DWARF2 register number to a gdb REGNUM.
m:int:dwarf2_reg_to_regnum:int dwarf2_regnr:dwarf2_regnr::no_op_reg_to_regnum::0
2007-11-02 Markus Deuling <deuling@de.ibm.com> * gdbarch.sh (register_name): Add gdbarch parameter. * gdbarch.{c,h}: Regenerate. * target-descriptions.c (tdesc_register_name): Add gdbarch parameter. (tdesc_register_name): Replace current_gdbarch by gdbarch. * target-descriptions.h (tdesc_register_name): Add gdbarch parameter. * xstormy16-tdep.c (xstormy16_register_name): Add gdbarch parameter. * vax-tdep.c (vax_register_name): Add gdbarch parameter. * spu-tdep.c (spu_register_name): Add gdbarch parameter. * s390-tdep.c (s390_register_name): Add gdbarch parameter. * mt-tdep.c (mt_register_name): Add gdbarch parameter. (mt_registers_info): Replace current_gdbarch by gdbarch. (mt_register_reggroup_p): Add gdbarch to mt_register_name call. * mips-tdep.c (mips_register_name): Add gdbarch parameter. Replace current_gdbarch by gdbarch. (mips_register_name): Add gdbarch to tdesc_register_name call. * mep-tdep.c (mep_register_name): Add gdbarch parameter. Replace current_gdbarch by gdbarch. (mep_register_reggroup_p): Add gdbarch to mep_register_name call. * m32c-tdep.c (m32c_register_name): Add gdbarch parameter. Replace current_gdbarch by gdbarch. * m88k-tdep.c (m88k_register_name): Add gdbarch parameter. * m68k-tdep.c (m68k_register_name): Add gdbarch parameter. * m32r-tdep.c (m32r_register_name): Add gdbarch parameter. (m32r_frame_unwind_cache): Use get_frame_arch to get at the current architecture by frame_info. * iq2000-tdep.c (iq2000_register_name): Add gdbarch parameter. * ia64-tdep.c (ia64_register_name): Add gdbarch parameter. * hppa-tdep.c (hppa32_register_name, hppa64_register_name): Add gdbarch parameter. * h8300-tdep.c (h8300_register_name, h8300s_register_name) (h8300sx_register_name): Add gdbarch parameter. * cris-tdep.c (cris_register_name, crisv32_register_name): Add gdbarch parameter. Replace current_gdbarch by gdbarch. (cris_gdbarch_init): Replace current_gdbarch by gdbarch (comment). * avr-tdep.c (avr_register_name): Add gdbarch parameter. * arm-tdep.c (arm_register_name): Add gdbarch paramete * amd64-tdep.c (amd64_register_name): Add gdbarch parameter. Update caller. * amd64-tdep.h (amd64_register_name): Add gdbarch parameter. * amd64-linux-tdep.c (amd64_linux_register_name): Add gdbarch parameter. * alpha-tdep.c (alpha_register_name): Add gdbarch parameter. (alpha_cannot_fetch_register, alpha_cannot_store_register): Update call of alpha_register_name. * frv-tdep.c (frv_register_name): Add gdbarch parameter. * i386-tdep.c (i386_register_name): Add gdbarch parameter. Replace current_gdbarch by gdbarch. (i386_register_type): Replace ?current_gdbarch by gdbarch. * i386-tdep.h (i386_register_name): Add gdbarch parameter. * i386-linux-tdep.c (i386_linux_register_name): Add gdbarch parameter. * m68hc11-tdep.c (m68hc11_register_name): Add gdbarch parameter. (m68hc11_register_reggroup_p): Add gdbarch to call of m68hc11_register_name. * mn10300-tdep.c (mn10300_generic_register_name, am33_register_name) (am33_2_register_name): Add gdbarch parameter. (mn10300_frame_unwind_cache): Use get_frame_arch to get at the current architecture by frame_info. (mn10300_dump_tdep): Replace current_gdbarch by gdbarch. * rs6000-tdep.c (rs6000_register_name): Add gdbarch parameter. Replace current_gdbarch by gdbarch. * score-tdep.c (score_register_name): Add gdbarch parameter. (score_return_value, score_push_dummy_call): Replace current_gdbarch by gdbarch. * sh64-tdep.c (sh64_register_name): Add gdbarch parameter. (sh64_compact_reg_base_num, sh64_register_convert_to_virtual) (sh64_register_convert_to_raw, sh64_fv_reg_base_num) (sh64_dr_reg_base_num, sh64_fpp_reg_base_num): Add gdbarch parameter and update caller. Replace current_gdbarch by gdbarch. (sh64_extract_return_value, sh64_store_return_value): Use get_regcache_arch to get at the current architecture by regcache. * sh-tdep.c (sh_sh_register_name, sh_sh3_register_name) (sh_sh3e_register_name, sh_sh2e_register_name, sh_sh2a_register_name) (sh_sh2a_nofpu_register_name, sh_sh_dsp_register_name) (sh_sh3_dsp_register_name, sh_sh4_register_name) (sh_sh4_nofpu_register_name, sh_sh4al_dsp_register_name): Add gdbarch parameter. (fv_reg_base_num, dr_reg_base_num, sh_justify_value_in_reg) (sh_next_flt_argreg): Add gdbarch parameter and update caller. Replace current_gdbarch by gdbarch. (sh_extract_return_value_fpu, sh_store_return_value_fpu): Use get_regcache_arch to get at the current architecture by regcache. * sparc-tdep.c (sparc32_register_name): Add gdbarch parameter. * sparc64-tdep.c (sparc64_register_name): Add gdbarch parameter. * v850-tdep.c (v850_register_name, v850e_register_name): Add gdbarch parameter. (v850_unwind_sp, v850_unwind_pc): Replace current_gdbarch by gdbarch. * xtensa-tdep.c (xtensa_register_name): Add gdbarch parameter. Replace current_gdbarch by gdbarch. (xtensa_pseudo_register_read, xtensa_pseudo_register_write) (xtensa_frame_prev_register): Add gdbarch parameter to xtensa_register_name call.
2007-11-02 15:27:15 +01:00
m:const char *:register_name:int regnr:regnr::0
# Return the type of a register specified by the architecture. Only
# the register cache should call this function directly; others should
# use "register_type".
M:struct type *:register_type:int reg_nr:reg_nr
Convert frame unwinders to use the current frame and "struct value". * frame.c (frame_debug): Make global. (get_frame_id): Pass this frame to unwinder routines. (frame_pc_unwind): Remove unused unwind->prev_pc support. (do_frame_register_read): Do not discard the return value of frame_register_read. (frame_register_unwind): Remove debug messages. Use frame_unwind_register_value. (frame_unwind_register_value, get_frame_register_value): New functions. (create_new_frame, get_frame_base_address, get_frame_locals_address) (get_frame_args_address, get_frame_type): Pass this frame to unwinder routines. (frame_cleanup_after_sniffer, frame_prepare_for_sniffer): New functions. * frame.h: Update comments. (frame_debug, frame_unwind_register_value, get_frame_register_value) (frame_prepare_for_sniffer): Declare. * frame-unwind.h: Update comments and parameter names. (default_frame_sniffer): Declare. (frame_prev_register_ftype): Return a struct value *. (struct frame_unwind): Remove prev_pc member. (frame_unwind_sniffer_ftype, frame_unwind_append_sniffer): Delete. (frame_unwind_append_unwinder, frame_unwind_got_optimized) (frame_unwind_got_register, frame_unwind_got_memory) (frame_unwind_got_constant, frame_unwind_got_address): Declare. * frame-base.h: Update comments and parameter names. * valops.c (value_fetch_lazy): Use get_frame_register_value. Iterate if necessary. Add debugging output. * sentinel-frame.c (sentinel_frame_prev_register) (sentinel_frame_this_id): Update for new signature. (sentinel_frame_prev_pc): Delete. (sentinel_frame_unwinder): Remove prev_pc. * ia64-tdep.c (ia64_libunwind_frame_unwind): Do not initialize prev_pc. * libunwind-frame.c (libunwind_frame_unwind): Likewise. * frame-unwind.c (struct frame_unwind_table_entry): Remove sniffer. (frame_unwind_append_sniffer): Delete. (frame_unwind_append_unwinder): New function. (frame_unwind_find_by_frame): Take this frame. Only use sniffers from unwinders. Use frame_prepare_for_sniffer. (default_frame_sniffer, frame_unwind_got_optimized) (frame_unwind_got_register, frame_unwind_got_memory) (frame_unwind_got_constant, frame_unwind_got_address): New functions. * dummy-frame.c (dummy_frame_sniffer): Use gdbarch_dummy_id. (dummy_frame_prev_register, dummy_frame_this_id): Update for new signature. * gdbarch.sh: Replace unwind_dummy_id with dummy_id. * gdbarch.c, gdbarch.c: Regenerated. * frame-base.c (default_frame_base_address) (default_frame_locals_address, default_frame_args_address): Update for new signature. (frame_base_find_by_frame): Pass this frame to unwinder routines. * infcall.c (call_function_by_hand): Update comments. * Makefile.in (frame-unwind.o): Update dependencies. * gdbint.texinfo (Stack Frames): New chapter. (Algorithms): Move Frames text to the new chapter. (Target Conditionals): Delete SAVE_DUMMY_FRAME_TOS. Document gdbarch_dummy_id instead of gdbarch_unwind_dummy_id.
2008-04-30 23:16:46 +02:00
M:struct frame_id:dummy_id:struct frame_info *this_frame:this_frame
# Implement DUMMY_ID and PUSH_DUMMY_CALL, then delete
# deprecated_fp_regnum.
v:int:deprecated_fp_regnum:::-1:-1::0
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
v:int:call_dummy_location::::AT_ENTRY_POINT::0
M:CORE_ADDR:push_dummy_code:CORE_ADDR sp, CORE_ADDR funaddr, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr, struct regcache *regcache:sp, funaddr, args, nargs, value_type, real_pc, bp_addr, regcache
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::default_print_float_info::0
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.
m:int:register_sim_regno:int reg_nr:reg_nr::legacy_register_sim_regno::0
m:int:cannot_fetch_register:int regnum:regnum::cannot_register_not::0
m:int:cannot_store_register:int regnum:regnum::cannot_register_not::0
# Determine the address where a longjmp will land and save this address
# in PC. Return nonzero on success.
#
# FRAME corresponds to the longjmp frame.
F:int:get_longjmp_target:struct frame_info *frame, CORE_ADDR *pc:frame, pc
1999-08-31 03:14:27 +02:00
#
v:int:believe_pcc_promotion:::::::
1999-08-31 03:14:27 +02:00
#
m:int:convert_register_p:int regnum, struct type *type:regnum, type:0:generic_convert_register_p::0
gdb/ * dwarf2loc.c (read_pieced_value): Handle get_frame_register_bytes returning that the register piece is unavailable/optimized out. (write_pieced_value): Handle get_frame_register_bytes returning that the register piece is unavailable/optimized out when doing a read-modify write of a bitfield. * findvar.c (value_from_register): Handle get_frame_register_bytes returning that the register piece is unavailable/optimized out. * frame.c (get_frame_register_bytes): New parameters `optimizedp' and `unavailablep'. Throw error on bad debug info. Use frame_register instead of frame_register_read, to fill in the new arguments. * frame.h (get_frame_register_bytes): New parameters `optimizedp' and `unavailablep'. * valops.c: (value_assign): Adjust, and handle get_frame_register_bytes failing. * spu-tdep.c: Include exceptions.h. (spu_software_single_step): Adjust, and handle get_frame_register_bytes failing. (spu_get_longjmp_target): Ditto. * gdbarch.sh (register_to_value): Change to return int. New parameters `optimizedp' and `unavailablep'. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.c (i386_register_to_value): Adjust to new gdbarch_register_to_value interface. * i387-tdep.c (i387_register_to_value): Ditto. * i387-tdep.h (i387_register_to_value): Ditto. * alpha-tdep.c (alpha_register_to_value): Ditto. * ia64-tdep.c (ia64_register_to_value): Ditto. * m68k-tdep.c (m68k_register_to_value): Ditto. * mips-tdep.c (mips_register_to_value): Ditto. * rs6000-tdep.c (rs6000_register_to_value): Ditto.
2011-03-18 19:42:41 +01:00
f:int:register_to_value:struct frame_info *frame, int regnum, struct type *type, gdb_byte *buf, int *optimizedp, int *unavailablep:frame, regnum, type, buf, optimizedp, unavailablep:0
f:void:value_to_register:struct frame_info *frame, int regnum, struct type *type, const gdb_byte *buf:frame, regnum, type, buf:0
# Construct a value representing the contents of register REGNUM in
Use address_from_register in dwarf2-frame.c:read_addr_from_reg This patch fixes a problem that prevented use of the Dwarf unwinders on SPU, because dwarf2-frame.c common code did not support the situation where the stack and/or frame pointer is maintained in a *vector* register. This is because read_addr_from_reg is hard-coded to assume that such pointers can be read from registers via a simple get_frame_register / unpack_pointer operation. Now, there *is* a routine address_from_register that calls into the appropriate tdep routines to handle pointer values in "weird" registers like on SPU, but it turns out I cannot simply change dwarf2-frame.c to use address_from_register. This is because address_from_register uses value_from_register to create a (temporary) value, and that routine at some point calls get_frame_id in order to set up that value's VALUE_FRAME_ID entry. However, the dwarf2-frame.c read_addr_from_reg routine will be called during early unwinding (to unwind the frame's CFA), at which point the frame's ID is not actually known yet! This would cause an assert. On the other hand, we may notice that VALUE_FRAME_ID is only needed in the value returned by value_from_register if that value is later used as an lvalue. But this is obviously never done to the temporary value used in address_from_register. So, if we could change address_from_register to not call value_from_register but instead accept constructing a value that doesn't have VALUE_FRAME_ID set, things should be fine. To do that, we can change the value_from_register callback to accept a FRAME_ID instead of a FRAME; the only existing uses of the FRAME argument were either to extract its frame ID, or its gdbarch. (To keep a way of getting at the latter, we also change the callback's type from "f" to "m".) Together with the required follow-on changes in the existing value_from_register implementations (including the default one), this seems to fix the problem. As another minor interface cleanup, I've removed the explicit TYPE argument from address_from_register. This routine really always uses a default pointer type, and in the new implementation it -to some extent- relies on that fact, in that it will now no longer handle types that require gdbarch_convert_register_p handling. gdb: 2014-04-17 Ulrich Weigand  <uweigand@de.ibm.com> * gdbarch.sh (value_from_register): Make class "m" instead of "f". Replace FRAME argument with FRAME_ID. * gdbarch.c, gdbarch.h: Regenerate. * findvar.c (default_value_from_register): Add GDBARCH argument; replace FRAME by FRAME_ID. No longer call get_frame_id. (value_from_register): Update call to gdbarch_value_from_register. * value.h (default_value_from_register): Update prototype. * s390-linux-tdep.c (s390_value_from_register): Update interface and call to default_value_from_register. * spu-tdep.c (spu_value_from_register): Likewise. * findvar.c (address_from_register): Remove TYPE argument. Do not call value_from_register; use gdbarch_value_from_register with null_frame_id instead. * value.h (address_from_register): Update prototype. * dwarf2-frame.c (read_addr_from_reg): Use address_from_register. * dwarf2loc.c (dwarf_expr_read_addr_from_reg): Update for address_from_register interface change.
2014-04-17 14:01:39 +02:00
# frame FRAME_ID, interpreted as type TYPE. The routine needs to
# allocate and return a struct value with all value attributes
# (but not the value contents) filled in.
Use address_from_register in dwarf2-frame.c:read_addr_from_reg This patch fixes a problem that prevented use of the Dwarf unwinders on SPU, because dwarf2-frame.c common code did not support the situation where the stack and/or frame pointer is maintained in a *vector* register. This is because read_addr_from_reg is hard-coded to assume that such pointers can be read from registers via a simple get_frame_register / unpack_pointer operation. Now, there *is* a routine address_from_register that calls into the appropriate tdep routines to handle pointer values in "weird" registers like on SPU, but it turns out I cannot simply change dwarf2-frame.c to use address_from_register. This is because address_from_register uses value_from_register to create a (temporary) value, and that routine at some point calls get_frame_id in order to set up that value's VALUE_FRAME_ID entry. However, the dwarf2-frame.c read_addr_from_reg routine will be called during early unwinding (to unwind the frame's CFA), at which point the frame's ID is not actually known yet! This would cause an assert. On the other hand, we may notice that VALUE_FRAME_ID is only needed in the value returned by value_from_register if that value is later used as an lvalue. But this is obviously never done to the temporary value used in address_from_register. So, if we could change address_from_register to not call value_from_register but instead accept constructing a value that doesn't have VALUE_FRAME_ID set, things should be fine. To do that, we can change the value_from_register callback to accept a FRAME_ID instead of a FRAME; the only existing uses of the FRAME argument were either to extract its frame ID, or its gdbarch. (To keep a way of getting at the latter, we also change the callback's type from "f" to "m".) Together with the required follow-on changes in the existing value_from_register implementations (including the default one), this seems to fix the problem. As another minor interface cleanup, I've removed the explicit TYPE argument from address_from_register. This routine really always uses a default pointer type, and in the new implementation it -to some extent- relies on that fact, in that it will now no longer handle types that require gdbarch_convert_register_p handling. gdb: 2014-04-17 Ulrich Weigand  <uweigand@de.ibm.com> * gdbarch.sh (value_from_register): Make class "m" instead of "f". Replace FRAME argument with FRAME_ID. * gdbarch.c, gdbarch.h: Regenerate. * findvar.c (default_value_from_register): Add GDBARCH argument; replace FRAME by FRAME_ID. No longer call get_frame_id. (value_from_register): Update call to gdbarch_value_from_register. * value.h (default_value_from_register): Update prototype. * s390-linux-tdep.c (s390_value_from_register): Update interface and call to default_value_from_register. * spu-tdep.c (spu_value_from_register): Likewise. * findvar.c (address_from_register): Remove TYPE argument. Do not call value_from_register; use gdbarch_value_from_register with null_frame_id instead. * value.h (address_from_register): Update prototype. * dwarf2-frame.c (read_addr_from_reg): Use address_from_register. * dwarf2loc.c (dwarf_expr_read_addr_from_reg): Update for address_from_register interface change.
2014-04-17 14:01:39 +02:00
m:struct value *:value_from_register:struct type *type, int regnum, struct frame_id frame_id:type, regnum, frame_id::default_value_from_register::0
1999-08-31 03:14:27 +02:00
#
m:CORE_ADDR:pointer_to_address:struct type *type, const gdb_byte *buf:type, buf::unsigned_pointer_to_address::0
m:void:address_to_pointer:struct type *type, gdb_byte *buf, CORE_ADDR addr:type, buf, addr::unsigned_address_to_pointer::0
M:CORE_ADDR:integer_to_address:struct type *type, const gdb_byte *buf:type, buf
gdb/ * breakpoint.h (bp_location): Add related_address member. * inferior.h (get_return_value): Take a pointer to struct value instead of struct type for the function requested. * value.h (using_struct_return): Likewise. * gdbarch.sh (return_value): Take a pointer to struct value instead of struct type for the function requested. * breakpoint.c (set_breakpoint_location_function): Initialize related_address for bp_gnu_ifunc_resolver breakpoints. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Pass the requested function's address to gdbarch_return_value. * eval.c (evaluate_subexp_standard): Pass the requested function's address to using_struct_return. * infcall.c (call_function_by_hand): Pass the requested function's address to using_struct_return and gdbarch_return_value. * infcmd.c (get_return_value): Take a pointer to struct value instead of struct type for the function requested. (print_return_value): Update accordingly. (finish_command_continuation): Likewise. * stack.c (return_command): Pass the requested function's address to using_struct_return and gdbarch_return_value. * value.c (using_struct_return): Take a pointer to struct value instead of struct type for the function requested. Pass the requested function's address to gdbarch_return_value. * python/py-finishbreakpoint.c (finish_breakpoint_object): New function_value member, replacing function_type. (bpfinishpy_dealloc): Update accordingly. (bpfinishpy_pre_stop_hook): Likewise. (bpfinishpy_init): Likewise. Record the requested function's address. * mips-tdep.c (mips_fval_reg): New enum. (mips_o32_push_dummy_call): For MIPS16 FP doubles do not swap words put in GP registers. (mips_o64_push_dummy_call): Update a comment. (mips_o32_return_value): Take a pointer to struct value instead of struct type for the function requested and use it to check if using the MIPS16 calling convention. Return the designated general purpose registers for floating-point values returned in MIPS16 mode. (mips_o64_return_value): Likewise. * ppc-tdep.h (ppc_sysv_abi_return_value): Update prototype. (ppc_sysv_abi_broken_return_value): Likewise. (ppc64_sysv_abi_return_value): Likewise. * alpha-tdep.c (alpha_return_value): Take a pointer to struct value instead of struct type for the function requested. * amd64-tdep.c (amd64_return_value): Likewise. * amd64-windows-tdep.c (amd64_windows_return_value): Likewise. * arm-tdep.c (arm_return_value): Likewise. * avr-tdep.c (avr_return_value): Likewise. * bfin-tdep.c (bfin_return_value): Likewise. * cris-tdep.c (cris_return_value): Likewise. * frv-tdep.c (frv_return_value): Likewise. * h8300-tdep.c (h8300_return_value): Likewise. (h8300h_return_value): Likewise. * hppa-tdep.c (hppa32_return_value): Likewise. (hppa64_return_value): Likewise. * i386-tdep.c (i386_return_value): Likewise. * ia64-tdep.c (ia64_return_value): Likewise. * iq2000-tdep.c (iq2000_return_value): Likewise. * lm32-tdep.c (lm32_return_value): Likewise. * m32c-tdep.c (m32c_return_value): Likewise. * m32r-tdep.c (m32r_return_value): Likewise. * m68hc11-tdep.c (m68hc11_return_value): Likewise. * m68k-tdep.c (m68k_return_value): Likewise. (m68k_svr4_return_value): Likewise. * m88k-tdep.c (m88k_return_value): Likewise. * mep-tdep.c (mep_return_value): Likewise. * microblaze-tdep.c (microblaze_return_value): Likewise. * mn10300-tdep.c (mn10300_return_value): Likewise. * moxie-tdep.c (moxie_return_value): Likewise. * mt-tdep.c (mt_return_value): Likewise. * ppc-linux-tdep.c (ppc_linux_return_value): Likewise. * ppc-sysv-tdep.c (ppc_sysv_abi_return_value): Likewise. (ppc_sysv_abi_broken_return_value): Likewise. (ppc64_sysv_abi_return_value): Likewise. * ppcnbsd-tdep.c (ppcnbsd_return_value): Likewise. * rl78-tdep.c (rl78_return_value): Likewise. * rs6000-aix-tdep.c (rs6000_return_value): Likewise. * rx-tdep.c (rx_return_value): Likewise. * s390-tdep.c (s390_return_value): Likewise. * score-tdep.c (score_return_value): Likewise. * sh-tdep.c (sh_return_value_nofpu): Likewise. (sh_return_value_fpu): Likewise. * sh64-tdep.c (sh64_return_value): Likewise. * sparc-tdep.c (sparc32_return_value): Likewise. * sparc64-tdep.c (sparc64_return_value): Likewise. * spu-tdep.c (spu_return_value): Likewise. * tic6x-tdep.c (tic6x_return_value): Likewise. * v850-tdep.c (v850_return_value): Likewise. * vax-tdep.c (vax_return_value): Likewise. * xstormy16-tdep.c (xstormy16_return_value): Likewise. * xtensa-tdep.c (xtensa_return_value): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. gdb/testsuite/ * gdb.base/return-nodebug.exp: Also test float and double types.
2012-05-16 16:35:09 +02:00
# Return the return-value convention that will be used by FUNCTION
# to return a value of type VALTYPE. FUNCTION may be NULL in which
# case the return convention is computed based only on VALTYPE.
#
# If READBUF is not NULL, extract the return value and save it in this buffer.
#
# If WRITEBUF is not NULL, it contains a return value which will be
# stored into the appropriate register. This can be used when we want
# to force the value returned by a function (see the "return" command
# for instance).
gdb/ * breakpoint.h (bp_location): Add related_address member. * inferior.h (get_return_value): Take a pointer to struct value instead of struct type for the function requested. * value.h (using_struct_return): Likewise. * gdbarch.sh (return_value): Take a pointer to struct value instead of struct type for the function requested. * breakpoint.c (set_breakpoint_location_function): Initialize related_address for bp_gnu_ifunc_resolver breakpoints. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Pass the requested function's address to gdbarch_return_value. * eval.c (evaluate_subexp_standard): Pass the requested function's address to using_struct_return. * infcall.c (call_function_by_hand): Pass the requested function's address to using_struct_return and gdbarch_return_value. * infcmd.c (get_return_value): Take a pointer to struct value instead of struct type for the function requested. (print_return_value): Update accordingly. (finish_command_continuation): Likewise. * stack.c (return_command): Pass the requested function's address to using_struct_return and gdbarch_return_value. * value.c (using_struct_return): Take a pointer to struct value instead of struct type for the function requested. Pass the requested function's address to gdbarch_return_value. * python/py-finishbreakpoint.c (finish_breakpoint_object): New function_value member, replacing function_type. (bpfinishpy_dealloc): Update accordingly. (bpfinishpy_pre_stop_hook): Likewise. (bpfinishpy_init): Likewise. Record the requested function's address. * mips-tdep.c (mips_fval_reg): New enum. (mips_o32_push_dummy_call): For MIPS16 FP doubles do not swap words put in GP registers. (mips_o64_push_dummy_call): Update a comment. (mips_o32_return_value): Take a pointer to struct value instead of struct type for the function requested and use it to check if using the MIPS16 calling convention. Return the designated general purpose registers for floating-point values returned in MIPS16 mode. (mips_o64_return_value): Likewise. * ppc-tdep.h (ppc_sysv_abi_return_value): Update prototype. (ppc_sysv_abi_broken_return_value): Likewise. (ppc64_sysv_abi_return_value): Likewise. * alpha-tdep.c (alpha_return_value): Take a pointer to struct value instead of struct type for the function requested. * amd64-tdep.c (amd64_return_value): Likewise. * amd64-windows-tdep.c (amd64_windows_return_value): Likewise. * arm-tdep.c (arm_return_value): Likewise. * avr-tdep.c (avr_return_value): Likewise. * bfin-tdep.c (bfin_return_value): Likewise. * cris-tdep.c (cris_return_value): Likewise. * frv-tdep.c (frv_return_value): Likewise. * h8300-tdep.c (h8300_return_value): Likewise. (h8300h_return_value): Likewise. * hppa-tdep.c (hppa32_return_value): Likewise. (hppa64_return_value): Likewise. * i386-tdep.c (i386_return_value): Likewise. * ia64-tdep.c (ia64_return_value): Likewise. * iq2000-tdep.c (iq2000_return_value): Likewise. * lm32-tdep.c (lm32_return_value): Likewise. * m32c-tdep.c (m32c_return_value): Likewise. * m32r-tdep.c (m32r_return_value): Likewise. * m68hc11-tdep.c (m68hc11_return_value): Likewise. * m68k-tdep.c (m68k_return_value): Likewise. (m68k_svr4_return_value): Likewise. * m88k-tdep.c (m88k_return_value): Likewise. * mep-tdep.c (mep_return_value): Likewise. * microblaze-tdep.c (microblaze_return_value): Likewise. * mn10300-tdep.c (mn10300_return_value): Likewise. * moxie-tdep.c (moxie_return_value): Likewise. * mt-tdep.c (mt_return_value): Likewise. * ppc-linux-tdep.c (ppc_linux_return_value): Likewise. * ppc-sysv-tdep.c (ppc_sysv_abi_return_value): Likewise. (ppc_sysv_abi_broken_return_value): Likewise. (ppc64_sysv_abi_return_value): Likewise. * ppcnbsd-tdep.c (ppcnbsd_return_value): Likewise. * rl78-tdep.c (rl78_return_value): Likewise. * rs6000-aix-tdep.c (rs6000_return_value): Likewise. * rx-tdep.c (rx_return_value): Likewise. * s390-tdep.c (s390_return_value): Likewise. * score-tdep.c (score_return_value): Likewise. * sh-tdep.c (sh_return_value_nofpu): Likewise. (sh_return_value_fpu): Likewise. * sh64-tdep.c (sh64_return_value): Likewise. * sparc-tdep.c (sparc32_return_value): Likewise. * sparc64-tdep.c (sparc64_return_value): Likewise. * spu-tdep.c (spu_return_value): Likewise. * tic6x-tdep.c (tic6x_return_value): Likewise. * v850-tdep.c (v850_return_value): Likewise. * vax-tdep.c (vax_return_value): Likewise. * xstormy16-tdep.c (xstormy16_return_value): Likewise. * xtensa-tdep.c (xtensa_return_value): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. gdb/testsuite/ * gdb.base/return-nodebug.exp: Also test float and double types.
2012-05-16 16:35:09 +02:00
M:enum return_value_convention:return_value:struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf:function, valtype, regcache, readbuf, writebuf
# Return true if the return value of function is stored in the first hidden
# parameter. In theory, this feature should be language-dependent, specified
# by language and its ABI, such as C++. Unfortunately, compiler may
# implement it to a target-dependent feature. So that we need such hook here
# to be aware of this in GDB.
m:int:return_in_first_hidden_param_p:struct type *type:type::default_return_in_first_hidden_param_p::0
* gdbarch.sh (skip_prologue): Add gdbarch as parameter. * gdbarch.{c,h}: Regenerate. * alpha-tdep.c (alpha_skip_prologue): Add gdbarch as parameter. * amd64-tdep.c (amd64_skip_prologue): Likewise. * avr-tdep.c (avr_skip_prologue): Likewise. * cris-tdep.c (cris_skip_prologue): Likewise. * frv-tdep.c (frv_skip_prologue): Likewise. * h8300-tdep.c (h8300_skip_prologue): Likewise. * hppa-tdep.c (hppa_skip_prologue): Likewise. * i386-tdep.c (i386_skip_prologue): Likewise. * ia64-tdep.c (ia64_skip_prologue): Likewise. * iq2000-tdep.c (iq2000_skip_prologue): Likewise. * m32r-tdep.c (m32r_skip_prologue): Likewise. * m68hc11-tdep.c (m68hc11_skip_prologue): Likewise. * m68k-tdep.c (m68k_skip_prologue): Likewise. * m88k-tdep.c (m88k_skip_prologue): Likewise. * mep-tdep.c (mep_skip_prologue): Likewise. * mips-tdep.c (mips_skip_prologue): Likewise. * mn10300-tdep.c (mn10300_skip_prologue): Likewise. * mt-tdep.c (mt_skip_prologue): Likewise. * rs6000-tdep.c (rs6000_skip_prologue): Likewise. * score-tdep.c (score_skip_prologue): Likewise. * sh64-tdep.c (sh64_skip_prologue): Likewise. * sh-tdep.c (sh_skip_prologue): Likewise. * sparc64-tdep.c (sparc64_skip_prologue): Likewise. * sparc-tdep.c (sparc32_skip_prologue): Likewise. * spu-tdep.c (spu_skip_prologue): Likewise. * v850-tdep.c (v850_skip_prologue): Likewise. * vax-tdep.c (vax_skip_prologue): Likewise. * xstormy16-tdep.c (xstormy16_skip_prologue): Likewise. * xtensa-tdep.c (xtensa_skip_prologue): Likewise. * arm-tdep.c (arm_skip_prologue): Add gdbarch as parameter. Replace current_gdbarch by gdbarch. * m32c-tdep.c (m32c_skip_prologue): Likewise. * s390-tdep.c (s390_skip_prologue): Likewise.
2008-01-11 14:20:02 +01:00
m:CORE_ADDR:skip_prologue:CORE_ADDR ip:ip:0:0
M:CORE_ADDR:skip_main_prologue:CORE_ADDR ip:ip
PowerPC64 ELFv2 ABI: skip global entry point code This patch handles another aspect of the ELFv2 ABI, which unfortunately requires common code changes. In ELFv2, functions may provide both a global and a local entry point. The global entry point (where the function symbol points to) is intended to be used for function-pointer or cross-module (PLT) calls, and requires r12 to be set up to the entry point address itself. The local entry point (which is found at a fixed offset after the global entry point, as defined by bits in the symbol table entries' st_other field), instead expects r2 to be set up to the current TOC. Now, when setting a breakpoint on a function by name, you really want that breakpoint to trigger either way, no matter whether the function is called via its local or global entry point. Since the global entry point will always fall through into the local entry point, the way to achieve that is to simply set the breakpoint at the local entry point. One way to do that would be to have prologue parsing skip the code sequence that makes up the global entry point. Unfortunately, this does not work reliably, since -for optimized code- GDB these days will not actuall invoke the prologue parsing code but instead just set the breakpoint at the symbol address and rely on DWARF being correct at any point throughout the function ... Unfortunately, I don't really see any way to express the notion of local entry points with the current set of gdbarch callbacks. Thus this patch adds a new callback, skip_entrypoint, that is somewhat analogous to skip_prologue, but is called every time GDB needs to determine a function start address, even in those cases where GDB decides to not call skip_prologue. As a side effect, the skip_entrypoint implementation on ppc64 does not need to perform any instruction parsing; it can simply rely on the local entry point flags in the symbol table entry. With this implemented, two test cases would still fail to set the breakpoint correctly, but that's because they use the construct: gdb_test "break *hello" Now, using "*hello" explicitly instructs GDB to set the breakpoint at the numerical value of "hello" treated as function pointer, so it will by definition only hit the global entry point. I think this behaviour is unavoidable, but acceptable -- most people do not use this construct, and if they do, they get what they asked for ... In one of those two test cases, use of this construct is really not appropriate. I think this was added way back when as a means to work around prologue skipping problems on some platforms. These days that shouldn't really be necessary any more ... For the other (step-bt), we really want to make sure backtracing works on the very first instruction of the routine. To enable that test also on powerpc64le-linux, we can modify the code to call the test function via function pointer (which makes it use the global entry point in the ELFv2 ABI). gdb/ChangeLog: * gdbarch.sh (skip_entrypoint): New callback. * gdbarch.c, gdbarch.h: Regenerate. * symtab.c (skip_prologue_sal): Call gdbarch_skip_entrypoint. * infrun.c (fill_in_stop_func): Likewise. * ppc-linux-tdep.c: Include "elf/ppc64.h". (ppc_elfv2_elf_make_msymbol_special): New function. (ppc_elfv2_skip_entrypoint): Likewise. (ppc_linux_init_abi): Install them for ELFv2. gdb/testsuite/ChangeLog: * gdb.base/sigbpt.exp: Do not use "*" when setting breakpoint on a function. * gdb.base/step-bt.c: Call hello via function pointer to make sure its first instruction is executed on powerpc64le-linux.
2014-02-04 18:44:14 +01:00
# On some platforms, a single function may provide multiple entry points,
# e.g. one that is used for function-pointer calls and a different one
# that is used for direct function calls.
# In order to ensure that breakpoints set on the function will trigger
# no matter via which entry point the function is entered, a platform
# may provide the skip_entrypoint callback. It is called with IP set
# to the main entry point of a function (as determined by the symbol table),
# and should return the address of the innermost entry point, where the
# actual breakpoint needs to be set. Note that skip_entrypoint is used
# by GDB common code even when debugging optimized code, where skip_prologue
# is not used.
M:CORE_ADDR:skip_entrypoint:CORE_ADDR ip:ip
f:int:inner_than:CORE_ADDR lhs, CORE_ADDR rhs:lhs, rhs:0:0
2007-11-07 07:33:01 +01:00
m:const gdb_byte *:breakpoint_from_pc:CORE_ADDR *pcptr, int *lenptr:pcptr, lenptr::0:
# Return the adjusted address and kind to use for Z0/Z1 packets.
# KIND is usually the memory length of the breakpoint, but may have a
# different target-specific meaning.
m:void:remote_breakpoint_from_pc:CORE_ADDR *pcptr, int *kindptr:pcptr, kindptr:0:default_remote_breakpoint_from_pc::0
M:CORE_ADDR:adjust_breakpoint_address:CORE_ADDR bpaddr:bpaddr
m:int:memory_insert_breakpoint:struct bp_target_info *bp_tgt:bp_tgt:0:default_memory_insert_breakpoint::0
m:int:memory_remove_breakpoint:struct bp_target_info *bp_tgt:bp_tgt: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. gdbarch_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
* Makefile.in (arm-tdep.o, eval.o, target-descriptions.o) (xml-tdesc.o): Update. * xml-support.c: Add a comment. (gdb_xml_enums_boolean): New variable. (gdb_xml_parse_attr_enum): Use strcasecmp. * xml-support.h (gdb_xml_enums_boolean): Declare. * xml-tdesc.c (struct tdesc_parsing_data): Record current_feature, next_regnum, and current_union. (tdesc_start_feature, tdesc_start_reg, tdesc_start_union) (tdesc_end_union, tdesc_start_field, tdesc_start_vector) (field_attributes, union_children, reg_attributes, union_attributes) (vector_attributes, feature_attributes, feature_children): New. (target_children): Make static. Add <feature>. (tdesc_elements): Make static. * target-descriptions.c (struct tdesc_reg, tdesc_reg_p, type_p) (struct tdesc_feature, tdesc_feature_p): New types. (struct target_desc): Add features member. (struct tdesc_arch_data, tdesc_data): New. (target_find_description): Clarify error message. Warn about ignored register descriptions. (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_data_init, tdesc_data_alloc) (tdesc_data_cleanup, tdesc_numbered_register) (tdesc_numbered_register_choices, tdesc_find_register) (tdesc_register_name, tdesc_register_type) (tdesc_remote_register_number, tdesc_register_reggroup_p) (set_tdesc_pseudo_register_name, set_tdesc_pseudo_register_type) (set_tdesc_pseudo_register_reggroup_p, tdesc_use_registers) (tdesc_free_reg, tdesc_create_reg, tdesc_free_feature) (tdesc_create_feature, tdesc_record_type): New. (free_target_description): Free features. (_initialize_target_descriptions): Initialize tdesc_data. * arch-utils.c (default_remote_register_number): New. * arch-utils.h (default_remote_register_number): New prototype. * target-descriptions.h (set_tdesc_pseudo_register_name) (set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_reggroup_p) (tdesc_use_registers, tdesc_data_alloc, tdesc_data_cleanup) (tdesc_numbered_register, tdesc_numbered_register_choices) (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_create_feature, tdesc_record_type) (tdesc_create_reg): Declare. * gdbarch.sh (remote_register_number): New entry. * gdbarch.c, gdbarch.h: Regenerate. * remote.c (init_remote_state): Use gdbarch_remote_register_number. * features/gdb-target.dtd: Add feature, reg, vector, union, and field. * arm-tdep.c (arm_register_aliases): New. (arm_register_name_strings): Rename to... (arm_register_names): ...this. Make const. Delete the old version. (current_option, arm_register_byte): Delete. (set_disassembly_style): Simplify. Do not adjust arm_register_names. (value_of_arm_user_reg): New. (arm_gdbarch_init): Verify any described registers. Call tdesc_use_registers. Don't use arm_register_byte. Create aliases for standard register names. (_initialize_arm_tdep): Do not adjust arm_register_names. * user-regs.c (struct user_reg): Add baton member. (append_user_reg, user_reg_add_builtin, user_regs_init) (user_reg_add, value_of_user_reg): Use a baton for user register functions. * std-regs.c: Update. * user-regs.h (user_reg_read_ftype, user_reg_add_builtin) (user_reg_add): Add baton argument. * NEWS: Mention target description register support. * features/arm-core.xml, features/arm-fpa.xml: New. * eval.c (evaluate_subexp_standard): Allow ptype $register when the program is not running. * gdb.texinfo (-target-disconnect): Use @smallexample. (Requirements): Add anchor for Expat. Update description. (Target Descriptions): Mention Expat. (Target Description Format): Document new elements. Use @smallexample. (Predefined Target Types, Standard Target Features): New sections. * doc/gdbint.texinfo (Target Descriptions): New section. * gdb.xml/single-reg.xml, gdb.xml/tdesc-regs.exp, gdb.xml/core-only.xml, gdb.xml/extra-regs.xml: New files.
2007-02-08 22:00:36 +01:00
# Return the remote protocol register number associated with this
# register. Normally the identity mapping.
m:int:remote_register_number:int regno:regno::default_remote_register_number::0
* Makefile.in (arm-tdep.o, eval.o, target-descriptions.o) (xml-tdesc.o): Update. * xml-support.c: Add a comment. (gdb_xml_enums_boolean): New variable. (gdb_xml_parse_attr_enum): Use strcasecmp. * xml-support.h (gdb_xml_enums_boolean): Declare. * xml-tdesc.c (struct tdesc_parsing_data): Record current_feature, next_regnum, and current_union. (tdesc_start_feature, tdesc_start_reg, tdesc_start_union) (tdesc_end_union, tdesc_start_field, tdesc_start_vector) (field_attributes, union_children, reg_attributes, union_attributes) (vector_attributes, feature_attributes, feature_children): New. (target_children): Make static. Add <feature>. (tdesc_elements): Make static. * target-descriptions.c (struct tdesc_reg, tdesc_reg_p, type_p) (struct tdesc_feature, tdesc_feature_p): New types. (struct target_desc): Add features member. (struct tdesc_arch_data, tdesc_data): New. (target_find_description): Clarify error message. Warn about ignored register descriptions. (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_data_init, tdesc_data_alloc) (tdesc_data_cleanup, tdesc_numbered_register) (tdesc_numbered_register_choices, tdesc_find_register) (tdesc_register_name, tdesc_register_type) (tdesc_remote_register_number, tdesc_register_reggroup_p) (set_tdesc_pseudo_register_name, set_tdesc_pseudo_register_type) (set_tdesc_pseudo_register_reggroup_p, tdesc_use_registers) (tdesc_free_reg, tdesc_create_reg, tdesc_free_feature) (tdesc_create_feature, tdesc_record_type): New. (free_target_description): Free features. (_initialize_target_descriptions): Initialize tdesc_data. * arch-utils.c (default_remote_register_number): New. * arch-utils.h (default_remote_register_number): New prototype. * target-descriptions.h (set_tdesc_pseudo_register_name) (set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_reggroup_p) (tdesc_use_registers, tdesc_data_alloc, tdesc_data_cleanup) (tdesc_numbered_register, tdesc_numbered_register_choices) (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_create_feature, tdesc_record_type) (tdesc_create_reg): Declare. * gdbarch.sh (remote_register_number): New entry. * gdbarch.c, gdbarch.h: Regenerate. * remote.c (init_remote_state): Use gdbarch_remote_register_number. * features/gdb-target.dtd: Add feature, reg, vector, union, and field. * arm-tdep.c (arm_register_aliases): New. (arm_register_name_strings): Rename to... (arm_register_names): ...this. Make const. Delete the old version. (current_option, arm_register_byte): Delete. (set_disassembly_style): Simplify. Do not adjust arm_register_names. (value_of_arm_user_reg): New. (arm_gdbarch_init): Verify any described registers. Call tdesc_use_registers. Don't use arm_register_byte. Create aliases for standard register names. (_initialize_arm_tdep): Do not adjust arm_register_names. * user-regs.c (struct user_reg): Add baton member. (append_user_reg, user_reg_add_builtin, user_regs_init) (user_reg_add, value_of_user_reg): Use a baton for user register functions. * std-regs.c: Update. * user-regs.h (user_reg_read_ftype, user_reg_add_builtin) (user_reg_add): Add baton argument. * NEWS: Mention target description register support. * features/arm-core.xml, features/arm-fpa.xml: New. * eval.c (evaluate_subexp_standard): Allow ptype $register when the program is not running. * gdb.texinfo (-target-disconnect): Use @smallexample. (Requirements): Add anchor for Expat. Update description. (Target Descriptions): Mention Expat. (Target Description Format): Document new elements. Use @smallexample. (Predefined Target Types, Standard Target Features): New sections. * doc/gdbint.texinfo (Target Descriptions): New section. * gdb.xml/single-reg.xml, gdb.xml/tdesc-regs.exp, gdb.xml/core-only.xml, gdb.xml/extra-regs.xml: New files.
2007-02-08 22:00:36 +01:00
# Fetch the target specific address used to represent a load module.
F:CORE_ADDR:fetch_tls_load_module_address:struct objfile *objfile:objfile
1999-08-31 03:14:27 +02:00
#
v:CORE_ADDR:frame_args_skip:::0:::0
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_LOCALS_ADDRESS as been replaced by the per-frame
# frame-base. Enable frame-base before frame-unwind.
F:int:frame_num_args:struct frame_info *frame:frame
1999-08-31 03:14:27 +02:00
#
M:CORE_ADDR:frame_align:CORE_ADDR address:address
m:int:stabs_argument_has_addr:struct type *type:type::default_stabs_argument_has_addr::0
v:int:frame_red_zone_size
#
m:CORE_ADDR:convert_from_func_ptr_addr:CORE_ADDR addr, struct target_ops *targ:addr, targ::convert_from_func_ptr_addr_identity::0
2001-06-16 00:10:21 +02:00
# 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. gdbarch_addr_bits_remove takes out any such bits so
2001-06-16 00:10:21 +02:00
# 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).
m:CORE_ADDR:addr_bits_remove: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.
#
# A return value of 1 means that the software_single_step breakpoints
# were inserted; 0 means they were not.
F:int:software_single_step:struct frame_info *frame:frame
# Return non-zero if the processor is executing a delay slot and a
# further single-step is needed before the instruction finishes.
M:int:single_step_through_delay:struct frame_info *frame:frame
# FIXME: cagney/2003-08-28: Need to find a better way of selecting the
# disassembler. Perhaps objdump can handle it?
f:int:print_insn:bfd_vma vma, struct disassemble_info *info:vma, info::0:
f:CORE_ADDR:skip_trampoline_code:struct frame_info *frame, CORE_ADDR pc:frame, 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
# Some systems also have trampoline code for returning from shared libs.
* blockframe.c (find_pc_partial_function_gnu_ifunc): Change type of "name" parameter to const char ** from char **. All callers updated. (find_pc_partial_function): Ditto. (cache_pc_function_name): Change type to const char * from char *. * symtab.h ((find_pc_partial_function_gnu_ifunc): Update. (find_pc_partial_function): Update. * alpha-tdep.h (struct gdbarch_tdep, member pc_in_sigtramp): Change type of "name" parameter to const char * from char *. All uses updated. * arch-utils.c (generic_in_solib_return_trampoline): Change type of "name" parameter to const char * from char *. * arch-utils.h (generic_in_solib_return_trampoline): Update. * frv-linux-tdep.c (frv_linux_pc_in_sigtramp): Change type of "name" parameter to const char * from char *. * gdbarch.sh (in_solib_return_trampoline): Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * hppa-hpux-tdep.c (hppa_hpux_in_solib_return_trampoline): Update. * rs6000-tdep.c (rs6000_in_solib_return_trampoline): Update. * m32r-linux-tdep.c (m32r_linux_pc_in_sigtramp): Change type of "name" parameter to const char * from char *. * skip.c (skip_function_pc): Ditto. * sparc-sol2-tdep.c (sparc_sol2_pc_in_sigtramp): Ditto. * sparc-tdep.h (sparc_sol2_pc_in_sigtramp): Update. * sparc64fbsd-tdep.c (sparc64fbsd_pc_in_sigtramp): Ditto. * sparc64nbsd-tdep.c (sparc64nbsd_pc_in_sigtramp): Ditto. * sparc64obsd-tdep.c (sparc64obsd_pc_in_sigtramp): Ditto. * sparcnbsd-tdep.c (sparc32nbsd_pc_in_sigtramp): Ditto. * sparcobsd-tdep.c (sparc32obsd_pc_in_sigtramp): Ditto. * nbsd-tdep.c (nbsd_pc_in_sigtramp): Similary for "func_name". * nbsd-tdep.h (nbsd_pc_in_sigtramp): Update.
2012-02-02 21:19:17 +01:00
m:int:in_solib_return_trampoline:CORE_ADDR pc, const 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 function's epilogue. stack_frame_destroyed_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:stack_frame_destroyed_p:CORE_ADDR addr:addr:0:generic_stack_frame_destroyed_p::0
MIPS: Keep the ISA bit in compressed code addresses 1. Background information The MIPS architecture, as originally designed and implemented in mid-1980s has a uniform instruction word size that is 4 bytes, naturally aligned. As such all MIPS instructions are located at addresses that have their bits #1 and #0 set to zeroes, and any attempt to execute an instruction from an address that has any of the two bits set to one causes an address error exception. This may for example happen when a jump-register instruction is executed whose register value used as the jump target has any of these bits set. Then in mid 1990s LSI sought a way to improve code density for their TinyRISC family of MIPS cores and invented an alternatively encoded instruction set in a joint effort with MIPS Technologies (then a subsidiary of SGI). The new instruction set has been named the MIPS16 ASE (Application-Specific Extension) and uses a variable instruction word size, which is 2 bytes (as the name of the ASE suggests) for most, but there are a couple of exceptions that take 4 bytes, and then most of the 2-byte instructions can be treated with a 2-byte extension prefix to expand the range of the immediate operands used. As a result instructions are no longer 4-byte aligned, instead they are aligned to a multiple of 2. That left the bit #0 still unused for code references, be it for the standard MIPS (i.e. as originally invented) or for the MIPS16 instruction set, and based on that observation a clever trick was invented that on one hand allowed the processor to be seamlessly switched between the two instruction sets at any time at the run time while on the other avoided the introduction of any special control register to do that. So it is the bit #0 of the instruction address that was chosen as the selector and named the ISA bit. Any instruction executed at an even address is interpreted as a standard MIPS instruction (the address still has to have its bit #1 clear), any instruction executed at an odd address is interpreted as a MIPS16 instruction. To switch between modes ordinary jump instructions are used, such as used for function calls and returns, specifically the bit #0 of the source register used in jump-register instructions selects the execution (ISA) mode for the following piece of code to be interpreted in. Additionally new jump-immediate instructions were added that flipped the ISA bit to select the opposite mode upon execution. They were considered necessary to avoid the need to make register jumps in all cases as the original jump-immediate instructions provided no way to change the bit #0 at all. This was all important for cases where standard MIPS and MIPS16 code had to be mixed, either for compatibility with the existing binary code base or to access resources not reachable from MIPS16 code (the MIPS16 instruction set only provides access to general-purpose registers, and not for example floating-point unit registers or privileged coprocessor 0 registers) -- pieces of code in the opposite mode can be executed as ordinary subroutine calls. A similar approach has been more recently adopted for the MIPS16 replacement instruction set defined as the so called microMIPS ASE. This is another instruction set encoding introduced to the MIPS architecture. Just like the MIPS16 ASE, the microMIPS instruction set uses a variable-length encoding, where each instruction takes a multiple of 2 bytes. The ISA bit has been reused and for microMIPS-capable processors selects between the standard MIPS and the microMIPS mode instead. 2. Statement of the problem To put it shortly, MIPS16 and microMIPS code pointers used by GDB are different to these observed at the run time. This results in the same expressions being evaluated producing different results in GDB and in the program being debugged. Obviously it's the results obtained at the run time that are correct (they define how the program behaves) and therefore by definition the results obtained in GDB are incorrect. A bit longer description will record that obviously at the run time the ISA bit has to be set correctly (refer to background information above if unsure why so) or the program will not run as expected. This is recorded in all the executable file structures used at the run time: the dynamic symbol table (but not always the static one!), the GOT, and obviously in all the addresses embedded in code or data of the program itself, calculated by applying the appropriate relocations at the static link time. While a program is being processed by GDB, the ISA bit is stripped off from any code addresses, presumably to make them the same as the respective raw memory byte address used by the processor to access the instruction in the instruction fetch access cycle. This stripping is actually performed outside GDB proper, in BFD, specifically _bfd_mips_elf_symbol_processing (elfxx-mips.c, see the piece of code at the very bottom of that function, starting with an: "If this is an odd-valued function symbol, assume it's a MIPS16 or microMIPS one." comment). This function is also responsible for symbol table dumps made by `objdump' too, so you'll never see the ISA bit reported there by that tool, you need to use `readelf'. This is however unlike what is ever done at the run time, the ISA bit once present is never stripped off, for example a cast like this: (short *) main will not strip the ISA bit off and if the resulting pointer is intended to be used to access instructions as data, for example for software instruction decoding (like for fault recovery or emulation in a signal handler) or for self-modifying code then the bit still has to be stripped off by an explicit AND operation. This is probably best illustrated with a simple real program example. Let's consider the following simple program: $ cat foobar.c int __attribute__ ((mips16)) foo (void) { return 1; } int __attribute__ ((mips16)) bar (void) { return 2; } int __attribute__ ((nomips16)) foo32 (void) { return 3; } int (*foo32p) (void) = foo32; int (*foop) (void) = foo; int fooi = (int) foo; int main (void) { return foop (); } $ This is plain C with no odd tricks, except from the instruction mode attributes. They are not necessary to trigger this problem, I just put them here so that the program can be contained in a single source file and to make it obvious which function is MIPS16 code and which is not. Let's try it with Linux, so that everyone can repeat this experiment: $ mips-linux-gnu-gcc -mips16 -g -O2 -o foobar foobar.c $ Let's have a look at some interesting symbols: $ mips-linux-gnu-readelf -s foobar | egrep 'table|foo|bar' Symbol table '.dynsym' contains 7 entries: Symbol table '.symtab' contains 95 entries: 55: 00000000 0 FILE LOCAL DEFAULT ABS foobar.c 66: 0040068c 4 FUNC GLOBAL DEFAULT [MIPS16] 12 bar 68: 00410848 4 OBJECT GLOBAL DEFAULT 21 foo32p 70: 00410844 4 OBJECT GLOBAL DEFAULT 21 foop 78: 00400684 8 FUNC GLOBAL DEFAULT 12 foo32 80: 00400680 4 FUNC GLOBAL DEFAULT [MIPS16] 12 foo 88: 00410840 4 OBJECT GLOBAL DEFAULT 21 fooi $ Hmm, no sight of the ISA bit, but notice how foo and bar (but not foo32!) have been marked as MIPS16 functions (ELF symbol structure's `st_other' field is used for that). So let's try to run and poke at this program with GDB. I'll be using a native system for simplicity (I'll be using ellipses here and there to remove unrelated clutter): $ ./foobar $ echo $? 1 $ So far, so good. $ gdb ./foobar [...] (gdb) break main Breakpoint 1 at 0x400490: file foobar.c, line 23. (gdb) run Starting program: .../foobar Breakpoint 1, main () at foobar.c:23 23 return foop (); (gdb) Yay, it worked! OK, so let's poke at it: (gdb) print main $1 = {int (void)} 0x400490 <main> (gdb) print foo32 $2 = {int (void)} 0x400684 <foo32> (gdb) print foo32p $3 = (int (*)(void)) 0x400684 <foo32> (gdb) print bar $4 = {int (void)} 0x40068c <bar> (gdb) print foo $5 = {int (void)} 0x400680 <foo> (gdb) print foop $6 = (int (*)(void)) 0x400681 <foo> (gdb) A-ha! Here's the difference and finally the ISA bit! (gdb) print /x fooi $7 = 0x400681 (gdb) p/x $pc p/x $pc $8 = 0x400491 (gdb) And here as well... (gdb) advance foo foo () at foobar.c:4 4 } (gdb) disassemble Dump of assembler code for function foo: 0x00400680 <+0>: jr ra 0x00400682 <+2>: li v0,1 End of assembler dump. (gdb) finish Run till exit from #0 foo () at foobar.c:4 main () at foobar.c:24 24 } Value returned is $9 = 1 (gdb) continue Continuing. [Inferior 1 (process 14103) exited with code 01] (gdb) So let's be a bit inquisitive... (gdb) run Starting program: .../foobar Breakpoint 1, main () at foobar.c:23 23 return foop (); (gdb) Actually we do not like to run foo here at all. Let's run bar instead! (gdb) set foop = bar (gdb) print foop $10 = (int (*)(void)) 0x40068c <bar> (gdb) Hmm, no ISA bit. Is it going to work? (gdb) advance bar bar () at foobar.c:9 9 } (gdb) p/x $pc $11 = 0x40068c (gdb) disassemble Dump of assembler code for function bar: => 0x0040068c <+0>: jr ra 0x0040068e <+2>: li v0,2 End of assembler dump. (gdb) finish Run till exit from #0 bar () at foobar.c:9 Program received signal SIGILL, Illegal instruction. bar () at foobar.c:9 9 } (gdb) Oops! (gdb) p/x $pc $12 = 0x40068c (gdb) We're still there! (gdb) continue Continuing. Program terminated with signal SIGILL, Illegal instruction. The program no longer exists. (gdb) So let's try something else: (gdb) run Starting program: .../foobar Breakpoint 1, main () at foobar.c:23 23 return foop (); (gdb) set foop = foo (gdb) advance foo foo () at foobar.c:4 4 } (gdb) disassemble Dump of assembler code for function foo: => 0x00400680 <+0>: jr ra 0x00400682 <+2>: li v0,1 End of assembler dump. (gdb) finish Run till exit from #0 foo () at foobar.c:4 Program received signal SIGILL, Illegal instruction. foo () at foobar.c:4 4 } (gdb) continue Continuing. Program terminated with signal SIGILL, Illegal instruction. The program no longer exists. (gdb) The same problem! (gdb) run Starting program: /net/build2-lucid-cs/scratch/macro/mips-linux-fsf-gcc/isa-bit/foobar Breakpoint 1, main () at foobar.c:23 23 return foop (); (gdb) set foop = foo32 (gdb) advance foo32 foo32 () at foobar.c:14 14 } (gdb) disassemble Dump of assembler code for function foo32: => 0x00400684 <+0>: jr ra 0x00400688 <+4>: li v0,3 End of assembler dump. (gdb) finish Run till exit from #0 foo32 () at foobar.c:14 main () at foobar.c:24 24 } Value returned is $14 = 3 (gdb) continue Continuing. [Inferior 1 (process 14113) exited with code 03] (gdb) That did work though, so it's the ISA bit only! (gdb) quit Enough! That's the tip of the iceberg only though. So let's rebuild the executable with some dynamic symbols: $ mips-linux-gnu-gcc -mips16 -Wl,--export-dynamic -g -O2 -o foobar-dyn foobar.c $ mips-linux-gnu-readelf -s foobar-dyn | egrep 'table|foo|bar' Symbol table '.dynsym' contains 32 entries: 6: 004009cd 4 FUNC GLOBAL DEFAULT 12 bar 8: 00410b88 4 OBJECT GLOBAL DEFAULT 21 foo32p 9: 00410b84 4 OBJECT GLOBAL DEFAULT 21 foop 15: 004009c4 8 FUNC GLOBAL DEFAULT 12 foo32 17: 004009c1 4 FUNC GLOBAL DEFAULT 12 foo 25: 00410b80 4 OBJECT GLOBAL DEFAULT 21 fooi Symbol table '.symtab' contains 95 entries: 55: 00000000 0 FILE LOCAL DEFAULT ABS foobar.c 69: 004009cd 4 FUNC GLOBAL DEFAULT 12 bar 71: 00410b88 4 OBJECT GLOBAL DEFAULT 21 foo32p 72: 00410b84 4 OBJECT GLOBAL DEFAULT 21 foop 79: 004009c4 8 FUNC GLOBAL DEFAULT 12 foo32 81: 004009c1 4 FUNC GLOBAL DEFAULT 12 foo 89: 00410b80 4 OBJECT GLOBAL DEFAULT 21 fooi $ OK, now the ISA bit is there for a change, but the MIPS16 `st_other' attribute gone, hmm... What does `objdump' do then: $ mips-linux-gnu-objdump -Tt foobar-dyn | egrep 'SYMBOL|foo|bar' foobar-dyn: file format elf32-tradbigmips SYMBOL TABLE: 00000000 l df *ABS* 00000000 foobar.c 004009cc g F .text 00000004 0xf0 bar 00410b88 g O .data 00000004 foo32p 00410b84 g O .data 00000004 foop 004009c4 g F .text 00000008 foo32 004009c0 g F .text 00000004 0xf0 foo 00410b80 g O .data 00000004 fooi DYNAMIC SYMBOL TABLE: 004009cc g DF .text 00000004 Base 0xf0 bar 00410b88 g DO .data 00000004 Base foo32p 00410b84 g DO .data 00000004 Base foop 004009c4 g DF .text 00000008 Base foo32 004009c0 g DF .text 00000004 Base 0xf0 foo 00410b80 g DO .data 00000004 Base fooi $ Hmm, the attribute (0xf0, printed raw) is back, and the ISA bit gone again. Let's have a look at some DWARF-2 records GDB uses (I'll be stripping off a lot here for brevity) -- debug info: $ mips-linux-gnu-readelf -wi foobar Contents of the .debug_info section: [...] Compilation Unit @ offset 0x88: Length: 0xbb (32-bit) Version: 4 Abbrev Offset: 62 Pointer Size: 4 <0><93>: Abbrev Number: 1 (DW_TAG_compile_unit) <94> DW_AT_producer : (indirect string, offset: 0x19e): GNU C 4.8.0 20120513 (experimental) -meb -mips16 -march=mips32r2 -mhard-float -mllsc -mplt -mno-synci -mno-shared -mabi=32 -g -O2 <98> DW_AT_language : 1 (ANSI C) <99> DW_AT_name : (indirect string, offset: 0x190): foobar.c <9d> DW_AT_comp_dir : (indirect string, offset: 0x225): [...] <a1> DW_AT_ranges : 0x0 <a5> DW_AT_low_pc : 0x0 <a9> DW_AT_stmt_list : 0x27 <1><ad>: Abbrev Number: 2 (DW_TAG_subprogram) <ae> DW_AT_external : 1 <ae> DW_AT_name : foo <b2> DW_AT_decl_file : 1 <b3> DW_AT_decl_line : 1 <b4> DW_AT_prototyped : 1 <b4> DW_AT_type : <0xc2> <b8> DW_AT_low_pc : 0x400680 <bc> DW_AT_high_pc : 0x400684 <c0> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa) <c2> DW_AT_GNU_all_call_sites: 1 <1><c2>: Abbrev Number: 3 (DW_TAG_base_type) <c3> DW_AT_byte_size : 4 <c4> DW_AT_encoding : 5 (signed) <c5> DW_AT_name : int <1><c9>: Abbrev Number: 4 (DW_TAG_subprogram) <ca> DW_AT_external : 1 <ca> DW_AT_name : (indirect string, offset: 0x18a): foo32 <ce> DW_AT_decl_file : 1 <cf> DW_AT_decl_line : 11 <d0> DW_AT_prototyped : 1 <d0> DW_AT_type : <0xc2> <d4> DW_AT_low_pc : 0x400684 <d8> DW_AT_high_pc : 0x40068c <dc> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa) <de> DW_AT_GNU_all_call_sites: 1 <1><de>: Abbrev Number: 2 (DW_TAG_subprogram) <df> DW_AT_external : 1 <df> DW_AT_name : bar <e3> DW_AT_decl_file : 1 <e4> DW_AT_decl_line : 6 <e5> DW_AT_prototyped : 1 <e5> DW_AT_type : <0xc2> <e9> DW_AT_low_pc : 0x40068c <ed> DW_AT_high_pc : 0x400690 <f1> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa) <f3> DW_AT_GNU_all_call_sites: 1 <1><f3>: Abbrev Number: 5 (DW_TAG_subprogram) <f4> DW_AT_external : 1 <f4> DW_AT_name : (indirect string, offset: 0x199): main <f8> DW_AT_decl_file : 1 <f9> DW_AT_decl_line : 21 <fa> DW_AT_prototyped : 1 <fa> DW_AT_type : <0xc2> <fe> DW_AT_low_pc : 0x400490 <102> DW_AT_high_pc : 0x4004a4 <106> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa) <108> DW_AT_GNU_all_tail_call_sites: 1 [...] $ -- no sign of the ISA bit anywhere -- frame info: $ mips-linux-gnu-readelf -wf foobar [...] Contents of the .debug_frame section: 00000000 0000000c ffffffff CIE Version: 1 Augmentation: "" Code alignment factor: 1 Data alignment factor: -4 Return address column: 31 DW_CFA_def_cfa_register: r29 DW_CFA_nop 00000010 0000000c 00000000 FDE cie=00000000 pc=00400680..00400684 00000020 0000000c 00000000 FDE cie=00000000 pc=00400684..0040068c 00000030 0000000c 00000000 FDE cie=00000000 pc=0040068c..00400690 00000040 00000018 00000000 FDE cie=00000000 pc=00400490..004004a4 DW_CFA_advance_loc: 6 to 00400496 DW_CFA_def_cfa_offset: 32 DW_CFA_offset: r31 at cfa-4 DW_CFA_advance_loc: 6 to 0040049c DW_CFA_restore: r31 DW_CFA_def_cfa_offset: 0 DW_CFA_nop DW_CFA_nop DW_CFA_nop [...] $ -- no sign of the ISA bit anywhere -- range info (GDB doesn't use arange): $ mips-linux-gnu-readelf -wR foobar Contents of the .debug_ranges section: Offset Begin End 00000000 00400680 00400690 00000000 00400490 004004a4 00000000 <End of list> $ -- no sign of the ISA bit anywhere -- line info: $ mips-linux-gnu-readelf -wl foobar Raw dump of debug contents of section .debug_line: [...] Offset: 0x27 Length: 78 DWARF Version: 2 Prologue Length: 31 Minimum Instruction Length: 1 Initial value of 'is_stmt': 1 Line Base: -5 Line Range: 14 Opcode Base: 13 Opcodes: Opcode 1 has 0 args Opcode 2 has 1 args Opcode 3 has 1 args Opcode 4 has 1 args Opcode 5 has 1 args Opcode 6 has 0 args Opcode 7 has 0 args Opcode 8 has 0 args Opcode 9 has 1 args Opcode 10 has 0 args Opcode 11 has 0 args Opcode 12 has 1 args The Directory Table is empty. The File Name Table: Entry Dir Time Size Name 1 0 0 0 foobar.c Line Number Statements: Extended opcode 2: set Address to 0x400681 Special opcode 6: advance Address by 0 to 0x400681 and Line by 1 to 2 Special opcode 7: advance Address by 0 to 0x400681 and Line by 2 to 4 Special opcode 55: advance Address by 3 to 0x400684 and Line by 8 to 12 Special opcode 7: advance Address by 0 to 0x400684 and Line by 2 to 14 Advance Line by -7 to 7 Special opcode 131: advance Address by 9 to 0x40068d and Line by 0 to 7 Special opcode 7: advance Address by 0 to 0x40068d and Line by 2 to 9 Advance PC by 3 to 0x400690 Extended opcode 1: End of Sequence Extended opcode 2: set Address to 0x400491 Advance Line by 21 to 22 Copy Special opcode 6: advance Address by 0 to 0x400491 and Line by 1 to 23 Special opcode 60: advance Address by 4 to 0x400495 and Line by -1 to 22 Special opcode 34: advance Address by 2 to 0x400497 and Line by 1 to 23 Special opcode 62: advance Address by 4 to 0x40049b and Line by 1 to 24 Special opcode 32: advance Address by 2 to 0x40049d and Line by -1 to 23 Special opcode 6: advance Address by 0 to 0x40049d and Line by 1 to 24 Advance PC by 7 to 0x4004a4 Extended opcode 1: End of Sequence [...] -- a-ha, the ISA bit is there! However it's not always right for some reason, I don't have a small test case to show it, but here's an excerpt from MIPS16 libc, a prologue of a function: 00019630 <__libc_init_first>: 19630: e8a0 jrc ra 19632: 6500 nop 00019634 <_init>: 19634: f000 6a11 li v0,17 19638: f7d8 0b08 la v1,15e00 <_DYNAMIC+0x15c54> 1963c: f400 3240 sll v0,16 19640: e269 addu v0,v1 19642: 659a move gp,v0 19644: 64f6 save 48,ra,s0-s1 19646: 671c move s0,gp 19648: d204 sw v0,16(sp) 1964a: f352 984c lw v0,-27828(s0) 1964e: 6724 move s1,a0 and the corresponding DWARF-2 line info: Line Number Statements: Extended opcode 2: set Address to 0x19631 Advance Line by 44 to 45 Copy Special opcode 8: advance Address by 0 to 0x19631 and Line by 3 to 48 Special opcode 66: advance Address by 4 to 0x19635 and Line by 5 to 53 Advance PC by constant 17 to 0x19646 Special opcode 25: advance Address by 1 to 0x19647 and Line by 6 to 59 Advance Line by -6 to 53 Special opcode 33: advance Address by 2 to 0x19649 and Line by 0 to 53 Special opcode 39: advance Address by 2 to 0x1964b and Line by 6 to 59 Advance Line by -6 to 53 Special opcode 61: advance Address by 4 to 0x1964f and Line by 0 to 53 -- see that "Advance PC by constant 17" there? It clears the ISA bit, however code at 0x19646 is not standard MIPS code at all. For some reason the constant is always 17, I've never seen DW_LNS_const_add_pc used with any other value -- is that a binutils bug or what? 3. Solution: I think we should retain the value of the ISA bit in code references, that is effectively treat them as cookies as they indeed are (although trivially calculated) rather than raw memory byte addresses. In a perfect world both the static symbol table and the respective DWARF-2 records should be fixed to include the ISA bit in all the cases. I think however that this is infeasible. All the uses of `_bfd_mips_elf_symbol_processing' can not necessarily be tracked down. This function is used by `elf_slurp_symbol_table' that in turn is used by `bfd_canonicalize_symtab' and `bfd_canonicalize_dynamic_symtab', which are public interfaces. Similarly DWARF-2 records are used outside GDB, one notable if a bit questionable is the exception unwinder (libgcc/unwind-dw2.c) -- I have identified at least bits in `execute_cfa_program' and `uw_frame_state_for', both around the calls to `_Unwind_IsSignalFrame', that would need an update as they effectively flip the ISA bit freely; see also the comment about MASK_RETURN_ADDR in gcc/config/mips/mips.h. But there may be more places. Any change in how DWARF-2 records are produced would require an update there and would cause compatibility problems with libgcc.a binaries already distributed; given that this is a static library a complex change involving function renames would likely be required. I propose therefore to accept the existing inconsistencies and deal with them entirely within GDB. I have figured out that the ISA bit lost in various places can still be recovered as long as we have symbol information -- that'll have the `st_other' attribute correctly set to one of standard MIPS/MIPS16/microMIPS encoding. Here's the resulting change. It adds a couple of new `gdbarch' hooks, one to update symbol information with the ISA bit lost in `_bfd_mips_elf_symbol_processing', and two other ones to adjust DWARF-2 records as they're processed. The ISA bit is set in each address handled according to information retrieved from the symbol table for the symbol spanning the address if any; limits are adjusted based on the address they point to related to the respective base address. Additionally minimal symbol information has to be adjusted accordingly in its gdbarch hook. With these changes in place some complications with ISA bit juggling in the PC that never fully worked can be removed from the MIPS backend. Conversely, the generic dynamic linker event special breakpoint symbol handler has to be updated to call the minimal symbol gdbarch hook to record that the symbol is a MIPS16 or microMIPS address if applicable or the breakpoint will be set at the wrong address and either fail to work or cause SIGTRAPs (this is because the symbol is handled early on and bypasses regular symbol processing). 4. Results obtained The change fixes the example above -- to repeat only the crucial steps: (gdb) break main Breakpoint 1 at 0x400491: file foobar.c, line 23. (gdb) run Starting program: .../foobar Breakpoint 1, main () at foobar.c:23 23 return foop (); (gdb) print foo $1 = {int (void)} 0x400681 <foo> (gdb) set foop = bar (gdb) advance bar bar () at foobar.c:9 9 } (gdb) disassemble Dump of assembler code for function bar: => 0x0040068d <+0>: jr ra 0x0040068f <+2>: li v0,2 End of assembler dump. (gdb) finish Run till exit from #0 bar () at foobar.c:9 main () at foobar.c:24 24 } Value returned is $2 = 2 (gdb) continue Continuing. [Inferior 1 (process 14128) exited with code 02] (gdb) -- excellent! The change removes about 90 failures per MIPS16 multilib in mips-sde-elf testing too, results for MIPS16 are now similar to that for standard MIPS; microMIPS results are a bit worse because of host-I/O problems in QEMU used instead of MIPSsim for microMIPS testing only: === gdb Summary === # of expected passes 14299 # of unexpected failures 187 # of expected failures 56 # of known failures 58 # of unresolved testcases 11 # of untested testcases 52 # of unsupported tests 174 MIPS16: === gdb Summary === # of expected passes 14298 # of unexpected failures 187 # of unexpected successes 2 # of expected failures 54 # of known failures 58 # of unresolved testcases 12 # of untested testcases 52 # of unsupported tests 174 microMIPS: === gdb Summary === # of expected passes 14149 # of unexpected failures 201 # of unexpected successes 2 # of expected failures 54 # of known failures 58 # of unresolved testcases 7 # of untested testcases 53 # of unsupported tests 175 2014-12-12 Maciej W. Rozycki <macro@codesourcery.com> Maciej W. Rozycki <macro@mips.com> Pedro Alves <pedro@codesourcery.com> gdb/ * gdbarch.sh (elf_make_msymbol_special): Change type to `F', remove `predefault' and `invalid_p' initializers. (make_symbol_special): New architecture method. (adjust_dwarf2_addr, adjust_dwarf2_line): Likewise. (objfile, symbol): New declarations. * arch-utils.h (default_elf_make_msymbol_special): Remove prototype. (default_make_symbol_special): New prototype. (default_adjust_dwarf2_addr): Likewise. (default_adjust_dwarf2_line): Likewise. * mips-tdep.h (mips_unmake_compact_addr): New prototype. * arch-utils.c (default_elf_make_msymbol_special): Remove function. (default_make_symbol_special): New function. (default_adjust_dwarf2_addr): Likewise. (default_adjust_dwarf2_line): Likewise. * dwarf2-frame.c (decode_frame_entry_1): Call `gdbarch_adjust_dwarf2_addr'. * dwarf2loc.c (dwarf2_find_location_expression): Likewise. * dwarf2read.c (create_addrmap_from_index): Likewise. (process_psymtab_comp_unit_reader): Likewise. (add_partial_symbol): Likewise. (add_partial_subprogram): Likewise. (process_full_comp_unit): Likewise. (read_file_scope): Likewise. (read_func_scope): Likewise. Call `gdbarch_make_symbol_special'. (read_lexical_block_scope): Call `gdbarch_adjust_dwarf2_addr'. (read_call_site_scope): Likewise. (dwarf2_ranges_read): Likewise. (dwarf2_record_block_ranges): Likewise. (read_attribute_value): Likewise. (dwarf_decode_lines_1): Call `gdbarch_adjust_dwarf2_line'. (new_symbol_full): Call `gdbarch_adjust_dwarf2_addr'. * elfread.c (elf_symtab_read): Don't call `gdbarch_elf_make_msymbol_special' if unset. * mips-linux-tdep.c (micromips_linux_sigframe_validate): Strip the ISA bit from the PC. * mips-tdep.c (mips_unmake_compact_addr): New function. (mips_elf_make_msymbol_special): Set the ISA bit in the symbol's address appropriately. (mips_make_symbol_special): New function. (mips_pc_is_mips): Set the ISA bit before symbol lookup. (mips_pc_is_mips16): Likewise. (mips_pc_is_micromips): Likewise. (mips_pc_isa): Likewise. (mips_adjust_dwarf2_addr): New function. (mips_adjust_dwarf2_line): Likewise. (mips_read_pc, mips_unwind_pc): Keep the ISA bit. (mips_addr_bits_remove): Likewise. (mips_skip_trampoline_code): Likewise. (mips_write_pc): Don't set the ISA bit. (mips_eabi_push_dummy_call): Likewise. (mips_o64_push_dummy_call): Likewise. (mips_gdbarch_init): Install `mips_make_symbol_special', `mips_adjust_dwarf2_addr' and `mips_adjust_dwarf2_line' gdbarch handlers. * solib.c (gdb_bfd_lookup_symbol_from_symtab): Get target-specific symbol address adjustments. * gdbarch.h: Regenerate. * gdbarch.c: Regenerate. 2014-12-12 Maciej W. Rozycki <macro@codesourcery.com> gdb/testsuite/ * gdb.base/func-ptrs.c: New file. * gdb.base/func-ptrs.exp: New file.
2014-12-12 14:31:53 +01:00
# Process an ELF symbol in the minimal symbol table in a backend-specific
# way. Normally this hook is supposed to do nothing, however if required,
# then this hook can be used to apply tranformations to symbols that are
# considered special in some way. For example the MIPS backend uses it
# to interpret \`st_other' information to mark compressed code symbols so
# that they can be treated in the appropriate manner in the processing of
# the main symbol table and DWARF-2 records.
F:void:elf_make_msymbol_special:asymbol *sym, struct minimal_symbol *msym:sym, msym
f:void:coff_make_msymbol_special:int val, struct minimal_symbol *msym:val, msym::default_coff_make_msymbol_special::0
MIPS: Keep the ISA bit in compressed code addresses 1. Background information The MIPS architecture, as originally designed and implemented in mid-1980s has a uniform instruction word size that is 4 bytes, naturally aligned. As such all MIPS instructions are located at addresses that have their bits #1 and #0 set to zeroes, and any attempt to execute an instruction from an address that has any of the two bits set to one causes an address error exception. This may for example happen when a jump-register instruction is executed whose register value used as the jump target has any of these bits set. Then in mid 1990s LSI sought a way to improve code density for their TinyRISC family of MIPS cores and invented an alternatively encoded instruction set in a joint effort with MIPS Technologies (then a subsidiary of SGI). The new instruction set has been named the MIPS16 ASE (Application-Specific Extension) and uses a variable instruction word size, which is 2 bytes (as the name of the ASE suggests) for most, but there are a couple of exceptions that take 4 bytes, and then most of the 2-byte instructions can be treated with a 2-byte extension prefix to expand the range of the immediate operands used. As a result instructions are no longer 4-byte aligned, instead they are aligned to a multiple of 2. That left the bit #0 still unused for code references, be it for the standard MIPS (i.e. as originally invented) or for the MIPS16 instruction set, and based on that observation a clever trick was invented that on one hand allowed the processor to be seamlessly switched between the two instruction sets at any time at the run time while on the other avoided the introduction of any special control register to do that. So it is the bit #0 of the instruction address that was chosen as the selector and named the ISA bit. Any instruction executed at an even address is interpreted as a standard MIPS instruction (the address still has to have its bit #1 clear), any instruction executed at an odd address is interpreted as a MIPS16 instruction. To switch between modes ordinary jump instructions are used, such as used for function calls and returns, specifically the bit #0 of the source register used in jump-register instructions selects the execution (ISA) mode for the following piece of code to be interpreted in. Additionally new jump-immediate instructions were added that flipped the ISA bit to select the opposite mode upon execution. They were considered necessary to avoid the need to make register jumps in all cases as the original jump-immediate instructions provided no way to change the bit #0 at all. This was all important for cases where standard MIPS and MIPS16 code had to be mixed, either for compatibility with the existing binary code base or to access resources not reachable from MIPS16 code (the MIPS16 instruction set only provides access to general-purpose registers, and not for example floating-point unit registers or privileged coprocessor 0 registers) -- pieces of code in the opposite mode can be executed as ordinary subroutine calls. A similar approach has been more recently adopted for the MIPS16 replacement instruction set defined as the so called microMIPS ASE. This is another instruction set encoding introduced to the MIPS architecture. Just like the MIPS16 ASE, the microMIPS instruction set uses a variable-length encoding, where each instruction takes a multiple of 2 bytes. The ISA bit has been reused and for microMIPS-capable processors selects between the standard MIPS and the microMIPS mode instead. 2. Statement of the problem To put it shortly, MIPS16 and microMIPS code pointers used by GDB are different to these observed at the run time. This results in the same expressions being evaluated producing different results in GDB and in the program being debugged. Obviously it's the results obtained at the run time that are correct (they define how the program behaves) and therefore by definition the results obtained in GDB are incorrect. A bit longer description will record that obviously at the run time the ISA bit has to be set correctly (refer to background information above if unsure why so) or the program will not run as expected. This is recorded in all the executable file structures used at the run time: the dynamic symbol table (but not always the static one!), the GOT, and obviously in all the addresses embedded in code or data of the program itself, calculated by applying the appropriate relocations at the static link time. While a program is being processed by GDB, the ISA bit is stripped off from any code addresses, presumably to make them the same as the respective raw memory byte address used by the processor to access the instruction in the instruction fetch access cycle. This stripping is actually performed outside GDB proper, in BFD, specifically _bfd_mips_elf_symbol_processing (elfxx-mips.c, see the piece of code at the very bottom of that function, starting with an: "If this is an odd-valued function symbol, assume it's a MIPS16 or microMIPS one." comment). This function is also responsible for symbol table dumps made by `objdump' too, so you'll never see the ISA bit reported there by that tool, you need to use `readelf'. This is however unlike what is ever done at the run time, the ISA bit once present is never stripped off, for example a cast like this: (short *) main will not strip the ISA bit off and if the resulting pointer is intended to be used to access instructions as data, for example for software instruction decoding (like for fault recovery or emulation in a signal handler) or for self-modifying code then the bit still has to be stripped off by an explicit AND operation. This is probably best illustrated with a simple real program example. Let's consider the following simple program: $ cat foobar.c int __attribute__ ((mips16)) foo (void) { return 1; } int __attribute__ ((mips16)) bar (void) { return 2; } int __attribute__ ((nomips16)) foo32 (void) { return 3; } int (*foo32p) (void) = foo32; int (*foop) (void) = foo; int fooi = (int) foo; int main (void) { return foop (); } $ This is plain C with no odd tricks, except from the instruction mode attributes. They are not necessary to trigger this problem, I just put them here so that the program can be contained in a single source file and to make it obvious which function is MIPS16 code and which is not. Let's try it with Linux, so that everyone can repeat this experiment: $ mips-linux-gnu-gcc -mips16 -g -O2 -o foobar foobar.c $ Let's have a look at some interesting symbols: $ mips-linux-gnu-readelf -s foobar | egrep 'table|foo|bar' Symbol table '.dynsym' contains 7 entries: Symbol table '.symtab' contains 95 entries: 55: 00000000 0 FILE LOCAL DEFAULT ABS foobar.c 66: 0040068c 4 FUNC GLOBAL DEFAULT [MIPS16] 12 bar 68: 00410848 4 OBJECT GLOBAL DEFAULT 21 foo32p 70: 00410844 4 OBJECT GLOBAL DEFAULT 21 foop 78: 00400684 8 FUNC GLOBAL DEFAULT 12 foo32 80: 00400680 4 FUNC GLOBAL DEFAULT [MIPS16] 12 foo 88: 00410840 4 OBJECT GLOBAL DEFAULT 21 fooi $ Hmm, no sight of the ISA bit, but notice how foo and bar (but not foo32!) have been marked as MIPS16 functions (ELF symbol structure's `st_other' field is used for that). So let's try to run and poke at this program with GDB. I'll be using a native system for simplicity (I'll be using ellipses here and there to remove unrelated clutter): $ ./foobar $ echo $? 1 $ So far, so good. $ gdb ./foobar [...] (gdb) break main Breakpoint 1 at 0x400490: file foobar.c, line 23. (gdb) run Starting program: .../foobar Breakpoint 1, main () at foobar.c:23 23 return foop (); (gdb) Yay, it worked! OK, so let's poke at it: (gdb) print main $1 = {int (void)} 0x400490 <main> (gdb) print foo32 $2 = {int (void)} 0x400684 <foo32> (gdb) print foo32p $3 = (int (*)(void)) 0x400684 <foo32> (gdb) print bar $4 = {int (void)} 0x40068c <bar> (gdb) print foo $5 = {int (void)} 0x400680 <foo> (gdb) print foop $6 = (int (*)(void)) 0x400681 <foo> (gdb) A-ha! Here's the difference and finally the ISA bit! (gdb) print /x fooi $7 = 0x400681 (gdb) p/x $pc p/x $pc $8 = 0x400491 (gdb) And here as well... (gdb) advance foo foo () at foobar.c:4 4 } (gdb) disassemble Dump of assembler code for function foo: 0x00400680 <+0>: jr ra 0x00400682 <+2>: li v0,1 End of assembler dump. (gdb) finish Run till exit from #0 foo () at foobar.c:4 main () at foobar.c:24 24 } Value returned is $9 = 1 (gdb) continue Continuing. [Inferior 1 (process 14103) exited with code 01] (gdb) So let's be a bit inquisitive... (gdb) run Starting program: .../foobar Breakpoint 1, main () at foobar.c:23 23 return foop (); (gdb) Actually we do not like to run foo here at all. Let's run bar instead! (gdb) set foop = bar (gdb) print foop $10 = (int (*)(void)) 0x40068c <bar> (gdb) Hmm, no ISA bit. Is it going to work? (gdb) advance bar bar () at foobar.c:9 9 } (gdb) p/x $pc $11 = 0x40068c (gdb) disassemble Dump of assembler code for function bar: => 0x0040068c <+0>: jr ra 0x0040068e <+2>: li v0,2 End of assembler dump. (gdb) finish Run till exit from #0 bar () at foobar.c:9 Program received signal SIGILL, Illegal instruction. bar () at foobar.c:9 9 } (gdb) Oops! (gdb) p/x $pc $12 = 0x40068c (gdb) We're still there! (gdb) continue Continuing. Program terminated with signal SIGILL, Illegal instruction. The program no longer exists. (gdb) So let's try something else: (gdb) run Starting program: .../foobar Breakpoint 1, main () at foobar.c:23 23 return foop (); (gdb) set foop = foo (gdb) advance foo foo () at foobar.c:4 4 } (gdb) disassemble Dump of assembler code for function foo: => 0x00400680 <+0>: jr ra 0x00400682 <+2>: li v0,1 End of assembler dump. (gdb) finish Run till exit from #0 foo () at foobar.c:4 Program received signal SIGILL, Illegal instruction. foo () at foobar.c:4 4 } (gdb) continue Continuing. Program terminated with signal SIGILL, Illegal instruction. The program no longer exists. (gdb) The same problem! (gdb) run Starting program: /net/build2-lucid-cs/scratch/macro/mips-linux-fsf-gcc/isa-bit/foobar Breakpoint 1, main () at foobar.c:23 23 return foop (); (gdb) set foop = foo32 (gdb) advance foo32 foo32 () at foobar.c:14 14 } (gdb) disassemble Dump of assembler code for function foo32: => 0x00400684 <+0>: jr ra 0x00400688 <+4>: li v0,3 End of assembler dump. (gdb) finish Run till exit from #0 foo32 () at foobar.c:14 main () at foobar.c:24 24 } Value returned is $14 = 3 (gdb) continue Continuing. [Inferior 1 (process 14113) exited with code 03] (gdb) That did work though, so it's the ISA bit only! (gdb) quit Enough! That's the tip of the iceberg only though. So let's rebuild the executable with some dynamic symbols: $ mips-linux-gnu-gcc -mips16 -Wl,--export-dynamic -g -O2 -o foobar-dyn foobar.c $ mips-linux-gnu-readelf -s foobar-dyn | egrep 'table|foo|bar' Symbol table '.dynsym' contains 32 entries: 6: 004009cd 4 FUNC GLOBAL DEFAULT 12 bar 8: 00410b88 4 OBJECT GLOBAL DEFAULT 21 foo32p 9: 00410b84 4 OBJECT GLOBAL DEFAULT 21 foop 15: 004009c4 8 FUNC GLOBAL DEFAULT 12 foo32 17: 004009c1 4 FUNC GLOBAL DEFAULT 12 foo 25: 00410b80 4 OBJECT GLOBAL DEFAULT 21 fooi Symbol table '.symtab' contains 95 entries: 55: 00000000 0 FILE LOCAL DEFAULT ABS foobar.c 69: 004009cd 4 FUNC GLOBAL DEFAULT 12 bar 71: 00410b88 4 OBJECT GLOBAL DEFAULT 21 foo32p 72: 00410b84 4 OBJECT GLOBAL DEFAULT 21 foop 79: 004009c4 8 FUNC GLOBAL DEFAULT 12 foo32 81: 004009c1 4 FUNC GLOBAL DEFAULT 12 foo 89: 00410b80 4 OBJECT GLOBAL DEFAULT 21 fooi $ OK, now the ISA bit is there for a change, but the MIPS16 `st_other' attribute gone, hmm... What does `objdump' do then: $ mips-linux-gnu-objdump -Tt foobar-dyn | egrep 'SYMBOL|foo|bar' foobar-dyn: file format elf32-tradbigmips SYMBOL TABLE: 00000000 l df *ABS* 00000000 foobar.c 004009cc g F .text 00000004 0xf0 bar 00410b88 g O .data 00000004 foo32p 00410b84 g O .data 00000004 foop 004009c4 g F .text 00000008 foo32 004009c0 g F .text 00000004 0xf0 foo 00410b80 g O .data 00000004 fooi DYNAMIC SYMBOL TABLE: 004009cc g DF .text 00000004 Base 0xf0 bar 00410b88 g DO .data 00000004 Base foo32p 00410b84 g DO .data 00000004 Base foop 004009c4 g DF .text 00000008 Base foo32 004009c0 g DF .text 00000004 Base 0xf0 foo 00410b80 g DO .data 00000004 Base fooi $ Hmm, the attribute (0xf0, printed raw) is back, and the ISA bit gone again. Let's have a look at some DWARF-2 records GDB uses (I'll be stripping off a lot here for brevity) -- debug info: $ mips-linux-gnu-readelf -wi foobar Contents of the .debug_info section: [...] Compilation Unit @ offset 0x88: Length: 0xbb (32-bit) Version: 4 Abbrev Offset: 62 Pointer Size: 4 <0><93>: Abbrev Number: 1 (DW_TAG_compile_unit) <94> DW_AT_producer : (indirect string, offset: 0x19e): GNU C 4.8.0 20120513 (experimental) -meb -mips16 -march=mips32r2 -mhard-float -mllsc -mplt -mno-synci -mno-shared -mabi=32 -g -O2 <98> DW_AT_language : 1 (ANSI C) <99> DW_AT_name : (indirect string, offset: 0x190): foobar.c <9d> DW_AT_comp_dir : (indirect string, offset: 0x225): [...] <a1> DW_AT_ranges : 0x0 <a5> DW_AT_low_pc : 0x0 <a9> DW_AT_stmt_list : 0x27 <1><ad>: Abbrev Number: 2 (DW_TAG_subprogram) <ae> DW_AT_external : 1 <ae> DW_AT_name : foo <b2> DW_AT_decl_file : 1 <b3> DW_AT_decl_line : 1 <b4> DW_AT_prototyped : 1 <b4> DW_AT_type : <0xc2> <b8> DW_AT_low_pc : 0x400680 <bc> DW_AT_high_pc : 0x400684 <c0> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa) <c2> DW_AT_GNU_all_call_sites: 1 <1><c2>: Abbrev Number: 3 (DW_TAG_base_type) <c3> DW_AT_byte_size : 4 <c4> DW_AT_encoding : 5 (signed) <c5> DW_AT_name : int <1><c9>: Abbrev Number: 4 (DW_TAG_subprogram) <ca> DW_AT_external : 1 <ca> DW_AT_name : (indirect string, offset: 0x18a): foo32 <ce> DW_AT_decl_file : 1 <cf> DW_AT_decl_line : 11 <d0> DW_AT_prototyped : 1 <d0> DW_AT_type : <0xc2> <d4> DW_AT_low_pc : 0x400684 <d8> DW_AT_high_pc : 0x40068c <dc> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa) <de> DW_AT_GNU_all_call_sites: 1 <1><de>: Abbrev Number: 2 (DW_TAG_subprogram) <df> DW_AT_external : 1 <df> DW_AT_name : bar <e3> DW_AT_decl_file : 1 <e4> DW_AT_decl_line : 6 <e5> DW_AT_prototyped : 1 <e5> DW_AT_type : <0xc2> <e9> DW_AT_low_pc : 0x40068c <ed> DW_AT_high_pc : 0x400690 <f1> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa) <f3> DW_AT_GNU_all_call_sites: 1 <1><f3>: Abbrev Number: 5 (DW_TAG_subprogram) <f4> DW_AT_external : 1 <f4> DW_AT_name : (indirect string, offset: 0x199): main <f8> DW_AT_decl_file : 1 <f9> DW_AT_decl_line : 21 <fa> DW_AT_prototyped : 1 <fa> DW_AT_type : <0xc2> <fe> DW_AT_low_pc : 0x400490 <102> DW_AT_high_pc : 0x4004a4 <106> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa) <108> DW_AT_GNU_all_tail_call_sites: 1 [...] $ -- no sign of the ISA bit anywhere -- frame info: $ mips-linux-gnu-readelf -wf foobar [...] Contents of the .debug_frame section: 00000000 0000000c ffffffff CIE Version: 1 Augmentation: "" Code alignment factor: 1 Data alignment factor: -4 Return address column: 31 DW_CFA_def_cfa_register: r29 DW_CFA_nop 00000010 0000000c 00000000 FDE cie=00000000 pc=00400680..00400684 00000020 0000000c 00000000 FDE cie=00000000 pc=00400684..0040068c 00000030 0000000c 00000000 FDE cie=00000000 pc=0040068c..00400690 00000040 00000018 00000000 FDE cie=00000000 pc=00400490..004004a4 DW_CFA_advance_loc: 6 to 00400496 DW_CFA_def_cfa_offset: 32 DW_CFA_offset: r31 at cfa-4 DW_CFA_advance_loc: 6 to 0040049c DW_CFA_restore: r31 DW_CFA_def_cfa_offset: 0 DW_CFA_nop DW_CFA_nop DW_CFA_nop [...] $ -- no sign of the ISA bit anywhere -- range info (GDB doesn't use arange): $ mips-linux-gnu-readelf -wR foobar Contents of the .debug_ranges section: Offset Begin End 00000000 00400680 00400690 00000000 00400490 004004a4 00000000 <End of list> $ -- no sign of the ISA bit anywhere -- line info: $ mips-linux-gnu-readelf -wl foobar Raw dump of debug contents of section .debug_line: [...] Offset: 0x27 Length: 78 DWARF Version: 2 Prologue Length: 31 Minimum Instruction Length: 1 Initial value of 'is_stmt': 1 Line Base: -5 Line Range: 14 Opcode Base: 13 Opcodes: Opcode 1 has 0 args Opcode 2 has 1 args Opcode 3 has 1 args Opcode 4 has 1 args Opcode 5 has 1 args Opcode 6 has 0 args Opcode 7 has 0 args Opcode 8 has 0 args Opcode 9 has 1 args Opcode 10 has 0 args Opcode 11 has 0 args Opcode 12 has 1 args The Directory Table is empty. The File Name Table: Entry Dir Time Size Name 1 0 0 0 foobar.c Line Number Statements: Extended opcode 2: set Address to 0x400681 Special opcode 6: advance Address by 0 to 0x400681 and Line by 1 to 2 Special opcode 7: advance Address by 0 to 0x400681 and Line by 2 to 4 Special opcode 55: advance Address by 3 to 0x400684 and Line by 8 to 12 Special opcode 7: advance Address by 0 to 0x400684 and Line by 2 to 14 Advance Line by -7 to 7 Special opcode 131: advance Address by 9 to 0x40068d and Line by 0 to 7 Special opcode 7: advance Address by 0 to 0x40068d and Line by 2 to 9 Advance PC by 3 to 0x400690 Extended opcode 1: End of Sequence Extended opcode 2: set Address to 0x400491 Advance Line by 21 to 22 Copy Special opcode 6: advance Address by 0 to 0x400491 and Line by 1 to 23 Special opcode 60: advance Address by 4 to 0x400495 and Line by -1 to 22 Special opcode 34: advance Address by 2 to 0x400497 and Line by 1 to 23 Special opcode 62: advance Address by 4 to 0x40049b and Line by 1 to 24 Special opcode 32: advance Address by 2 to 0x40049d and Line by -1 to 23 Special opcode 6: advance Address by 0 to 0x40049d and Line by 1 to 24 Advance PC by 7 to 0x4004a4 Extended opcode 1: End of Sequence [...] -- a-ha, the ISA bit is there! However it's not always right for some reason, I don't have a small test case to show it, but here's an excerpt from MIPS16 libc, a prologue of a function: 00019630 <__libc_init_first>: 19630: e8a0 jrc ra 19632: 6500 nop 00019634 <_init>: 19634: f000 6a11 li v0,17 19638: f7d8 0b08 la v1,15e00 <_DYNAMIC+0x15c54> 1963c: f400 3240 sll v0,16 19640: e269 addu v0,v1 19642: 659a move gp,v0 19644: 64f6 save 48,ra,s0-s1 19646: 671c move s0,gp 19648: d204 sw v0,16(sp) 1964a: f352 984c lw v0,-27828(s0) 1964e: 6724 move s1,a0 and the corresponding DWARF-2 line info: Line Number Statements: Extended opcode 2: set Address to 0x19631 Advance Line by 44 to 45 Copy Special opcode 8: advance Address by 0 to 0x19631 and Line by 3 to 48 Special opcode 66: advance Address by 4 to 0x19635 and Line by 5 to 53 Advance PC by constant 17 to 0x19646 Special opcode 25: advance Address by 1 to 0x19647 and Line by 6 to 59 Advance Line by -6 to 53 Special opcode 33: advance Address by 2 to 0x19649 and Line by 0 to 53 Special opcode 39: advance Address by 2 to 0x1964b and Line by 6 to 59 Advance Line by -6 to 53 Special opcode 61: advance Address by 4 to 0x1964f and Line by 0 to 53 -- see that "Advance PC by constant 17" there? It clears the ISA bit, however code at 0x19646 is not standard MIPS code at all. For some reason the constant is always 17, I've never seen DW_LNS_const_add_pc used with any other value -- is that a binutils bug or what? 3. Solution: I think we should retain the value of the ISA bit in code references, that is effectively treat them as cookies as they indeed are (although trivially calculated) rather than raw memory byte addresses. In a perfect world both the static symbol table and the respective DWARF-2 records should be fixed to include the ISA bit in all the cases. I think however that this is infeasible. All the uses of `_bfd_mips_elf_symbol_processing' can not necessarily be tracked down. This function is used by `elf_slurp_symbol_table' that in turn is used by `bfd_canonicalize_symtab' and `bfd_canonicalize_dynamic_symtab', which are public interfaces. Similarly DWARF-2 records are used outside GDB, one notable if a bit questionable is the exception unwinder (libgcc/unwind-dw2.c) -- I have identified at least bits in `execute_cfa_program' and `uw_frame_state_for', both around the calls to `_Unwind_IsSignalFrame', that would need an update as they effectively flip the ISA bit freely; see also the comment about MASK_RETURN_ADDR in gcc/config/mips/mips.h. But there may be more places. Any change in how DWARF-2 records are produced would require an update there and would cause compatibility problems with libgcc.a binaries already distributed; given that this is a static library a complex change involving function renames would likely be required. I propose therefore to accept the existing inconsistencies and deal with them entirely within GDB. I have figured out that the ISA bit lost in various places can still be recovered as long as we have symbol information -- that'll have the `st_other' attribute correctly set to one of standard MIPS/MIPS16/microMIPS encoding. Here's the resulting change. It adds a couple of new `gdbarch' hooks, one to update symbol information with the ISA bit lost in `_bfd_mips_elf_symbol_processing', and two other ones to adjust DWARF-2 records as they're processed. The ISA bit is set in each address handled according to information retrieved from the symbol table for the symbol spanning the address if any; limits are adjusted based on the address they point to related to the respective base address. Additionally minimal symbol information has to be adjusted accordingly in its gdbarch hook. With these changes in place some complications with ISA bit juggling in the PC that never fully worked can be removed from the MIPS backend. Conversely, the generic dynamic linker event special breakpoint symbol handler has to be updated to call the minimal symbol gdbarch hook to record that the symbol is a MIPS16 or microMIPS address if applicable or the breakpoint will be set at the wrong address and either fail to work or cause SIGTRAPs (this is because the symbol is handled early on and bypasses regular symbol processing). 4. Results obtained The change fixes the example above -- to repeat only the crucial steps: (gdb) break main Breakpoint 1 at 0x400491: file foobar.c, line 23. (gdb) run Starting program: .../foobar Breakpoint 1, main () at foobar.c:23 23 return foop (); (gdb) print foo $1 = {int (void)} 0x400681 <foo> (gdb) set foop = bar (gdb) advance bar bar () at foobar.c:9 9 } (gdb) disassemble Dump of assembler code for function bar: => 0x0040068d <+0>: jr ra 0x0040068f <+2>: li v0,2 End of assembler dump. (gdb) finish Run till exit from #0 bar () at foobar.c:9 main () at foobar.c:24 24 } Value returned is $2 = 2 (gdb) continue Continuing. [Inferior 1 (process 14128) exited with code 02] (gdb) -- excellent! The change removes about 90 failures per MIPS16 multilib in mips-sde-elf testing too, results for MIPS16 are now similar to that for standard MIPS; microMIPS results are a bit worse because of host-I/O problems in QEMU used instead of MIPSsim for microMIPS testing only: === gdb Summary === # of expected passes 14299 # of unexpected failures 187 # of expected failures 56 # of known failures 58 # of unresolved testcases 11 # of untested testcases 52 # of unsupported tests 174 MIPS16: === gdb Summary === # of expected passes 14298 # of unexpected failures 187 # of unexpected successes 2 # of expected failures 54 # of known failures 58 # of unresolved testcases 12 # of untested testcases 52 # of unsupported tests 174 microMIPS: === gdb Summary === # of expected passes 14149 # of unexpected failures 201 # of unexpected successes 2 # of expected failures 54 # of known failures 58 # of unresolved testcases 7 # of untested testcases 53 # of unsupported tests 175 2014-12-12 Maciej W. Rozycki <macro@codesourcery.com> Maciej W. Rozycki <macro@mips.com> Pedro Alves <pedro@codesourcery.com> gdb/ * gdbarch.sh (elf_make_msymbol_special): Change type to `F', remove `predefault' and `invalid_p' initializers. (make_symbol_special): New architecture method. (adjust_dwarf2_addr, adjust_dwarf2_line): Likewise. (objfile, symbol): New declarations. * arch-utils.h (default_elf_make_msymbol_special): Remove prototype. (default_make_symbol_special): New prototype. (default_adjust_dwarf2_addr): Likewise. (default_adjust_dwarf2_line): Likewise. * mips-tdep.h (mips_unmake_compact_addr): New prototype. * arch-utils.c (default_elf_make_msymbol_special): Remove function. (default_make_symbol_special): New function. (default_adjust_dwarf2_addr): Likewise. (default_adjust_dwarf2_line): Likewise. * dwarf2-frame.c (decode_frame_entry_1): Call `gdbarch_adjust_dwarf2_addr'. * dwarf2loc.c (dwarf2_find_location_expression): Likewise. * dwarf2read.c (create_addrmap_from_index): Likewise. (process_psymtab_comp_unit_reader): Likewise. (add_partial_symbol): Likewise. (add_partial_subprogram): Likewise. (process_full_comp_unit): Likewise. (read_file_scope): Likewise. (read_func_scope): Likewise. Call `gdbarch_make_symbol_special'. (read_lexical_block_scope): Call `gdbarch_adjust_dwarf2_addr'. (read_call_site_scope): Likewise. (dwarf2_ranges_read): Likewise. (dwarf2_record_block_ranges): Likewise. (read_attribute_value): Likewise. (dwarf_decode_lines_1): Call `gdbarch_adjust_dwarf2_line'. (new_symbol_full): Call `gdbarch_adjust_dwarf2_addr'. * elfread.c (elf_symtab_read): Don't call `gdbarch_elf_make_msymbol_special' if unset. * mips-linux-tdep.c (micromips_linux_sigframe_validate): Strip the ISA bit from the PC. * mips-tdep.c (mips_unmake_compact_addr): New function. (mips_elf_make_msymbol_special): Set the ISA bit in the symbol's address appropriately. (mips_make_symbol_special): New function. (mips_pc_is_mips): Set the ISA bit before symbol lookup. (mips_pc_is_mips16): Likewise. (mips_pc_is_micromips): Likewise. (mips_pc_isa): Likewise. (mips_adjust_dwarf2_addr): New function. (mips_adjust_dwarf2_line): Likewise. (mips_read_pc, mips_unwind_pc): Keep the ISA bit. (mips_addr_bits_remove): Likewise. (mips_skip_trampoline_code): Likewise. (mips_write_pc): Don't set the ISA bit. (mips_eabi_push_dummy_call): Likewise. (mips_o64_push_dummy_call): Likewise. (mips_gdbarch_init): Install `mips_make_symbol_special', `mips_adjust_dwarf2_addr' and `mips_adjust_dwarf2_line' gdbarch handlers. * solib.c (gdb_bfd_lookup_symbol_from_symtab): Get target-specific symbol address adjustments. * gdbarch.h: Regenerate. * gdbarch.c: Regenerate. 2014-12-12 Maciej W. Rozycki <macro@codesourcery.com> gdb/testsuite/ * gdb.base/func-ptrs.c: New file. * gdb.base/func-ptrs.exp: New file.
2014-12-12 14:31:53 +01:00
# Process a symbol in the main symbol table in a backend-specific way.
# Normally this hook is supposed to do nothing, however if required,
# then this hook can be used to apply tranformations to symbols that
# are considered special in some way. This is currently used by the
# MIPS backend to make sure compressed code symbols have the ISA bit
# set. This in turn is needed for symbol values seen in GDB to match
# the values used at the runtime by the program itself, for function
# and label references.
f:void:make_symbol_special:struct symbol *sym, struct objfile *objfile:sym, objfile::default_make_symbol_special::0
# Adjust the address retrieved from a DWARF-2 record other than a line
# entry in a backend-specific way. Normally this hook is supposed to
# return the address passed unchanged, however if that is incorrect for
# any reason, then this hook can be used to fix the address up in the
# required manner. This is currently used by the MIPS backend to make
# sure addresses in FDE, range records, etc. referring to compressed
# code have the ISA bit set, matching line information and the symbol
# table.
f:CORE_ADDR:adjust_dwarf2_addr:CORE_ADDR pc:pc::default_adjust_dwarf2_addr::0
# Adjust the address updated by a line entry in a backend-specific way.
# Normally this hook is supposed to return the address passed unchanged,
# however in the case of inconsistencies in these records, this hook can
# be used to fix them up in the required manner. This is currently used
# by the MIPS backend to make sure all line addresses in compressed code
# are presented with the ISA bit set, which is not always the case. This
# in turn ensures breakpoint addresses are correctly matched against the
# stop PC.
f:CORE_ADDR:adjust_dwarf2_line:CORE_ADDR addr, int rel:addr, rel::default_adjust_dwarf2_line::0
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
# Return the appropriate type_flags for the supplied address class.
# This function should return 1 if the address class was recognized and
# type_flags was set, zero otherwise.
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
Replace 'core_regset_sections' by iterator method The core_regset_sections list in gdbarch (needed for multi-arch capable core file generation support) is replaced by an iterator method. Overall, this reduces the code a bit, and it allows for more flexibility. gdb/ChangeLog: * amd64-linux-tdep.c (amd64_linux_regset_sections): Remove. (amd64_linux_iterate_over_regset_sections): New. (amd64_linux_init_abi_common): Don't install the regset section list, but the new iterator in gdbarch. * arm-linux-tdep.c (arm_linux_fpa_regset_sections) (arm_linux_vfp_regset_sections): Remove. Move combined logic... (arm_linux_iterate_over_regset_sections): ...here. New function. (arm_linux_init_abi): Set iterator instead of section list. * corelow.c (get_core_registers_cb): New function, logic moved from... (get_core_registers): ...loop body here. Use new iterator method instead of walking through the regset section list. * gdbarch.sh: Remove 'core_regset_sections'. New method 'iterate_over_regset_sections'. New typedef 'iterate_over_regset_sections_cb'. * gdbarch.c: Regenerate. * gdbarch.h: Likewise. * i386-linux-tdep.c (i386_linux_regset_sections) (i386_linux_sse_regset_sections, i386_linux_avx_regset_sections): Remove. (i386_linux_iterate_over_regset_sections): New. (i386_linux_init_abi): Don't choose a regset section list, but install new iterator in gdbarch. * linux-tdep.c (struct linux_collect_regset_section_cb_data): New. (linux_collect_regset_section_cb): New function, logic moved from... (linux_collect_thread_registers): ...loop body here. Use iterator method instead of walking through list. (linux_make_corefile_notes_1): Check for presence of iterator method instead of regset section list. * ppc-linux-tdep.c (ppc_linux_vsx_regset_sections) (ppc_linux_vmx_regset_sections, ppc_linux_fp_regset_sections) (ppc64_linux_vsx_regset_sections, ppc64_linux_vmx_regset_sections) (ppc64_linux_fp_regset_sections): Remove. Move combined logic... (ppc_linux_iterate_over_regset_sections): ...here. New function. (ppc_linux_init_abi): Don't choose from above regset section lists, but install new iterator in gdbarch. * regset.h (struct core_regset_section): Remove. * s390-linux-tdep.c (struct gdbarch_tdep): Add new fields have_linux_v1, have_linux_v2, and have_tdb. (s390_linux32_regset_sections, s390_linux32v1_regset_sections) (s390_linux32v2_regset_sections, s390_linux64_regset_sections) (s390_linux64v1_regset_sections, s390_linux64v2_regset_sections) (s390x_linux64_regset_sections, s390x_linux64v1_regset_sections) (s390x_linux64v2_regset_sections): Remove. Move combined logic... (s390_iterate_over_regset_sections): ...here. New function. Use new tdep fields. (s390_gdbarch_init): Set new tdep fields. Don't choose from above regset section lists, but install new iterator.
2014-09-04 17:26:43 +02:00
# Iterate over all supported register notes in a core file. For each
# supported register note section, the iterator must call CB and pass
# CB_DATA unchanged. If REGCACHE is not NULL, the iterator can limit
# the supported register note sections based on the current register
# values. Otherwise it should enumerate all supported register note
# sections.
M:void:iterate_over_regset_sections:iterate_over_regset_sections_cb *cb, void *cb_data, const struct regcache *regcache:cb, cb_data, regcache
* gdbarch.sh (make_corefile_notes): New architecture callback. * gdbarch.c: Regenerate. * gdbarch.h: Likewise. * gcore.c (write_gcore_file): Try gdbarch_make_corefile_notes before target_make_corefile_notes. If NULL is returned, the target does not support core file generation. * linux-nat.c: Include "linux-tdep.h". (find_signalled_thread, find_stop_signal): Remove. (linux_nat_do_thread_registers): Likewise. (struct linux_nat_corefile_thread_data): Likewise. (linux_nat_corefile_thread_callback): Likewise. (iterate_over_spus): Likewise. (struct linux_spu_corefile_data): Likewise. (linux_spu_corefile_callback): Likewise. (linux_spu_make_corefile_notes): Likewise. (linux_nat_collect_thread_registers): New function. (linux_nat_make_corefile_notes): Replace contents by call to linux_make_corefile_notes passing linux_nat_collect_thread_registers as native-only callback. * linux-tdep.h: Include "bfd.h". (struct regcache): Add forward declaration. (linux_collect_thread_registers_ftype): New typedef. (linux_make_corefile_notes): Add prototype. * linux-tdep.c: Include "gdbthread.h", "gdbcore.h", "regcache.h", "regset.h", and "elf-bfd.h". (find_signalled_thread, find_stop_signal): New functions. (linux_spu_make_corefile_notes): Likewise. (linux_collect_thread_registers): Likewise. (struct linux_corefile_thread_data): New data structure. (linux_corefile_thread_callback): New funcion. (linux_make_corefile_notes): Likewise. (linux_make_corefile_notes_1): Likewise. (linux_init_abi): Install it.
2012-01-20 10:56:56 +01:00
# Create core file notes
M:char *:make_corefile_notes:bfd *obfd, int *note_size:obfd, note_size
# The elfcore writer hook to use to write Linux prpsinfo notes to core
# files. Most Linux architectures use the same prpsinfo32 or
# prpsinfo64 layouts, and so won't need to provide this hook, as we
# call the Linux generic routines in bfd to write prpsinfo notes by
# default.
F:char *:elfcore_write_linux_prpsinfo:bfd *obfd, char *note_data, int *note_size, const struct elf_internal_linux_prpsinfo *info:obfd, note_data, note_size, info
# Find core file memory regions
M:int:find_memory_regions:find_memory_region_ftype func, void *data:func, data
# Read offset OFFSET of TARGET_OBJECT_LIBRARIES formatted shared libraries list from
# core file into buffer READBUF with length LEN. Return the number of bytes read
# (zero indicates failure).
# failed, otherwise, return the red length of READBUF.
M:ULONGEST:core_xfer_shared_libraries:gdb_byte *readbuf, ULONGEST offset, ULONGEST len:readbuf, offset, len
ppc-aix core file relocation. The current code attempts to provide relocation support when debugging core files via the rs6000_xfer_partial method of the rs6000-nat target_ops vector. However, this target_ops vector does not get pushed on the target stack at all when debugging core files, thus bypassing completely that part of the code. This patch fixes the problem by extending corelow's core_xfer_partial into handling the TARGET_OBJECT_LIBRARIES_AIX object. gdb/ChangeLog: * gdbarch.sh (core_xfer_shared_libraries_aix): New method. * gdbarch.h, gdbarch.c: Regenerate. * corelow.c (core_xfer_partial): Add TARGET_OBJECT_LIBRARIES_AIX handling. * rs6000-aix-tdep.h: New file. * Makefile.in (HFILES_NO_SRCDIR): Add rs6000-aix-tdep.h. * rs6000-aix-tdep.c: Include "rs6000-aix-tdep.h" and "xml-utils.h". (struct field_info, struct ld_info_desc): New types. (ld_info32_desc, ld_info64_desc): New static constants. (struct ld_info): New type. (rs6000_aix_extract_ld_info): New function. (rs6000_aix_shared_library_to_xml): Likewise. (rs6000_aix_ld_info_to_xml): Likewise. (rs6000_aix_core_xfer_shared_libraries_aix): Likewise. (rs6000_aix_init_osabi): Add call to set_gdbarch_core_xfer_shared_libraries_aix. * rs6000-nat.c: Add "rs6000-aix-tdep.h" include. Remove "xml-utils.h" include. (LdInfo): Delete typedef. (ARCH64_DECL, LDI_FIELD, LDI_NEXT, LDI_FD, LDI_FILENAME): Delete macros. (rs6000_ptrace_ldinfo): Change return type to gdb_byte *. Adjust code accordingly. (rs6000_core_ldinfo): Delete, folded into rs6000_aix_core_xfer_shared_libraries_aix. (rs6000_xfer_shared_library): Delete. (rs6000_xfer_shared_libraries): Reimplement.
2013-05-15 14:26:14 +02:00
# Read offset OFFSET of TARGET_OBJECT_LIBRARIES_AIX formatted shared
# libraries list from core file into buffer READBUF with length LEN.
# Return the number of bytes read (zero indicates failure).
M:ULONGEST:core_xfer_shared_libraries_aix:gdb_byte *readbuf, ULONGEST offset, ULONGEST len:readbuf, offset, len
ppc-aix core file relocation. The current code attempts to provide relocation support when debugging core files via the rs6000_xfer_partial method of the rs6000-nat target_ops vector. However, this target_ops vector does not get pushed on the target stack at all when debugging core files, thus bypassing completely that part of the code. This patch fixes the problem by extending corelow's core_xfer_partial into handling the TARGET_OBJECT_LIBRARIES_AIX object. gdb/ChangeLog: * gdbarch.sh (core_xfer_shared_libraries_aix): New method. * gdbarch.h, gdbarch.c: Regenerate. * corelow.c (core_xfer_partial): Add TARGET_OBJECT_LIBRARIES_AIX handling. * rs6000-aix-tdep.h: New file. * Makefile.in (HFILES_NO_SRCDIR): Add rs6000-aix-tdep.h. * rs6000-aix-tdep.c: Include "rs6000-aix-tdep.h" and "xml-utils.h". (struct field_info, struct ld_info_desc): New types. (ld_info32_desc, ld_info64_desc): New static constants. (struct ld_info): New type. (rs6000_aix_extract_ld_info): New function. (rs6000_aix_shared_library_to_xml): Likewise. (rs6000_aix_ld_info_to_xml): Likewise. (rs6000_aix_core_xfer_shared_libraries_aix): Likewise. (rs6000_aix_init_osabi): Add call to set_gdbarch_core_xfer_shared_libraries_aix. * rs6000-nat.c: Add "rs6000-aix-tdep.h" include. Remove "xml-utils.h" include. (LdInfo): Delete typedef. (ARCH64_DECL, LDI_FIELD, LDI_NEXT, LDI_FD, LDI_FILENAME): Delete macros. (rs6000_ptrace_ldinfo): Change return type to gdb_byte *. Adjust code accordingly. (rs6000_core_ldinfo): Delete, folded into rs6000_aix_core_xfer_shared_libraries_aix. (rs6000_xfer_shared_library): Delete. (rs6000_xfer_shared_libraries): Reimplement.
2013-05-15 14:26:14 +02:00
gdb/ Make core files the process_stratum. * corefile.c (core_target): New variable. (core_file_command): Remove variable t, use core_target. * corelow.c (core_ops): Make it static. (init_core_ops): Change to process_stratum. Initialize CORE_TARGET. * defs.h (make_cleanup_unpush_target): New prototype. * gdbarch.h: Regenerate. * gdbarch.sh (core_pid_to_str): Remove core_stratum from its comment. * gdbcore.h (core_target): New declaration. * inf-ptrace.c (inf_ptrace_create_inferior, inf_ptrace_attach): New variables ops_already_pushed and back_to. Use push_target, make_cleanup_unpush_target and discard_cleanups calls. * record.c (record_open): Replace core_stratum by a core_bfd check. * target.c (target_is_pushed): New function. (find_core_target): Remove. * target.h (enum strata) <core_stratum>: Remove. (target_is_pushed): New declaration. (find_core_target): Remove declaration. * tracepoint.c (init_tfile_ops) <to_stratum>: Remove comment. * utils.c (do_unpush_target, make_cleanup_unpush_target): New functions. gdb/doc/ Make core files the process_stratum. * gdb.texinfo (Active Targets): Remove core_stratum. Include record_stratum example. gdb/testsuite/ Make core files the process_stratum. * gdb.base/corefile.exp (run: load core again) (run: sanity check we see the core file, run: with core) (run: core file is cleared, attach: load core again) (attach: sanity check we see the core file, attach: with core) (attach: core file is cleared): New tests. * gdb.base/coremaker.c (main): New parameters. Implement "sleep" argv.
2010-07-19 19:51:25 +02:00
# How the core target converts a PTID from a core file to a string.
* corelow.c (get_core_registers): Adjust. (core_file_thread_alive): Rename to... (core_thread_alive): ... this. (core_pid_to_str): Try gdbarch_core_pid_to_str first. (init_core_ops): Adjust. (coreops_suppress_target): Delete. (_initialize_corelow): Unconditionally add core_ops. * procfs.c: Include "inf-child.h". (procfs_ops): Delete. (init_procfs_ops): Delete. Reimplement as... (procfs_target): ... this, inheriting from inf-child. (procfs_attach, procfs_detach, procfs_fetch_registers): Adjust. (procfs_prepare_to_store): Delete. (procfs_store_registers, procfs_resume): Adjust. (procfs_open): Delete. (procfs_suppress_run): Delete. (procfs_can_run): Delete. (procfs_mourn_inferior): Adjust. (procfs_init_inferior): Add target_ops parameter. Adjust. (procfs_create_inferior): Don't pass procfs_init_inferior to fork_inferior. Instead call it after fork_inferior returns. (procfs_find_new_threads): Adjust. (_initialize_procfs): Adjust to use procfs_target instead of init_procfs_ops. * sol-thread.c (orig_core_ops, sol_core_ops): Delete. (lwp_to_thread): Use target_thread_alive. (sol_thread_open): Delete. (sol_thread_attach): Delete. (sol_thread_detach, sol_thread_resume, sol_thread_wait) (sol_thread_fetch_registers, sol_thread_store_registers): Adjust to use find_target_beneath. (sol_thread_prepare_to_store, sol_thread_xfer_memory): Delete. (sol_thread_xfer_partial): Adjust to use find_target_beneath. (sol_thread_files_info, sol_thread_kill_inferior): Delete. (check_for_thread_db): New. (sol_thread_notice_signals, sol_thread_create_inferior): Delete. (sol_thread_new_objfile): Call check_for_thread_db. (sol_thread_mourn_inferior): Adjust to use find_target_beneath. (sol_thread_can_run): Delete. (sol_thread_alive): Adjust to use find_target_beneath. (sol_thread_stop): Delete. (rw_common): Use target_write_memory or target_read_memory. (ps_lgetregs, ps_lgetfpregs): Use target_fetch_registers. (ps_lsetregs, ps_lsetfpregs): Use target_store_registers. (solaris_pid_to_str): Remove check for libthread_db initialization failing. (sol_find_new_threads): Remove check for libthread_db initialization failing, or for an invalid inferior_ptid. Adjust to use find_target_beneath. (sol_core_open, sol_core_close, sol_core_detach, sol_core_files_info, sol_find_memory_regions, sol_make_note_section, ignore): Delete. (init_sol_thread_ops): Make it a thread_stratum target. Remove unneeded callback settings. (init_sol_core_ops): Delete. (_initialize_sol_thread): No longer call init_sol_core_ops, set procfs_suppress_run, or hack with core_ops. * target.h (struct target_ops): Add a target_ops * parameter to to_resume, to_fetch_registers, to_store_registers, to_thread_alive and to_find_new_threads. (target_fetch_registers, target_store_registers) (target_thread_alive, target_find_new_threads): Redeclare as function. * target.c (update_current_target): Do not inherit or de_fault to_resume, to_fetch_registers, to_store_registers, to_thread_alive, to_find_new_threads. (target_resume): Adjust. (target_thread_alive, target_find_new_threads): New. (debug_to_resume, debug_to_fetch_registers): Delete. (target_fetch_registers): New. (debug_to_store_registers): Delete. (target_store_registers): New. (debug_to_thread_alive, debug_to_find_new_threads): Delete. (setup_target_debug): Adjust. * gdbcore.h (core_ops): Delete declaration. * inf-ptrace.c, linux-nat.c, remote.c, amd64-linux-nat.c, inf-child.c, linux-thread-db.c, bsd-uthread.c, inf-ttrace.c, i386-sol2-tdep.c, darwin-nat.c, gnu-nat.c, go32-nat.c, hpux-thread.c, i386-linux-nat.c, i386fbsd-nat.c, monitor.c, nto-procfs.c, remote-m32r-sdi.c, remote-mips.c, windows-nat.c, alphabsd-nat.c, amd64bsd-nat.c, arm-linux-nat.c, armnbsd-nat.c, bsd-kvm.c, hppa-hpux-nat.c, hppa-linux-nat.c, hppabsd-nat.c, hppanbsd-nat.c, i386-darwin-nat.c, i386bsd-nat.c, ia64-linux-nat.c, m32r-linux-nat.c, m68kbsd-nat.c, m68klinux-nat.c, m88kbsd-nat.c, mips-linux-nat.c, mips64obsd-nat.c, mipsnbsd-nat.c, ppc-linux-nat.c, ppcnbsd-nat.c, ppcobsd-nat.c, remote-sim.c, rs6000-nat.c, s390-nat.c, shnbsd-nat.c, sparc-nat.c, sparc-nat.h, spu-linux-nat.c, vaxbsd-nat.c, xtensa-linux-nat.c: Adjust to target_ops changes. * gdbarch.sh (core_pid_to_str): New gdbarch callback. * gdbarch.h, gdbarch.c: Regenerate. * sol2-tdep.c: Include "inferior.h". (sol2_core_pid_to_str): New. * sol2-tdep.h (sol2_core_pid_to_str): Declare. * amd64-sol2-tdep.c (amd64_sol2_init_abi): Set it. * sparc-sol2-tdep.c (sparc32_sol2_init_abi): Set it. * sparc64-sol2-tdep.c (sparc64_sol2_init_abi): Set it. * i386-sol2-tdep.c (i386_sol2_init_abi): Set it.
2009-02-23 01:03:50 +01:00
M:char *:core_pid_to_str:ptid_t ptid:ptid
# BFD target to use when generating a core file.
V:const char *:gcore_bfd_target:::0:0:::pstring (gdbarch->gcore_bfd_target)
* NEWS: Mention pointer to member improvements. * Makefile.in (gnu-v3-abi.o): Delete special rule. (eval.o, gnu-v3-abi.o, ia64-tdep.o): Update. * ada-valprint.c (ada_print_scalar): Update for new type codes. * c-typeprint.c (c_print_type): Update for new type codes. (c_type_print_varspec_prefix, c_type_print_varspec_suffix) (c_type_print_base): Likewise. (c_type_print_args): Rewrite. * c-valprint.c (c_val_print): Update for new type codes. Remove support for references to members. Treat methods like functions. * cp-abi.c (cplus_print_method_ptr, cplus_method_ptr_size) (cplus_make_method_ptr, cplus_method_ptr_to_value): New. * cp-abi.h (cplus_print_method_ptr, cplus_method_ptr_size) (cplus_make_method_ptr, cplus_method_ptr_to_value): New prototypes. (struct cp_abi_ops): Add corresponding members. * cp-valprint.c (cp_print_class_method): Delete. (cp_find_class_member): New function. (cp_print_class_member): Use it. Simplify support for bogus member pointers. * dwarf2read.c (quirk_gcc_member_function_pointer): Use lookup_methodptr_type. (read_tag_ptr_to_member_type): Likewise, and lookup_memberptr_type. * eval.c (evaluate_subexp_standard): Implement EVAL_SKIP for OP_SCOPE. Update call to value_aggregate_elt. Rewrite member pointer support. (evaluate_subexp_for_address): Handle OP_SCOPE explicitly. Handle references returned by user defined operators. * f-typeprint.c (f_print_type, f_type_print_varspec_prefix) (f_type_print_varspec_suffix): Remove support for member pointers. * gdbtypes.c (lookup_memberptr_type): Renamed from lookup_member_type and adjusted. (smash_to_memberptr_type): Likewise, from smash_to_member_type. (lookup_methodptr_type): New. (rank_one_type): Adjust for TYPE_CODE_MEMBERPTR. (recursive_dump_type): Update for new types. * gdbtypes.h (enum type_code): Replace TYPE_CODE_MEMBER with TYPE_CODE_MEMBERPTR and TYPE_CODE_METHODPTR. (lookup_memberptr_type, lookup_methodptr_type) (smash_to_memberptr_type): New prototypes. (smash_to_method_type): Formatting fix. (lookup_member_type, smash_to_member_type): Delete prototypes. * gnu-v3-abi.c (gnuv3_get_vtable, gnuv3_get_virtual_fn): New. Do not rely on debug information for the vptr or the method's enclosing type. Handle function descriptors for IA64. (gnuv3_virtual_fn_field): Rewrite using the new functions. (gnuv3_find_method_in, gnuv3_print_method_ptr) (gnuv3_method_ptr_size, gnuv3_make_method_ptr) (gnuv3_method_ptr_to_value): New. (init_gnuv3_ops): Set new members of gnu_v3_abi_ops. * hpread.c (hpread_type_lookup): Update for new types. * infcall.c (value_arg_coerce): Likewise. * m2-typeprint.c (m2_print_type): Remove explicit support for member pointers. * m2-valprint.c (m2_val_print): Likewise. * p-typeprint.c (pascal_type_print_varspec_prefix) (pascal_type_print_varspec_suffix, pascal_type_print_base): Likewise. * p-valprint.c (pascal_val_print): Likewise. (pascal_object_print_class_method, pascal_object_print_class_member): Delete. * p-lang.h (pascal_object_print_class_method) (pascal_object_print_class_member): Delete prototypes. * stabsread.c (read_type): Update for new types. * typeprint.c (print_type_scalar): Likewise. * valops.c (value_struct_elt_for_reference, value_namespace_elt) (value_maybe_namespace_elt, value_aggregate_elt): Add want_address argument. Construct a pointer to member if the address of a function or data member is requested. (value_cast_pointers): Don't modify the input value. (value_cast): Adjust pointer to member handling for new types. Allow null pointer to member constants. Don't modify the input value. (value_ind): Remove pointer to member check. Handle function descriptors for function pointers. (value_struct_elt, value_find_oload_method_list, check_field): Remove pointer to member checks. * value.c (unpack_long): Allow pointers to data members. (value_from_longest): Allow member pointers. * value.h (value_aggregate_elt): Add want_address. * varobj.c (c_variable_editable): Remove check for members. * gdbarch.sh: Add vtable_function_descriptors and vbit_in_delta. * ia64-tdep.c (ia64_convert_from_func_ptr_addr): Handle descriptors in virtual tables. (ia64_gdbarch_init): Call set_gdbarch_vtable_function_descriptors. * c-lang.h (cp_print_class_method): Delete prototype. * arm-tdep.c (arm_gdbarch_init): Call set_gdbarch_vbit_in_delta. * mips-tdep.c (mips_gdbarch_init): Likewise. * gdbarch.c, gdbarch.h: Regenerated. * gdb.cp/classes.exp (test_pointers_to_class_members): Update expected output. Test the types of members and member pointers. * gdb.cp/inherit.exp (test_print_mi_member_types): Remove KFAILs for gdb/2092. * gdb.cp/member-ptr.exp: Search for a comment instead of a statement. Enable for GCC. Update expected output for some tests and add new tests. Remove obsolete GCC KFAILs. Allow GCC's class layout. * gdb.cp/member-ptr.cc (Padding, Padding::vspacer, Base, Base::get_x) (Base::vget_base, Left, Left::vget, Right, Right::vget, Diamond) (Diamond::vget_base): New. (main): Add new tests. * gdb.cp/printmethod.exp: Update expected output for member functions. * gdb.cp/virtfunc.exp (test_virtual_calls): Add a KFAIL for print pEe->D::vg().
2007-01-03 19:05:45 +01:00
# If the elements of C++ vtables are in-place function descriptors rather
# than normal function pointers (which may point to code or a descriptor),
# set this to one.
v:int:vtable_function_descriptors:::0:0::0
* NEWS: Mention pointer to member improvements. * Makefile.in (gnu-v3-abi.o): Delete special rule. (eval.o, gnu-v3-abi.o, ia64-tdep.o): Update. * ada-valprint.c (ada_print_scalar): Update for new type codes. * c-typeprint.c (c_print_type): Update for new type codes. (c_type_print_varspec_prefix, c_type_print_varspec_suffix) (c_type_print_base): Likewise. (c_type_print_args): Rewrite. * c-valprint.c (c_val_print): Update for new type codes. Remove support for references to members. Treat methods like functions. * cp-abi.c (cplus_print_method_ptr, cplus_method_ptr_size) (cplus_make_method_ptr, cplus_method_ptr_to_value): New. * cp-abi.h (cplus_print_method_ptr, cplus_method_ptr_size) (cplus_make_method_ptr, cplus_method_ptr_to_value): New prototypes. (struct cp_abi_ops): Add corresponding members. * cp-valprint.c (cp_print_class_method): Delete. (cp_find_class_member): New function. (cp_print_class_member): Use it. Simplify support for bogus member pointers. * dwarf2read.c (quirk_gcc_member_function_pointer): Use lookup_methodptr_type. (read_tag_ptr_to_member_type): Likewise, and lookup_memberptr_type. * eval.c (evaluate_subexp_standard): Implement EVAL_SKIP for OP_SCOPE. Update call to value_aggregate_elt. Rewrite member pointer support. (evaluate_subexp_for_address): Handle OP_SCOPE explicitly. Handle references returned by user defined operators. * f-typeprint.c (f_print_type, f_type_print_varspec_prefix) (f_type_print_varspec_suffix): Remove support for member pointers. * gdbtypes.c (lookup_memberptr_type): Renamed from lookup_member_type and adjusted. (smash_to_memberptr_type): Likewise, from smash_to_member_type. (lookup_methodptr_type): New. (rank_one_type): Adjust for TYPE_CODE_MEMBERPTR. (recursive_dump_type): Update for new types. * gdbtypes.h (enum type_code): Replace TYPE_CODE_MEMBER with TYPE_CODE_MEMBERPTR and TYPE_CODE_METHODPTR. (lookup_memberptr_type, lookup_methodptr_type) (smash_to_memberptr_type): New prototypes. (smash_to_method_type): Formatting fix. (lookup_member_type, smash_to_member_type): Delete prototypes. * gnu-v3-abi.c (gnuv3_get_vtable, gnuv3_get_virtual_fn): New. Do not rely on debug information for the vptr or the method's enclosing type. Handle function descriptors for IA64. (gnuv3_virtual_fn_field): Rewrite using the new functions. (gnuv3_find_method_in, gnuv3_print_method_ptr) (gnuv3_method_ptr_size, gnuv3_make_method_ptr) (gnuv3_method_ptr_to_value): New. (init_gnuv3_ops): Set new members of gnu_v3_abi_ops. * hpread.c (hpread_type_lookup): Update for new types. * infcall.c (value_arg_coerce): Likewise. * m2-typeprint.c (m2_print_type): Remove explicit support for member pointers. * m2-valprint.c (m2_val_print): Likewise. * p-typeprint.c (pascal_type_print_varspec_prefix) (pascal_type_print_varspec_suffix, pascal_type_print_base): Likewise. * p-valprint.c (pascal_val_print): Likewise. (pascal_object_print_class_method, pascal_object_print_class_member): Delete. * p-lang.h (pascal_object_print_class_method) (pascal_object_print_class_member): Delete prototypes. * stabsread.c (read_type): Update for new types. * typeprint.c (print_type_scalar): Likewise. * valops.c (value_struct_elt_for_reference, value_namespace_elt) (value_maybe_namespace_elt, value_aggregate_elt): Add want_address argument. Construct a pointer to member if the address of a function or data member is requested. (value_cast_pointers): Don't modify the input value. (value_cast): Adjust pointer to member handling for new types. Allow null pointer to member constants. Don't modify the input value. (value_ind): Remove pointer to member check. Handle function descriptors for function pointers. (value_struct_elt, value_find_oload_method_list, check_field): Remove pointer to member checks. * value.c (unpack_long): Allow pointers to data members. (value_from_longest): Allow member pointers. * value.h (value_aggregate_elt): Add want_address. * varobj.c (c_variable_editable): Remove check for members. * gdbarch.sh: Add vtable_function_descriptors and vbit_in_delta. * ia64-tdep.c (ia64_convert_from_func_ptr_addr): Handle descriptors in virtual tables. (ia64_gdbarch_init): Call set_gdbarch_vtable_function_descriptors. * c-lang.h (cp_print_class_method): Delete prototype. * arm-tdep.c (arm_gdbarch_init): Call set_gdbarch_vbit_in_delta. * mips-tdep.c (mips_gdbarch_init): Likewise. * gdbarch.c, gdbarch.h: Regenerated. * gdb.cp/classes.exp (test_pointers_to_class_members): Update expected output. Test the types of members and member pointers. * gdb.cp/inherit.exp (test_print_mi_member_types): Remove KFAILs for gdb/2092. * gdb.cp/member-ptr.exp: Search for a comment instead of a statement. Enable for GCC. Update expected output for some tests and add new tests. Remove obsolete GCC KFAILs. Allow GCC's class layout. * gdb.cp/member-ptr.cc (Padding, Padding::vspacer, Base, Base::get_x) (Base::vget_base, Left, Left::vget, Right, Right::vget, Diamond) (Diamond::vget_base): New. (main): Add new tests. * gdb.cp/printmethod.exp: Update expected output for member functions. * gdb.cp/virtfunc.exp (test_virtual_calls): Add a KFAIL for print pEe->D::vg().
2007-01-03 19:05:45 +01:00
# Set if the least significant bit of the delta is used instead of the least
# significant bit of the pfn for pointers to virtual member functions.
v:int:vbit_in_delta:::0:0::0
# Advance PC to next instruction in order to skip a permanent breakpoint.
add a default method for gdbarch_skip_permanent_breakpoint breakpoint.c uses gdbarch_breakpoint_from_pc to determine whether a breakpoint location points at a permanent breakpoint: static int bp_loc_is_permanent (struct bp_location *loc) { ... addr = loc->address; bpoint = gdbarch_breakpoint_from_pc (loc->gdbarch, &addr, &len); ... if (target_read_memory (loc->address, target_mem, len) == 0 && memcmp (target_mem, bpoint, len) == 0) retval = 1; ... So I think we should default the gdbarch_skip_permanent_breakpoint hook to advancing the PC by the length of the breakpoint instruction, as determined by gdbarch_breakpoint_from_pc. I believe that simple implementation does the right thing for most architectures. If there's an oddball architecture where that doesn't work, then it should override the hook, just like it should be overriding the hook if there was no default anyway. The only two implementation of skip_permanent_breakpoint are i386_skip_permanent_breakpoint, for x86, and hppa_skip_permanent_breakpoint, for PA-RISC/HP-UX The x86 implementation is trivial, and can clearly be replaced by the new default. I don't know about the HP-UX one though, I know almost nothing about PA. It may well be advancing the PC ends up being equivalent. Otherwise, it must be that "jump $pc_after_bp" doesn't work either... Tested on x86_64 Fedora 20 native and gdbserver. gdb/ 2014-11-12 Pedro Alves <palves@redhat.com> * arch-utils.c (default_skip_permanent_breakpoint): New function. * arch-utils.h (default_skip_permanent_breakpoint): New declaration. * gdbarch.sh (skip_permanent_breakpoint): Now an 'f' function. Install default_skip_permanent_breakpoint as default method. * i386-tdep.c (i386_skip_permanent_breakpoint): Delete function. (i386_gdbarch_init): Don't install it. * infrun.c (resume): Assume there's always a gdbarch_skip_permanent_breakpoint implementation. * gdbarch.h, gdbarch.c: Regenerate.
2014-11-12 11:10:48 +01:00
f:void:skip_permanent_breakpoint:struct regcache *regcache:regcache:default_skip_permanent_breakpoint:default_skip_permanent_breakpoint::0
# The maximum length of an instruction on this architecture in bytes.
Implement displaced stepping. gdb/ * gdbarch.sh (max_insn_length): New 'variable'. (displaced_step_copy, displaced_step_fixup) (displaced_step_free_closure, displaced_step_location): New functions. (struct displaced_step_closure): Add forward declaration. * gdbarch.c, gdbarch.h: Regenerated. * arch-utils.c: #include "objfiles.h". (simple_displaced_step_copy_insn) (simple_displaced_step_free_closure) (displaced_step_at_entry_point): New functions. * arch-utils.h (simple_displaced_step_copy_insn) (simple_displaced_step_free_closure) (displaced_step_at_entry_point): New prototypes. * i386-tdep.c (I386_MAX_INSN_LEN): Rename to... (I386_MAX_MATCHED_INSN_LEN): ... this. (i386_absolute_jmp_p, i386_absolute_call_p) (i386_ret_p, i386_call_p, i386_breakpoint_p, i386_syscall_p) (i386_displaced_step_fixup): New functions. (struct i386_insn, i386_match_insn): Update. (i386_gdbarch_init): Set gdbarch_max_insn_length. * i386-tdep.h (I386_MAX_INSN_LEN): New. (i386_displaced_step_fixup): New prototype. * i386-linux-tdep.c (i386_linux_init_abi): Include "arch-utils.h". Register gdbarch_displaced_step_copy, gdbarch_displaced_step_fixup, gdbarch_displaced_step_free_closure, and gdbarch_displaced_step_location functions. * infrun.c (debug_displaced): New variable. (show_debug_displaced): New function. (struct displaced_step_request): New struct. (displaced_step_request_queue, displaced_step_ptid) (displaced_step_gdbarch, displaced_step_closure) (displaced_step_original, displaced_step_copy) (displaced_step_saved_copy, can_use_displaced_stepping): New variables. (show_can_use_displaced_stepping, use_displaced_stepping) (displaced_step_clear, cleanup_displaced_step_closure) (displaced_step_dump_bytes, displaced_step_prepare) (displaced_step_clear_cleanup, write_memory_ptid) (displaced_step_fixup): New functions. (resume): Call displaced_step_prepare. (proceed): Call read_pc once, and remember the value. If using displaced stepping, don't remove breakpoints. (handle_inferior_event): Call displaced_step_fixup. Add some debugging output. When we try to step over a breakpoint, but get a signal to deliver to the thread instead, ensure the step-resume breakpoint is actually inserted. If a thread hop is needed, and displaced stepping is enabled, don't remove breakpoints. (init_wait_for_inferior): Call displaced_step_clear. (_initialize_infrun): Add "set debug displaced" command. Add "maint set can-use-displaced-stepping" command. Clear displaced_step_ptid. * inferior.h (debug_displaced): Declare variable. (displaced_step_dump_bytes): Declare function. * Makefile.in (arch-utils.o, i386-linux-tdep.o): Update dependencies. gdb/testsuite/ * gdb.asm/asmsrc1.s: Add scratch space. gdb/doc/ * gdb.texinfo (Debugging Output): Document "set/show debug displaced". (Maintenance Commands): Document "maint set/show can-use-displaced-stepping".
2008-05-02 18:49:54 +02:00
V:ULONGEST:max_insn_length:::0:0
# Copy the instruction at FROM to TO, and make any adjustments
# necessary to single-step it at that address.
#
# REGS holds the state the thread's registers will have before
# executing the copied instruction; the PC in REGS will refer to FROM,
# not the copy at TO. The caller should update it to point at TO later.
#
# Return a pointer to data of the architecture's choice to be passed
# to gdbarch_displaced_step_fixup. Or, return NULL to indicate that
# the instruction's effects have been completely simulated, with the
# resulting state written back to REGS.
#
# For a general explanation of displaced stepping and how GDB uses it,
# see the comments in infrun.c.
#
# The TO area is only guaranteed to have space for
# gdbarch_max_insn_length (arch) bytes, so this function must not
# write more bytes than that to that area.
#
# If you do not provide this function, GDB assumes that the
# architecture does not support displaced stepping.
#
# If your architecture doesn't need to adjust instructions before
# single-stepping them, consider using simple_displaced_step_copy_insn
# here.
#
# If the instruction cannot execute out of line, return NULL. The
# core falls back to stepping past the instruction in-line instead in
# that case.
Implement displaced stepping. gdb/ * gdbarch.sh (max_insn_length): New 'variable'. (displaced_step_copy, displaced_step_fixup) (displaced_step_free_closure, displaced_step_location): New functions. (struct displaced_step_closure): Add forward declaration. * gdbarch.c, gdbarch.h: Regenerated. * arch-utils.c: #include "objfiles.h". (simple_displaced_step_copy_insn) (simple_displaced_step_free_closure) (displaced_step_at_entry_point): New functions. * arch-utils.h (simple_displaced_step_copy_insn) (simple_displaced_step_free_closure) (displaced_step_at_entry_point): New prototypes. * i386-tdep.c (I386_MAX_INSN_LEN): Rename to... (I386_MAX_MATCHED_INSN_LEN): ... this. (i386_absolute_jmp_p, i386_absolute_call_p) (i386_ret_p, i386_call_p, i386_breakpoint_p, i386_syscall_p) (i386_displaced_step_fixup): New functions. (struct i386_insn, i386_match_insn): Update. (i386_gdbarch_init): Set gdbarch_max_insn_length. * i386-tdep.h (I386_MAX_INSN_LEN): New. (i386_displaced_step_fixup): New prototype. * i386-linux-tdep.c (i386_linux_init_abi): Include "arch-utils.h". Register gdbarch_displaced_step_copy, gdbarch_displaced_step_fixup, gdbarch_displaced_step_free_closure, and gdbarch_displaced_step_location functions. * infrun.c (debug_displaced): New variable. (show_debug_displaced): New function. (struct displaced_step_request): New struct. (displaced_step_request_queue, displaced_step_ptid) (displaced_step_gdbarch, displaced_step_closure) (displaced_step_original, displaced_step_copy) (displaced_step_saved_copy, can_use_displaced_stepping): New variables. (show_can_use_displaced_stepping, use_displaced_stepping) (displaced_step_clear, cleanup_displaced_step_closure) (displaced_step_dump_bytes, displaced_step_prepare) (displaced_step_clear_cleanup, write_memory_ptid) (displaced_step_fixup): New functions. (resume): Call displaced_step_prepare. (proceed): Call read_pc once, and remember the value. If using displaced stepping, don't remove breakpoints. (handle_inferior_event): Call displaced_step_fixup. Add some debugging output. When we try to step over a breakpoint, but get a signal to deliver to the thread instead, ensure the step-resume breakpoint is actually inserted. If a thread hop is needed, and displaced stepping is enabled, don't remove breakpoints. (init_wait_for_inferior): Call displaced_step_clear. (_initialize_infrun): Add "set debug displaced" command. Add "maint set can-use-displaced-stepping" command. Clear displaced_step_ptid. * inferior.h (debug_displaced): Declare variable. (displaced_step_dump_bytes): Declare function. * Makefile.in (arch-utils.o, i386-linux-tdep.o): Update dependencies. gdb/testsuite/ * gdb.asm/asmsrc1.s: Add scratch space. gdb/doc/ * gdb.texinfo (Debugging Output): Document "set/show debug displaced". (Maintenance Commands): Document "maint set/show can-use-displaced-stepping".
2008-05-02 18:49:54 +02:00
M:struct displaced_step_closure *:displaced_step_copy_insn:CORE_ADDR from, CORE_ADDR to, struct regcache *regs:from, to, regs
# Return true if GDB should use hardware single-stepping to execute
# the displaced instruction identified by CLOSURE. If false,
# GDB will simply restart execution at the displaced instruction
# location, and it is up to the target to ensure GDB will receive
# control again (e.g. by placing a software breakpoint instruction
# into the displaced instruction buffer).
#
# The default implementation returns false on all targets that
# provide a gdbarch_software_single_step routine, and true otherwise.
m:int:displaced_step_hw_singlestep:struct displaced_step_closure *closure:closure::default_displaced_step_hw_singlestep::0
Implement displaced stepping. gdb/ * gdbarch.sh (max_insn_length): New 'variable'. (displaced_step_copy, displaced_step_fixup) (displaced_step_free_closure, displaced_step_location): New functions. (struct displaced_step_closure): Add forward declaration. * gdbarch.c, gdbarch.h: Regenerated. * arch-utils.c: #include "objfiles.h". (simple_displaced_step_copy_insn) (simple_displaced_step_free_closure) (displaced_step_at_entry_point): New functions. * arch-utils.h (simple_displaced_step_copy_insn) (simple_displaced_step_free_closure) (displaced_step_at_entry_point): New prototypes. * i386-tdep.c (I386_MAX_INSN_LEN): Rename to... (I386_MAX_MATCHED_INSN_LEN): ... this. (i386_absolute_jmp_p, i386_absolute_call_p) (i386_ret_p, i386_call_p, i386_breakpoint_p, i386_syscall_p) (i386_displaced_step_fixup): New functions. (struct i386_insn, i386_match_insn): Update. (i386_gdbarch_init): Set gdbarch_max_insn_length. * i386-tdep.h (I386_MAX_INSN_LEN): New. (i386_displaced_step_fixup): New prototype. * i386-linux-tdep.c (i386_linux_init_abi): Include "arch-utils.h". Register gdbarch_displaced_step_copy, gdbarch_displaced_step_fixup, gdbarch_displaced_step_free_closure, and gdbarch_displaced_step_location functions. * infrun.c (debug_displaced): New variable. (show_debug_displaced): New function. (struct displaced_step_request): New struct. (displaced_step_request_queue, displaced_step_ptid) (displaced_step_gdbarch, displaced_step_closure) (displaced_step_original, displaced_step_copy) (displaced_step_saved_copy, can_use_displaced_stepping): New variables. (show_can_use_displaced_stepping, use_displaced_stepping) (displaced_step_clear, cleanup_displaced_step_closure) (displaced_step_dump_bytes, displaced_step_prepare) (displaced_step_clear_cleanup, write_memory_ptid) (displaced_step_fixup): New functions. (resume): Call displaced_step_prepare. (proceed): Call read_pc once, and remember the value. If using displaced stepping, don't remove breakpoints. (handle_inferior_event): Call displaced_step_fixup. Add some debugging output. When we try to step over a breakpoint, but get a signal to deliver to the thread instead, ensure the step-resume breakpoint is actually inserted. If a thread hop is needed, and displaced stepping is enabled, don't remove breakpoints. (init_wait_for_inferior): Call displaced_step_clear. (_initialize_infrun): Add "set debug displaced" command. Add "maint set can-use-displaced-stepping" command. Clear displaced_step_ptid. * inferior.h (debug_displaced): Declare variable. (displaced_step_dump_bytes): Declare function. * Makefile.in (arch-utils.o, i386-linux-tdep.o): Update dependencies. gdb/testsuite/ * gdb.asm/asmsrc1.s: Add scratch space. gdb/doc/ * gdb.texinfo (Debugging Output): Document "set/show debug displaced". (Maintenance Commands): Document "maint set/show can-use-displaced-stepping".
2008-05-02 18:49:54 +02:00
# Fix up the state resulting from successfully single-stepping a
# displaced instruction, to give the result we would have gotten from
# stepping the instruction in its original location.
#
# REGS is the register state resulting from single-stepping the
# displaced instruction.
#
# CLOSURE is the result from the matching call to
# gdbarch_displaced_step_copy_insn.
#
# If you provide gdbarch_displaced_step_copy_insn.but not this
# function, then GDB assumes that no fixup is needed after
# single-stepping the instruction.
#
# For a general explanation of displaced stepping and how GDB uses it,
# see the comments in infrun.c.
M:void:displaced_step_fixup:struct displaced_step_closure *closure, CORE_ADDR from, CORE_ADDR to, struct regcache *regs:closure, from, to, regs::NULL
# Free a closure returned by gdbarch_displaced_step_copy_insn.
#
# If you provide gdbarch_displaced_step_copy_insn, you must provide
# this function as well.
#
# If your architecture uses closures that don't need to be freed, then
# you can use simple_displaced_step_free_closure here.
#
# For a general explanation of displaced stepping and how GDB uses it,
# see the comments in infrun.c.
m:void:displaced_step_free_closure:struct displaced_step_closure *closure:closure::NULL::(! gdbarch->displaced_step_free_closure) != (! gdbarch->displaced_step_copy_insn)
# Return the address of an appropriate place to put displaced
# instructions while we step over them. There need only be one such
# place, since we're only stepping one thread over a breakpoint at a
# time.
#
# For a general explanation of displaced stepping and how GDB uses it,
# see the comments in infrun.c.
m:CORE_ADDR:displaced_step_location:void:::NULL::(! gdbarch->displaced_step_location) != (! gdbarch->displaced_step_copy_insn)
# Relocate an instruction to execute at a different address. OLDLOC
# is the address in the inferior memory where the instruction to
# relocate is currently at. On input, TO points to the destination
# where we want the instruction to be copied (and possibly adjusted)
# to. On output, it points to one past the end of the resulting
# instruction(s). The effect of executing the instruction at TO shall
# be the same as if executing it at FROM. For example, call
# instructions that implicitly push the return address on the stack
# should be adjusted to return to the instruction after OLDLOC;
# relative branches, and other PC-relative instructions need the
# offset adjusted; etc.
M:void:relocate_instruction:CORE_ADDR *to, CORE_ADDR from:to, from::NULL
# Refresh overlay mapped state for section OSECT.
F:void:overlay_update:struct obj_section *osect:osect
M:const struct target_desc *:core_read_description:struct target_ops *target, bfd *abfd:target, abfd
# Handle special encoding of static variables in stabs debug info.
* gdbtypes.h (struct main_type): Change type of name,tag_name, and fields.name members from char * to const char *. All uses updated. (struct cplus_struct_type): Change type of fn_fieldlists.name member from char * to const char *. All uses updated. (type_name_no_tag): Update. (lookup_unsigned_typename, lookup_signed_typename): Update. * gdbtypes.c (type_name_no_tag): Change result type from char * to const char *. All callers updated. (lookup_unsigned_typename, lookup_signed_typename): Change type of name parameter from char * to const char *. * symtab.h (struct cplus_specific): Change type of demangled_name member from char * to const char *. All uses updated. (struct general_symbol_info): Change type of name and mangled_lang.demangled_name members from char * to const char *. All uses updated. (symbol_get_demangled_name, symbol_natural_name): Update. (symbol_demangled_name, symbol_search_name): Update. * symtab.c (symbol_get_demangled_name): Change result type from char * to const char *. All callers updated. (symbol_natural_name, symbol_demangled_name): Ditto. (symbol_search_name): Ditto. (completion_list_add_name): Change type of symname,sym_text, text,word parameters from char * to const char *. (completion_list_objc_symbol): Change type of sym_text, text,word parameters from char * to const char *. * ada-lang.c (find_struct_field): Change type of name parameter from char * to const char *. (encoded_ordered_before): Similarly for N0,N1 parameters. (old_renaming_is_invisible): Similarly for function_name parameter. (ada_type_name): Change result type from char * to const char *. All callers updated. * ada-lang.h (ada_type_name): Update. * buildsym.c (hashname): Change type of name parameter from char * to const char *. * buildsym.h (hashname): Update. * dbxread.c (end_psymtab): Change type of include_list parameter from char ** to const char **. * dwarf2read.c (determine_prefix): Change result type from char * to const char *. All callers updated. * f-lang.c (find_common_for_function): Change type of name, funcname parameters from char * to const char *. * f-lang.c (find_common_for_function): Update. * f-valprint.c (list_all_visible_commons): Change type of funcname parameters from char * to const char *. * gdbarch.sh (static_transform_name): Change type of name parameter and result from char * to const char *. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * i386-sol2-tdep.c (i386_sol2_static_transform_name): Change type of name parameter from char * to const char *. * jv-lang.c (java_primitive_type_from_name): Ditto. (java_demangled_signature_length): Similarly for signature parameter. (java_demangled_signature_copy): Ditto. (java_demangle_type_signature): Ditto. * jv-lang.h (java_primitive_type_from_name): Update. (java_demangle_type_signature): Update. * objc-lang.c (specialcmp): Change type of a,b parameters from char * to const char *. * p-lang.c (is_pascal_string_type): Change type of arrayname parameter from char * to const char *. All callers updated. * p-lang.h (is_pascal_string_type): Update. * solib-frv.c (find_canonical_descriptor_in_load_object): Change type of name parameter from char * to const char *. * sparc-sol2-tdep.c (sparc_sol2_static_transform_name): Ditto. * utils.c (fprintf_symbol_filtered): Ditto. * defs.h (fprintf_symbol_filtered): Update. * sparc-tdep.h (sparc_sol2_static_transform_name): Update. * stabsread.h (end_psymtab): Update. * stack.c (find_frame_funname): Change type of funname parameter from char ** to const char **. * stack.h (find_frame_funname): Update. * typeprint.c (type_print): Change type of varstring parameter from char * to const char *. * value.h (type_print): Update. * xcoffread.c (xcoff_start_psymtab): Change type of filename parameter from char * to const char *. All callers updated. (xcoff_end_psymtab): Change type of include_list parameter from char ** to const char **. All callers updated. (swap_sym): Similarly for name parameter. All callers updated. * coffread.c (patch_type): Add (char*) cast to xfree parameter. Use xstrdup. (process_coff_symbol): Use xstrdup. * stabsread.c (stabs_method_name_from_physname): Renamed from update_method_name_from_physname. Change result type from void to char *. All callers updated. (read_member_functions): In has_destructor case, store name in objfile obstack instead of malloc space. In !has_stub case, fix mem leak.
2012-02-07 05:48:23 +01:00
F:const char *:static_transform_name:const char *name:name
* gdbarch.sh (sofun_address_maybe_missing): New gdbarch variable. * gdbarch.c, gdbarch.h: Regenerate. * dbxread.c (find_stab_function_addr): Define unconditionally. (read_dbx_symtab): Use gdbarch_sofun_address_maybe_missing instead of SOFUN_ADDRESS_MAYBE_MISSING. (end_psymtab): Likewise. (process_one_symbol): Likewise. * mdebugread.c (parse_partial_symbols): Likewise. * symtab.h (struct minimal_symbol): Always define "filename" member. * elfread.c (elf_symtab_read): Use msym->filename unconditionally. * minsyms.c (lookup_minimal_symbol): Likewise. * symmisc.c (dump_msymbols): Likewise. * config/i386/i386sol2.mt (DEPRECATED_TM_FILE): Remove. * config/i386/linux.mt (DEPRECATED_TM_FILE): Remove. * config/i386/tm-i386sol2.h: Remove file. * config/i386/tm-linux.h: Remove file. * i386-linux-tdep.c (i386_linux_init_abi): Add call to set_gdbarch_sofun_address_maybe_missing. * i386-sol2-tdep.c (i386_sol2_init_abi): Likewise. * config/powerpc/linux.mt (DEPRECATED_TM_FILE): Remove. * config/powerpc/nbsd.mt (DEPRECATED_TM_FILE): Remove. * config/powerpc/obsd.mt (DEPRECATED_TM_FILE): Remove. * config/powerpc/ppc-eabi.mt (DEPRECATED_TM_FILE): Remove. * config/powerpc/ppc-sim.mt (DEPRECATED_TM_FILE): Remove. * config/powerpc/tm-ppc-eabi.h: Remove file. * rs6000-tdep.c (rs6000_gdbarch_init): Add call to set_gdbarch_sofun_address_maybe_missing. * config/sparc/sol2-64.mt (DEPRECATED_TM_FILE): Remove. * config/sparc/sol2.mt (DEPRECATED_TM_FILE): Remove. * config/sparc/tm-sol2.h: Remove file. * sparc64-sol2-tdep.c (sparc64_sol2_init_abi): Add call to set_gdbarch_sofun_address_maybe_missing. * sparc-sol2-tdep.c (sparc32_sol2_init_abi): Likewise. doc/ChangeLog: * gdbarch.texi (Target Conditionals): Remove documentation of SOFUN_ADDRESS_MAYBE_MISSING, replaced by ... (Compiler Characteristics): ... documentation of set_gdbarch_sofun_address_maybe_missing.
2007-10-19 14:26:35 +02:00
# Set if the address in N_SO or N_FUN stabs may be zero.
v:int:sofun_address_maybe_missing:::0:0::0
# Parse the instruction at ADDR storing in the record execution log
# the registers REGCACHE and memory ranges that will be affected when
# the instruction executes, along with their current values.
# Return -1 if something goes wrong, 0 otherwise.
M:int:process_record:struct regcache *regcache, CORE_ADDR addr:regcache, addr
# Save process state after a signal.
# Return -1 if something goes wrong, 0 otherwise.
M:int:process_record_signal:struct regcache *regcache, enum gdb_signal signal:regcache, signal
# Signal translation: translate inferior's signal (target's) number
# into GDB's representation. The implementation of this method must
# be host independent. IOW, don't rely on symbols of the NAT_FILE
# header (the nm-*.h files), the host <signal.h> header, or similar
# headers. This is mainly used when cross-debugging core files ---
# "Live" targets hide the translation behind the target interface
# (target_wait, target_resume, etc.).
M:enum gdb_signal:gdb_signal_from_target:int signo:signo
This patch implements the new gdbarch method gdbarch_gdb_signal_to_target. It will be used when one wants to convert between the internal GDB signal representation (enum gdb_signal) and the target's representation. The idea of this patch came from a chat between Pedro and I on IRC, plus the discussion of my patches to add the new $_exitsignal convenience variable: <http://sourceware.org/ml/gdb-patches/2013-06/msg00452.html> <http://sourceware.org/ml/gdb-patches/2013-06/msg00352.html> What I did was to investigate, on the Linux kernel, which targets shared the signal numbers definition with the generic definition, present at <include/uapi/asm-generic/signal.h>. For the record, I used linux-3.10-rc7 as the main source of information, always looking at <arch/<ARCH_NAME>/include/uapi/asm/signal.h>. For SIGRTMAX (which defaults to _NSIG in most cases), I had to look at different signal-related files, but most of them (except MIPS) were defined to 64 anyway. Then, with all the differences in hand, I implemented the bits on each target. 2013-08-09 Sergio Durigan Junior <sergiodj@redhat.com> * linux-tdep.c: Define enum with generic signal numbers. (linux_gdb_signal_from_target): New function. (linux_gdb_signal_to_target): Likewise. (linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target methods to the functions above. * linux-tdep.h (linux_gdb_signal_from_target): New prototype. (linux_gdb_signal_to_target): Likewise. * alpha-linux-tdep.c: Define new enum with signals different from generic Linux kernel. (alpha_linux_gdb_signal_from_target): New function. (alpha_linux_gdb_signal_to_target): Likewise. (alpha_linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target with the functions mentioned above. * avr-tdep.c: Define enum with differences between Linux kernel and AVR signals. (avr_linux_gdb_signal_from_target): New function. (avr_linux_gdb_signal_to_target): Likewise. (avr_gdbarch_init): Set gdbarch_gdb_signal_{to,from}_target to the functions mentioned above. * sparc-linux-tdep.c: Define enum with differences between SPARC and generic Linux kernel signal numbers. (sparc32_linux_gdb_signal_from_target): New function. (sparc32_linux_gdb_signal_to_target): Likewise. (sparc32_linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target to the functions defined above. * xtensa-linux-tdep.c: Define enum with differences between Xtensa and Linux kernel generic signals. (xtensa_linux_gdb_signal_from_target): New function. (xtensa_linux_gdb_signal_to_target): Likewise. (xtensa_linux_init_abi): Set gdbarch_gdb_signal_to_target to the functions defined above. * mips-linux-tdep.c: Define enum with differences between signals in MIPS and Linux kernel generic ones. (mips_gdb_signal_to_target): New function. (mips_gdb_signal_from_target): Redefine to use new enum, handle only different signals from the Linux kernel generic. (mips_linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target the functions defined above. * mips-linux-tdep.h (enum mips_signals): Remove.
2013-08-09 18:54:43 +02:00
# Signal translation: translate the GDB's internal signal number into
# the inferior's signal (target's) representation. The implementation
# of this method must be host independent. IOW, don't rely on symbols
# of the NAT_FILE header (the nm-*.h files), the host <signal.h>
# header, or similar headers.
# Return the target signal number if found, or -1 if the GDB internal
# signal number is invalid.
M:int:gdb_signal_to_target:enum gdb_signal signal:signal
2009-02-06 Pedro Alves <pedro@codesourcery.com> gdb/ * target.h (enum target_object): Add new TARGET_OBJECT_SIGNAL_INFO. * infrun.c (siginfo_value_read, siginfo_value_write): New. (siginfo_value_funcs): New. (siginfo_make_value): New. (_initialize_infrun): Create the $_siginfo convenience variable. * gdbtypes.h (append_composite_type_field_aligned): Declare. * gdbtypes.c (append_composite_type_field): Rename to... (append_composite_type_field_aligned): ... this. Add ALIGNMENT argument. Handle it. (append_composite_type_field): Rewrite on top of append_composite_type_field_aligned. * value.h (internalvar_make_value): New typedef. (struct internalvar) <make_value>: New field. (create_internalvar_type_lazy): Declare. * value.c (create_internalvar): Clear make_value. (create_internalvar_type_lazy): New. (value_of_internalvar): If make_value is set use it. (preserve_values): Skip internal variables that don't have a value. * gdbarch.sh (get_siginfo_type): New. * gdbarch.h, gdbarch.c: Regenerate. * linux-tdep.h, linux-tdep.c: New. * amd64-linux-tdep.c: Include "linux-tdep.h". (amd64_linux_init_abi): Register linux_get_siginfo_type and linux_get_siginfo_mapper. * i386-linux-tdep.c: Include "linux-tdep.h". (i386_linux_init_abi): Register linux_get_siginfo_type and linux_get_siginfo_mapper. * arm-linux-tdep.c: Include "linux-tdep.h". (i386_linux_init_abi): Register linux_get_siginfo_type and linux_get_siginfo_mapper. * linux-nat.c (linux_xfer_siginfo): New. (linux_nat_xfer_partial): Handle TARGET_OBJECT_SIGNAL_INFO. * remote.c (PACKET_qXfer_siginfo_read) (PACKET_qXfer_siginfo_write): New. (feature remote_protocol_features): Add "qXfer:siginfo:read" and "qXfer:siginfo:write" features. (remote_xfer_partial): Handle TARGET_OBJECT_SIGNAL_INFO. (_initialize_remote): Add "set/show remote read-siginfo-object" and "set/show remote write-siginfo-object" commands. * Makefile.in (ALL_TARGET_OBS): Add linux-tdep.o. (HFILES_NO_SRCDIR): Add linux-tdep.h. (ALLDEPFILES): Add linux-tdep.c. * configure.tgt (arm*-*-linux* | arm*-*-uclinux*) (i[34567]86-*-linux*, x86_64-*-linux*): Add linux-tdep.o to gdb_target_obs. 2009-02-06 Pedro Alves <pedro@codesourcery.com> gdb/gdbserver/ * server.c (handle_query): Report qXfer:siginfo:read and qXfer:siginfo:write as supported and handle them. * target.h (struct target_ops) <qxfer_siginfo>: New field. * linux-low.c (linux_xfer_siginfo): New. (linux_target_ops): Set it. 2009-02-06 Pedro Alves <pedro@codesourcery.com> gdb/doc/ * gdb.texinfo (Signals): Document $_siginfo. (Convenience Variables): Mention $_siginfo. (Remote Configuration): Document qXfer:siginfo:read, qXfer:siginfo:write packets, and the read-siginfo-object, write-siginfo-object commands. 2009-02-06 Pedro Alves <pedro@codesourcery.com> gdb/testsuite/ * gdb.base/siginfo-obj.c, gdb.base/siginfo-obj.exp: New.
2009-02-06 23:59:01 +01:00
# Extra signal info inspection.
#
# Return a type suitable to inspect extra signal information.
M:struct type *:get_siginfo_type:void:
# Record architecture-specific information from the symbol table.
M:void:record_special_symbol:struct objfile *objfile, asymbol *sym:objfile, sym
Implementing catch syscall. * amd64-linux-tdep.c: Include xml-syscall.h header, define the XML syscall name for the architecture. (amd64_linux_get_syscall_number): New function. (amd64_linux_init_abi): Register the correct functions for syscall catchpoint; set the correct syscall file name. * breakpoint.c: New include: xml-syscall.h. (set_raw_breakpoint_without_location): Setting the parameters for the catch syscall feature. (insert_catch_syscall): New. (remove_catch_syscall): New. (breakpoint_hit_catch_syscall): New. (print_it_catch_syscall): New. (print_one_catch_syscall): New. (print_mention_catch_syscall): New. (catch_syscall_breakpoint_ops): New. (syscall_catchpoint_p): New. (create_catchpoint_without_mention): New. (create_catchpoint): Modified in order to use create_catchpoint_without_mention. (create_syscall_event_catchpoint): New. (clean_up_filters): New. (catch_syscall_split_args): New. (catch_syscall_command_1): New. (delete_breakpoint): Add cleanup for catch syscall. (is_syscall_catchpoint_enabled): New. (catch_syscall_enabled): New. (catching_syscall_number): New. (catch_syscall_completer): New completer function. (add_catch_command): Add the completer function for catchpoints. * breakpoint.h (syscalls_to_be_caught): New vector. (catch_syscall_enabled): New. (catching_syscall_number): New. * gdbarch.c: Regenerated. * gdbarch.h: Regenerated. * gdbarch.sh: Add syscall catchpoint functions and structures. (get_syscall_number): New. (UNKNOWN_SYSCALL): New definition. * i386-linux-nat.c (i386_linux_resume): Select the proper request to be made for ptrace() considering if we are catching syscalls or not. * i386-linux-tdep.c: Include xml-syscall.h header, define the XML syscall name for the architecture. (i386_linux_get_syscall_number): New. (i386_linux_init_abi): Register the correct functions for syscall catchpoint; set the correct syscall file name. * inf-child.c (inf_child_set_syscall_catchpoint): New. (inf_child_target): Assign default values to target_ops. * inf-ptrace.c (inf_ptrace_resume): Select the proper request to be made for ptrace() considering if we are catching syscalls or not. * inferior.h (struct inferior): Included new variables any_syscall_count, syscalls_counts and total_syscalls_count, used to keep track of requested syscall catchpoints. * infrun.c (resume): Add syscall catchpoint. (deal_with_syscall_event): New. (handle_inferior_event): Add syscall entry/return events. (inferior_has_called_syscall): New. * linux-nat.c: Define some helpful variables to track wether we have support for the needed ptrace option. (linux_test_for_tracesysgood): New. (linux_supports_tracesysgood): New. (linux_enable_tracesysgood): New. (linux_enable_event_reporting): Save the current used ptrace options. (linux_child_post_attach): Calling linux_enable_tracesysgood. (linux_child_post_startup_inferior): Likewise. (linux_child_set_syscall_catchpoint): New function. (linux_handle_extended_wait): Handle the case which the inferior stops because it has called or returned from a syscall. (linux_target_install_ops): Install the necessary functions to handle syscall catchpoints. * linux-nat.h (struct lwp_info): Include syscall_state into the structure, which indicates if we are in a syscall entry or return. * ppc-linux-tdep.c: Include xml-syscall.h header, define the XML syscall filename for the arch. (ppc_linux_get_syscall_number): New. (ppc_linux_init_abi): Register the correct functions for syscall catchpoint; setting the correct name for the XML syscall file. * target.c (update_current_target): Update/copy functions related to syscall catchpoint. (target_waitstatus_to_string): Add syscall catchpoint entry/return events. * target.h (struct target_waitstatus): Add syscall number. (struct syscall): New struct to hold information about syscalls in the system. (struct target_ops): Add ops for syscall catchpoint. (inferior_has_called_syscall): New. (target_set_syscall_catchpoint): New. * xml-support.c (xml_fetch_content_from_file): New function, transferred from xml-tdesc.c. * xml-support.h (xml_fetch_content_from_file): New. * xml-tdesc.c (fetch_xml_from_file): Function removed; transferred to xml-support.c. (file_read_description_xml): Updated to use the new xml_fetch_content_from_file function. * syscalls/gdb-syscalls.dtd: New definition file for syscall's XML support. * syscalls/amd64-linux.xml: New file containing information about syscalls for GNU/Linux systems that use amd64 architecture. * syscalls/i386-linux.xml: New file containing information about syscalls for GNU/Linux systems that use i386 architecture. * syscalls/ppc-linux.xml: New file containing information about syscalls for GNU/Linux systems that use PPC architecture. * syscalls/ppc64-linux.xml: New file containing information about syscalls for GNU/Linux systems that use PPC64 architecture. * xml-syscall.c: New file containing functions for manipulating syscall's XML files. * xml-syscall.h: New file, exporting the functions above mentioned. * Makefile.in: Support for relocatable GDB datadir and XML syscall. * NEWS: Added information about the catch syscall feature. * doc/gdb.texinfo (Set Catchpoints): Documentation about the new feature. * testsuite/Makefile.in: Inclusion of catch-syscall object. * testsuite/gdb.base/catch-syscall.c: New file. * testsuite/gdb.base/catch-syscall.exp: New file.
2009-09-15 05:30:08 +02:00
# Function for the 'catch syscall' feature.
# Get architecture-specific system calls information from registers.
M:LONGEST:get_syscall_number:ptid_t ptid:ptid
Partial fix for PR breakpoints/10737: Make syscall info be per-arch instead of global This patch intends to partially fix PR breakpoints/10737, which is about making the syscall information (for the "catch syscall" command) be per-arch, instead of global. This is not a full fix because of the other issues pointed by Pedro here: <https://sourceware.org/bugzilla/show_bug.cgi?id=10737#c5> However, I consider it a good step towards the real fix. It will also help me fix <https://sourceware.org/bugzilla/show_bug.cgi?id=17402>. What this patch does, basically, is move the "syscalls_info" struct to gdbarch. Currently, the syscall information is stored in a global variable inside gdb/xml-syscall.c, which means that there is no easy way to correlate this info with the current target or architecture being used, for example. This causes strange behaviors, because the syscall info is not re-read when the arch changes. For example, if you put a syscall catchpoint in syscall 5 on i386 (syscall open), and then load a x86_64 program on GDB and put the same syscall 5 there (fstat on x86_64), you will still see that GDB tells you that it is catching "open", even though it is not. With this patch, GDB correctly says that it will be catching fstat syscalls. (gdb) set architecture i386 The target architecture is assumed to be i386 (gdb) catch syscall 5 Catchpoint 1 (syscall 'open' [5]) (gdb) set architecture i386:x86-64 The target architecture is assumed to be i386:x86-64 (gdb) catch syscall 5 Catchpoint 2 (syscall 'open' [5]) But with the patch: (gdb) set architecture i386 The target architecture is assumed to be i386 (gdb) catch syscall 5 Catchpoint 1 (syscall 'open' [5]) (gdb) set architecture i386:x86-64 The target architecture is assumed to be i386:x86-64 (gdb) catch syscall 5 Catchpoint 2 (syscall 'fstat' [5]) As I said, there are still some problems on the "catch syscall" mechanism, because (for example) the user should be able to "catch syscall open" on i386, and then expect "open" to be caught also on x86_64. Currently, it doesn't work. I intend to work on this later. gdb/ 2014-11-20 Sergio Durigan Junior <sergiodj@redhat.com> PR breakpoints/10737 * amd64-linux-tdep.c (amd64_linux_init_abi_common): Adjust call to set_xml_syscall_file_name to provide gdbarch. * arm-linux-tdep.c (arm_linux_init_abi): Likewise. * bfin-linux-tdep.c (bfin_linux_init_abi): Likewise. * breakpoint.c (print_it_catch_syscall): Adjust call to get_syscall_by_number to provide gdbarch. (print_one_catch_syscall): Likewise. (print_mention_catch_syscall): Likewise. (print_recreate_catch_syscall): Likewise. (catch_syscall_split_args): Adjust calls to get_syscall_by_number and get_syscall_by_name to provide gdbarch. (catch_syscall_completer): Adjust call to get_syscall_names to provide gdbarch. * gdbarch.c: Regenerate. * gdbarch.h: Likewise. * gdbarch.sh: Forward declare "struct syscalls_info". (xml_syscall_file): New variable. (syscalls_info): Likewise. * i386-linux-tdep.c (i386_linux_init_abi): Adjust call to set_xml_syscall_file_name to provide gdbarch. * mips-linux-tdep.c (mips_linux_init_abi): Likewise. * ppc-linux-tdep.c (ppc_linux_init_abi): Likewise. * s390-linux-tdep.c (s390_gdbarch_init): Likewise. * sparc-linux-tdep.c (sparc32_linux_init_abi): Likewise. * sparc64-linux-tdep.c (sparc64_linux_init_abi): Likewise. * xml-syscall.c: Include gdbarch.h. (set_xml_syscall_file_name): Accept gdbarch parameter. (get_syscall_by_number): Likewise. (get_syscall_by_name): Likewise. (get_syscall_names): Likewise. (my_gdb_datadir): Delete global variable. (struct syscalls_info) <my_gdb_datadir>: New variable. (struct syscalls_info) <sysinfo>: Rename variable to "syscalls_info". (sysinfo): Delete global variable. (have_initialized_sysinfo): Likewise. (xml_syscall_file): Likewise. (sysinfo_free_syscalls_desc): Rename to... (syscalls_info_free_syscalls_desc): ... this. (free_syscalls_info): Rename "sysinfo" to "syscalls_info". Adjust code to the new layout of "struct syscalls_info". (make_cleanup_free_syscalls_info): Rename parameter "sysinfo" to "syscalls_info". (syscall_create_syscall_desc): Likewise. (syscall_start_syscall): Likewise. (syscall_parse_xml): Likewise. (xml_init_syscalls_info): Likewise. Drop "const" from return value. (init_sysinfo): Rename to... (init_syscalls_info): ...this. Add gdbarch as a parameter. Adjust function to deal with gdbarch. (xml_get_syscall_number): Delete parameter sysinfo. Accept gdbarch as a parameter. Adjust code. (xml_get_syscall_name): Likewise. (xml_list_of_syscalls): Likewise. (set_xml_syscall_file_name): Accept gdbarch as parameter. (get_syscall_by_number): Likewise. (get_syscall_by_name): Likewise. (get_syscall_names): Likewise. * xml-syscall.h (set_xml_syscall_file_name): Likewise. (get_syscall_by_number): Likewise. (get_syscall_by_name): Likewise. (get_syscall_names): Likewise. gdb/testsuite/ 2014-11-20 Sergio Durigan Junior <sergiodj@redhat.com> PR breakpoints/10737 * gdb.base/catch-syscall.exp (do_syscall_tests): Call test_catch_syscall_multi_arch. (test_catch_syscall_multi_arch): New function.
2014-11-20 18:28:18 +01:00
# The filename of the XML syscall for this architecture.
v:const char *:xml_syscall_file:::0:0::0:pstring (gdbarch->xml_syscall_file)
# Information about system calls from this architecture
v:struct syscalls_info *:syscalls_info:::0:0::0:host_address_to_string (gdbarch->syscalls_info)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
# SystemTap related fields and functions.
Extend SystemTap SDT probe argument parser This patch extends the current generic parser for SystemTap SDT probe arguments. It can be almost considered a cleanup, but the main point of it is actually to allow the generic parser to accept multiple prefixes and suffixes for the its operands (i.e., integers, register names, and register indirection). I have chosen to implement this as a list of const strings, and declare this list as "static" inside each target's method used to initialize gdbarch. This patch is actually a preparation for an upcoming patch for ARM, which implements the support for multiple integer prefixes (as defined by ARM's asm spec). And AArch64 will also need this, for the same reason. This patch was regtested on all architectures that it touches (i.e., i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found. 2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com> * amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe argument prefixes and suffixes. Initialize gdbarch with them. * arm-linux-tdep.c (arm_linux_init_abi): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix, stap_integer_suffix) (stap_register_prefix, stap_register_suffix) (stap_register_indirection_prefix) (stap_register_indirection_suffix): Declare as "const char *const *" instead of "const char *". Adjust printing function. Rename all of the variables to the plural. (pstring_list): New function. * i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe argument prefixes and suffixes. Initialize gdbarch with them. * ia64-linux-tdep.c (ia64_linux_init_abi): Likewise. * ppc-linux-tdep.c (ppc_linux_init_abi): Likewise. * s390-linux-tdep.c (s390_gdbarch_init): Likewise. * stap-probe.c (stap_is_generic_prefix): New function. (stap_is_register_prefix): Likewise. (stap_is_register_indirection_prefix): Likewise. (stap_is_integer_prefix): Likewise. (stap_generic_check_suffix): Likewise. (stap_check_integer_suffix): Likewise. (stap_check_register_suffix): Likewise. (stap_check_register_indirection_suffix): Likewise. (stap_parse_register_operand): Remove unecessary declarations for variables holding prefix and suffix information. Use the new functions listed above for checking for prefixes and suffixes. (stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
# A NULL-terminated array of prefixes used to mark an integer constant
# on the architecture's assembly.
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
# For example, on x86 integer constants are written as:
#
# \$10 ;; integer constant 10
#
# in this case, this prefix would be the character \`\$\'.
Extend SystemTap SDT probe argument parser This patch extends the current generic parser for SystemTap SDT probe arguments. It can be almost considered a cleanup, but the main point of it is actually to allow the generic parser to accept multiple prefixes and suffixes for the its operands (i.e., integers, register names, and register indirection). I have chosen to implement this as a list of const strings, and declare this list as "static" inside each target's method used to initialize gdbarch. This patch is actually a preparation for an upcoming patch for ARM, which implements the support for multiple integer prefixes (as defined by ARM's asm spec). And AArch64 will also need this, for the same reason. This patch was regtested on all architectures that it touches (i.e., i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found. 2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com> * amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe argument prefixes and suffixes. Initialize gdbarch with them. * arm-linux-tdep.c (arm_linux_init_abi): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix, stap_integer_suffix) (stap_register_prefix, stap_register_suffix) (stap_register_indirection_prefix) (stap_register_indirection_suffix): Declare as "const char *const *" instead of "const char *". Adjust printing function. Rename all of the variables to the plural. (pstring_list): New function. * i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe argument prefixes and suffixes. Initialize gdbarch with them. * ia64-linux-tdep.c (ia64_linux_init_abi): Likewise. * ppc-linux-tdep.c (ppc_linux_init_abi): Likewise. * s390-linux-tdep.c (s390_gdbarch_init): Likewise. * stap-probe.c (stap_is_generic_prefix): New function. (stap_is_register_prefix): Likewise. (stap_is_register_indirection_prefix): Likewise. (stap_is_integer_prefix): Likewise. (stap_generic_check_suffix): Likewise. (stap_check_integer_suffix): Likewise. (stap_check_register_suffix): Likewise. (stap_check_register_indirection_suffix): Likewise. (stap_parse_register_operand): Remove unecessary declarations for variables holding prefix and suffix information. Use the new functions listed above for checking for prefixes and suffixes. (stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
v:const char *const *:stap_integer_prefixes:::0:0::0:pstring_list (gdbarch->stap_integer_prefixes)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
Extend SystemTap SDT probe argument parser This patch extends the current generic parser for SystemTap SDT probe arguments. It can be almost considered a cleanup, but the main point of it is actually to allow the generic parser to accept multiple prefixes and suffixes for the its operands (i.e., integers, register names, and register indirection). I have chosen to implement this as a list of const strings, and declare this list as "static" inside each target's method used to initialize gdbarch. This patch is actually a preparation for an upcoming patch for ARM, which implements the support for multiple integer prefixes (as defined by ARM's asm spec). And AArch64 will also need this, for the same reason. This patch was regtested on all architectures that it touches (i.e., i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found. 2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com> * amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe argument prefixes and suffixes. Initialize gdbarch with them. * arm-linux-tdep.c (arm_linux_init_abi): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix, stap_integer_suffix) (stap_register_prefix, stap_register_suffix) (stap_register_indirection_prefix) (stap_register_indirection_suffix): Declare as "const char *const *" instead of "const char *". Adjust printing function. Rename all of the variables to the plural. (pstring_list): New function. * i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe argument prefixes and suffixes. Initialize gdbarch with them. * ia64-linux-tdep.c (ia64_linux_init_abi): Likewise. * ppc-linux-tdep.c (ppc_linux_init_abi): Likewise. * s390-linux-tdep.c (s390_gdbarch_init): Likewise. * stap-probe.c (stap_is_generic_prefix): New function. (stap_is_register_prefix): Likewise. (stap_is_register_indirection_prefix): Likewise. (stap_is_integer_prefix): Likewise. (stap_generic_check_suffix): Likewise. (stap_check_integer_suffix): Likewise. (stap_check_register_suffix): Likewise. (stap_check_register_indirection_suffix): Likewise. (stap_parse_register_operand): Remove unecessary declarations for variables holding prefix and suffix information. Use the new functions listed above for checking for prefixes and suffixes. (stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
# A NULL-terminated array of suffixes used to mark an integer constant
# on the architecture's assembly.
v:const char *const *:stap_integer_suffixes:::0:0::0:pstring_list (gdbarch->stap_integer_suffixes)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
Extend SystemTap SDT probe argument parser This patch extends the current generic parser for SystemTap SDT probe arguments. It can be almost considered a cleanup, but the main point of it is actually to allow the generic parser to accept multiple prefixes and suffixes for the its operands (i.e., integers, register names, and register indirection). I have chosen to implement this as a list of const strings, and declare this list as "static" inside each target's method used to initialize gdbarch. This patch is actually a preparation for an upcoming patch for ARM, which implements the support for multiple integer prefixes (as defined by ARM's asm spec). And AArch64 will also need this, for the same reason. This patch was regtested on all architectures that it touches (i.e., i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found. 2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com> * amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe argument prefixes and suffixes. Initialize gdbarch with them. * arm-linux-tdep.c (arm_linux_init_abi): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix, stap_integer_suffix) (stap_register_prefix, stap_register_suffix) (stap_register_indirection_prefix) (stap_register_indirection_suffix): Declare as "const char *const *" instead of "const char *". Adjust printing function. Rename all of the variables to the plural. (pstring_list): New function. * i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe argument prefixes and suffixes. Initialize gdbarch with them. * ia64-linux-tdep.c (ia64_linux_init_abi): Likewise. * ppc-linux-tdep.c (ppc_linux_init_abi): Likewise. * s390-linux-tdep.c (s390_gdbarch_init): Likewise. * stap-probe.c (stap_is_generic_prefix): New function. (stap_is_register_prefix): Likewise. (stap_is_register_indirection_prefix): Likewise. (stap_is_integer_prefix): Likewise. (stap_generic_check_suffix): Likewise. (stap_check_integer_suffix): Likewise. (stap_check_register_suffix): Likewise. (stap_check_register_indirection_suffix): Likewise. (stap_parse_register_operand): Remove unecessary declarations for variables holding prefix and suffix information. Use the new functions listed above for checking for prefixes and suffixes. (stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
# A NULL-terminated array of prefixes used to mark a register name on
# the architecture's assembly.
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
# For example, on x86 the register name is written as:
#
# \%eax ;; register eax
#
# in this case, this prefix would be the character \`\%\'.
Extend SystemTap SDT probe argument parser This patch extends the current generic parser for SystemTap SDT probe arguments. It can be almost considered a cleanup, but the main point of it is actually to allow the generic parser to accept multiple prefixes and suffixes for the its operands (i.e., integers, register names, and register indirection). I have chosen to implement this as a list of const strings, and declare this list as "static" inside each target's method used to initialize gdbarch. This patch is actually a preparation for an upcoming patch for ARM, which implements the support for multiple integer prefixes (as defined by ARM's asm spec). And AArch64 will also need this, for the same reason. This patch was regtested on all architectures that it touches (i.e., i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found. 2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com> * amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe argument prefixes and suffixes. Initialize gdbarch with them. * arm-linux-tdep.c (arm_linux_init_abi): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix, stap_integer_suffix) (stap_register_prefix, stap_register_suffix) (stap_register_indirection_prefix) (stap_register_indirection_suffix): Declare as "const char *const *" instead of "const char *". Adjust printing function. Rename all of the variables to the plural. (pstring_list): New function. * i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe argument prefixes and suffixes. Initialize gdbarch with them. * ia64-linux-tdep.c (ia64_linux_init_abi): Likewise. * ppc-linux-tdep.c (ppc_linux_init_abi): Likewise. * s390-linux-tdep.c (s390_gdbarch_init): Likewise. * stap-probe.c (stap_is_generic_prefix): New function. (stap_is_register_prefix): Likewise. (stap_is_register_indirection_prefix): Likewise. (stap_is_integer_prefix): Likewise. (stap_generic_check_suffix): Likewise. (stap_check_integer_suffix): Likewise. (stap_check_register_suffix): Likewise. (stap_check_register_indirection_suffix): Likewise. (stap_parse_register_operand): Remove unecessary declarations for variables holding prefix and suffix information. Use the new functions listed above for checking for prefixes and suffixes. (stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
v:const char *const *:stap_register_prefixes:::0:0::0:pstring_list (gdbarch->stap_register_prefixes)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
Extend SystemTap SDT probe argument parser This patch extends the current generic parser for SystemTap SDT probe arguments. It can be almost considered a cleanup, but the main point of it is actually to allow the generic parser to accept multiple prefixes and suffixes for the its operands (i.e., integers, register names, and register indirection). I have chosen to implement this as a list of const strings, and declare this list as "static" inside each target's method used to initialize gdbarch. This patch is actually a preparation for an upcoming patch for ARM, which implements the support for multiple integer prefixes (as defined by ARM's asm spec). And AArch64 will also need this, for the same reason. This patch was regtested on all architectures that it touches (i.e., i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found. 2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com> * amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe argument prefixes and suffixes. Initialize gdbarch with them. * arm-linux-tdep.c (arm_linux_init_abi): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix, stap_integer_suffix) (stap_register_prefix, stap_register_suffix) (stap_register_indirection_prefix) (stap_register_indirection_suffix): Declare as "const char *const *" instead of "const char *". Adjust printing function. Rename all of the variables to the plural. (pstring_list): New function. * i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe argument prefixes and suffixes. Initialize gdbarch with them. * ia64-linux-tdep.c (ia64_linux_init_abi): Likewise. * ppc-linux-tdep.c (ppc_linux_init_abi): Likewise. * s390-linux-tdep.c (s390_gdbarch_init): Likewise. * stap-probe.c (stap_is_generic_prefix): New function. (stap_is_register_prefix): Likewise. (stap_is_register_indirection_prefix): Likewise. (stap_is_integer_prefix): Likewise. (stap_generic_check_suffix): Likewise. (stap_check_integer_suffix): Likewise. (stap_check_register_suffix): Likewise. (stap_check_register_indirection_suffix): Likewise. (stap_parse_register_operand): Remove unecessary declarations for variables holding prefix and suffix information. Use the new functions listed above for checking for prefixes and suffixes. (stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
# A NULL-terminated array of suffixes used to mark a register name on
# the architecture's assembly.
v:const char *const *:stap_register_suffixes:::0:0::0:pstring_list (gdbarch->stap_register_suffixes)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
Extend SystemTap SDT probe argument parser This patch extends the current generic parser for SystemTap SDT probe arguments. It can be almost considered a cleanup, but the main point of it is actually to allow the generic parser to accept multiple prefixes and suffixes for the its operands (i.e., integers, register names, and register indirection). I have chosen to implement this as a list of const strings, and declare this list as "static" inside each target's method used to initialize gdbarch. This patch is actually a preparation for an upcoming patch for ARM, which implements the support for multiple integer prefixes (as defined by ARM's asm spec). And AArch64 will also need this, for the same reason. This patch was regtested on all architectures that it touches (i.e., i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found. 2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com> * amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe argument prefixes and suffixes. Initialize gdbarch with them. * arm-linux-tdep.c (arm_linux_init_abi): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix, stap_integer_suffix) (stap_register_prefix, stap_register_suffix) (stap_register_indirection_prefix) (stap_register_indirection_suffix): Declare as "const char *const *" instead of "const char *". Adjust printing function. Rename all of the variables to the plural. (pstring_list): New function. * i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe argument prefixes and suffixes. Initialize gdbarch with them. * ia64-linux-tdep.c (ia64_linux_init_abi): Likewise. * ppc-linux-tdep.c (ppc_linux_init_abi): Likewise. * s390-linux-tdep.c (s390_gdbarch_init): Likewise. * stap-probe.c (stap_is_generic_prefix): New function. (stap_is_register_prefix): Likewise. (stap_is_register_indirection_prefix): Likewise. (stap_is_integer_prefix): Likewise. (stap_generic_check_suffix): Likewise. (stap_check_integer_suffix): Likewise. (stap_check_register_suffix): Likewise. (stap_check_register_indirection_suffix): Likewise. (stap_parse_register_operand): Remove unecessary declarations for variables holding prefix and suffix information. Use the new functions listed above for checking for prefixes and suffixes. (stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
# A NULL-terminated array of prefixes used to mark a register
# indirection on the architecture's assembly.
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
# For example, on x86 the register indirection is written as:
#
# \(\%eax\) ;; indirecting eax
#
# in this case, this prefix would be the charater \`\(\'.
#
# Please note that we use the indirection prefix also for register
# displacement, e.g., \`4\(\%eax\)\' on x86.
Extend SystemTap SDT probe argument parser This patch extends the current generic parser for SystemTap SDT probe arguments. It can be almost considered a cleanup, but the main point of it is actually to allow the generic parser to accept multiple prefixes and suffixes for the its operands (i.e., integers, register names, and register indirection). I have chosen to implement this as a list of const strings, and declare this list as "static" inside each target's method used to initialize gdbarch. This patch is actually a preparation for an upcoming patch for ARM, which implements the support for multiple integer prefixes (as defined by ARM's asm spec). And AArch64 will also need this, for the same reason. This patch was regtested on all architectures that it touches (i.e., i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found. 2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com> * amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe argument prefixes and suffixes. Initialize gdbarch with them. * arm-linux-tdep.c (arm_linux_init_abi): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix, stap_integer_suffix) (stap_register_prefix, stap_register_suffix) (stap_register_indirection_prefix) (stap_register_indirection_suffix): Declare as "const char *const *" instead of "const char *". Adjust printing function. Rename all of the variables to the plural. (pstring_list): New function. * i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe argument prefixes and suffixes. Initialize gdbarch with them. * ia64-linux-tdep.c (ia64_linux_init_abi): Likewise. * ppc-linux-tdep.c (ppc_linux_init_abi): Likewise. * s390-linux-tdep.c (s390_gdbarch_init): Likewise. * stap-probe.c (stap_is_generic_prefix): New function. (stap_is_register_prefix): Likewise. (stap_is_register_indirection_prefix): Likewise. (stap_is_integer_prefix): Likewise. (stap_generic_check_suffix): Likewise. (stap_check_integer_suffix): Likewise. (stap_check_register_suffix): Likewise. (stap_check_register_indirection_suffix): Likewise. (stap_parse_register_operand): Remove unecessary declarations for variables holding prefix and suffix information. Use the new functions listed above for checking for prefixes and suffixes. (stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
v:const char *const *:stap_register_indirection_prefixes:::0:0::0:pstring_list (gdbarch->stap_register_indirection_prefixes)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
Extend SystemTap SDT probe argument parser This patch extends the current generic parser for SystemTap SDT probe arguments. It can be almost considered a cleanup, but the main point of it is actually to allow the generic parser to accept multiple prefixes and suffixes for the its operands (i.e., integers, register names, and register indirection). I have chosen to implement this as a list of const strings, and declare this list as "static" inside each target's method used to initialize gdbarch. This patch is actually a preparation for an upcoming patch for ARM, which implements the support for multiple integer prefixes (as defined by ARM's asm spec). And AArch64 will also need this, for the same reason. This patch was regtested on all architectures that it touches (i.e., i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found. 2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com> * amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe argument prefixes and suffixes. Initialize gdbarch with them. * arm-linux-tdep.c (arm_linux_init_abi): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix, stap_integer_suffix) (stap_register_prefix, stap_register_suffix) (stap_register_indirection_prefix) (stap_register_indirection_suffix): Declare as "const char *const *" instead of "const char *". Adjust printing function. Rename all of the variables to the plural. (pstring_list): New function. * i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe argument prefixes and suffixes. Initialize gdbarch with them. * ia64-linux-tdep.c (ia64_linux_init_abi): Likewise. * ppc-linux-tdep.c (ppc_linux_init_abi): Likewise. * s390-linux-tdep.c (s390_gdbarch_init): Likewise. * stap-probe.c (stap_is_generic_prefix): New function. (stap_is_register_prefix): Likewise. (stap_is_register_indirection_prefix): Likewise. (stap_is_integer_prefix): Likewise. (stap_generic_check_suffix): Likewise. (stap_check_integer_suffix): Likewise. (stap_check_register_suffix): Likewise. (stap_check_register_indirection_suffix): Likewise. (stap_parse_register_operand): Remove unecessary declarations for variables holding prefix and suffix information. Use the new functions listed above for checking for prefixes and suffixes. (stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
# A NULL-terminated array of suffixes used to mark a register
# indirection on the architecture's assembly.
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
# For example, on x86 the register indirection is written as:
#
# \(\%eax\) ;; indirecting eax
#
# in this case, this prefix would be the charater \`\)\'.
#
# Please note that we use the indirection suffix also for register
# displacement, e.g., \`4\(\%eax\)\' on x86.
Extend SystemTap SDT probe argument parser This patch extends the current generic parser for SystemTap SDT probe arguments. It can be almost considered a cleanup, but the main point of it is actually to allow the generic parser to accept multiple prefixes and suffixes for the its operands (i.e., integers, register names, and register indirection). I have chosen to implement this as a list of const strings, and declare this list as "static" inside each target's method used to initialize gdbarch. This patch is actually a preparation for an upcoming patch for ARM, which implements the support for multiple integer prefixes (as defined by ARM's asm spec). And AArch64 will also need this, for the same reason. This patch was regtested on all architectures that it touches (i.e., i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found. 2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com> * amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe argument prefixes and suffixes. Initialize gdbarch with them. * arm-linux-tdep.c (arm_linux_init_abi): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix, stap_integer_suffix) (stap_register_prefix, stap_register_suffix) (stap_register_indirection_prefix) (stap_register_indirection_suffix): Declare as "const char *const *" instead of "const char *". Adjust printing function. Rename all of the variables to the plural. (pstring_list): New function. * i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe argument prefixes and suffixes. Initialize gdbarch with them. * ia64-linux-tdep.c (ia64_linux_init_abi): Likewise. * ppc-linux-tdep.c (ppc_linux_init_abi): Likewise. * s390-linux-tdep.c (s390_gdbarch_init): Likewise. * stap-probe.c (stap_is_generic_prefix): New function. (stap_is_register_prefix): Likewise. (stap_is_register_indirection_prefix): Likewise. (stap_is_integer_prefix): Likewise. (stap_generic_check_suffix): Likewise. (stap_check_integer_suffix): Likewise. (stap_check_register_suffix): Likewise. (stap_check_register_indirection_suffix): Likewise. (stap_parse_register_operand): Remove unecessary declarations for variables holding prefix and suffix information. Use the new functions listed above for checking for prefixes and suffixes. (stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
v:const char *const *:stap_register_indirection_suffixes:::0:0::0:pstring_list (gdbarch->stap_register_indirection_suffixes)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
Extend SystemTap SDT probe argument parser This patch extends the current generic parser for SystemTap SDT probe arguments. It can be almost considered a cleanup, but the main point of it is actually to allow the generic parser to accept multiple prefixes and suffixes for the its operands (i.e., integers, register names, and register indirection). I have chosen to implement this as a list of const strings, and declare this list as "static" inside each target's method used to initialize gdbarch. This patch is actually a preparation for an upcoming patch for ARM, which implements the support for multiple integer prefixes (as defined by ARM's asm spec). And AArch64 will also need this, for the same reason. This patch was regtested on all architectures that it touches (i.e., i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found. 2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com> * amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe argument prefixes and suffixes. Initialize gdbarch with them. * arm-linux-tdep.c (arm_linux_init_abi): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix, stap_integer_suffix) (stap_register_prefix, stap_register_suffix) (stap_register_indirection_prefix) (stap_register_indirection_suffix): Declare as "const char *const *" instead of "const char *". Adjust printing function. Rename all of the variables to the plural. (pstring_list): New function. * i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe argument prefixes and suffixes. Initialize gdbarch with them. * ia64-linux-tdep.c (ia64_linux_init_abi): Likewise. * ppc-linux-tdep.c (ppc_linux_init_abi): Likewise. * s390-linux-tdep.c (s390_gdbarch_init): Likewise. * stap-probe.c (stap_is_generic_prefix): New function. (stap_is_register_prefix): Likewise. (stap_is_register_indirection_prefix): Likewise. (stap_is_integer_prefix): Likewise. (stap_generic_check_suffix): Likewise. (stap_check_integer_suffix): Likewise. (stap_check_register_suffix): Likewise. (stap_check_register_indirection_suffix): Likewise. (stap_parse_register_operand): Remove unecessary declarations for variables holding prefix and suffix information. Use the new functions listed above for checking for prefixes and suffixes. (stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
# Prefix(es) used to name a register using GDB's nomenclature.
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
#
# For example, on PPC a register is represented by a number in the assembly
# language (e.g., \`10\' is the 10th general-purpose register). However,
# inside GDB this same register has an \`r\' appended to its name, so the 10th
# register would be represented as \`r10\' internally.
v:const char *:stap_gdb_register_prefix:::0:0::0:pstring (gdbarch->stap_gdb_register_prefix)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
# Suffix used to name a register using GDB's nomenclature.
v:const char *:stap_gdb_register_suffix:::0:0::0:pstring (gdbarch->stap_gdb_register_suffix)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
# Check if S is a single operand.
#
# Single operands can be:
# \- Literal integers, e.g. \`\$10\' on x86
# \- Register access, e.g. \`\%eax\' on x86
# \- Register indirection, e.g. \`\(\%eax\)\' on x86
# \- Register displacement, e.g. \`4\(\%eax\)\' on x86
#
# This function should check for these patterns on the string
# and return 1 if some were found, or zero otherwise. Please try to match
# as much info as you can from the string, i.e., if you have to match
# something like \`\(\%\', do not match just the \`\(\'.
M:int:stap_is_single_operand:const char *s:s
# Function used to handle a "special case" in the parser.
#
# A "special case" is considered to be an unknown token, i.e., a token
# that the parser does not know how to parse. A good example of special
# case would be ARM's register displacement syntax:
#
# [R0, #4] ;; displacing R0 by 4
#
# Since the parser assumes that a register displacement is of the form:
#
# <number> <indirection_prefix> <register_name> <indirection_suffix>
#
# it means that it will not be able to recognize and parse this odd syntax.
# Therefore, we should add a special case function that will handle this token.
#
# This function should generate the proper expression form of the expression
# using GDB\'s internal expression mechanism (e.g., \`write_exp_elt_opcode\'
# and so on). It should also return 1 if the parsing was successful, or zero
# if the token was not recognized as a special token (in this case, returning
# zero means that the special parser is deferring the parsing to the generic
# parser), and should advance the buffer pointer (p->arg).
M:int:stap_parse_special_token:struct stap_parse_info *p:p
# DTrace related functions.
# The expression to compute the NARTGth+1 argument to a DTrace USDT probe.
# NARG must be >= 0.
M:void:dtrace_parse_probe_argument:struct parser_state *pstate, int narg:pstate, narg
# True if the given ADDR does not contain the instruction sequence
# corresponding to a disabled DTrace is-enabled probe.
M:int:dtrace_probe_is_enabled:CORE_ADDR addr:addr
# Enable a DTrace is-enabled probe at ADDR.
M:void:dtrace_enable_probe:CORE_ADDR addr:addr
# Disable a DTrace is-enabled probe at ADDR.
M:void:dtrace_disable_probe:CORE_ADDR addr:addr
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
# True if the list of shared libraries is one and only for all
# processes, as opposed to a list of shared libraries per inferior.
# This usually means that all processes, although may or may not share
# an address space, will see the same set of symbols at the same
# addresses.
v:int:has_global_solist:::0:0::0
# On some targets, even though each inferior has its own private
# address space, the debug interface takes care of making breakpoints
# visible to all address spaces automatically. For such cases,
# this property should be set to true.
v:int:has_global_breakpoints:::0:0::0
2009-10-19 Pedro Alves <pedro@codesourcery.com> Stan Shebs <stan@codesourcery.com> Add base multi-executable/process support to GDB. gdb/ * Makefile.in (SFILES): Add progspace.c. (COMMON_OBS): Add progspace.o. * progspace.h: New. * progspace.c: New. * breakpoint.h (struct bp_target_info) <placed_address_space>: New field. (struct bp_location) <pspace>: New field. (struct breakpoint) <pspace>: New field. (bpstat_stop_status, breakpoint_here_p) (moribund_breakpoint_here_p, breakpoint_inserted_here_p) (regular_breakpoint_inserted_here_p) (software_breakpoint_inserted_here_p, breakpoint_thread_match) (set_default_breakpoint): Adjust prototypes. (remove_breakpoints_pid, breakpoint_program_space_exit): Declare. (insert_single_step_breakpoint, deprecated_insert_raw_breakpoint): Adjust prototypes. * breakpoint.c (executing_startup): Delete. (default_breakpoint_sspace): New. (breakpoint_restore_shadows): Skip if the address space doesn't match. (update_watchpoint): Record the frame's program space in the breakpoint location. (insert_bp_location): Record the address space in target_info. Adjust to pass the symbol space to solib_name_from_address. (breakpoint_program_space_exit): New. (insert_breakpoint_locations): Switch the symbol space and thread when inserting breakpoints. Don't insert breakpoints in a vfork parent waiting for vfork done if we're not attached to the vfork child. (remove_breakpoints_pid): New. (reattach_breakpoints): Switch to a thread of PID. Ignore breakpoints of other symbol spaces. (create_internal_breakpoint): Store the symbol space in the sal. (create_longjmp_master_breakpoint): Iterate over all symbol spaces. (update_breakpoints_after_exec): Ignore breakpoints for other symbol spaces. (remove_breakpoint): Rename to ... (remove_breakpoint_1): ... this. Pass the breakpoints symbol space to solib_name_from_address. (remove_breakpoint): New. (mark_breakpoints_out): Ignore breakpoints from other symbol spaces. (breakpoint_init_inferior): Ditto. (breakpoint_here_p): Add an address space argument and adjust to use breakpoint_address_match. (moribund_breakpoint_here_p): Ditto. (regular_breakpoint_inserted_here_p): Ditto. (breakpoint_inserted_here_p): Ditto. (software_breakpoint_inserted_here_p): Ditto. (breakpoint_thread_match): Ditto. (bpstat_check_location): Ditto. (bpstat_stop_status): Ditto. (print_breakpoint_location): If there's a location to print, switch the current symbol space. (print_one_breakpoint_location): Add `allflag' argument. (print_one_breakpoint): Ditto. Adjust. (do_captured_breakpoint_query): Adjust. (breakpoint_1): Adjust. (breakpoint_has_pc): Also match the symbol space. (describe_other_breakpoints): Add a symbol space argument and adjust. (set_default_breakpoint): Add a symbol space argument. Set default_breakpoint_sspace. (breakpoint_address_match): New. (check_duplicates_for): Add an address space argument, and adjust. (set_raw_breakpoint): Record the symbol space in the location and in the breakpoint. (set_longjmp_breakpoint): Skip longjmp master breakpoints from other symbol spaces. (remove_thread_event_breakpoints, remove_solib_event_breakpoints) (disable_breakpoints_in_shlibs): Skip breakpoints from other symbol spaces. (disable_breakpoints_in_unloaded_shlib): Match symbol spaces. (create_catchpoint): Set the symbol space in the sal. (disable_breakpoints_before_startup): Skip breakpoints from other symbol spaces. Set executing_startup in the current symbol space. (enable_breakpoints_after_startup): Clear executing_startup in the current symbol space. Skip breakpoints from other symbol spaces. (clone_momentary_breakpoint): Also copy the symbol space. (add_location_to_breakpoint): Set the location's symbol space. (bp_loc_is_permanent): Switch thread and symbol space. (create_breakpoint): Adjust. (expand_line_sal_maybe): Expand comment to mention symbol spaces. Switch thread and symbol space when reading memory. (parse_breakpoint_sals): Set the symbol space in the sal. (break_command_really): Ditto. (skip_prologue_sal): Switch and space. (resolve_sal_pc): Ditto. (watch_command_1): Record the symbol space in the sal. (create_ada_exception_breakpoint): Adjust. (clear_command): Adjust. Match symbol spaces. (update_global_location_list): Use breakpoint_address_match. (breakpoint_re_set_one): Switch thread and space. (breakpoint_re_set): Save symbol space. (breakpoint_re_set_thread): Also reset the symbol space. (deprecated_insert_raw_breakpoint): Add an address space argument. Adjust. (insert_single_step_breakpoint): Ditto. (single_step_breakpoint_inserted_here_p): Ditto. (clear_syscall_counts): New. (_initialize_breakpoint): Install it as inferior_exit observer. * exec.h: Include "progspace.h". (exec_bfd, exec_bfd_mtime): New defines. (exec_close): Declare. * exec.c: Include "gdbthread.h" and "progspace.h". (exec_bfd, exec_bfd_mtime, current_target_sections_1): Delete. (using_exec_ops): New. (exec_close_1): Rename to exec_close, and make public. (exec_close): Rename to exec_close_1, and adjust all callers. Add description. Remove target sections and close executables from all program spaces. (exec_file_attach): Add comment. (add_target_sections): Check on `using_exec_ops' to check if the target should be pushed. (remove_target_sections): Only unpush the target if there are no more target sections in any symbol space. * gdbcore.h: Include "exec.h". (exec_bfd, exec_bfd_mtime): Remove declarations. * frame.h (get_frame_program_space, get_frame_address_space) (frame_unwind_program_space): Declare. * frame.c (struct frame_info) <pspace, aspace>: New fields. (create_sentinel_frame): Add program space argument. Set the pspace and aspace fields of the frame object. (get_current_frame, create_new_frame): Adjust. (get_frame_program_space): New. (frame_unwind_program_space): New. (get_frame_address_space): New. * stack.c (print_frame_info): Adjust. (print_frame): Use the frame's program space. * gdbthread.h (any_live_thread_of_process): Declare. * thread.c (any_live_thread_of_process): New. (switch_to_thread): Switch the program space as well. (restore_selected_frame): Don't warn if trying to restore frame level 0. * inferior.h: Include "progspace.h". (detach_fork): Declare. (struct inferior) <removable, aspace, pspace> <vfork_parent, vfork_child, pending_detach> <waiting_for_vfork_done>: New fields. <terminal_info>: Remove field. <data, num_data>: New fields. (register_inferior_data, register_inferior_data_with_cleanup) (clear_inferior_data, set_inferior_data, inferior_data): Declare. (exit_inferior, exit_inferior_silent, exit_inferior_num_silent) (inferior_appeared): Declare. (find_inferior_pid): Typo. (find_inferior_id, find_inferior_for_program_space): Declare. (set_current_inferior, save_current_inferior, prune_inferiors) (number_of_inferiors): Declare. (inferior_list): Declare. * inferior.c: Include "gdbcore.h" and "symfile.h". (inferior_list): Make public. (delete_inferior_1): Always delete thread silently. (find_inferior_id): Make public. (current_inferior_): New. (current_inferior): Use it. (set_current_inferior): New. (restore_inferior): New. (save_current_inferior): New. (free_inferior): Free the per-inferior data. (add_inferior_silent): Allocate per-inferior data. Call inferior_appeared. (delete_threads_of_inferior): New. (delete_inferior_1): Adjust interface to take an inferior pointer. (delete_inferior): Adjust. (delete_inferior_silent): Adjust. (exit_inferior_1): New. (exit_inferior): New. (exit_inferior_silent): New. (exit_inferior_num_silent): New. (detach_inferior): Adjust. (inferior_appeared): New. (discard_all_inferiors): Adjust. (find_inferior_id): Make public. Assert pid is not zero. (find_inferior_for_program_space): New. (have_inferiors): Check if we have any inferior with pid not zero. (have_live_inferiors): Go over all pushed targets looking for process_stratum. (prune_inferiors): New. (number_of_inferiors): New. (print_inferior): Add executable column. Print vfork parent/child relationships. (inferior_command): Adjust to cope with not running inferiors. (remove_inferior_command): New. (add_inferior_command): New. (clone_inferior_command): New. (struct inferior_data): New. (struct inferior_data_registration): New. (struct inferior_data_registry): New. (inferior_data_registry): New. (register_inferior_data_with_cleanup): New. (register_inferior_data): New. (inferior_alloc_data): New. (inferior_free_data): New. (clear_inferior_data): New. (set_inferior_data): New. (inferior_data): New. (initialize_inferiors): New. (_initialize_inferiors): Register "add-inferior", "remove-inferior" and "clone-inferior" commands. * objfiles.h: Include "progspace.h". (struct objfile) <pspace>: New field. (symfile_objfile, object_files): Don't declare. (ALL_PSPACE_OBJFILES): New. (ALL_PSPACE_OBJFILES_SAFE): New. (ALL_OBJFILES, ALL_OBJFILES_SAFE): Adjust. (ALL_PSPACE_SYMTABS): New. (ALL_PRIMARY_SYMTABS): Adjust. (ALL_PSPACE_PRIMARY_SYMTABS): New. (ALL_PSYMTABS): Adjust. (ALL_PSPACE_PSYMTABS): New. * objfiles.c (object_files, symfile_objfile): Delete. (struct objfile_sspace_info): New. (objfiles_pspace_data): New. (objfiles_pspace_data_cleanup): New. (get_objfile_pspace_data): New. (objfiles_changed_p): Delete. (allocate_objfile): Set the objfile's program space. Adjust to reference objfiles_changed_p in pspace data. (free_objfile): Adjust to reference objfiles_changed_p in pspace data. (objfile_relocate): Ditto. (update_section_map): Add pspace argument. Adjust to iterate over objfiles in the passed in pspace. (find_pc_section): Delete sections and num_sections statics. Adjust to refer to program space's objfiles_changed_p. Adjust to refer to sections and num_sections store in the objfile's pspace data. (objfiles_changed): Adjust to reference objfiles_changed_p in pspace data. (_initialize_objfiles): New. * linespec.c (decode_all_digits, decode_dollar): Set the sal's program space. * source.c (current_source_pspace): New. (get_current_source_symtab_and_line): Set the sal's program space. (set_current_source_symtab_and_line): Set current_source_pspace. (select_source_symtab): Ditto. Use ALL_OBJFILES. (forget_cached_source_info): Iterate over all program spaces. * symfile.c (clear_symtab_users): Adjust. * symmisc.c (print_symbol_bcache_statistics): Iterate over all program spaces. (print_objfile_statistics): Ditto. (maintenance_print_msymbols): Ditto. (maintenance_print_objfiles): Ditto. (maintenance_info_symtabs): Ditto. (maintenance_info_psymtabs): Ditto. * symtab.h (SYMTAB_PSPACE): New. (struct symtab_and_line) <pspace>: New field. * symtab.c (init_sal): Clear the sal's program space. (find_pc_sect_symtab): Set the sal's program space. Switch thread and space. (append_expanded_sal): Add program space argument. Iterate over all program spaces. (expand_line_sal): Iterate over all program spaces. Switch program space. * target.h (enum target_waitkind) <TARGET_WAITKIND_VFORK_DONE>: New. (struct target_ops) <to_thread_address_space>: New field. (target_thread_address_space): Define. * target.c (target_detach): Only remove breakpoints from the inferior we're detaching. (target_thread_address_space): New. * defs.h (initialize_progspace): Declare. * top.c (gdb_init): Call it. * solist.h (struct so_list) <sspace>: New field. * solib.h (struct program_space): Forward declare. (solib_name_from_address): Adjust prototype. * solib.c (so_list_head): Replace with a macro referencing the program space. (update_solib_list): Set the so's program space. (solib_name_from_address): Add a program space argument and adjust. * solib-svr4.c (struct svr4_info) <pid>: Delete field. <interp_text_sect_low, interp_text_sect_high, interp_plt_sect_low> <interp_plt_sect_high>: New fields. (svr4_info_p, svr4_info): Delete. (solib_svr4_sspace_data): New. (get_svr4_info): Rewrite. (svr4_sspace_data_cleanup): New. (open_symbol_file_object): Adjust. (svr4_default_sos): Adjust. (svr4_fetch_objfile_link_map): Adjust. (interp_text_sect_low, interp_text_sect_high, interp_plt_sect_low) (interp_plt_sect_high): Delete. (svr4_in_dynsym_resolve_code): Adjust. (enable_break): Adjust. (svr4_clear_solib): Revert bit that removed the svr4_info here, and reinstate clearing debug_base, debug_loader_offset_p, debug_loader_offset and debug_loader_name. (_initialize_svr4_solib): Register solib_svr4_pspace_data. Don't install an inferior_exit observer anymore. * printcmd.c (struct display) <pspace>: New field. (display_command): Set the display's sspace. (do_one_display): Match the display's sspace. (display_uses_solib_p): Ditto. * linux-fork.c (detach_fork): Moved to infrun.c. (_initialize_linux_fork): Moved "detach-on-fork" command to infrun.c. * infrun.c (detach_fork): Moved from linux-fork.c. (proceed_after_vfork_done): New. (handle_vfork_child_exec_or_exit): New. (follow_exec_mode_replace, follow_exec_mode_keep) (follow_exec_mode_names, follow_exec_mode_string) (show_follow_exec_mode_string): New. (follow_exec): New. Reinstate the mark_breakpoints_out call. Remove shared libraries before attaching new executable. If user wants to keep the inferior, keep it. (displaced_step_fixup): Adjust to pass an address space to the breakpoints module. (resume): Ditto. (clear_proceed_status): In all-stop mode, always clear the proceed status of all threads. (prepare_to_proceed): Adjust to pass an address space to the breakpoints module. (proceed): Ditto. (adjust_pc_after_break): Ditto. (handle_inferior_event): When handling a process exit, switch the program space to the inferior's that had exited. Call handle_vfork_child_exec_or_exit. Adjust to pass an address space to the breakpoints module. In non-stop mode, when following a fork and detach-fork is off, also resume the other branch. Handle TARGET_WAITKIND_VFORK_DONE. Set the program space in sals. (normal_stop): Prune inferiors. (_initialize_infrun): Install the new "follow-exec-mode" command. "detach-on-fork" moved here. * regcache.h (get_regcache_aspace): Declare. * regcache.c (struct regcache) <aspace>: New field. (regcache_xmalloc): Clear the aspace. (get_regcache_aspace): New. (regcache_cpy): Copy the aspace field. (regcache_cpy_no_passthrough): Ditto. (get_thread_regcache): Fetch the thread's address space from the target, and store it in the regcache. * infcall.c (call_function_by_hand): Set the sal's pspace. * arch-utils.c (default_has_shared_address_space): New. * arch-utils.h (default_has_shared_address_space): Declare. * gdbarch.sh (has_shared_address_space): New. * gdbarch.h, gdbarch.c: Regenerate. * linux-tdep.c: Include auxv.h, target.h, elf/common.h. (linux_has_shared_address_space): New. (_initialize_linux_tdep): Declare. * arm-tdep.c (arm_software_single_step): Pass the frame's address space to insert_single_step_breakpoint. * arm-linux-tdep.c (arm_linux_software_single_step): Pass the frame's pspace to breakpoint functions. * cris-tdep.c (crisv32_single_step_through_delay): Ditto. (cris_software_single_step): Ditto. * mips-tdep.c (deal_with_atomic_sequence): Add frame argument. Pass the frame's pspace to breakpoint functions. (mips_software_single_step): Adjust. (mips_single_step_through_delay): Adjust. * rs6000-aix-tdep.c (rs6000_software_single_step): Adjust. * rs6000-tdep.c (ppc_deal_with_atomic_sequence): Adjust. * solib-irix.c (enable_break): Adjust to pass the current frame's address space to breakpoint functions. * sparc-tdep.c (sparc_software_single_step): Ditto. * spu-tdep.c (spu_software_single_step): Ditto. * alpha-tdep.c (alpha_software_single_step): Ditto. * record.c (record_wait): Adjust to pass an address space to the breakpoints module. * fork-child.c (fork_inferior): Set the new inferior's program and address spaces. * inf-ptrace.c (inf_ptrace_follow_fork): Copy the parent's program and address spaces. (inf_ptrace_attach): Set the inferior's program and address spaces. * linux-nat.c: Include "solib.h". (linux_child_follow_fork): Manage parent and child's program and address spaces. Clone the parent's program space if necessary. Don't wait for the vfork to be done here. Refuse to resume if following the vfork parent while leaving the child stopped. (resume_callback): Don't resume a vfork parent. (linux_nat_resume): Also check for pending events in the lp->waitstatus field. (linux_handle_extended_wait): Report TARGET_WAITKIND_VFORK_DONE events to the core. (stop_wait_callback): Don't wait for SIGSTOP on vfork parents. (cancel_breakpoint): Adjust. * linux-thread-db.c (thread_db_wait): Don't remove thread event breakpoints here. (thread_db_mourn_inferior): Don't mark breakpoints out here. Remove thread event breakpoints after mourning. * corelow.c: Include progspace.h. (core_open): Set the inferior's program and address spaces. * remote.c (remote_add_inferior): Set the new inferior's program and address spaces. (remote_start_remote): Update address spaces. (extended_remote_create_inferior_1): Don't init the thread list if we already debugging other inferiors. * darwin-nat.c (darwin_attach): Set the new inferior's program and address spaces. * gnu-nat.c (gnu_attach): Ditto. * go32-nat.c (go32_create_inferior): Ditto. * inf-ttrace.c (inf_ttrace_follow_fork, inf_ttrace_attach): Ditto. * monitor.c (monitor_open): Ditto. * nto-procfs.c (procfs_attach, procfs_create_inferior): Ditto. * procfs.c (do_attach): Ditto. * windows-nat.c (do_initial_windows_stuff): Ditto. * inflow.c (inferior_process_group) (terminal_init_inferior_with_pgrp, terminal_inferior, (terminal_ours_1, inflow_inferior_exit, copy_terminal_info) (child_terminal_info, new_tty_postfork, set_sigint_trap): Adjust to use per-inferior data instead of inferior->terminal_info. (inflow_inferior_data): New. (inflow_new_inferior): Delete. (inflow_inferior_data_cleanup): New. (get_inflow_inferior_data): New. * mi/mi-interp.c (mi_new_inferior): Rename to... (mi_inferior_appeared): ... this. (mi_interpreter_init): Adjust. * tui/tui-disasm.c: Include "progspace.h". (tui_set_disassem_content): Pass an address space to breakpoint_here_p. * NEWS: Mention multi-program debugging support. Mention new commands "add-inferior", "clone-inferior", "remove-inferior", "maint info program-spaces", and new option "set follow-exec-mode". 2009-10-19 Pedro Alves <pedro@codesourcery.com> Stan Shebs <stan@codesourcery.com> gdb/doc/ * observer.texi (new_inferior): Rename to... (inferior_appeared): ... this. 2009-10-19 Pedro Alves <pedro@codesourcery.com> Stan Shebs <stan@codesourcery.com> gdb/testsuite/ * gdb.base/foll-vfork.exp: Adjust to spell out "follow-fork". * gdb.base/foll-exec.exp: Adjust to expect a process id before "Executing new program". * gdb.base/foll-fork.exp: Adjust to spell out "follow-fork". * gdb.base/multi-forks.exp: Ditto. Adjust to the inferior being left listed after having been killed. * gdb.base/attach.exp: Adjust to spell out "symbol-file". * gdb.base/maint.exp: Adjust test. * Makefile.in (ALL_SUBDIRS): Add gdb.multi. * gdb.multi/Makefile.in: New. * gdb.multi/base.exp: New. * gdb.multi/goodbye.c: New. * gdb.multi/hangout.c: New. * gdb.multi/hello.c: New. * gdb.multi/bkpt-multi-exec.c: New. * gdb.multi/bkpt-multi-exec.exp: New. * gdb.multi/crashme.c: New. 2009-10-19 Pedro Alves <pedro@codesourcery.com> Stan Shebs <stan@codesourcery.com> gdb/doc/ * gdb.texinfo (Inferiors): Rename node to ... (Inferiors and Programs): ... this. Mention running multiple programs in the same debug session. <info inferiors>: Mention the new 'Executable' column if "info inferiors". Update examples. Document the "add-inferior", "clone-inferior", "remove-inferior" and "maint info program-spaces" commands. (Process): Rename node to... (Forks): ... this. Document "set|show follow-exec-mode".
2009-10-19 11:51:43 +02:00
# True if inferiors share an address space (e.g., uClinux).
m:int:has_shared_address_space:void:::default_has_shared_address_space::0
Add fast tracepoints. * arch-utils.h (default_fast_tracepoint_valid_at): Declare. * arch-utils.c (default_fast_tracepoint_valid_at): New function. * breakpoint.h (enum bptype): Add bp_fast_tracepoint. * breakpoint.c (tracepoint_type): New function. (ALL_TRACEPOINTS): Use it. (should_be_inserted): Ditto. (bpstat_check_location): Ditto. (print_one_breakpoint_location): Ditto. (user_settable_breakpoint): Ditto. (set_breakpoint_location_function): Ditto. (disable_breakpoints_in_shlibs): Ditto. (delete_trace_command): Ditto. (print_it_typical): Add bp_fast_tracepoint case. (bpstat_what): Ditto. (print_one_breakpoint_location): Ditto. (allocate_bp_location): Ditto. (mention): Ditto. (breakpoint_re_set_one): Ditto. (disable_command): Ditto. (enable_command): Ditto. (check_fast_tracepoint_sals): New function. (break_command_really): Call it. (ftrace_command): New function. (_initialize_breakpoint): Add ftrace command. * gdbarch.sh (fast_tracepoint_valid_at): New. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.c (i386_fast_tracepoint_valid_at): New function. (i386_gdbarch_init): Use it. * remote.c (struct remote_state): New field fast_tracepoints. (PACKET_FastTracepoints): New packet config type. (remote_fast_tracepoint_feature): New function. (remote_protocol_features): Add FastTracepoints. (remote_supports_fast_tracepoints): New function. (_initialize_remote): Add FastTracepoints. * tracepoint.c (download_tracepoint): Add fast tracepoint option. * NEWS: Mention fast tracepoints. * gdb.texinfo (Create and Delete Tracepoints): Describe fast tracepoints. (Tracepoint Packets): Describe remote protocol for fast tracepoints. * gdb.trace/tracecmd.exp: Test ftrace.
2010-01-06 05:20:27 +01:00
# True if a fast tracepoint can be set at an address.
Remove isize output argument from fast_tracepoint_valid_at This patch removes the isize output argument from the fast_tracepoint_valid_at gdbarch hook. It was used to return the size of the instruction that needs to be replaced when installing a fast tracepoint. Instead of getting this value from the fast_tracepoint_valid_at hook, we can call the gdb_insn_length function. If we do not do this, then architectures which do not have a restriction on where to install the fast tracepoint will send uninitialized memory off to GDBserver. See remote_download_tracepoint: ~~~ int isize; if (gdbarch_fast_tracepoint_valid_at (target_gdbarch (), tpaddr, &isize, NULL)) xsnprintf (buf + strlen (buf), BUF_SIZE - strlen (buf), ":F%x", isize); ~~~ The default implementation of fast_tracepoint_valid_at will not set isize resulting in uninitialized memory being sent. Later on, GDBserver could use this information to compute a jump offset. gdb/ChangeLog: * arch-utils.c (default_fast_tracepoint_valid_at): Remove unused isize argument. * arch-utils.h (default_fast_tracepoint_valid_at): Likewise. * breakpoint.c (check_fast_tracepoint_sals): Adjust call to gdbarch_fast_tracepoint_valid_at. * gdbarch.sh (fast_tracepoint_valid_at): Remove isize argument. * gdbarch.h: Regenerate. * gdbarch.c: Regenerate. * i386-tdep.c (i386_fast_tracepoint_valid_at): Remove isize argument. Do not set it. * remote.c (remote_download_tracepoint): Adjust call to gdbarch_fast_tracepoint_valid_at. Call gdb_insn_length to get the instruction length.
2015-07-30 19:05:00 +02:00
m:int:fast_tracepoint_valid_at:CORE_ADDR addr, char **msg:addr, msg::default_fast_tracepoint_valid_at::0
gdb 2010-03-05 Corinna Vinschen <vinschen@redhat.com> Tom Tromey <tromey@redhat.com> * utils.c (host_char_to_target): Add 'gdbarch' argument. (parse_escape): Likewise. * python/py-utils.c (unicode_to_target_string): Update. (unicode_to_target_python_string): Update. (target_string_to_unicode): Update. * printcmd.c (printf_command): Update. * p-exp.y (yylex): Update. * objc-exp.y (yylex): Update. * mi/mi-parse.c: Include charset.h. (mi_parse_escape): New function. (mi_parse_argv): Use it. * jv-exp.y (yylex): Update. * i386-cygwin-tdep.c (i386_cygwin_auto_wide_charset): New function. (i386_cygwin_init_abi): Call set_gdbarch_auto_wide_charset. * gdbarch.sh (auto_charset, auto_wide_charset): New. * gdbarch.c: Rebuild. * gdbarch.h: Rebuild. * defs.h (parse_escape): Update. * cli/cli-setshow.c: Include arch-utils.h. (do_setshow_command): Update. * cli/cli-cmds.c (echo_command): Update. * charset.h (target_charset, target_wide_charset): Update. * charset.c: Include arch-utils.h. (target_charset_name): Default to "auto". (target_wide_charset_name): Likewise. (show_target_charset_name): Handle "auto". (show_target_wide_charset_name): Likewise. (be_le_arch): New global. (set_be_le_names): Add 'gdbarch' argument. (validate): Likewise. Don't call set_be_le_names. (set_charset_sfunc, set_host_charset_sfunc) (set_target_charset_sfunc, set_target_wide_charset_sfunc): Update. (target_charset): Add 'gdbarch' argument. (target_wide_charset): Likewise. Remove 'byte_order' argument. (auto_target_charset_name): New global. (default_auto_charset, default_auto_wide_charset): New functions. (_initialize_charset): Set auto_target_charset_name. Allow "auto" for target charsets. Copy result of nl_langinfo. Use GetACP if USE_WIN32API. * c-lang.c (charset_for_string_type): Add 'gdbarch' argument, remove 'byte_order' argument. Update. (classify_type): Likewise. (c_emit_char): Update. (c_printchar): Update. (c_printstr): Update. (c_get_string): Update. (evaluate_subexp_c): Update. * arch-utils.h (default_auto_charset, default_auto_wide_charset): Declare. * python/python.c (gdbpy_target_charset): New function. (gdbpy_target_wide_charset): Likewise. (GdbMethods): Update. * NEWS: Update. gdb/doc * gdb.texinfo (Basic Python): Document target_charset and target_wide_charset. gdb/testsuite * gdb.python/py-prettyprint.py (pp_nullstr.to_string): Use gdb.target_charset. (pp_ns.to_string): Likewise.
2010-03-05 21:18:19 +01:00
# Return the "auto" target charset.
f:const char *:auto_charset:void::default_auto_charset:default_auto_charset::0
# Return the "auto" target wide charset.
f:const char *:auto_wide_charset:void::default_auto_wide_charset:default_auto_wide_charset::0
# If non-empty, this is a file extension that will be opened in place
# of the file extension reported by the shared library list.
#
# This is most useful for toolchains that use a post-linker tool,
# where the names of the files run on the target differ in extension
# compared to the names of the files GDB should load for debug info.
v:const char *:solib_symbols_extension:::::::pstring (gdbarch->solib_symbols_extension)
# If true, the target OS has DOS-based file system semantics. That
# is, absolute paths include a drive name, and the backslash is
# considered a directory separator.
v:int:has_dos_based_file_system:::0:0::0
# Generate bytecodes to collect the return address in a frame.
# Since the bytecodes run on the target, possibly with GDB not even
# connected, the full unwinding machinery is not available, and
# typically this function will issue bytecodes for one or more likely
# places that the return address may be found.
m:void:gen_return_address:struct agent_expr *ax, struct axs_value *value, CORE_ADDR scope:ax, value, scope::default_gen_return_address::0
# Implement the "info proc" command.
M:void:info_proc:const char *args, enum info_proc_what what:args, what
# Implement the "info proc" command for core files. Noe that there
# are two "info_proc"-like methods on gdbarch -- one for core files,
# one for live targets.
M:void:core_info_proc:const char *args, enum info_proc_what what:args, what
New "iterate_over_objfiles_in_search_order" gdbarch method. This patch introduces the "iterate_over_objfiles_in_search_order" gdbarch method, as well as its default implementation, and converts the areas where it will matter to using this gdbarch method. The default method implementation is the only one installed, and the changes should have no functional impact in terms of behavior. This only paves the way for the architectures that will need their own version. gdb/ChangeLog: * gdbarch.sh: Add generation of "iterate_over_objfiles_in_search_order_cb_ftype" typedef in gdbarch.h. Add include of "objfiles.h" in gdbarch.c. (iterate_over_objfiles_in_search_order): New gdbarch method. * gdbarch.h, gdbarch.c: Regenerate. * objfiles.h (default_iterate_over_objfiles_in_search_order): Add declaration. * objfiles.c (default_iterate_over_objfiles_in_search_order): New function. * symtab.c (lookup_symbol_aux_objfile): New function, extracted out of lookup_symbol_aux_symtabs. (lookup_symbol_aux_symtabs): Replace extracted-out code by call to lookup_symbol_aux_objfile. (struct global_sym_lookup_data): New type. (lookup_symbol_global_iterator_cb): New function. (lookup_symbol_global): Search for symbol using gdbarch_iterate_over_objfiles_in_search_order and lookup_symbol_global_iterator_cb. * findvar.c (struct minsym_lookup_data): New type. (minsym_lookup_iterator_cb): New function. (default_read_var_value) [case LOC_UNRESOLVED]: Resolve the symbol's address via gdbarch_iterate_over_objfiles_in_search_order and minsym_lookup_iterator_cb.
2012-06-05 15:50:50 +02:00
# Iterate over all objfiles in the order that makes the most sense
# for the architecture to make global symbol searches.
#
# CB is a callback function where OBJFILE is the objfile to be searched,
# and CB_DATA a pointer to user-defined data (the same data that is passed
# when calling this gdbarch method). The iteration stops if this function
# returns nonzero.
#
# CB_DATA is a pointer to some user-defined data to be passed to
# the callback.
#
# If not NULL, CURRENT_OBJFILE corresponds to the objfile being
# inspected when the symbol search was requested.
m:void:iterate_over_objfiles_in_search_order:iterate_over_objfiles_in_search_order_cb_ftype *cb, void *cb_data, struct objfile *current_objfile:cb, cb_data, current_objfile:0:default_iterate_over_objfiles_in_search_order::0
# Ravenscar arch-dependent ops.
v:struct ravenscar_arch_ops *:ravenscar_ops:::NULL:NULL::0:host_address_to_string (gdbarch->ravenscar_ops)
# Return non-zero if the instruction at ADDR is a call; zero otherwise.
m:int:insn_is_call:CORE_ADDR addr:addr::default_insn_is_call::0
# Return non-zero if the instruction at ADDR is a return; zero otherwise.
m:int:insn_is_ret:CORE_ADDR addr:addr::default_insn_is_ret::0
# Return non-zero if the instruction at ADDR is a jump; zero otherwise.
m:int:insn_is_jump:CORE_ADDR addr:addr::default_insn_is_jump::0
# Read one auxv entry from *READPTR, not reading locations >= ENDPTR.
# Return 0 if *READPTR is already at the end of the buffer.
# Return -1 if there is insufficient buffer for a whole entry.
# Return 1 if an entry was read into *TYPEP and *VALP.
M:int:auxv_parse:gdb_byte **readptr, gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp:readptr, endptr, typep, valp
# Find the address range of the current inferior's vsyscall/vDSO, and
# write it to *RANGE. If the vsyscall's length can't be determined, a
# range with zero length is returned. Returns true if the vsyscall is
# found, false otherwise.
m:int:vsyscall_range:struct mem_range *range:range::default_vsyscall_range::0
# Allocate SIZE bytes of PROT protected page aligned memory in inferior.
# PROT has GDB_MMAP_PROT_* bitmask format.
# Throw an error if it is not possible. Returned address is always valid.
f:CORE_ADDR:infcall_mmap:CORE_ADDR size, unsigned prot:size, prot::default_infcall_mmap::0
compile: Use also inferior munmap Currently inferior memory is allocated by inferior mmap() but it is never deallocated; despite the injected objfile incl. its symbols is freed. This was intentional so that one can do for example: inferior: char *str = "foo"; GDB: (gdb) compile code str = "bar"; I believe later patches will be needed to introduce full control over keeping vs. discarding the injected module as being discussed in: compile: objfiles lifetime UI https://sourceware.org/ml/gdb/2015-04/msg00051.html Message-ID: <20150429135735.GA16974@host1.jankratochvil.net> https://sourceware.org/ml/gdb/2015-05/msg00007.html As decided by Phil it is better not to leak inferior pages as users can workaround the issue above for example by: (gdb) compile code str = strdup ("bar"); I have checked that in fact gdb/doc/ (written by Phil) already expects the injected code will be unmapped so that does not need to be changed: compile code int ff = 5; p = &ff; In this example, @code{p} would point to @code{ff} when the @code{compile} command is executing the source code provided to it. However, as variables in the (example) program persist with their assigned values, the variable @code{p} would point to an invalid location when the command exists. gdb/ChangeLog 2015-04-28 Jan Kratochvil <jan.kratochvil@redhat.com> * arch-utils.c (default_infcall_munmap): New. * arch-utils.h (default_infcall_munmap): New declaration. * compile/compile-object-load.c (struct munmap_list, munmap_list_add) (munmap_list_free, munmap_listp_free_cleanup): New. (struct setup_sections_data): Add field munmap_list_headp. (setup_sections): Call munmap_list_add. (compile_object_load): New variable munmap_list_head, initialize setup_sections_data.munmap_list_headp, return munmap_list_head. * compile/compile-object-load.h (struct munmap_list): New declaration. (struct compile_module): Add field munmap_list_head. (munmap_list_free): New declaration. * compile/compile-object-run.c (struct do_module_cleanup): Add field munmap_list_head. (do_module_cleanup): Call munmap_list_free. (compile_object_run): Pass munmap_list_head to do_module_cleanup. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (infcall_munmap): New. * linux-tdep.c (linux_infcall_munmap): New. (linux_init_abi): Install it. gdb/testsuite/ChangeLog 2015-04-28 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.compile/compile.exp (keep jit in memory): Rename to ... (do not keep jit in memory): ... this. (expect 5): Change it to ... (expect no 5): ... this.
2015-06-03 21:22:56 +02:00
# Deallocate SIZE bytes of memory at ADDR in inferior from gdbarch_infcall_mmap.
# Print a warning if it is not possible.
f:void:infcall_munmap:CORE_ADDR addr, CORE_ADDR size:addr, size::default_infcall_munmap::0
# Return string (caller has to use xfree for it) with options for GCC
# to produce code for this target, typically "-m64", "-m32" or "-m31".
# These options are put before CU's DW_AT_producer compilation options so that
# they can override it. Method may also return NULL.
m:char *:gcc_target_options:void:::default_gcc_target_options::0
add gnu_triplet_regexp gdbarch method gdb has to inform libcc1.so of the target being used, so that the correct compiler can be invoked. The compiler is invoked using the GNU configury triplet prefix, e.g., "x86_64-unknown-linux-gnu-gcc". In order for this to work we need to map the gdbarch to the GNU configury triplet arch. In most cases these are identical; however, the x86 family poses some problems, as the BFD arch names are quite different from the GNU triplet names. So, we introduce a new gdbarch method for this. A regular expression is used because there are various valid values for the arch prefix in the triplet. This patch also updates the osabi code to associate a regular expression with the OS ABI. I have only added a concrete value for Linux. Note that the "-gnu" part is optional, at least on Fedora it is omitted from the installed GCC executable's name. gdb/ChangeLog 2014-12-12 Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * osabi.h (osabi_triplet_regexp): Declare. * osabi.c (struct osabi_names): New. (gdb_osabi_names): Change type to struct osabi_names. Update values. (gdbarch_osabi_name): Update. (osabi_triplet_regexp): New function. (osabi_from_tdesc_string, _initialize_gdb_osabi): Update. * i386-tdep.c (i386_gnu_triplet_regexp): New method. (i386_elf_init_abi, i386_go32_init_abi, i386_gdbarch_init): Call set_gdbarch_gnu_triplet_regexp. * gdbarch.sh (gnu_triplet_regexp): New method. * gdbarch.c, gdbarch.h: Rebuild. * arch-utils.h (default_gnu_triplet_regexp): Declare. * arch-utils.c (default_gnu_triplet_regexp): New function.
2014-06-13 17:28:24 +02:00
# Return a regular expression that matches names used by this
# architecture in GNU configury triplets. The result is statically
# allocated and must not be freed. The default implementation simply
# returns the BFD architecture name, which is correct in nearly every
# case.
m:const char *:gnu_triplet_regexp:void:::default_gnu_triplet_regexp::0
# Return the size in 8-bit bytes of an addressable memory unit on this
# architecture. This corresponds to the number of 8-bit bytes associated to
# each address in memory.
m:int:addressable_memory_unit_size:void:::default_addressable_memory_unit_size::0
1999-08-31 03:14:27 +02:00
EOF
}
#
# The .log file
#
exec > new-gdbarch.log
function_list | while do_read
do
cat <<EOF
${class} ${returntype} ${function} ($formal)
1999-08-31 03:14:27 +02:00
EOF
for r in ${read}
do
eval echo \"\ \ \ \ ${r}=\${${r}}\"
done
if class_is_predicate_p && fallback_default_p
then
echo "Error: predicate function ${function} can not have a non- multi-arch default" 1>&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 ${function} must have a predefault" 1>&2
kill $$
exit 1
fi
fi
echo ""
done
exec 1>&2
compare_new gdbarch.log
1999-08-31 03:14:27 +02:00
copyright ()
{
cat <<EOF
gdb/ * copying.awk: Print buffer-read-only and vi ro markers. * copying.c: Rebuild. * gdbarch.sh (copyright): Print buffer-read-only and vi ro markers. * gdbarch.c, gdbarch.h: Rebuild. * target-descriptions.c (maint_print_c_tdesc_cmd): Print buffer-read-only and vi ro markers. * features/arm-with-iwmmxt.c: Rebuild. * features/arm-with-m-fpa-layout.c: Rebuild. * features/arm-with-m-vfp-d16.c: Rebuild. * features/arm-with-m.c: Rebuild. * features/arm-with-neon.c: Rebuild. * features/arm-with-vfpv2.c: Rebuild. * features/arm-with-vfpv3.c: Rebuild. * features/i386/amd64-avx-linux.c: Rebuild. * features/i386/amd64-avx.c: Rebuild. * features/i386/amd64-linux.c: Rebuild. * features/i386/amd64.c: Rebuild. * features/i386/i386-avx-linux.c: Rebuild. * features/i386/i386-avx.c: Rebuild. * features/i386/i386-linux.c: Rebuild. * features/i386/i386-mmx-linux.c: Rebuild. * features/i386/i386-mmx.c: Rebuild. * features/i386/i386.c: Rebuild. * features/i386/x32-avx-linux.c: Rebuild. * features/i386/x32-avx.c: Rebuild. * features/i386/x32-linux.c: Rebuild. * features/i386/x32.c: Rebuild. * features/mips-dsp-linux.c: Rebuild. * features/mips-linux.c: Rebuild. * features/mips64-dsp-linux.c: Rebuild. * features/mips64-linux.c: Rebuild. * features/rs6000/powerpc-32.c: Rebuild. * features/rs6000/powerpc-32l.c: Rebuild. * features/rs6000/powerpc-403.c: Rebuild. * features/rs6000/powerpc-403gc.c: Rebuild. * features/rs6000/powerpc-405.c: Rebuild. * features/rs6000/powerpc-505.c: Rebuild. * features/rs6000/powerpc-601.c: Rebuild. * features/rs6000/powerpc-602.c: Rebuild. * features/rs6000/powerpc-603.c: Rebuild. * features/rs6000/powerpc-604.c: Rebuild. * features/rs6000/powerpc-64.c: Rebuild. * features/rs6000/powerpc-64l.c: Rebuild. * features/rs6000/powerpc-7400.c: Rebuild. * features/rs6000/powerpc-750.c: Rebuild. * features/rs6000/powerpc-860.c: Rebuild. * features/rs6000/powerpc-altivec32.c: Rebuild. * features/rs6000/powerpc-altivec32l.c: Rebuild. * features/rs6000/powerpc-altivec64.c: Rebuild. * features/rs6000/powerpc-altivec64l.c: Rebuild. * features/rs6000/powerpc-cell32l.c: Rebuild. * features/rs6000/powerpc-cell64l.c: Rebuild. * features/rs6000/powerpc-e500.c: Rebuild. * features/rs6000/powerpc-e500l.c: Rebuild. * features/rs6000/powerpc-isa205-32l.c: Rebuild. * features/rs6000/powerpc-isa205-64l.c: Rebuild. * features/rs6000/powerpc-isa205-altivec32l.c: Rebuild. * features/rs6000/powerpc-isa205-altivec64l.c: Rebuild. * features/rs6000/powerpc-isa205-vsx32l.c: Rebuild. * features/rs6000/powerpc-isa205-vsx64l.c: Rebuild. * features/rs6000/powerpc-vsx32.c: Rebuild. * features/rs6000/powerpc-vsx32l.c: Rebuild. * features/rs6000/powerpc-vsx64.c: Rebuild. * features/rs6000/powerpc-vsx64l.c: Rebuild. * features/rs6000/rs6000.c: Rebuild. * features/s390-linux32.c: Rebuild. * features/s390-linux32v1.c: Rebuild. * features/s390-linux32v2.c: Rebuild. * features/s390-linux64.c: Rebuild. * features/s390-linux64v1.c: Rebuild. * features/s390-linux64v2.c: Rebuild. * features/s390x-linux64.c: Rebuild. * features/s390x-linux64v1.c: Rebuild. * features/s390x-linux64v2.c: Rebuild. * features/tic6x-c62x-linux.c: Rebuild. * features/tic6x-c62x.c: Rebuild. * features/tic6x-c64x-linux.c: Rebuild. * features/tic6x-c64x.c: Rebuild. * features/tic6x-c64xp-linux.c: Rebuild. * features/tic6x-c64xp.c: Rebuild.
2012-07-27 22:23:05 +02:00
/* *INDENT-OFF* */ /* THIS FILE IS GENERATED -*- buffer-read-only: t -*- */
/* vi:set ro: */
2000-03-30 07:32:23 +02:00
1999-08-31 03:14:27 +02:00
/* Dynamic architecture support for GDB, the GNU debugger.
Copyright (C) 1998-2015 Free Software Foundation, Inc.
1999-08-31 03:14:27 +02:00
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 3 of the License, or
1999-08-31 03:14:27 +02:00
(at your option) any later version.
1999-08-31 03:14:27 +02:00
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.
1999-08-31 03:14:27 +02:00
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
1999-08-31 03:14:27 +02:00
/* This file was created with the aid of \`\`gdbarch.sh''.
The Bourne shell script \`\`gdbarch.sh'' creates the files
1999-08-31 03:14:27 +02:00
\`\`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
1999-08-31 03:14:27 +02:00
to this file, modifying gdbarch.sh and using its output may prove
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
easier. */
1999-08-31 03:14:27 +02:00
EOF
}
#
# The .h file
#
exec > new-gdbarch.h
copyright
cat <<EOF
#ifndef GDBARCH_H
#define GDBARCH_H
#include "frame.h"
struct floatformat;
struct ui_file;
1999-08-31 03:14:27 +02:00
struct value;
struct objfile;
struct obj_section;
struct minimal_symbol;
struct regcache;
struct reggroup;
struct regset;
2003-09-04 Andrew Cagney <cagney@redhat.com> * avr-tdep.c: Include "dis-asm.h". * cris-tdep.c: Include "dis-asm.h". (cris_delayed_get_disassembler): Use "struct disassemble_info" instead of corresponding typedef. * h8300-tdep.c: Include "dis-asm.h". * ia64-tdep.c: Include "dis-asm.h". * i386-tdep.c: Include "dis-asm.h". (i386_print_insn): Use "struct disassemble_info" instead of corresponding typedef. * m68k-tdep.c: Include "dis-asm.h". * mcore-tdep.c: Include "dis-asm.h". * mips-tdep.c: Include "dis-asm.h". (gdb_print_insn_mips): Make static, use "struct disassemble_info" instead of corresponding typedef. * ns32k-tdep.c: Include "dis-asm.h". * s390-tdep.c: Include "dis-asm.h". * sparc-tdep.c: Include "dis-asm.h". * vax-tdep.c: Include "dis-asm.h". * v850-tdep.c: Include "dis-asm.h". * mn10300-tdep.c: Include "dis-asm.h". * rs6000-tdep.c: Include "dis-asm.h". * xstormy16-tdep.c: Include "dis-asm.h". (_initialize_xstormy16_tdep): Delete "extern" declaration of print_insn_xstormy16. * Makefile.in (v850-tdep.o): Update dependencies. (vax-tdep.o, sparc-tdep.o, s390-tdep.o): Ditto. (ns32k-tdep.o, mips-tdep.o, mcore-tdep.o): Ditto. (m68k-tdep.o, ia64-tdep.o, i386-tdep.o): Ditto. (h8300-tdep.o, cris-tdep.o, avr-tdep.o): Ditto. (mn10300-tdep.o, xstormy16-tdep.o, disasm.o): Ditto. (gdbarch_h): Remove $(dis_asm_h). * disasm.c: Include "dis-asm.h". (dis_asm_read_memory): Use "struct disassemble_info" instead of corresponding typedef. (dis_asm_memory_error, dump_insns, do_assembly_only): Ditto. (gdb_disassemble_info, gdb_disassembly, gdb_print_insn): Ditto. * gdbarch.sh: Do not include "dis-asm.h". (struct disassemble_info): Declare opaque. (TARGET_PRINT_INSN): Update declaration. * gdbarch.h, gdbarch.c: Re-generate.
2003-09-09 06:41:32 +02:00
struct disassemble_info;
struct target_ops;
2004-03-15 Andrew Cagney <cagney@redhat.com> * gdbarch.sh (gdbarch_data_pre_init_fytpe) (gdbarch_data_register_pre_init, gdbarch_data_post_init_fytpe) (gdbarch_data_register_post_init): Replace gdbarch_data_init_ftype and register_gdbarch_data. (deprecated_set_gdbarch_data): Rename set_gdbarch_data. (struct gdbarch_data): Replace "init" by "pre_init" and "post_init". * gdbarch.h, gdbarch.c: Re-generate. * dwarf2-frame.c (dwarf2_frame_init): Replace "gdbarch" paramter with"obstack", use OBSTACK_ZALLOC. (dwarf2_frame_ops): Delete. (dwarf2_frame_set_init_reg): Use gdbarch_data. (dwarf2_frame_init_reg): Use gdbarch_data. (_initialize_dwarf2_frame): Use gdbarch_data_register_pre_init. * solib-svr4.c (set_solib_svr4_fetch_link_map_offsets) (_initialize_svr4_solib): Update. * user-regs.c (_initialize_user_regs): Update. * reggroups.c (_initialize_reggroup): Update. * regcache.c (_initialize_regcache): Update. * mips-linux-tdep.c (_initialize_mips_linux_tdep): Update. * libunwind-frame.c (_initialize_libunwind_frame): Update. * gnu-v3-abi.c (init_gnuv3_ops): Update. * frame-unwind.c (_initialize_frame_unwind): Update. * frame-base.c (_initialize_frame_base): Update. * user-regs.c (user_reg_add): Update. * reggroups.c (reggroup_add): Update. * mips-linux-tdep.c (set_mips_linux_register_addr): Update. * libunwind-frame.c (libunwind_frame_set_descr): Update. * frame-unwind.c (frame_unwind_append_sniffer): Update. * frame-base.c (frame_base_table): Update. * remote.c (_initialize_remote): Update. * gdb_obstack.h (OBSTACK_ZALLOC, OBSTACK_CALLOC): Define.
2004-03-15 21:38:08 +01:00
struct obstack;
gdb/ * breakpoint.c (deprecated_read_memory_nobpt): Update to use shadow_len. (insert_bp_location, reattach_breakpoints, remove_breakpoint) (delete_breakpoint): Update calls to changed methods. (deprecated_insert_raw_breakpoint, deprecated_remove_raw_breakpoint) (single_step_breakpoints, insert_single_step_breakpoint) (remove_single_step_breakpoints): New. * breakpoint.h (struct bp_target_info): New. (struct bp_location): Replace shadow_contents with target_info and overlay_target_info. (deprecated_insert_raw_breakpoint, deprecated_remove_raw_breakpoint) (insert_single_step_breakpoint, remove_single_step_breakpoints): New prototypes. * gdbarch.sh: Forward declare struct bp_target_info in gdbarch.h. (memory_insert_breakpoint, memory_remove_breakpoint): Update second argument. * mem-break.c (default_memory_insert_breakpoint): Update. Set placed_address, placed_size, and shadow_len. (default_memory_remove_breakpoint): Update. Don't use BREAKPOINT_FROM_PC. (memory_insert_breakpoint, memory_remove_breakpoint): Update. * target.c (update_current_target): Update prototypes for changed functions. (debug_to_insert_breakpoint, debug_to_remove_breakpoint) (debug_to_insert_hw_breakpoint, debug_to_remove_hw_breakpoint): Update. * target.h: Forward declare struct bp_target_info. (struct target_ops): Use a bp_target_info argument for to_insert_breakpoint, to_remove_breakpoint, to_insert_hw_breakpoint, and to_remove_hw_breakpoint. (target_insert_breakpoint, target_remove_breakpoint) (target_insert_hw_breakpoint, target_remove_hw_breakpoint) (memory_insert_breakpoint, memory_remove_breakpoint) (default_memory_insert_breakpoint, default_memory_remove_breakpoint): Update. * config/i386/nm-i386.h: Forward declare struct bp_target_info. (i386_insert_hw_breakpoint, i386_remove_hw_breakpoint): Update. (target_insert_hw_breakpoint, target_remove_hw_breakpoint): Likewise. * gdbarch.c, gdbarch.h: Regenerated. * alpha-tdep.c (alpha_software_single_step): Use insert_single_step_breakpoint and remove_single_step_breakpoints. Remove unused statics. * arm-tdep.c (arm_software_single_step): Likewise. Add a note. * cris-tdep.c (cris_software_single_step): Likewise. * mips-tdep.c (mips_software_single_step): Likewise. * rs6000-tdep.c (rs6000_software_single_step): Likewise. * sparc-tdep.c (sparc_software_single_step): Likewise. * wince.c (struct thread_info_struct): Remove step_prev. (undoSStep): Use remove_single_step_breakpoints. (wince_software_single_step): Use insert_single_step_breakpoint. * corelow.c (ignore): Remove unneeded prototype. Update arguments. * exec.c (ignore): Likewise. * sol-thread.c (ignore): Likewise. * procfs.c (dbx_link_shadow_contents): Delete. (dbx_link_bpt): New. (procfs_mourn_inferior): Remove it if necessary. (remove_dbx_link_breakpoint): Use it. (insert_dbx_link_bpt_in_file): Set it. (procfs_init_inferior): Don't update dbx_link_bpt_addr. * rs6000-nat.c (exec_one_dummy_insn): Use deprecated_insert_raw_breakpoint and deprecated_remove_raw_breakpoint. * solib-irix.c (shadow_contents, breakpoint_addr): Delete. (base_breakpoint): New. (disable_break): Use it. (enable_break): Set it. * i386-nat.c (i386_insert_hw_breakpoint, i386_remove_hw_breakpoint): Update. * ia64-tdep.c (ia64_memory_insert_breakpoint) (ia64_memory_remove_breakpoint): Likewise. * m32r-tdep.c (m32r_memory_insert_breakpoint) (m32r_memory_remove_breakpoint): Likewise. * monitor.c (monitor_insert_breakpoint, monitor_remove_breakpoint): Likewise. Remove unnecessary prototypes. Use placed_address and placed_size. Removed useless read from memory. * nto-procfs.c (procfs_insert_breakpoint) (procfs_remove_breakpoint, procfs_insert_hw_breakpoint) (procfs_remove_hw_breakpoint): Update. * ocd.c (ocd_insert_breakpoint, ocd_remove_breakpoint): Likewise. * ocd.h (ocd_insert_breakpoint, ocd_remove_breakpoint): Likewise. * ppc-linux-tdep.c (ppc_linux_memory_remove_breakpoint): Likewise. * ppc-tdep.h (ppc_linux_memory_remove_breakpoint): Likewise. * remote-e7000.c (e7000_insert_breakpoint) (e7000_remove_breakpoint): Likewise. * remote-m32r-sdi.c (m32r_insert_breakpoint) (m32r_remove_breakpoint): Likewise. * remote-mips.c (mips_insert_breakpoint) (mips_remove_breakpoint): Likewise. * remote-rdp.c (remote_rdp_insert_breakpoint) (remote_rdp_remove_breakpoint): Likewise. (rdp_step): Use deprecated_insert_raw_breakpoint and deprecated_remove_raw_breakpoint. * remote-sds.c (sds_insert_breakpoint, sds_remove_breakpoint): Update. * remote-sim.c (gdbsim_insert_breakpoint, gdbsim_remove_breakpoint): Delete. (init_gdbsim_ops): Use memory_insert_breakpoint and memory_remove_breakpoint. * remote-st.c (st2000_insert_breakpoint) (st2000_remove_breakpoint): Update. Remove unused BREAKPOINT_FROM_PC. * remote.c (remote_insert_breakpoint, remote_remove_breakpoint): Update. Use placed_address and placed_size. (remote_insert_hw_breakpoint, remote_remove_hw_breakpoint): Likewise. gdb/doc/ * gdbint.texinfo (x86 Watchpoints, Target Conditionals): Update insert and remove breakpoint prototypes. (Watchpoints): Move description of target_insert_hw_breakpoint and target_remove_hw_breakpoint ... (Breakpoints): ... to here. Document target_insert_breakpoint and target_remove_breakpoint.
2006-04-18 21:20:08 +02:00
struct bp_target_info;
struct target_desc;
MIPS: Keep the ISA bit in compressed code addresses 1. Background information The MIPS architecture, as originally designed and implemented in mid-1980s has a uniform instruction word size that is 4 bytes, naturally aligned. As such all MIPS instructions are located at addresses that have their bits #1 and #0 set to zeroes, and any attempt to execute an instruction from an address that has any of the two bits set to one causes an address error exception. This may for example happen when a jump-register instruction is executed whose register value used as the jump target has any of these bits set. Then in mid 1990s LSI sought a way to improve code density for their TinyRISC family of MIPS cores and invented an alternatively encoded instruction set in a joint effort with MIPS Technologies (then a subsidiary of SGI). The new instruction set has been named the MIPS16 ASE (Application-Specific Extension) and uses a variable instruction word size, which is 2 bytes (as the name of the ASE suggests) for most, but there are a couple of exceptions that take 4 bytes, and then most of the 2-byte instructions can be treated with a 2-byte extension prefix to expand the range of the immediate operands used. As a result instructions are no longer 4-byte aligned, instead they are aligned to a multiple of 2. That left the bit #0 still unused for code references, be it for the standard MIPS (i.e. as originally invented) or for the MIPS16 instruction set, and based on that observation a clever trick was invented that on one hand allowed the processor to be seamlessly switched between the two instruction sets at any time at the run time while on the other avoided the introduction of any special control register to do that. So it is the bit #0 of the instruction address that was chosen as the selector and named the ISA bit. Any instruction executed at an even address is interpreted as a standard MIPS instruction (the address still has to have its bit #1 clear), any instruction executed at an odd address is interpreted as a MIPS16 instruction. To switch between modes ordinary jump instructions are used, such as used for function calls and returns, specifically the bit #0 of the source register used in jump-register instructions selects the execution (ISA) mode for the following piece of code to be interpreted in. Additionally new jump-immediate instructions were added that flipped the ISA bit to select the opposite mode upon execution. They were considered necessary to avoid the need to make register jumps in all cases as the original jump-immediate instructions provided no way to change the bit #0 at all. This was all important for cases where standard MIPS and MIPS16 code had to be mixed, either for compatibility with the existing binary code base or to access resources not reachable from MIPS16 code (the MIPS16 instruction set only provides access to general-purpose registers, and not for example floating-point unit registers or privileged coprocessor 0 registers) -- pieces of code in the opposite mode can be executed as ordinary subroutine calls. A similar approach has been more recently adopted for the MIPS16 replacement instruction set defined as the so called microMIPS ASE. This is another instruction set encoding introduced to the MIPS architecture. Just like the MIPS16 ASE, the microMIPS instruction set uses a variable-length encoding, where each instruction takes a multiple of 2 bytes. The ISA bit has been reused and for microMIPS-capable processors selects between the standard MIPS and the microMIPS mode instead. 2. Statement of the problem To put it shortly, MIPS16 and microMIPS code pointers used by GDB are different to these observed at the run time. This results in the same expressions being evaluated producing different results in GDB and in the program being debugged. Obviously it's the results obtained at the run time that are correct (they define how the program behaves) and therefore by definition the results obtained in GDB are incorrect. A bit longer description will record that obviously at the run time the ISA bit has to be set correctly (refer to background information above if unsure why so) or the program will not run as expected. This is recorded in all the executable file structures used at the run time: the dynamic symbol table (but not always the static one!), the GOT, and obviously in all the addresses embedded in code or data of the program itself, calculated by applying the appropriate relocations at the static link time. While a program is being processed by GDB, the ISA bit is stripped off from any code addresses, presumably to make them the same as the respective raw memory byte address used by the processor to access the instruction in the instruction fetch access cycle. This stripping is actually performed outside GDB proper, in BFD, specifically _bfd_mips_elf_symbol_processing (elfxx-mips.c, see the piece of code at the very bottom of that function, starting with an: "If this is an odd-valued function symbol, assume it's a MIPS16 or microMIPS one." comment). This function is also responsible for symbol table dumps made by `objdump' too, so you'll never see the ISA bit reported there by that tool, you need to use `readelf'. This is however unlike what is ever done at the run time, the ISA bit once present is never stripped off, for example a cast like this: (short *) main will not strip the ISA bit off and if the resulting pointer is intended to be used to access instructions as data, for example for software instruction decoding (like for fault recovery or emulation in a signal handler) or for self-modifying code then the bit still has to be stripped off by an explicit AND operation. This is probably best illustrated with a simple real program example. Let's consider the following simple program: $ cat foobar.c int __attribute__ ((mips16)) foo (void) { return 1; } int __attribute__ ((mips16)) bar (void) { return 2; } int __attribute__ ((nomips16)) foo32 (void) { return 3; } int (*foo32p) (void) = foo32; int (*foop) (void) = foo; int fooi = (int) foo; int main (void) { return foop (); } $ This is plain C with no odd tricks, except from the instruction mode attributes. They are not necessary to trigger this problem, I just put them here so that the program can be contained in a single source file and to make it obvious which function is MIPS16 code and which is not. Let's try it with Linux, so that everyone can repeat this experiment: $ mips-linux-gnu-gcc -mips16 -g -O2 -o foobar foobar.c $ Let's have a look at some interesting symbols: $ mips-linux-gnu-readelf -s foobar | egrep 'table|foo|bar' Symbol table '.dynsym' contains 7 entries: Symbol table '.symtab' contains 95 entries: 55: 00000000 0 FILE LOCAL DEFAULT ABS foobar.c 66: 0040068c 4 FUNC GLOBAL DEFAULT [MIPS16] 12 bar 68: 00410848 4 OBJECT GLOBAL DEFAULT 21 foo32p 70: 00410844 4 OBJECT GLOBAL DEFAULT 21 foop 78: 00400684 8 FUNC GLOBAL DEFAULT 12 foo32 80: 00400680 4 FUNC GLOBAL DEFAULT [MIPS16] 12 foo 88: 00410840 4 OBJECT GLOBAL DEFAULT 21 fooi $ Hmm, no sight of the ISA bit, but notice how foo and bar (but not foo32!) have been marked as MIPS16 functions (ELF symbol structure's `st_other' field is used for that). So let's try to run and poke at this program with GDB. I'll be using a native system for simplicity (I'll be using ellipses here and there to remove unrelated clutter): $ ./foobar $ echo $? 1 $ So far, so good. $ gdb ./foobar [...] (gdb) break main Breakpoint 1 at 0x400490: file foobar.c, line 23. (gdb) run Starting program: .../foobar Breakpoint 1, main () at foobar.c:23 23 return foop (); (gdb) Yay, it worked! OK, so let's poke at it: (gdb) print main $1 = {int (void)} 0x400490 <main> (gdb) print foo32 $2 = {int (void)} 0x400684 <foo32> (gdb) print foo32p $3 = (int (*)(void)) 0x400684 <foo32> (gdb) print bar $4 = {int (void)} 0x40068c <bar> (gdb) print foo $5 = {int (void)} 0x400680 <foo> (gdb) print foop $6 = (int (*)(void)) 0x400681 <foo> (gdb) A-ha! Here's the difference and finally the ISA bit! (gdb) print /x fooi $7 = 0x400681 (gdb) p/x $pc p/x $pc $8 = 0x400491 (gdb) And here as well... (gdb) advance foo foo () at foobar.c:4 4 } (gdb) disassemble Dump of assembler code for function foo: 0x00400680 <+0>: jr ra 0x00400682 <+2>: li v0,1 End of assembler dump. (gdb) finish Run till exit from #0 foo () at foobar.c:4 main () at foobar.c:24 24 } Value returned is $9 = 1 (gdb) continue Continuing. [Inferior 1 (process 14103) exited with code 01] (gdb) So let's be a bit inquisitive... (gdb) run Starting program: .../foobar Breakpoint 1, main () at foobar.c:23 23 return foop (); (gdb) Actually we do not like to run foo here at all. Let's run bar instead! (gdb) set foop = bar (gdb) print foop $10 = (int (*)(void)) 0x40068c <bar> (gdb) Hmm, no ISA bit. Is it going to work? (gdb) advance bar bar () at foobar.c:9 9 } (gdb) p/x $pc $11 = 0x40068c (gdb) disassemble Dump of assembler code for function bar: => 0x0040068c <+0>: jr ra 0x0040068e <+2>: li v0,2 End of assembler dump. (gdb) finish Run till exit from #0 bar () at foobar.c:9 Program received signal SIGILL, Illegal instruction. bar () at foobar.c:9 9 } (gdb) Oops! (gdb) p/x $pc $12 = 0x40068c (gdb) We're still there! (gdb) continue Continuing. Program terminated with signal SIGILL, Illegal instruction. The program no longer exists. (gdb) So let's try something else: (gdb) run Starting program: .../foobar Breakpoint 1, main () at foobar.c:23 23 return foop (); (gdb) set foop = foo (gdb) advance foo foo () at foobar.c:4 4 } (gdb) disassemble Dump of assembler code for function foo: => 0x00400680 <+0>: jr ra 0x00400682 <+2>: li v0,1 End of assembler dump. (gdb) finish Run till exit from #0 foo () at foobar.c:4 Program received signal SIGILL, Illegal instruction. foo () at foobar.c:4 4 } (gdb) continue Continuing. Program terminated with signal SIGILL, Illegal instruction. The program no longer exists. (gdb) The same problem! (gdb) run Starting program: /net/build2-lucid-cs/scratch/macro/mips-linux-fsf-gcc/isa-bit/foobar Breakpoint 1, main () at foobar.c:23 23 return foop (); (gdb) set foop = foo32 (gdb) advance foo32 foo32 () at foobar.c:14 14 } (gdb) disassemble Dump of assembler code for function foo32: => 0x00400684 <+0>: jr ra 0x00400688 <+4>: li v0,3 End of assembler dump. (gdb) finish Run till exit from #0 foo32 () at foobar.c:14 main () at foobar.c:24 24 } Value returned is $14 = 3 (gdb) continue Continuing. [Inferior 1 (process 14113) exited with code 03] (gdb) That did work though, so it's the ISA bit only! (gdb) quit Enough! That's the tip of the iceberg only though. So let's rebuild the executable with some dynamic symbols: $ mips-linux-gnu-gcc -mips16 -Wl,--export-dynamic -g -O2 -o foobar-dyn foobar.c $ mips-linux-gnu-readelf -s foobar-dyn | egrep 'table|foo|bar' Symbol table '.dynsym' contains 32 entries: 6: 004009cd 4 FUNC GLOBAL DEFAULT 12 bar 8: 00410b88 4 OBJECT GLOBAL DEFAULT 21 foo32p 9: 00410b84 4 OBJECT GLOBAL DEFAULT 21 foop 15: 004009c4 8 FUNC GLOBAL DEFAULT 12 foo32 17: 004009c1 4 FUNC GLOBAL DEFAULT 12 foo 25: 00410b80 4 OBJECT GLOBAL DEFAULT 21 fooi Symbol table '.symtab' contains 95 entries: 55: 00000000 0 FILE LOCAL DEFAULT ABS foobar.c 69: 004009cd 4 FUNC GLOBAL DEFAULT 12 bar 71: 00410b88 4 OBJECT GLOBAL DEFAULT 21 foo32p 72: 00410b84 4 OBJECT GLOBAL DEFAULT 21 foop 79: 004009c4 8 FUNC GLOBAL DEFAULT 12 foo32 81: 004009c1 4 FUNC GLOBAL DEFAULT 12 foo 89: 00410b80 4 OBJECT GLOBAL DEFAULT 21 fooi $ OK, now the ISA bit is there for a change, but the MIPS16 `st_other' attribute gone, hmm... What does `objdump' do then: $ mips-linux-gnu-objdump -Tt foobar-dyn | egrep 'SYMBOL|foo|bar' foobar-dyn: file format elf32-tradbigmips SYMBOL TABLE: 00000000 l df *ABS* 00000000 foobar.c 004009cc g F .text 00000004 0xf0 bar 00410b88 g O .data 00000004 foo32p 00410b84 g O .data 00000004 foop 004009c4 g F .text 00000008 foo32 004009c0 g F .text 00000004 0xf0 foo 00410b80 g O .data 00000004 fooi DYNAMIC SYMBOL TABLE: 004009cc g DF .text 00000004 Base 0xf0 bar 00410b88 g DO .data 00000004 Base foo32p 00410b84 g DO .data 00000004 Base foop 004009c4 g DF .text 00000008 Base foo32 004009c0 g DF .text 00000004 Base 0xf0 foo 00410b80 g DO .data 00000004 Base fooi $ Hmm, the attribute (0xf0, printed raw) is back, and the ISA bit gone again. Let's have a look at some DWARF-2 records GDB uses (I'll be stripping off a lot here for brevity) -- debug info: $ mips-linux-gnu-readelf -wi foobar Contents of the .debug_info section: [...] Compilation Unit @ offset 0x88: Length: 0xbb (32-bit) Version: 4 Abbrev Offset: 62 Pointer Size: 4 <0><93>: Abbrev Number: 1 (DW_TAG_compile_unit) <94> DW_AT_producer : (indirect string, offset: 0x19e): GNU C 4.8.0 20120513 (experimental) -meb -mips16 -march=mips32r2 -mhard-float -mllsc -mplt -mno-synci -mno-shared -mabi=32 -g -O2 <98> DW_AT_language : 1 (ANSI C) <99> DW_AT_name : (indirect string, offset: 0x190): foobar.c <9d> DW_AT_comp_dir : (indirect string, offset: 0x225): [...] <a1> DW_AT_ranges : 0x0 <a5> DW_AT_low_pc : 0x0 <a9> DW_AT_stmt_list : 0x27 <1><ad>: Abbrev Number: 2 (DW_TAG_subprogram) <ae> DW_AT_external : 1 <ae> DW_AT_name : foo <b2> DW_AT_decl_file : 1 <b3> DW_AT_decl_line : 1 <b4> DW_AT_prototyped : 1 <b4> DW_AT_type : <0xc2> <b8> DW_AT_low_pc : 0x400680 <bc> DW_AT_high_pc : 0x400684 <c0> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa) <c2> DW_AT_GNU_all_call_sites: 1 <1><c2>: Abbrev Number: 3 (DW_TAG_base_type) <c3> DW_AT_byte_size : 4 <c4> DW_AT_encoding : 5 (signed) <c5> DW_AT_name : int <1><c9>: Abbrev Number: 4 (DW_TAG_subprogram) <ca> DW_AT_external : 1 <ca> DW_AT_name : (indirect string, offset: 0x18a): foo32 <ce> DW_AT_decl_file : 1 <cf> DW_AT_decl_line : 11 <d0> DW_AT_prototyped : 1 <d0> DW_AT_type : <0xc2> <d4> DW_AT_low_pc : 0x400684 <d8> DW_AT_high_pc : 0x40068c <dc> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa) <de> DW_AT_GNU_all_call_sites: 1 <1><de>: Abbrev Number: 2 (DW_TAG_subprogram) <df> DW_AT_external : 1 <df> DW_AT_name : bar <e3> DW_AT_decl_file : 1 <e4> DW_AT_decl_line : 6 <e5> DW_AT_prototyped : 1 <e5> DW_AT_type : <0xc2> <e9> DW_AT_low_pc : 0x40068c <ed> DW_AT_high_pc : 0x400690 <f1> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa) <f3> DW_AT_GNU_all_call_sites: 1 <1><f3>: Abbrev Number: 5 (DW_TAG_subprogram) <f4> DW_AT_external : 1 <f4> DW_AT_name : (indirect string, offset: 0x199): main <f8> DW_AT_decl_file : 1 <f9> DW_AT_decl_line : 21 <fa> DW_AT_prototyped : 1 <fa> DW_AT_type : <0xc2> <fe> DW_AT_low_pc : 0x400490 <102> DW_AT_high_pc : 0x4004a4 <106> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa) <108> DW_AT_GNU_all_tail_call_sites: 1 [...] $ -- no sign of the ISA bit anywhere -- frame info: $ mips-linux-gnu-readelf -wf foobar [...] Contents of the .debug_frame section: 00000000 0000000c ffffffff CIE Version: 1 Augmentation: "" Code alignment factor: 1 Data alignment factor: -4 Return address column: 31 DW_CFA_def_cfa_register: r29 DW_CFA_nop 00000010 0000000c 00000000 FDE cie=00000000 pc=00400680..00400684 00000020 0000000c 00000000 FDE cie=00000000 pc=00400684..0040068c 00000030 0000000c 00000000 FDE cie=00000000 pc=0040068c..00400690 00000040 00000018 00000000 FDE cie=00000000 pc=00400490..004004a4 DW_CFA_advance_loc: 6 to 00400496 DW_CFA_def_cfa_offset: 32 DW_CFA_offset: r31 at cfa-4 DW_CFA_advance_loc: 6 to 0040049c DW_CFA_restore: r31 DW_CFA_def_cfa_offset: 0 DW_CFA_nop DW_CFA_nop DW_CFA_nop [...] $ -- no sign of the ISA bit anywhere -- range info (GDB doesn't use arange): $ mips-linux-gnu-readelf -wR foobar Contents of the .debug_ranges section: Offset Begin End 00000000 00400680 00400690 00000000 00400490 004004a4 00000000 <End of list> $ -- no sign of the ISA bit anywhere -- line info: $ mips-linux-gnu-readelf -wl foobar Raw dump of debug contents of section .debug_line: [...] Offset: 0x27 Length: 78 DWARF Version: 2 Prologue Length: 31 Minimum Instruction Length: 1 Initial value of 'is_stmt': 1 Line Base: -5 Line Range: 14 Opcode Base: 13 Opcodes: Opcode 1 has 0 args Opcode 2 has 1 args Opcode 3 has 1 args Opcode 4 has 1 args Opcode 5 has 1 args Opcode 6 has 0 args Opcode 7 has 0 args Opcode 8 has 0 args Opcode 9 has 1 args Opcode 10 has 0 args Opcode 11 has 0 args Opcode 12 has 1 args The Directory Table is empty. The File Name Table: Entry Dir Time Size Name 1 0 0 0 foobar.c Line Number Statements: Extended opcode 2: set Address to 0x400681 Special opcode 6: advance Address by 0 to 0x400681 and Line by 1 to 2 Special opcode 7: advance Address by 0 to 0x400681 and Line by 2 to 4 Special opcode 55: advance Address by 3 to 0x400684 and Line by 8 to 12 Special opcode 7: advance Address by 0 to 0x400684 and Line by 2 to 14 Advance Line by -7 to 7 Special opcode 131: advance Address by 9 to 0x40068d and Line by 0 to 7 Special opcode 7: advance Address by 0 to 0x40068d and Line by 2 to 9 Advance PC by 3 to 0x400690 Extended opcode 1: End of Sequence Extended opcode 2: set Address to 0x400491 Advance Line by 21 to 22 Copy Special opcode 6: advance Address by 0 to 0x400491 and Line by 1 to 23 Special opcode 60: advance Address by 4 to 0x400495 and Line by -1 to 22 Special opcode 34: advance Address by 2 to 0x400497 and Line by 1 to 23 Special opcode 62: advance Address by 4 to 0x40049b and Line by 1 to 24 Special opcode 32: advance Address by 2 to 0x40049d and Line by -1 to 23 Special opcode 6: advance Address by 0 to 0x40049d and Line by 1 to 24 Advance PC by 7 to 0x4004a4 Extended opcode 1: End of Sequence [...] -- a-ha, the ISA bit is there! However it's not always right for some reason, I don't have a small test case to show it, but here's an excerpt from MIPS16 libc, a prologue of a function: 00019630 <__libc_init_first>: 19630: e8a0 jrc ra 19632: 6500 nop 00019634 <_init>: 19634: f000 6a11 li v0,17 19638: f7d8 0b08 la v1,15e00 <_DYNAMIC+0x15c54> 1963c: f400 3240 sll v0,16 19640: e269 addu v0,v1 19642: 659a move gp,v0 19644: 64f6 save 48,ra,s0-s1 19646: 671c move s0,gp 19648: d204 sw v0,16(sp) 1964a: f352 984c lw v0,-27828(s0) 1964e: 6724 move s1,a0 and the corresponding DWARF-2 line info: Line Number Statements: Extended opcode 2: set Address to 0x19631 Advance Line by 44 to 45 Copy Special opcode 8: advance Address by 0 to 0x19631 and Line by 3 to 48 Special opcode 66: advance Address by 4 to 0x19635 and Line by 5 to 53 Advance PC by constant 17 to 0x19646 Special opcode 25: advance Address by 1 to 0x19647 and Line by 6 to 59 Advance Line by -6 to 53 Special opcode 33: advance Address by 2 to 0x19649 and Line by 0 to 53 Special opcode 39: advance Address by 2 to 0x1964b and Line by 6 to 59 Advance Line by -6 to 53 Special opcode 61: advance Address by 4 to 0x1964f and Line by 0 to 53 -- see that "Advance PC by constant 17" there? It clears the ISA bit, however code at 0x19646 is not standard MIPS code at all. For some reason the constant is always 17, I've never seen DW_LNS_const_add_pc used with any other value -- is that a binutils bug or what? 3. Solution: I think we should retain the value of the ISA bit in code references, that is effectively treat them as cookies as they indeed are (although trivially calculated) rather than raw memory byte addresses. In a perfect world both the static symbol table and the respective DWARF-2 records should be fixed to include the ISA bit in all the cases. I think however that this is infeasible. All the uses of `_bfd_mips_elf_symbol_processing' can not necessarily be tracked down. This function is used by `elf_slurp_symbol_table' that in turn is used by `bfd_canonicalize_symtab' and `bfd_canonicalize_dynamic_symtab', which are public interfaces. Similarly DWARF-2 records are used outside GDB, one notable if a bit questionable is the exception unwinder (libgcc/unwind-dw2.c) -- I have identified at least bits in `execute_cfa_program' and `uw_frame_state_for', both around the calls to `_Unwind_IsSignalFrame', that would need an update as they effectively flip the ISA bit freely; see also the comment about MASK_RETURN_ADDR in gcc/config/mips/mips.h. But there may be more places. Any change in how DWARF-2 records are produced would require an update there and would cause compatibility problems with libgcc.a binaries already distributed; given that this is a static library a complex change involving function renames would likely be required. I propose therefore to accept the existing inconsistencies and deal with them entirely within GDB. I have figured out that the ISA bit lost in various places can still be recovered as long as we have symbol information -- that'll have the `st_other' attribute correctly set to one of standard MIPS/MIPS16/microMIPS encoding. Here's the resulting change. It adds a couple of new `gdbarch' hooks, one to update symbol information with the ISA bit lost in `_bfd_mips_elf_symbol_processing', and two other ones to adjust DWARF-2 records as they're processed. The ISA bit is set in each address handled according to information retrieved from the symbol table for the symbol spanning the address if any; limits are adjusted based on the address they point to related to the respective base address. Additionally minimal symbol information has to be adjusted accordingly in its gdbarch hook. With these changes in place some complications with ISA bit juggling in the PC that never fully worked can be removed from the MIPS backend. Conversely, the generic dynamic linker event special breakpoint symbol handler has to be updated to call the minimal symbol gdbarch hook to record that the symbol is a MIPS16 or microMIPS address if applicable or the breakpoint will be set at the wrong address and either fail to work or cause SIGTRAPs (this is because the symbol is handled early on and bypasses regular symbol processing). 4. Results obtained The change fixes the example above -- to repeat only the crucial steps: (gdb) break main Breakpoint 1 at 0x400491: file foobar.c, line 23. (gdb) run Starting program: .../foobar Breakpoint 1, main () at foobar.c:23 23 return foop (); (gdb) print foo $1 = {int (void)} 0x400681 <foo> (gdb) set foop = bar (gdb) advance bar bar () at foobar.c:9 9 } (gdb) disassemble Dump of assembler code for function bar: => 0x0040068d <+0>: jr ra 0x0040068f <+2>: li v0,2 End of assembler dump. (gdb) finish Run till exit from #0 bar () at foobar.c:9 main () at foobar.c:24 24 } Value returned is $2 = 2 (gdb) continue Continuing. [Inferior 1 (process 14128) exited with code 02] (gdb) -- excellent! The change removes about 90 failures per MIPS16 multilib in mips-sde-elf testing too, results for MIPS16 are now similar to that for standard MIPS; microMIPS results are a bit worse because of host-I/O problems in QEMU used instead of MIPSsim for microMIPS testing only: === gdb Summary === # of expected passes 14299 # of unexpected failures 187 # of expected failures 56 # of known failures 58 # of unresolved testcases 11 # of untested testcases 52 # of unsupported tests 174 MIPS16: === gdb Summary === # of expected passes 14298 # of unexpected failures 187 # of unexpected successes 2 # of expected failures 54 # of known failures 58 # of unresolved testcases 12 # of untested testcases 52 # of unsupported tests 174 microMIPS: === gdb Summary === # of expected passes 14149 # of unexpected failures 201 # of unexpected successes 2 # of expected failures 54 # of known failures 58 # of unresolved testcases 7 # of untested testcases 53 # of unsupported tests 175 2014-12-12 Maciej W. Rozycki <macro@codesourcery.com> Maciej W. Rozycki <macro@mips.com> Pedro Alves <pedro@codesourcery.com> gdb/ * gdbarch.sh (elf_make_msymbol_special): Change type to `F', remove `predefault' and `invalid_p' initializers. (make_symbol_special): New architecture method. (adjust_dwarf2_addr, adjust_dwarf2_line): Likewise. (objfile, symbol): New declarations. * arch-utils.h (default_elf_make_msymbol_special): Remove prototype. (default_make_symbol_special): New prototype. (default_adjust_dwarf2_addr): Likewise. (default_adjust_dwarf2_line): Likewise. * mips-tdep.h (mips_unmake_compact_addr): New prototype. * arch-utils.c (default_elf_make_msymbol_special): Remove function. (default_make_symbol_special): New function. (default_adjust_dwarf2_addr): Likewise. (default_adjust_dwarf2_line): Likewise. * dwarf2-frame.c (decode_frame_entry_1): Call `gdbarch_adjust_dwarf2_addr'. * dwarf2loc.c (dwarf2_find_location_expression): Likewise. * dwarf2read.c (create_addrmap_from_index): Likewise. (process_psymtab_comp_unit_reader): Likewise. (add_partial_symbol): Likewise. (add_partial_subprogram): Likewise. (process_full_comp_unit): Likewise. (read_file_scope): Likewise. (read_func_scope): Likewise. Call `gdbarch_make_symbol_special'. (read_lexical_block_scope): Call `gdbarch_adjust_dwarf2_addr'. (read_call_site_scope): Likewise. (dwarf2_ranges_read): Likewise. (dwarf2_record_block_ranges): Likewise. (read_attribute_value): Likewise. (dwarf_decode_lines_1): Call `gdbarch_adjust_dwarf2_line'. (new_symbol_full): Call `gdbarch_adjust_dwarf2_addr'. * elfread.c (elf_symtab_read): Don't call `gdbarch_elf_make_msymbol_special' if unset. * mips-linux-tdep.c (micromips_linux_sigframe_validate): Strip the ISA bit from the PC. * mips-tdep.c (mips_unmake_compact_addr): New function. (mips_elf_make_msymbol_special): Set the ISA bit in the symbol's address appropriately. (mips_make_symbol_special): New function. (mips_pc_is_mips): Set the ISA bit before symbol lookup. (mips_pc_is_mips16): Likewise. (mips_pc_is_micromips): Likewise. (mips_pc_isa): Likewise. (mips_adjust_dwarf2_addr): New function. (mips_adjust_dwarf2_line): Likewise. (mips_read_pc, mips_unwind_pc): Keep the ISA bit. (mips_addr_bits_remove): Likewise. (mips_skip_trampoline_code): Likewise. (mips_write_pc): Don't set the ISA bit. (mips_eabi_push_dummy_call): Likewise. (mips_o64_push_dummy_call): Likewise. (mips_gdbarch_init): Install `mips_make_symbol_special', `mips_adjust_dwarf2_addr' and `mips_adjust_dwarf2_line' gdbarch handlers. * solib.c (gdb_bfd_lookup_symbol_from_symtab): Get target-specific symbol address adjustments. * gdbarch.h: Regenerate. * gdbarch.c: Regenerate. 2014-12-12 Maciej W. Rozycki <macro@codesourcery.com> gdb/testsuite/ * gdb.base/func-ptrs.c: New file. * gdb.base/func-ptrs.exp: New file.
2014-12-12 14:31:53 +01:00
struct objfile;
struct symbol;
Implement displaced stepping. gdb/ * gdbarch.sh (max_insn_length): New 'variable'. (displaced_step_copy, displaced_step_fixup) (displaced_step_free_closure, displaced_step_location): New functions. (struct displaced_step_closure): Add forward declaration. * gdbarch.c, gdbarch.h: Regenerated. * arch-utils.c: #include "objfiles.h". (simple_displaced_step_copy_insn) (simple_displaced_step_free_closure) (displaced_step_at_entry_point): New functions. * arch-utils.h (simple_displaced_step_copy_insn) (simple_displaced_step_free_closure) (displaced_step_at_entry_point): New prototypes. * i386-tdep.c (I386_MAX_INSN_LEN): Rename to... (I386_MAX_MATCHED_INSN_LEN): ... this. (i386_absolute_jmp_p, i386_absolute_call_p) (i386_ret_p, i386_call_p, i386_breakpoint_p, i386_syscall_p) (i386_displaced_step_fixup): New functions. (struct i386_insn, i386_match_insn): Update. (i386_gdbarch_init): Set gdbarch_max_insn_length. * i386-tdep.h (I386_MAX_INSN_LEN): New. (i386_displaced_step_fixup): New prototype. * i386-linux-tdep.c (i386_linux_init_abi): Include "arch-utils.h". Register gdbarch_displaced_step_copy, gdbarch_displaced_step_fixup, gdbarch_displaced_step_free_closure, and gdbarch_displaced_step_location functions. * infrun.c (debug_displaced): New variable. (show_debug_displaced): New function. (struct displaced_step_request): New struct. (displaced_step_request_queue, displaced_step_ptid) (displaced_step_gdbarch, displaced_step_closure) (displaced_step_original, displaced_step_copy) (displaced_step_saved_copy, can_use_displaced_stepping): New variables. (show_can_use_displaced_stepping, use_displaced_stepping) (displaced_step_clear, cleanup_displaced_step_closure) (displaced_step_dump_bytes, displaced_step_prepare) (displaced_step_clear_cleanup, write_memory_ptid) (displaced_step_fixup): New functions. (resume): Call displaced_step_prepare. (proceed): Call read_pc once, and remember the value. If using displaced stepping, don't remove breakpoints. (handle_inferior_event): Call displaced_step_fixup. Add some debugging output. When we try to step over a breakpoint, but get a signal to deliver to the thread instead, ensure the step-resume breakpoint is actually inserted. If a thread hop is needed, and displaced stepping is enabled, don't remove breakpoints. (init_wait_for_inferior): Call displaced_step_clear. (_initialize_infrun): Add "set debug displaced" command. Add "maint set can-use-displaced-stepping" command. Clear displaced_step_ptid. * inferior.h (debug_displaced): Declare variable. (displaced_step_dump_bytes): Declare function. * Makefile.in (arch-utils.o, i386-linux-tdep.o): Update dependencies. gdb/testsuite/ * gdb.asm/asmsrc1.s: Add scratch space. gdb/doc/ * gdb.texinfo (Debugging Output): Document "set/show debug displaced". (Maintenance Commands): Document "maint set/show can-use-displaced-stepping".
2008-05-02 18:49:54 +02:00
struct displaced_step_closure;
Implementing catch syscall. * amd64-linux-tdep.c: Include xml-syscall.h header, define the XML syscall name for the architecture. (amd64_linux_get_syscall_number): New function. (amd64_linux_init_abi): Register the correct functions for syscall catchpoint; set the correct syscall file name. * breakpoint.c: New include: xml-syscall.h. (set_raw_breakpoint_without_location): Setting the parameters for the catch syscall feature. (insert_catch_syscall): New. (remove_catch_syscall): New. (breakpoint_hit_catch_syscall): New. (print_it_catch_syscall): New. (print_one_catch_syscall): New. (print_mention_catch_syscall): New. (catch_syscall_breakpoint_ops): New. (syscall_catchpoint_p): New. (create_catchpoint_without_mention): New. (create_catchpoint): Modified in order to use create_catchpoint_without_mention. (create_syscall_event_catchpoint): New. (clean_up_filters): New. (catch_syscall_split_args): New. (catch_syscall_command_1): New. (delete_breakpoint): Add cleanup for catch syscall. (is_syscall_catchpoint_enabled): New. (catch_syscall_enabled): New. (catching_syscall_number): New. (catch_syscall_completer): New completer function. (add_catch_command): Add the completer function for catchpoints. * breakpoint.h (syscalls_to_be_caught): New vector. (catch_syscall_enabled): New. (catching_syscall_number): New. * gdbarch.c: Regenerated. * gdbarch.h: Regenerated. * gdbarch.sh: Add syscall catchpoint functions and structures. (get_syscall_number): New. (UNKNOWN_SYSCALL): New definition. * i386-linux-nat.c (i386_linux_resume): Select the proper request to be made for ptrace() considering if we are catching syscalls or not. * i386-linux-tdep.c: Include xml-syscall.h header, define the XML syscall name for the architecture. (i386_linux_get_syscall_number): New. (i386_linux_init_abi): Register the correct functions for syscall catchpoint; set the correct syscall file name. * inf-child.c (inf_child_set_syscall_catchpoint): New. (inf_child_target): Assign default values to target_ops. * inf-ptrace.c (inf_ptrace_resume): Select the proper request to be made for ptrace() considering if we are catching syscalls or not. * inferior.h (struct inferior): Included new variables any_syscall_count, syscalls_counts and total_syscalls_count, used to keep track of requested syscall catchpoints. * infrun.c (resume): Add syscall catchpoint. (deal_with_syscall_event): New. (handle_inferior_event): Add syscall entry/return events. (inferior_has_called_syscall): New. * linux-nat.c: Define some helpful variables to track wether we have support for the needed ptrace option. (linux_test_for_tracesysgood): New. (linux_supports_tracesysgood): New. (linux_enable_tracesysgood): New. (linux_enable_event_reporting): Save the current used ptrace options. (linux_child_post_attach): Calling linux_enable_tracesysgood. (linux_child_post_startup_inferior): Likewise. (linux_child_set_syscall_catchpoint): New function. (linux_handle_extended_wait): Handle the case which the inferior stops because it has called or returned from a syscall. (linux_target_install_ops): Install the necessary functions to handle syscall catchpoints. * linux-nat.h (struct lwp_info): Include syscall_state into the structure, which indicates if we are in a syscall entry or return. * ppc-linux-tdep.c: Include xml-syscall.h header, define the XML syscall filename for the arch. (ppc_linux_get_syscall_number): New. (ppc_linux_init_abi): Register the correct functions for syscall catchpoint; setting the correct name for the XML syscall file. * target.c (update_current_target): Update/copy functions related to syscall catchpoint. (target_waitstatus_to_string): Add syscall catchpoint entry/return events. * target.h (struct target_waitstatus): Add syscall number. (struct syscall): New struct to hold information about syscalls in the system. (struct target_ops): Add ops for syscall catchpoint. (inferior_has_called_syscall): New. (target_set_syscall_catchpoint): New. * xml-support.c (xml_fetch_content_from_file): New function, transferred from xml-tdesc.c. * xml-support.h (xml_fetch_content_from_file): New. * xml-tdesc.c (fetch_xml_from_file): Function removed; transferred to xml-support.c. (file_read_description_xml): Updated to use the new xml_fetch_content_from_file function. * syscalls/gdb-syscalls.dtd: New definition file for syscall's XML support. * syscalls/amd64-linux.xml: New file containing information about syscalls for GNU/Linux systems that use amd64 architecture. * syscalls/i386-linux.xml: New file containing information about syscalls for GNU/Linux systems that use i386 architecture. * syscalls/ppc-linux.xml: New file containing information about syscalls for GNU/Linux systems that use PPC architecture. * syscalls/ppc64-linux.xml: New file containing information about syscalls for GNU/Linux systems that use PPC64 architecture. * xml-syscall.c: New file containing functions for manipulating syscall's XML files. * xml-syscall.h: New file, exporting the functions above mentioned. * Makefile.in: Support for relocatable GDB datadir and XML syscall. * NEWS: Added information about the catch syscall feature. * doc/gdb.texinfo (Set Catchpoints): Documentation about the new feature. * testsuite/Makefile.in: Inclusion of catch-syscall object. * testsuite/gdb.base/catch-syscall.c: New file. * testsuite/gdb.base/catch-syscall.exp: New file.
2009-09-15 05:30:08 +02:00
struct syscall;
struct agent_expr;
struct axs_value;
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
struct stap_parse_info;
struct parser_state;
struct ravenscar_arch_ops;
struct elf_internal_linux_prpsinfo;
struct mem_range;
Partial fix for PR breakpoints/10737: Make syscall info be per-arch instead of global This patch intends to partially fix PR breakpoints/10737, which is about making the syscall information (for the "catch syscall" command) be per-arch, instead of global. This is not a full fix because of the other issues pointed by Pedro here: <https://sourceware.org/bugzilla/show_bug.cgi?id=10737#c5> However, I consider it a good step towards the real fix. It will also help me fix <https://sourceware.org/bugzilla/show_bug.cgi?id=17402>. What this patch does, basically, is move the "syscalls_info" struct to gdbarch. Currently, the syscall information is stored in a global variable inside gdb/xml-syscall.c, which means that there is no easy way to correlate this info with the current target or architecture being used, for example. This causes strange behaviors, because the syscall info is not re-read when the arch changes. For example, if you put a syscall catchpoint in syscall 5 on i386 (syscall open), and then load a x86_64 program on GDB and put the same syscall 5 there (fstat on x86_64), you will still see that GDB tells you that it is catching "open", even though it is not. With this patch, GDB correctly says that it will be catching fstat syscalls. (gdb) set architecture i386 The target architecture is assumed to be i386 (gdb) catch syscall 5 Catchpoint 1 (syscall 'open' [5]) (gdb) set architecture i386:x86-64 The target architecture is assumed to be i386:x86-64 (gdb) catch syscall 5 Catchpoint 2 (syscall 'open' [5]) But with the patch: (gdb) set architecture i386 The target architecture is assumed to be i386 (gdb) catch syscall 5 Catchpoint 1 (syscall 'open' [5]) (gdb) set architecture i386:x86-64 The target architecture is assumed to be i386:x86-64 (gdb) catch syscall 5 Catchpoint 2 (syscall 'fstat' [5]) As I said, there are still some problems on the "catch syscall" mechanism, because (for example) the user should be able to "catch syscall open" on i386, and then expect "open" to be caught also on x86_64. Currently, it doesn't work. I intend to work on this later. gdb/ 2014-11-20 Sergio Durigan Junior <sergiodj@redhat.com> PR breakpoints/10737 * amd64-linux-tdep.c (amd64_linux_init_abi_common): Adjust call to set_xml_syscall_file_name to provide gdbarch. * arm-linux-tdep.c (arm_linux_init_abi): Likewise. * bfin-linux-tdep.c (bfin_linux_init_abi): Likewise. * breakpoint.c (print_it_catch_syscall): Adjust call to get_syscall_by_number to provide gdbarch. (print_one_catch_syscall): Likewise. (print_mention_catch_syscall): Likewise. (print_recreate_catch_syscall): Likewise. (catch_syscall_split_args): Adjust calls to get_syscall_by_number and get_syscall_by_name to provide gdbarch. (catch_syscall_completer): Adjust call to get_syscall_names to provide gdbarch. * gdbarch.c: Regenerate. * gdbarch.h: Likewise. * gdbarch.sh: Forward declare "struct syscalls_info". (xml_syscall_file): New variable. (syscalls_info): Likewise. * i386-linux-tdep.c (i386_linux_init_abi): Adjust call to set_xml_syscall_file_name to provide gdbarch. * mips-linux-tdep.c (mips_linux_init_abi): Likewise. * ppc-linux-tdep.c (ppc_linux_init_abi): Likewise. * s390-linux-tdep.c (s390_gdbarch_init): Likewise. * sparc-linux-tdep.c (sparc32_linux_init_abi): Likewise. * sparc64-linux-tdep.c (sparc64_linux_init_abi): Likewise. * xml-syscall.c: Include gdbarch.h. (set_xml_syscall_file_name): Accept gdbarch parameter. (get_syscall_by_number): Likewise. (get_syscall_by_name): Likewise. (get_syscall_names): Likewise. (my_gdb_datadir): Delete global variable. (struct syscalls_info) <my_gdb_datadir>: New variable. (struct syscalls_info) <sysinfo>: Rename variable to "syscalls_info". (sysinfo): Delete global variable. (have_initialized_sysinfo): Likewise. (xml_syscall_file): Likewise. (sysinfo_free_syscalls_desc): Rename to... (syscalls_info_free_syscalls_desc): ... this. (free_syscalls_info): Rename "sysinfo" to "syscalls_info". Adjust code to the new layout of "struct syscalls_info". (make_cleanup_free_syscalls_info): Rename parameter "sysinfo" to "syscalls_info". (syscall_create_syscall_desc): Likewise. (syscall_start_syscall): Likewise. (syscall_parse_xml): Likewise. (xml_init_syscalls_info): Likewise. Drop "const" from return value. (init_sysinfo): Rename to... (init_syscalls_info): ...this. Add gdbarch as a parameter. Adjust function to deal with gdbarch. (xml_get_syscall_number): Delete parameter sysinfo. Accept gdbarch as a parameter. Adjust code. (xml_get_syscall_name): Likewise. (xml_list_of_syscalls): Likewise. (set_xml_syscall_file_name): Accept gdbarch as parameter. (get_syscall_by_number): Likewise. (get_syscall_by_name): Likewise. (get_syscall_names): Likewise. * xml-syscall.h (set_xml_syscall_file_name): Likewise. (get_syscall_by_number): Likewise. (get_syscall_by_name): Likewise. (get_syscall_names): Likewise. gdb/testsuite/ 2014-11-20 Sergio Durigan Junior <sergiodj@redhat.com> PR breakpoints/10737 * gdb.base/catch-syscall.exp (do_syscall_tests): Call test_catch_syscall_multi_arch. (test_catch_syscall_multi_arch): New function.
2014-11-20 18:28:18 +01:00
struct syscalls_info;
1999-08-31 03:14:27 +02:00
#include "regcache.h"
gdb/ 2012-11-09 Pedro Alves <palves@redhat.com> * gdbarch.sh (target_gdbarch) <gdbarch.h>: Reimplement as macro. (get_target_gdbarch) <gdbarch.h>: New function. (startup_gdbarch) <gdbarch.h>: Declare. <gdbarch.c> (target_gdbarch): Delete. <gdbarch.c> (deprecated_target_gdbarch_select_hack): Set the current inferior's gdbarch. <gdbarch.c> (get_target_gdbarch): New function. * inferior.c: Include target-descriptions.h. (free_inferior): Free target description info. (add_inferior_with_spaces): Set the inferior's initial architecture. (clone_inferior_command): Copy the original inferior's target description if it was user specified. (initialize_inferiors): Add comment. * inferior.h (struct target_desc_info): Forward declare. (struct inferior) <gdbarch>: New field. * linux-nat.c: Include target-descriptions.h. (linux_child_follow_fork): Copy the parent's architecture and target description to the child. * target-descriptions.c: Include inferior.h. (struct target_desc_info): New structure, holding the equivalents of ... (target_desc_fetched, current_target_desc) (target_description_filename): ... these removed globals. (get_tdesc_info, target_desc_info_from_user_p) (copy_inferior_target_desc_info, target_desc_info_free): New. (target_desc_fetched, current_target_desc) (target_description_filename): Reimplemented as convenience macros. (tdesc_filename_cmd_string): New global. (set_tdesc_filename_cmd): Copy the string manipulated by the "set tdescs filename ..." commands to the per-inferior equivalent. (show_tdesc_filename_cmd): Get the value to show from the per-inferior description filename. (_initilize_target_descriptions): Change the "set/show tdesc filename" commands' variable. * target-descriptions.h (struct target_desc, struct target_desc_info) (struct inferior): Forward declare. (target_find_description, target_clear_description) (target_current_description): Adjust comments. (copy_inferior_target_desc_info, target_desc_info_free) (target_desc_info_from_user_p). Declare. gdb/testsuite/ 2012-11-09 Pedro Alves <palves@redhat.com> * gdb.multi/multi-arch.exp: New.
2012-11-09 02:47:20 +01:00
/* The architecture associated with the inferior through the
connection to the target.
The architecture vector provides some information that is really a
property of the inferior, accessed through a particular target:
ptrace operations; the layout of certain RSP packets; the solib_ops
vector; etc. To differentiate architecture accesses to
per-inferior/target properties from
per-thread/per-frame/per-objfile properties, accesses to
per-inferior/target properties should be made through this
gdbarch. */
/* This is a convenience wrapper for 'current_inferior ()->gdbarch'. */
extern struct gdbarch *target_gdbarch (void);
gdb/ 2012-11-09 Pedro Alves <palves@redhat.com> * gdbarch.sh (target_gdbarch) <gdbarch.h>: Reimplement as macro. (get_target_gdbarch) <gdbarch.h>: New function. (startup_gdbarch) <gdbarch.h>: Declare. <gdbarch.c> (target_gdbarch): Delete. <gdbarch.c> (deprecated_target_gdbarch_select_hack): Set the current inferior's gdbarch. <gdbarch.c> (get_target_gdbarch): New function. * inferior.c: Include target-descriptions.h. (free_inferior): Free target description info. (add_inferior_with_spaces): Set the inferior's initial architecture. (clone_inferior_command): Copy the original inferior's target description if it was user specified. (initialize_inferiors): Add comment. * inferior.h (struct target_desc_info): Forward declare. (struct inferior) <gdbarch>: New field. * linux-nat.c: Include target-descriptions.h. (linux_child_follow_fork): Copy the parent's architecture and target description to the child. * target-descriptions.c: Include inferior.h. (struct target_desc_info): New structure, holding the equivalents of ... (target_desc_fetched, current_target_desc) (target_description_filename): ... these removed globals. (get_tdesc_info, target_desc_info_from_user_p) (copy_inferior_target_desc_info, target_desc_info_free): New. (target_desc_fetched, current_target_desc) (target_description_filename): Reimplemented as convenience macros. (tdesc_filename_cmd_string): New global. (set_tdesc_filename_cmd): Copy the string manipulated by the "set tdescs filename ..." commands to the per-inferior equivalent. (show_tdesc_filename_cmd): Get the value to show from the per-inferior description filename. (_initilize_target_descriptions): Change the "set/show tdesc filename" commands' variable. * target-descriptions.h (struct target_desc, struct target_desc_info) (struct inferior): Forward declare. (target_find_description, target_clear_description) (target_current_description): Adjust comments. (copy_inferior_target_desc_info, target_desc_info_free) (target_desc_info_from_user_p). Declare. gdb/testsuite/ 2012-11-09 Pedro Alves <palves@redhat.com> * gdb.multi/multi-arch.exp: New.
2012-11-09 02:47:20 +01:00
New "iterate_over_objfiles_in_search_order" gdbarch method. This patch introduces the "iterate_over_objfiles_in_search_order" gdbarch method, as well as its default implementation, and converts the areas where it will matter to using this gdbarch method. The default method implementation is the only one installed, and the changes should have no functional impact in terms of behavior. This only paves the way for the architectures that will need their own version. gdb/ChangeLog: * gdbarch.sh: Add generation of "iterate_over_objfiles_in_search_order_cb_ftype" typedef in gdbarch.h. Add include of "objfiles.h" in gdbarch.c. (iterate_over_objfiles_in_search_order): New gdbarch method. * gdbarch.h, gdbarch.c: Regenerate. * objfiles.h (default_iterate_over_objfiles_in_search_order): Add declaration. * objfiles.c (default_iterate_over_objfiles_in_search_order): New function. * symtab.c (lookup_symbol_aux_objfile): New function, extracted out of lookup_symbol_aux_symtabs. (lookup_symbol_aux_symtabs): Replace extracted-out code by call to lookup_symbol_aux_objfile. (struct global_sym_lookup_data): New type. (lookup_symbol_global_iterator_cb): New function. (lookup_symbol_global): Search for symbol using gdbarch_iterate_over_objfiles_in_search_order and lookup_symbol_global_iterator_cb. * findvar.c (struct minsym_lookup_data): New type. (minsym_lookup_iterator_cb): New function. (default_read_var_value) [case LOC_UNRESOLVED]: Resolve the symbol's address via gdbarch_iterate_over_objfiles_in_search_order and minsym_lookup_iterator_cb.
2012-06-05 15:50:50 +02:00
/* Callback type for the 'iterate_over_objfiles_in_search_order'
gdbarch method. */
typedef int (iterate_over_objfiles_in_search_order_cb_ftype)
(struct objfile *objfile, void *cb_data);
Replace 'core_regset_sections' by iterator method The core_regset_sections list in gdbarch (needed for multi-arch capable core file generation support) is replaced by an iterator method. Overall, this reduces the code a bit, and it allows for more flexibility. gdb/ChangeLog: * amd64-linux-tdep.c (amd64_linux_regset_sections): Remove. (amd64_linux_iterate_over_regset_sections): New. (amd64_linux_init_abi_common): Don't install the regset section list, but the new iterator in gdbarch. * arm-linux-tdep.c (arm_linux_fpa_regset_sections) (arm_linux_vfp_regset_sections): Remove. Move combined logic... (arm_linux_iterate_over_regset_sections): ...here. New function. (arm_linux_init_abi): Set iterator instead of section list. * corelow.c (get_core_registers_cb): New function, logic moved from... (get_core_registers): ...loop body here. Use new iterator method instead of walking through the regset section list. * gdbarch.sh: Remove 'core_regset_sections'. New method 'iterate_over_regset_sections'. New typedef 'iterate_over_regset_sections_cb'. * gdbarch.c: Regenerate. * gdbarch.h: Likewise. * i386-linux-tdep.c (i386_linux_regset_sections) (i386_linux_sse_regset_sections, i386_linux_avx_regset_sections): Remove. (i386_linux_iterate_over_regset_sections): New. (i386_linux_init_abi): Don't choose a regset section list, but install new iterator in gdbarch. * linux-tdep.c (struct linux_collect_regset_section_cb_data): New. (linux_collect_regset_section_cb): New function, logic moved from... (linux_collect_thread_registers): ...loop body here. Use iterator method instead of walking through list. (linux_make_corefile_notes_1): Check for presence of iterator method instead of regset section list. * ppc-linux-tdep.c (ppc_linux_vsx_regset_sections) (ppc_linux_vmx_regset_sections, ppc_linux_fp_regset_sections) (ppc64_linux_vsx_regset_sections, ppc64_linux_vmx_regset_sections) (ppc64_linux_fp_regset_sections): Remove. Move combined logic... (ppc_linux_iterate_over_regset_sections): ...here. New function. (ppc_linux_init_abi): Don't choose from above regset section lists, but install new iterator in gdbarch. * regset.h (struct core_regset_section): Remove. * s390-linux-tdep.c (struct gdbarch_tdep): Add new fields have_linux_v1, have_linux_v2, and have_tdb. (s390_linux32_regset_sections, s390_linux32v1_regset_sections) (s390_linux32v2_regset_sections, s390_linux64_regset_sections) (s390_linux64v1_regset_sections, s390_linux64v2_regset_sections) (s390x_linux64_regset_sections, s390x_linux64v1_regset_sections) (s390x_linux64v2_regset_sections): Remove. Move combined logic... (s390_iterate_over_regset_sections): ...here. New function. Use new tdep fields. (s390_gdbarch_init): Set new tdep fields. Don't choose from above regset section lists, but install new iterator.
2014-09-04 17:26:43 +02:00
Fix internal error when core file section is too big As reported in PR 17808, a test case with a forged (invalid) core file can crash GDB with an assertion failure. In that particular case the prstatus of an i386 core file looks like that from an AMD64 core file. Consequently the respective regset supply function i386_supply_gregset is invoked with a larger buffer than usual. But i386_supply_gregset asserts a specific buffer size, and this assertion fails. The patch relaxes all buffer size assertions in regset supply functions such that they merely check for a sufficiently large buffer. For consistency the regset collect functions are adjusted as well. gdb/ChangeLog: PR corefiles/17808: * gdbarch.sh (iterate_over_regset_sections_cb): Document this function type, particularly its SIZE parameter. * gdbarch.h: Regenerate. * amd64-tdep.c (amd64_supply_fpregset): In gdb_assert, compare actual against required size using ">=" instead of "==". (amd64_collect_fpregset): Likewise. * i386-tdep.c (i386_supply_gregset): Likewise. (i386_collect_gregset): Likewise. (i386_supply_fpregset): Likewise. (i386_collect_fpregset): Likewise. * mips-linux-tdep.c (mips_supply_gregset_wrapper): Likewise. (mips_fill_gregset_wrapper): Likewise. (mips_supply_fpregset_wrapper): Likewise. (mips_fill_fpregset_wrapper): Likewise. (mips64_supply_gregset_wrapper): Likewise. (mips64_fill_gregset_wrapper): Likewise. (mips64_supply_fpregset_wrapper): Likewise. (mips64_fill_fpregset_wrapper): Likewise. * mn10300-linux-tdep.c (am33_supply_gregset_method): Likewise. (am33_supply_fpregset_method): Likewise. (am33_collect_gregset_method): Likewise. (am33_collect_fpregset_method): Likewise.
2015-01-14 13:01:38 +01:00
/* Callback type for regset section iterators. The callback usually
invokes the REGSET's supply or collect method, to which it must
pass a buffer with at least the given SIZE. SECT_NAME is a BFD
section name, and HUMAN_NAME is used for diagnostic messages.
CB_DATA should have been passed unchanged through the iterator. */
Replace 'core_regset_sections' by iterator method The core_regset_sections list in gdbarch (needed for multi-arch capable core file generation support) is replaced by an iterator method. Overall, this reduces the code a bit, and it allows for more flexibility. gdb/ChangeLog: * amd64-linux-tdep.c (amd64_linux_regset_sections): Remove. (amd64_linux_iterate_over_regset_sections): New. (amd64_linux_init_abi_common): Don't install the regset section list, but the new iterator in gdbarch. * arm-linux-tdep.c (arm_linux_fpa_regset_sections) (arm_linux_vfp_regset_sections): Remove. Move combined logic... (arm_linux_iterate_over_regset_sections): ...here. New function. (arm_linux_init_abi): Set iterator instead of section list. * corelow.c (get_core_registers_cb): New function, logic moved from... (get_core_registers): ...loop body here. Use new iterator method instead of walking through the regset section list. * gdbarch.sh: Remove 'core_regset_sections'. New method 'iterate_over_regset_sections'. New typedef 'iterate_over_regset_sections_cb'. * gdbarch.c: Regenerate. * gdbarch.h: Likewise. * i386-linux-tdep.c (i386_linux_regset_sections) (i386_linux_sse_regset_sections, i386_linux_avx_regset_sections): Remove. (i386_linux_iterate_over_regset_sections): New. (i386_linux_init_abi): Don't choose a regset section list, but install new iterator in gdbarch. * linux-tdep.c (struct linux_collect_regset_section_cb_data): New. (linux_collect_regset_section_cb): New function, logic moved from... (linux_collect_thread_registers): ...loop body here. Use iterator method instead of walking through list. (linux_make_corefile_notes_1): Check for presence of iterator method instead of regset section list. * ppc-linux-tdep.c (ppc_linux_vsx_regset_sections) (ppc_linux_vmx_regset_sections, ppc_linux_fp_regset_sections) (ppc64_linux_vsx_regset_sections, ppc64_linux_vmx_regset_sections) (ppc64_linux_fp_regset_sections): Remove. Move combined logic... (ppc_linux_iterate_over_regset_sections): ...here. New function. (ppc_linux_init_abi): Don't choose from above regset section lists, but install new iterator in gdbarch. * regset.h (struct core_regset_section): Remove. * s390-linux-tdep.c (struct gdbarch_tdep): Add new fields have_linux_v1, have_linux_v2, and have_tdb. (s390_linux32_regset_sections, s390_linux32v1_regset_sections) (s390_linux32v2_regset_sections, s390_linux64_regset_sections) (s390_linux64v1_regset_sections, s390_linux64v2_regset_sections) (s390x_linux64_regset_sections, s390x_linux64v1_regset_sections) (s390x_linux64v2_regset_sections): Remove. Move combined logic... (s390_iterate_over_regset_sections): ...here. New function. Use new tdep fields. (s390_gdbarch_init): Set new tdep fields. Don't choose from above regset section lists, but install new iterator.
2014-09-04 17:26:43 +02:00
typedef void (iterate_over_regset_sections_cb)
Add 'regset' parameter to 'iterate_over_regset_sections_cb' This adds the 'regset' parameter to the iterator callback. Consequently the 'regset_from_core_section' method is dropped for all targets that provide the iterator method. This change prepares for replacing regset_from_core_section everywhere, thereby eliminating one gdbarch interface. Since the iterator is usually no more complex than regset_from_core_section alone, targets that previously didn't define core_regset_sections will then gain multi-arch capable core file generation support without increased complexity. gdb/ChangeLog: * gdbarch.sh (iterate_over_regset_sections_cb): Add regset parameter. * gdbarch.h: Regenerate. * corelow.c (sniff_core_bfd): Don't sniff if gdbarch has a regset iterator. (get_core_register_section): Add parameter 'regset' and use it, if set. Add parameter 'min_size' and verify the bfd section size against it. (get_core_registers_cb): Add parameter 'regset' and pass it to get_core_register section. For the "standard" register sections ".reg" and ".reg2", set an appropriate default for human_name. (get_core_registers): Don't abort when the gdbarch has an iterator but no regset_from_core_section. Add NULL/0 for parameters 'regset'/'min_size' in calls to get_core_register_section. * linux-tdep.c (linux_collect_regset_section_cb): Add parameter 'regset' and use it instead of calling the regset_from_core_section gdbarch method. * i386-tdep.h (struct gdbarch_tdep): Add field 'fpregset'. * i386-tdep.c (i386_supply_xstateregset) (i386_collect_xstateregset, i386_xstateregset): Moved to i386-linux-tdep.c. (i386_regset_from_core_section): Drop handling for .reg-xfp and .reg-xstate. (i386_gdbarch_init): Set tdep field 'fpregset'. Enable generic core file support only if the regset iterator hasn't been set. * i386-linux-tdep.c (i386_linux_supply_xstateregset) (i386_linux_collect_xstateregset, i386_linux_xstateregset): New. Moved from i386-tdep.c and renamed to *_linux*. (i386_linux_iterate_over_regset_sections): Add regset parameter to each callback invocation. Allow any .reg-xstate size when reading from a core file. * amd64-tdep.c (amd64_supply_xstateregset) (amd64_collect_xstateregset, amd64_xstateregset): Moved to amd64-linux-tdep.c. (amd64_regset_from_core_section): Remove. (amd64_init_abi): Set new tdep field 'fpregset'. No longer install an amd64-specific regset_from_core_section gdbarch method. * amd64-linux-tdep.c (amd64_linux_supply_xstateregset) (amd64_linux_collect_xstateregset, amd64_linux_xstateregset): New. Moved from amd64-tdep.c and renamed to *_linux*. (amd64_linux_iterate_over_regset_sections): Add regset parameter to each callback invocation. Allow any .reg-xstate size when reading from a core file. * arm-linux-tdep.c (arm_linux_regset_from_core_section): Remove. (arm_linux_iterate_over_regset_sections): Add regset parameter to each callback invocation. (arm_linux_init_abi): No longer set the regset_from_core_section gdbarch method. * ppc-linux-tdep.c (ppc_linux_regset_from_core_section): Remove. (ppc_linux_iterate_over_regset_sections): Add regset parameter to each callback invocation. (ppc_linux_init_abi): No longer set the regset_from_core_section gdbarch method. * s390-linux-tdep.c (struct gdbarch_tdep): Remove the fields gregset, sizeof_gregset, fpregset, and sizeof_fpregset. (s390_regset_from_core_section): Remove. (s390_iterate_over_regset_sections): Add regset parameter to each callback invocation. (s390_gdbarch_init): No longer set the regset_from_core_section gdbarch method. Drop initialization of deleted tdep fields.
2014-09-12 10:42:48 +02:00
(const char *sect_name, int size, const struct regset *regset,
const char *human_name, void *cb_data);
1999-08-31 03:14:27 +02:00
EOF
# function typedef's
printf "\n"
printf "\n"
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
printf "/* The following are pre-initialized by GDBARCH. */\n"
function_list | while do_read
1999-08-31 03:14:27 +02:00
do
if class_is_info_p
then
printf "\n"
printf "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);\n"
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
printf "/* set_gdbarch_${function}() - not applicable - pre-initialized. */\n"
fi
1999-08-31 03:14:27 +02:00
done
# function typedef's
printf "\n"
printf "\n"
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
printf "/* The following are initialized by the target dependent code. */\n"
function_list | while do_read
1999-08-31 03:14:27 +02:00
do
if [ -n "${comment}" ]
then
echo "${comment}" | sed \
-e '2 s,#,/*,' \
-e '3,$ s,#, ,' \
-e '$ s,$, */,'
fi
2004-06-21 Andrew Cagney <cagney@gnu.org> * gdbarch.sh: When the macro field is empty, do not generate a macro definition. When the macro field is "=", generate the macro name from the upper-case function name. (NUM_REGS, NUM_PSEUDO_REGS, SP_REGNUM, PC_REGNUM, PS_REGNUM) (FP0_REGNUM, STAB_REG_TO_REGNUM, ECOFF_REG_TO_REGNUM) (DWARF_REG_TO_REGNUM, SDB_REG_TO_REGNUM, DWARF2_REG_TO_REGNUM) (REGISTER_NAME, DEPRECATED_REGISTER_VIRTUAL_TYPE) (DEPRECATED_REGISTER_BYTES, DEPRECATED_REGISTER_BYTE) (DEPRECATED_REGISTER_RAW_SIZE, DEPRECATED_REGISTER_VIRTUAL_SIZE) (DEPRECATED_SAVE_DUMMY_FRAME_TOS, DEPRECATED_FP_REGNUM) (DEPRECATED_TARGET_READ_FP, DEPRECATED_PUSH_ARGUMENTS) (DEPRECATED_PUSH_RETURN_ADDRESS, DEPRECATED_DUMMY_WRITE_SP) (DEPRECATED_REGISTER_SIZE, CALL_DUMMY_LOCATION) (DEPRECATED_DO_REGISTERS_INFO, REGISTER_SIM_REGNO) (REGISTER_BYTES_OK, CANNOT_FETCH_REGISTER, CANNOT_STORE_REGISTER) (GET_LONGJMP_TARGET, DEPRECATED_INIT_FRAME_PC) (BELIEVE_PCC_PROMOTION, DEPRECATED_GET_SAVED_REGISTER) (CONVERT_REGISTER_P, REGISTER_TO_VALUE, VALUE_TO_REGISTER) (POINTER_TO_ADDRESS, ADDRESS_TO_POINTER, INTEGER_TO_ADDRESS) (DEPRECATED_POP_FRAME, DEPRECATED_STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE) (DEPRECATED_EXTRACT_RETURN_VALUE, DEPRECATED_STORE_RETURN_VALUE) (DEPRECATED_USE_STRUCT_CONVENTION) (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS) (DEPRECATED_FRAME_INIT_SAVED_REGS) (DEPRECATED_INIT_EXTRA_FRAME_INFO, SKIP_PROLOGUE, INNER_THAN) (BREAKPOINT_FROM_PC, MEMORY_INSERT_BREAKPOINT) (MEMORY_REMOVE_BREAKPOINT, DECR_PC_AFTER_BREAK) (DEPRECATED_FUNCTION_START_OFFSET, FRAME_ARGS_SKIP) (DEPRECATED_FRAMELESS_FUNCTION_INVOCATION, DEPRECATED_FRAME_CHAIN) (DEPRECATED_FRAME_CHAIN_VALID, DEPRECATED_FRAME_SAVED_PC) (DEPRECATED_FRAME_ARGS_ADDRESS, DEPRECATED_FRAME_LOCALS_ADDRESS) (DEPRECATED_SAVED_PC_AFTER_CALL, FRAME_NUM_ARGS) (DEPRECATED_STACK_ALIGN, DEPRECATED_REG_STRUCT_HAS_ADDR) (FRAME_RED_ZONE_SIZE, ADDR_BITS_REMOVE, SMASH_TEXT_ADDRESS) (SOFTWARE_SINGLE_STEP, SKIP_TRAMPOLINE_CODE) (IN_SOLIB_CALL_TRAMPOLINE, IN_SOLIB_RETURN_TRAMPOLINE) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) (NAME_OF_MALLOC, CANNOT_STEP_BREAKPOINT) (HAVE_NONSTEPPABLE_WATCHPOINT, ADDRESS_CLASS_TYPE_FLAGS) (FETCH_POINTER_ARGUMENT): Replace the macro name with "=".
2004-06-21 21:54:50 +02:00
if class_is_predicate_p
then
2004-06-21 Andrew Cagney <cagney@gnu.org> * gdbarch.sh: When the macro field is empty, do not generate a macro definition. When the macro field is "=", generate the macro name from the upper-case function name. (NUM_REGS, NUM_PSEUDO_REGS, SP_REGNUM, PC_REGNUM, PS_REGNUM) (FP0_REGNUM, STAB_REG_TO_REGNUM, ECOFF_REG_TO_REGNUM) (DWARF_REG_TO_REGNUM, SDB_REG_TO_REGNUM, DWARF2_REG_TO_REGNUM) (REGISTER_NAME, DEPRECATED_REGISTER_VIRTUAL_TYPE) (DEPRECATED_REGISTER_BYTES, DEPRECATED_REGISTER_BYTE) (DEPRECATED_REGISTER_RAW_SIZE, DEPRECATED_REGISTER_VIRTUAL_SIZE) (DEPRECATED_SAVE_DUMMY_FRAME_TOS, DEPRECATED_FP_REGNUM) (DEPRECATED_TARGET_READ_FP, DEPRECATED_PUSH_ARGUMENTS) (DEPRECATED_PUSH_RETURN_ADDRESS, DEPRECATED_DUMMY_WRITE_SP) (DEPRECATED_REGISTER_SIZE, CALL_DUMMY_LOCATION) (DEPRECATED_DO_REGISTERS_INFO, REGISTER_SIM_REGNO) (REGISTER_BYTES_OK, CANNOT_FETCH_REGISTER, CANNOT_STORE_REGISTER) (GET_LONGJMP_TARGET, DEPRECATED_INIT_FRAME_PC) (BELIEVE_PCC_PROMOTION, DEPRECATED_GET_SAVED_REGISTER) (CONVERT_REGISTER_P, REGISTER_TO_VALUE, VALUE_TO_REGISTER) (POINTER_TO_ADDRESS, ADDRESS_TO_POINTER, INTEGER_TO_ADDRESS) (DEPRECATED_POP_FRAME, DEPRECATED_STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE) (DEPRECATED_EXTRACT_RETURN_VALUE, DEPRECATED_STORE_RETURN_VALUE) (DEPRECATED_USE_STRUCT_CONVENTION) (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS) (DEPRECATED_FRAME_INIT_SAVED_REGS) (DEPRECATED_INIT_EXTRA_FRAME_INFO, SKIP_PROLOGUE, INNER_THAN) (BREAKPOINT_FROM_PC, MEMORY_INSERT_BREAKPOINT) (MEMORY_REMOVE_BREAKPOINT, DECR_PC_AFTER_BREAK) (DEPRECATED_FUNCTION_START_OFFSET, FRAME_ARGS_SKIP) (DEPRECATED_FRAMELESS_FUNCTION_INVOCATION, DEPRECATED_FRAME_CHAIN) (DEPRECATED_FRAME_CHAIN_VALID, DEPRECATED_FRAME_SAVED_PC) (DEPRECATED_FRAME_ARGS_ADDRESS, DEPRECATED_FRAME_LOCALS_ADDRESS) (DEPRECATED_SAVED_PC_AFTER_CALL, FRAME_NUM_ARGS) (DEPRECATED_STACK_ALIGN, DEPRECATED_REG_STRUCT_HAS_ADDR) (FRAME_RED_ZONE_SIZE, ADDR_BITS_REMOVE, SMASH_TEXT_ADDRESS) (SOFTWARE_SINGLE_STEP, SKIP_TRAMPOLINE_CODE) (IN_SOLIB_CALL_TRAMPOLINE, IN_SOLIB_RETURN_TRAMPOLINE) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) (NAME_OF_MALLOC, CANNOT_STEP_BREAKPOINT) (HAVE_NONSTEPPABLE_WATCHPOINT, ADDRESS_CLASS_TYPE_FLAGS) (FETCH_POINTER_ARGUMENT): Replace the macro name with "=".
2004-06-21 21:54:50 +02:00
printf "\n"
printf "extern int gdbarch_${function}_p (struct gdbarch *gdbarch);\n"
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"
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" ]
1999-08-31 03:14:27 +02:00
then
printf "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);\n"
1999-08-31 03:14:27 +02:00
else
printf "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch, ${formal});\n"
1999-08-31 03:14:27 +02:00
fi
printf "extern void set_gdbarch_${function} (struct gdbarch *gdbarch, gdbarch_${function}_ftype *${function});\n"
fi
1999-08-31 03:14:27 +02:00
done
# close it off
cat <<EOF
Implementing catch syscall. * amd64-linux-tdep.c: Include xml-syscall.h header, define the XML syscall name for the architecture. (amd64_linux_get_syscall_number): New function. (amd64_linux_init_abi): Register the correct functions for syscall catchpoint; set the correct syscall file name. * breakpoint.c: New include: xml-syscall.h. (set_raw_breakpoint_without_location): Setting the parameters for the catch syscall feature. (insert_catch_syscall): New. (remove_catch_syscall): New. (breakpoint_hit_catch_syscall): New. (print_it_catch_syscall): New. (print_one_catch_syscall): New. (print_mention_catch_syscall): New. (catch_syscall_breakpoint_ops): New. (syscall_catchpoint_p): New. (create_catchpoint_without_mention): New. (create_catchpoint): Modified in order to use create_catchpoint_without_mention. (create_syscall_event_catchpoint): New. (clean_up_filters): New. (catch_syscall_split_args): New. (catch_syscall_command_1): New. (delete_breakpoint): Add cleanup for catch syscall. (is_syscall_catchpoint_enabled): New. (catch_syscall_enabled): New. (catching_syscall_number): New. (catch_syscall_completer): New completer function. (add_catch_command): Add the completer function for catchpoints. * breakpoint.h (syscalls_to_be_caught): New vector. (catch_syscall_enabled): New. (catching_syscall_number): New. * gdbarch.c: Regenerated. * gdbarch.h: Regenerated. * gdbarch.sh: Add syscall catchpoint functions and structures. (get_syscall_number): New. (UNKNOWN_SYSCALL): New definition. * i386-linux-nat.c (i386_linux_resume): Select the proper request to be made for ptrace() considering if we are catching syscalls or not. * i386-linux-tdep.c: Include xml-syscall.h header, define the XML syscall name for the architecture. (i386_linux_get_syscall_number): New. (i386_linux_init_abi): Register the correct functions for syscall catchpoint; set the correct syscall file name. * inf-child.c (inf_child_set_syscall_catchpoint): New. (inf_child_target): Assign default values to target_ops. * inf-ptrace.c (inf_ptrace_resume): Select the proper request to be made for ptrace() considering if we are catching syscalls or not. * inferior.h (struct inferior): Included new variables any_syscall_count, syscalls_counts and total_syscalls_count, used to keep track of requested syscall catchpoints. * infrun.c (resume): Add syscall catchpoint. (deal_with_syscall_event): New. (handle_inferior_event): Add syscall entry/return events. (inferior_has_called_syscall): New. * linux-nat.c: Define some helpful variables to track wether we have support for the needed ptrace option. (linux_test_for_tracesysgood): New. (linux_supports_tracesysgood): New. (linux_enable_tracesysgood): New. (linux_enable_event_reporting): Save the current used ptrace options. (linux_child_post_attach): Calling linux_enable_tracesysgood. (linux_child_post_startup_inferior): Likewise. (linux_child_set_syscall_catchpoint): New function. (linux_handle_extended_wait): Handle the case which the inferior stops because it has called or returned from a syscall. (linux_target_install_ops): Install the necessary functions to handle syscall catchpoints. * linux-nat.h (struct lwp_info): Include syscall_state into the structure, which indicates if we are in a syscall entry or return. * ppc-linux-tdep.c: Include xml-syscall.h header, define the XML syscall filename for the arch. (ppc_linux_get_syscall_number): New. (ppc_linux_init_abi): Register the correct functions for syscall catchpoint; setting the correct name for the XML syscall file. * target.c (update_current_target): Update/copy functions related to syscall catchpoint. (target_waitstatus_to_string): Add syscall catchpoint entry/return events. * target.h (struct target_waitstatus): Add syscall number. (struct syscall): New struct to hold information about syscalls in the system. (struct target_ops): Add ops for syscall catchpoint. (inferior_has_called_syscall): New. (target_set_syscall_catchpoint): New. * xml-support.c (xml_fetch_content_from_file): New function, transferred from xml-tdesc.c. * xml-support.h (xml_fetch_content_from_file): New. * xml-tdesc.c (fetch_xml_from_file): Function removed; transferred to xml-support.c. (file_read_description_xml): Updated to use the new xml_fetch_content_from_file function. * syscalls/gdb-syscalls.dtd: New definition file for syscall's XML support. * syscalls/amd64-linux.xml: New file containing information about syscalls for GNU/Linux systems that use amd64 architecture. * syscalls/i386-linux.xml: New file containing information about syscalls for GNU/Linux systems that use i386 architecture. * syscalls/ppc-linux.xml: New file containing information about syscalls for GNU/Linux systems that use PPC architecture. * syscalls/ppc64-linux.xml: New file containing information about syscalls for GNU/Linux systems that use PPC64 architecture. * xml-syscall.c: New file containing functions for manipulating syscall's XML files. * xml-syscall.h: New file, exporting the functions above mentioned. * Makefile.in: Support for relocatable GDB datadir and XML syscall. * NEWS: Added information about the catch syscall feature. * doc/gdb.texinfo (Set Catchpoints): Documentation about the new feature. * testsuite/Makefile.in: Inclusion of catch-syscall object. * testsuite/gdb.base/catch-syscall.c: New file. * testsuite/gdb.base/catch-syscall.exp: New file.
2009-09-15 05:30:08 +02:00
/* Definition for an unknown syscall, used basically in error-cases. */
#define UNKNOWN_SYSCALL (-1)
1999-08-31 03:14:27 +02:00
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
1999-08-31 03:14:27 +02:00
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)
1999-08-31 03:14:27 +02:00
components it was determined that the global aproach was not
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
applicable. */
1999-08-31 03:14:27 +02:00
/* 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 global defaults.
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.
1999-08-31 03:14:27 +02:00
The INIT function shall return any of: NULL - indicating that it
doesn't recognize the selected architecture; an existing \`\`struct
1999-08-31 03:14:27 +02:00
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
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
multi-arch and non- multi-arch cases. */
1999-08-31 03:14:27 +02:00
struct gdbarch_list
{
struct gdbarch *gdbarch;
struct gdbarch_list *next;
};
struct gdbarch_info
{
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
/* Use default: NULL (ZERO). */
1999-08-31 03:14:27 +02:00
const struct bfd_arch_info *bfd_arch_info;
/* Use default: BFD_ENDIAN_UNKNOWN (NB: is not ZERO). */
enum bfd_endian byte_order;
1999-08-31 03:14:27 +02:00
enum bfd_endian byte_order_for_code;
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
/* Use default: NULL (ZERO). */
1999-08-31 03:14:27 +02:00
bfd *abfd;
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
/* Use default: NULL (ZERO). */
void *tdep_info;
/* Use default: GDB_OSABI_UNINITIALIZED (-1). */
enum gdb_osabi osabi;
/* Use default: NULL (ZERO). */
const struct target_desc *target_desc;
1999-08-31 03:14:27 +02:00
};
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);
1999-08-31 03:14:27 +02:00
/* DEPRECATED - use gdbarch_register() */
1999-08-31 03:14:27 +02:00
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 *);
1999-08-31 03:14:27 +02:00
/* 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
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
once initialization has been completed. */
extern const char **gdbarch_printable_names (void);
1999-08-31 03:14:27 +02:00
/* Helper function. Search the list of ARCHES for a GDBARCH that
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
matches the information provided by INFO. */
1999-08-31 03:14:27 +02:00
extern struct gdbarch_list *gdbarch_list_lookup_by_info (struct gdbarch_list *arches, const struct gdbarch_info *info);
1999-08-31 03:14:27 +02:00
/* Helper function. Create a preliminary \`\`struct gdbarch''. Perform
basic initialization using values obtained from the INFO and TDEP
1999-08-31 03:14:27 +02:00
parameters. set_gdbarch_*() functions are called to complete the
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
initialization of the object. */
1999-08-31 03:14:27 +02:00
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
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
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)))
/* Duplicate STRING, returning an equivalent string that's allocated on the
obstack associated with GDBARCH. The string is freed when the corresponding
architecture is also freed. */
extern char *gdbarch_obstack_strdup (struct gdbarch *arch, const char *string);
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
/* Helper function. Force an update of the current architecture.
1999-08-31 03:14:27 +02:00
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.
1999-08-31 03:14:27 +02:00
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
Returns non-zero if the update succeeds. */
extern int gdbarch_update_p (struct gdbarch_info info);
1999-08-31 03:14:27 +02:00
/* 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. */
extern struct gdbarch *gdbarch_find_by_info (struct gdbarch_info info);
/* Helper function. Set the target gdbarch to "gdbarch". */
extern void set_target_gdbarch (struct gdbarch *gdbarch);
1999-08-31 03:14:27 +02:00
/* 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.
1999-08-31 03:14:27 +02:00
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.
1999-08-31 03:14:27 +02:00
When a previously created architecture is re-selected, the
per-architecture data-pointer for that previous architecture is
restored. INIT() is not re-called.
1999-08-31 03:14:27 +02:00
Multiple registrarants for any architecture are allowed (and
strongly encouraged). */
struct gdbarch_data;
1999-08-31 03:14:27 +02:00
2004-03-15 Andrew Cagney <cagney@redhat.com> * gdbarch.sh (gdbarch_data_pre_init_fytpe) (gdbarch_data_register_pre_init, gdbarch_data_post_init_fytpe) (gdbarch_data_register_post_init): Replace gdbarch_data_init_ftype and register_gdbarch_data. (deprecated_set_gdbarch_data): Rename set_gdbarch_data. (struct gdbarch_data): Replace "init" by "pre_init" and "post_init". * gdbarch.h, gdbarch.c: Re-generate. * dwarf2-frame.c (dwarf2_frame_init): Replace "gdbarch" paramter with"obstack", use OBSTACK_ZALLOC. (dwarf2_frame_ops): Delete. (dwarf2_frame_set_init_reg): Use gdbarch_data. (dwarf2_frame_init_reg): Use gdbarch_data. (_initialize_dwarf2_frame): Use gdbarch_data_register_pre_init. * solib-svr4.c (set_solib_svr4_fetch_link_map_offsets) (_initialize_svr4_solib): Update. * user-regs.c (_initialize_user_regs): Update. * reggroups.c (_initialize_reggroup): Update. * regcache.c (_initialize_regcache): Update. * mips-linux-tdep.c (_initialize_mips_linux_tdep): Update. * libunwind-frame.c (_initialize_libunwind_frame): Update. * gnu-v3-abi.c (init_gnuv3_ops): Update. * frame-unwind.c (_initialize_frame_unwind): Update. * frame-base.c (_initialize_frame_base): Update. * user-regs.c (user_reg_add): Update. * reggroups.c (reggroup_add): Update. * mips-linux-tdep.c (set_mips_linux_register_addr): Update. * libunwind-frame.c (libunwind_frame_set_descr): Update. * frame-unwind.c (frame_unwind_append_sniffer): Update. * frame-base.c (frame_base_table): Update. * remote.c (_initialize_remote): Update. * gdb_obstack.h (OBSTACK_ZALLOC, OBSTACK_CALLOC): Define.
2004-03-15 21:38:08 +01:00
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);
1999-08-31 03:14:27 +02:00
extern void *gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *);
1999-08-31 03:14:27 +02:00
/* Set the dynamic target-system-dependent parameters (architecture,
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
byte-order, ...) using information found in the BFD. */
1999-08-31 03:14:27 +02:00
extern void set_gdbarch_from_file (bfd *);
1999-10-26 05:43:48 +02:00
/* Initialize the current architecture to the "first" one we find on
our list. */
extern void initialize_current_architecture (void);
1999-08-31 03:14:27 +02:00
/* gdbarch trace variable */
gdb/ * dwarf2loc.c (entry_values_debug): Add 'unsigned'. (_initialize_dwarf2loc): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * dwarf2loc.h: Update the declaration of 'entry_values_debug'. * dwarf2read.c (dwarf2_die_debug): Add 'unsigned'. (_initialize_dwarf2_read): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * darwin-nat.c (dwarwin_debug_flag): Add 'unsigned'. (_initialize_darwin_inferior): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * frame.c (frame_debug): Add 'unsigned'. (_intialize_frame): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * frame.h: Update the declaration of 'frame_debug'. * gdbtypes.c (overload_debug): Add 'unsigned'. (_initialize_gdbtypes): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * inferior.h: Update declaration of 'debug_infrun'. * infrun.c (debug_infrun): Add 'unsigned'. (_initialize_infrun): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * jit.c (jit_debug): Add 'unsigned'. (_initialize_jit): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * linux-nat.c (debug_linux_nat): Add 'unsigned'. (_initialize_linux_nat): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * linux-thread-db.c (libthread_db_debug): Add 'unsigned'. (_initialize_thread_db): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * machoread.c (mach_o_debug_level): Add 'unsigned'. (_initialize_machoread): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * mi/mi-cmd-var.c: Update the declaration of 'varobjdebug'. * microblaze-tdep.c (microblaze_debug_flag): Add 'unsigned'. (_initialize_microblaze_tdep): Call add_setshow_zuinteger_cmd intead of add_setshow_zinteger_cmd. * mips-tdep.c (mips_debug): Add 'unsigned'. (_initialize_mips_tdep): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * monitor.c (monitor_debug): Add 'unsigned'. (_initialize_remote_monitors): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * observer.c (observer_debug): Add 'unsigned'. (_initialize_observer): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * parse.c (expressiondebug): Add 'unsigned'. (_initialize_parse): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * record.c (record_debug): Add 'unsigned'. (_initialize_record): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * record.h: Update the declaration of 'record_debug'. * stap-probe.c (stap_expression_debug): Add 'unsigned'. (_initialize_stap_probe): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * serial.c (global_serial_debug_p): Add 'unsigned'. (_initialize_serial): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * solib-dsbt.c (solib_dsbt_debug): Add 'unsigned'. (_initialize_dsbt_solib): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * solib-frv.c (solib_frv_debug): Add 'unsigned'. (_initialize_frv_solib): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * target.c (targetdebug): Add 'unsigned'. (initialize_targets): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * valops.c (overload_debug): Add 'unsigned'. * varobj.c (varobjdebug): Add 'unsigned'. (_initialize_varobj): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * xtensa-tdep.c (xtensa_debug_level): Add 'unsigned'. (_initialize_xtensa_tdep): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * arch-utils.h: Remove the declaration of 'gdbarch_debug'. * gdbarch.sh (gdbarch_debug): Add 'unsigned'. (extern void _initialize_gdbarch): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * gdbarch.c, gdbarch.h: Re-generated.
2012-08-02 11:36:40 +02:00
extern unsigned int gdbarch_debug;
1999-08-31 03:14:27 +02:00
extern void gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file);
1999-08-31 03:14:27 +02:00
#endif
EOF
exec 1>&2
#../move-if-change new-gdbarch.h gdbarch.h
2000-03-30 07:32:23 +02:00
compare_new gdbarch.h
1999-08-31 03:14:27 +02:00
#
# C file
#
exec > new-gdbarch.c
copyright
cat <<EOF
#include "defs.h"
#include "arch-utils.h"
1999-08-31 03:14:27 +02:00
#include "gdbcmd.h"
#include "inferior.h"
1999-08-31 03:14:27 +02:00
#include "symcat.h"
#include "floatformat.h"
#include "reggroups.h"
#include "osabi.h"
#include "gdb_obstack.h"
gdb: * tui/tui-hooks.c: Include observer.h. (tui_event_default, tui_old_event_hooks, tui_event_hooks): Remove. (tui_bp_created_observer, tui_bp_deleted_observer, tui_bp_modified_observer): New globals. (tui_install_hooks): Use observers, not events. (tui_remove_hooks): Likewise. * mi/mi-cmd-break.c: Include observer.h, not gdb-events.h. (mi_breakpoint_observers_installed, mi_can_breakpoint_notify): New globals. (breakpoint_notify): Check mi_can_breakpoint_notify. (breakpoint_hooks): Remove. (mi_cmd_break_insert): Attach observers. Don't use events. * tracepoint.c: Include observer.h, not gdb-events.h. (tracepoint_operation, trace_pass_command): Notify observer. * interps.c: Don't include gdb-events.h. (clear_interpreter_hooks): Don't call clear_gdb_event_hooks. * gdbarch.c: Rebuild. * gdbarch.sh: Emit include for observer.h, not gdb-events.h. (deprecated_current_gdbarch_select_hack): Notify observer. * breakpoint.h: Don't include gdb-events.h. * breakpoint.c: Don't include gdb-events.h. (condition_command): Notify observer. (commands_command): Likewise. (commands_from_control_command): Likewise. (mention, delete_breakpoint, set_ignore_count): Likewise. (disable_breakpoint, do_enable_breakpoint): Likewise. * Makefile.in (gdb_events_h): Remove. (breakpoint_h): Update. (COMMON_OBS): Remove gdb-events.o. (gdb-events.o): Remove. (breakpoint.o, gdbarch.o, interps.o, tracepoint.o, gdbtk-bp.o, gdbtk-hooks.o, mi-cmd-break.o, tui-hooks.o): Update. * gdb-events.c: Remove. * gdb-events.h: Remove. * gdb-events.sh: Remove. gdb/doc: * observer.texi (GDB Observers): Document new observers: breakpoint_created, breakpoint_deleted, breakpoint_modified, tracepoint_created, tracepoint_deleted, tracepoint_modified, architecture_changed. gdb/gdbtk: * generic/gdbtk-hooks.c: Include observer.h, not gdb-events.h. (gdbtk_add_hooks): Use observers, not events. (gdbtk_architecture_changed): Add argument, for observer. * generic/gdbtk-bp.c: Include observer.h. (gdb_set_bp): Notify observer. (gdb_set_bp_addr): Likewise.
2008-07-25 18:12:03 +02:00
#include "observer.h"
#include "regcache.h"
New "iterate_over_objfiles_in_search_order" gdbarch method. This patch introduces the "iterate_over_objfiles_in_search_order" gdbarch method, as well as its default implementation, and converts the areas where it will matter to using this gdbarch method. The default method implementation is the only one installed, and the changes should have no functional impact in terms of behavior. This only paves the way for the architectures that will need their own version. gdb/ChangeLog: * gdbarch.sh: Add generation of "iterate_over_objfiles_in_search_order_cb_ftype" typedef in gdbarch.h. Add include of "objfiles.h" in gdbarch.c. (iterate_over_objfiles_in_search_order): New gdbarch method. * gdbarch.h, gdbarch.c: Regenerate. * objfiles.h (default_iterate_over_objfiles_in_search_order): Add declaration. * objfiles.c (default_iterate_over_objfiles_in_search_order): New function. * symtab.c (lookup_symbol_aux_objfile): New function, extracted out of lookup_symbol_aux_symtabs. (lookup_symbol_aux_symtabs): Replace extracted-out code by call to lookup_symbol_aux_objfile. (struct global_sym_lookup_data): New type. (lookup_symbol_global_iterator_cb): New function. (lookup_symbol_global): Search for symbol using gdbarch_iterate_over_objfiles_in_search_order and lookup_symbol_global_iterator_cb. * findvar.c (struct minsym_lookup_data): New type. (minsym_lookup_iterator_cb): New function. (default_read_var_value) [case LOC_UNRESOLVED]: Resolve the symbol's address via gdbarch_iterate_over_objfiles_in_search_order and minsym_lookup_iterator_cb.
2012-06-05 15:50:50 +02:00
#include "objfiles.h"
1999-08-31 03:14:27 +02:00
/* Static function declarations */
static void alloc_gdbarch_data (struct gdbarch *);
1999-08-31 03:14:27 +02:00
/* Non-zero if we want to trace architecture code. */
#ifndef GDBARCH_DEBUG
#define GDBARCH_DEBUG 0
#endif
gdb/ * dwarf2loc.c (entry_values_debug): Add 'unsigned'. (_initialize_dwarf2loc): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * dwarf2loc.h: Update the declaration of 'entry_values_debug'. * dwarf2read.c (dwarf2_die_debug): Add 'unsigned'. (_initialize_dwarf2_read): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * darwin-nat.c (dwarwin_debug_flag): Add 'unsigned'. (_initialize_darwin_inferior): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * frame.c (frame_debug): Add 'unsigned'. (_intialize_frame): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * frame.h: Update the declaration of 'frame_debug'. * gdbtypes.c (overload_debug): Add 'unsigned'. (_initialize_gdbtypes): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * inferior.h: Update declaration of 'debug_infrun'. * infrun.c (debug_infrun): Add 'unsigned'. (_initialize_infrun): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * jit.c (jit_debug): Add 'unsigned'. (_initialize_jit): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * linux-nat.c (debug_linux_nat): Add 'unsigned'. (_initialize_linux_nat): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * linux-thread-db.c (libthread_db_debug): Add 'unsigned'. (_initialize_thread_db): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * machoread.c (mach_o_debug_level): Add 'unsigned'. (_initialize_machoread): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * mi/mi-cmd-var.c: Update the declaration of 'varobjdebug'. * microblaze-tdep.c (microblaze_debug_flag): Add 'unsigned'. (_initialize_microblaze_tdep): Call add_setshow_zuinteger_cmd intead of add_setshow_zinteger_cmd. * mips-tdep.c (mips_debug): Add 'unsigned'. (_initialize_mips_tdep): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * monitor.c (monitor_debug): Add 'unsigned'. (_initialize_remote_monitors): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * observer.c (observer_debug): Add 'unsigned'. (_initialize_observer): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * parse.c (expressiondebug): Add 'unsigned'. (_initialize_parse): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * record.c (record_debug): Add 'unsigned'. (_initialize_record): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * record.h: Update the declaration of 'record_debug'. * stap-probe.c (stap_expression_debug): Add 'unsigned'. (_initialize_stap_probe): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * serial.c (global_serial_debug_p): Add 'unsigned'. (_initialize_serial): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * solib-dsbt.c (solib_dsbt_debug): Add 'unsigned'. (_initialize_dsbt_solib): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * solib-frv.c (solib_frv_debug): Add 'unsigned'. (_initialize_frv_solib): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * target.c (targetdebug): Add 'unsigned'. (initialize_targets): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * valops.c (overload_debug): Add 'unsigned'. * varobj.c (varobjdebug): Add 'unsigned'. (_initialize_varobj): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * xtensa-tdep.c (xtensa_debug_level): Add 'unsigned'. (_initialize_xtensa_tdep): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * arch-utils.h: Remove the declaration of 'gdbarch_debug'. * gdbarch.sh (gdbarch_debug): Add 'unsigned'. (extern void _initialize_gdbarch): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * gdbarch.c, gdbarch.h: Re-generated.
2012-08-02 11:36:40 +02:00
unsigned int gdbarch_debug = GDBARCH_DEBUG;
2005-02-24 Andrew Cagney <cagney@gnu.org> Add show_VARIABLE functions, update add_setshow call. * varobj.c (_initialize_varobj, show_varobjdebug): Add and update. * valprint.c (_initialize_valprint, show_print_max) (show_stop_print_at_null, show_repeat_count_threshold) (show_prettyprint_structs, show_unionprint) (show_prettyprint_arrays, show_addressprint, show_input_radix) (show_output_radix): Ditto. * valops.c (_initialize_valops, show_overload_resolution): Ditto. * utils.c (initialize_utils, show_chars_per_line) (show_lines_per_page, show_demangle, show_pagination_enabled) (show_sevenbit_strings, show_asm_demangle): Ditto * tui/tui-win.c (_initialize_tui_win, show_tui_border_kind) (show_tui_border_mode, show_tui_active_border_mode): Ditto. * top.c (init_main, show_new_async_prompt) (show_async_command_editing_p, show_write_history_p) (show_history_size, show_history_filename, show_caution) (show_annotation_level, init_main): Ditto. * target.c (initialize_targets, show_targetdebug) (show_trust_readonly): Ditto. * symfile.c (_initialize_symfile, show_symbol_reloading) (show_ext_args, show_download_write_size) (show_debug_file_directory): Ditto. * source.c (_initialize_source, show_lines_to_list): Ditto. * solib.c (_initialize_solib, show_auto_solib_add) (show_solib_search_path): Ditto. * p-valprint.c (_initialize_pascal_valprint) (show_pascal_static_field_print): Ditto. * printcmd.c (_initialize_printcmd, show_max_symbolic_offset) (show_print_symbol_filename): Add and update. * parse.c (_initialize_parse, show_expressiondebug): Dito. * observer.c (_initialize_observer, show_observer_debug): Dito. * maint.c (_initialize_maint_cmds, show_watchdog) (show_maintenance_profile_p): Dito. * linux-nat.c (_initialize_linux_nat, show_debug_linux_nat): Dito. * infrun.c (_initialize_infrun, show_debug_infrun) (show_stop_on_solib_events, show_follow_fork_mode_string) (show_scheduler_mode, show_step_stop_if_no_debug): Ditto. * infcall.c (_initialize_infcall, show_coerce_float_to_double_p) (show_unwind_on_signal_p): Ditto. * gdbtypes.c (build_gdbtypes, show_opaque_type_resolution) (_initialize_gdbtypes, show_overload_debug): Ditto. * gdb-events.c, gdb-events.sh (_initialize_gdb_events) (show_gdb_events_debug): Ditto. * gdbarch.c, gdbarch.sh (show_gdbarch_debug) (_initialize_gdbarch): Ditto. * frame.c (_initialize_frame, show_backtrace_past_main) (show_backtrace_past_entry, show_backtrace_limit) (show_frame_debug): Ditto. * exec.c (_initialize_exec, show_write_files): Ditto. * dwarf2read.c (_initialize_dwarf2_read) (show_dwarf2_max_cache_age): Ditto. * demangle.c (_initialize_demangler) (show_demangling_style_names): Ditto. * dcache.c (_initialize_dcache, show_dcache_enabled_p): Ditto. * cp-valprint.c (show_static_field_print) (_initialize_cp_valprint, show_vtblprint, show_objectprint): Ditto. * corefile.c (_initialize_core, show_gnutarget_string): Ditto. * cli/cli-logging.c (_initialize_cli_logging) (show_logging_overwrite, show_logging_redirect) (show_logging_filename): Ditto. * cli/cli-cmds.c (show_info_verbose, show_history_expansion_p) (init_cli_cmds, show_baud_rate, show_remote_debug) (show_remote_timeout, show_max_user_call_depth): Ditto. * charset.c (show_host_charset_name, show_target_charset_name) (initialize_charset): Ditto. * breakpoint.c (show_can_use_hw_watchpoints) (show_pending_break_support, _initialize_breakpoint): Ditto.
2005-02-24 14:51:36 +01:00
static void
show_gdbarch_debug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
fprintf_filtered (file, _("Architecture debugging is %s.\\n"), value);
}
1999-08-31 03:14:27 +02:00
static const char *
* doublest.c (floatformat_from_length): Use the right element from gdbarch floatformats. (floatformat_from_type, extract_typed_floating) (store_typed_floating): Likewise. * doublest.h: Remove declarations for undefined floatformat arrays. * gdbarch.sh (float_format, double_format, long_double_format): Change to pairs. (pformat): Update for pairs. * gdbarch.c, gdbarch.h: Regenerated. * gdbtypes.c (floatformats_ieee_single, floatformats_ieee_double) (floatformats_ieee_double_littlebyte_bigword) (floatformats_i387_ext, floatformats_m68881_ext, floatformats_arm_ext) (floatformats_ia64_spill, floatformats_ia64_quad, floatformats_vax_f) (floatformats_vax_d): New variables. (builtin_type_ieee_single, builtin_type_ieee_double) (builtin_type_arm_ext, builtin_type_ia64_spill) (builtin_type_ia64_quad): Replace arrays with individual types. (builtin_type_ieee_single_big, builtin_type_ieee_single_little) (builtin_type_ieee_double_big, builtin_type_ieee_double_little) (builtin_type_ieee_double_littlebyte_bigword, builtin_type_i960_ext) (builtin_type_m88110_ext, builtin_type_m88110_harris_ext) (builtin_type_arm_ext_big, builtin_type_arm_ext_littlebyte_bigword) (builtin_type_ia64_spill_big, builtin_type_ia64_spill_little) (builtin_type_ia64_quad_big, builtin_type_ia64_quad_little): Delete unused and endian-specific types. (recursive_dump_type): Update for floatformat pairs. (build_flt): Move higher. Handle bit == -1. Take a floatformat pair. (build_gdbtypes): Use build_flt. (_initialize_gdbtypes): Update set of initialized types. * gdbtypes.h: Update declarations to match gdbtypes.c. (struct main_type): Store a pointer to two floatformats. * arch-utils.c (default_float_format, default_double_format): Delete. * arch-utils.h (default_float_format, default_double_format): Delete. * arm-tdep.c, avr-tdep.c, hppa-tdep.c, hppabsd-tdep.c, i386-tdep.c, ia64-tdep.c, iq2000-tdep.c, m68k-tdep.c, m88k-tdep.c, mips-linux-tdep.c, mips-tdep.c, mt-tdep.c, ppcobsd-tdep.c, sparc-linux-tdep.c, sparc-tdep.c, sparcnbsd-tdep.c, spu-tdep.c, vax-tdep.c, alpha-tdep.c, ppc-sysv-tdep.c: Update.
2007-01-29 18:31:06 +01:00
pformat (const struct floatformat **format)
{
if (format == NULL)
return "(null)";
else
* doublest.c (floatformat_from_length): Use the right element from gdbarch floatformats. (floatformat_from_type, extract_typed_floating) (store_typed_floating): Likewise. * doublest.h: Remove declarations for undefined floatformat arrays. * gdbarch.sh (float_format, double_format, long_double_format): Change to pairs. (pformat): Update for pairs. * gdbarch.c, gdbarch.h: Regenerated. * gdbtypes.c (floatformats_ieee_single, floatformats_ieee_double) (floatformats_ieee_double_littlebyte_bigword) (floatformats_i387_ext, floatformats_m68881_ext, floatformats_arm_ext) (floatformats_ia64_spill, floatformats_ia64_quad, floatformats_vax_f) (floatformats_vax_d): New variables. (builtin_type_ieee_single, builtin_type_ieee_double) (builtin_type_arm_ext, builtin_type_ia64_spill) (builtin_type_ia64_quad): Replace arrays with individual types. (builtin_type_ieee_single_big, builtin_type_ieee_single_little) (builtin_type_ieee_double_big, builtin_type_ieee_double_little) (builtin_type_ieee_double_littlebyte_bigword, builtin_type_i960_ext) (builtin_type_m88110_ext, builtin_type_m88110_harris_ext) (builtin_type_arm_ext_big, builtin_type_arm_ext_littlebyte_bigword) (builtin_type_ia64_spill_big, builtin_type_ia64_spill_little) (builtin_type_ia64_quad_big, builtin_type_ia64_quad_little): Delete unused and endian-specific types. (recursive_dump_type): Update for floatformat pairs. (build_flt): Move higher. Handle bit == -1. Take a floatformat pair. (build_gdbtypes): Use build_flt. (_initialize_gdbtypes): Update set of initialized types. * gdbtypes.h: Update declarations to match gdbtypes.c. (struct main_type): Store a pointer to two floatformats. * arch-utils.c (default_float_format, default_double_format): Delete. * arch-utils.h (default_float_format, default_double_format): Delete. * arm-tdep.c, avr-tdep.c, hppa-tdep.c, hppabsd-tdep.c, i386-tdep.c, ia64-tdep.c, iq2000-tdep.c, m68k-tdep.c, m88k-tdep.c, mips-linux-tdep.c, mips-tdep.c, mt-tdep.c, ppcobsd-tdep.c, sparc-linux-tdep.c, sparc-tdep.c, sparcnbsd-tdep.c, spu-tdep.c, vax-tdep.c, alpha-tdep.c, ppc-sysv-tdep.c: Update.
2007-01-29 18:31:06 +01:00
/* Just print out one of them - this is only for diagnostics. */
return format[0]->name;
}
static const char *
pstring (const char *string)
{
if (string == NULL)
return "(null)";
return string;
Extend SystemTap SDT probe argument parser This patch extends the current generic parser for SystemTap SDT probe arguments. It can be almost considered a cleanup, but the main point of it is actually to allow the generic parser to accept multiple prefixes and suffixes for the its operands (i.e., integers, register names, and register indirection). I have chosen to implement this as a list of const strings, and declare this list as "static" inside each target's method used to initialize gdbarch. This patch is actually a preparation for an upcoming patch for ARM, which implements the support for multiple integer prefixes (as defined by ARM's asm spec). And AArch64 will also need this, for the same reason. This patch was regtested on all architectures that it touches (i.e., i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found. 2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com> * amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe argument prefixes and suffixes. Initialize gdbarch with them. * arm-linux-tdep.c (arm_linux_init_abi): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix, stap_integer_suffix) (stap_register_prefix, stap_register_suffix) (stap_register_indirection_prefix) (stap_register_indirection_suffix): Declare as "const char *const *" instead of "const char *". Adjust printing function. Rename all of the variables to the plural. (pstring_list): New function. * i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe argument prefixes and suffixes. Initialize gdbarch with them. * ia64-linux-tdep.c (ia64_linux_init_abi): Likewise. * ppc-linux-tdep.c (ppc_linux_init_abi): Likewise. * s390-linux-tdep.c (s390_gdbarch_init): Likewise. * stap-probe.c (stap_is_generic_prefix): New function. (stap_is_register_prefix): Likewise. (stap_is_register_indirection_prefix): Likewise. (stap_is_integer_prefix): Likewise. (stap_generic_check_suffix): Likewise. (stap_check_integer_suffix): Likewise. (stap_check_register_suffix): Likewise. (stap_check_register_indirection_suffix): Likewise. (stap_parse_register_operand): Remove unecessary declarations for variables holding prefix and suffix information. Use the new functions listed above for checking for prefixes and suffixes. (stap_parse_single_operand): Likewise.
2013-12-19 21:53:40 +01:00
}
/* Helper function to print a list of strings, represented as "const
char *const *". The list is printed comma-separated. */
static char *
pstring_list (const char *const *list)
{
static char ret[100];
const char *const *p;
size_t offset = 0;
if (list == NULL)
return "(null)";
ret[0] = '\0';
for (p = list; *p != NULL && offset < sizeof (ret); ++p)
{
size_t s = xsnprintf (ret + offset, sizeof (ret) - offset, "%s, ", *p);
offset += 2 + s;
}
if (offset > 0)
{
gdb_assert (offset - 2 < sizeof (ret));
ret[offset - 2] = '\0';
}
return ret;
}
1999-08-31 03:14:27 +02:00
EOF
# gdbarch open the gdbarch object
printf "\n"
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
printf "/* Maintain the struct gdbarch object. */\n"
printf "\n"
printf "struct gdbarch\n"
printf "{\n"
printf " /* Has this architecture been fully initialized? */\n"
printf " int initialized_p;\n"
printf "\n"
printf " /* An obstack bound to the lifetime of the architecture. */\n"
printf " struct obstack *obstack;\n"
printf "\n"
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
printf " /* basic architectural information. */\n"
function_list | while do_read
1999-08-31 03:14:27 +02:00
do
if class_is_info_p
then
printf " ${returntype} ${function};\n"
fi
1999-08-31 03:14:27 +02:00
done
printf "\n"
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
printf " /* target specific vector. */\n"
printf " struct gdbarch_tdep *tdep;\n"
printf " gdbarch_dump_tdep_ftype *dump_tdep;\n"
printf "\n"
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
printf " /* per-architecture data-pointers. */\n"
printf " unsigned nr_data;\n"
printf " void **data;\n"
printf "\n"
1999-08-31 03:14:27 +02:00
cat <<EOF
/* 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
1999-08-31 03:14:27 +02:00
field is dumped out
get_gdbarch(): Implement the set/get functions (probably using
the macro's as shortcuts).
*/
EOF
function_list | while do_read
1999-08-31 03:14:27 +02:00
do
if class_is_variable_p
then
printf " ${returntype} ${function};\n"
elif class_is_function_p
then
printf " gdbarch_${function}_ftype *${function};\n"
fi
1999-08-31 03:14:27 +02:00
done
printf "};\n"
1999-08-31 03:14:27 +02:00
# Create a new gdbarch struct
cat <<EOF
2000-08-11 04:55:38 +02:00
/* Create a new \`\`struct gdbarch'' based on information provided by
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
\`\`struct gdbarch_info''. */
1999-08-31 03:14:27 +02:00
EOF
printf "\n"
1999-08-31 03:14:27 +02:00
cat <<EOF
struct gdbarch *
gdbarch_alloc (const struct gdbarch_info *info,
struct gdbarch_tdep *tdep)
{
struct gdbarch *gdbarch;
/* Create an obstack for allocating all the per-architecture memory,
then use that to allocate the architecture vector. */
replace XMALLOC with XNEW This replaces XMALLOC with XNEW, and removes XMALLOC. The only non-mechanical bit here was remembering to edit gdbarch.sh. 2014-01-13 Tom Tromey <tromey@redhat.com> * defs.h (XMALLOC): Remove. * avr-tdep.c (avr_gdbarch_init): Use XNEW, not XMALLOC. * bfin-tdep.c (bfin_gdbarch_init): Likewise. * cli-out.c (struct ui_out *): Likewise. * cli/cli-dump.c (add_dump_command): Likewise. (add_dump_command): Likewise. * complaints.c (get_complaints): Likewise. (find_complaint): Likewise. * dwarf2-frame.c (execute_cfa_program): Likewise. * dwarf2read.c (abbrev_table_read_table): Likewise. * gdbarch.sh: Likewise. * gdbarch.c: Rebuild. * inf-ttrace.c (inf_ttrace_add_page): Likewise. * interps.c (interp_new): Likewise. * lm32-tdep.c (lm32_gdbarch_init): Likewise. * m32r-tdep.c (m32r_gdbarch_init): Likewise. * mi/mi-console.c (mi_console_file_new): Likewise. * mi/mi-interp.c (mi_interpreter_init): Likewise. * mi/mi-out.c (mi_out_new): Likewise. * mi/mi-parse.c (mi_parse): Likewise. * microblaze-tdep.c (microblaze_gdbarch_init): Likewise. * moxie-tdep.c (moxie_gdbarch_init): Likewise. * observer.c (xalloc_observer_list_node): Likewise. * regcache.c (regcache_xmalloc_1): Likewise. * reggroups.c (reggroup_new): Likewise. (_initialize_reggroup): Likewise. * registry.c (register_data_with_cleanup): Likewise. * remote.c (remote_notif_stop_alloc_reply): Likewise. * ser-base.c (serial_ttystate): Likewise. * ser-mingw.c (make_pipe_state): Likewise. * ser-pipe.c (pipe_open): Likewise. * serial.c (serial_open): Likewise. * sh64-tdep.c (sh64_gdbarch_init): Likewise. * tui/tui-data.c (tui_alloc_generic_win_info): Likewise. (tui_alloc_win_info): Likewise. (tui_add_content_elements): Likewise. * tui/tui-file.c (tui_file_new): Likewise. * tui/tui-out.c (tui_out_new): Likewise. * ui-file.c (mem_file_new): Likewise. * ui-out.c (push_level): Likewise. (make_cleanup_ui_out_end): Likewise. (append_header_to_list): Likewise. (ui_out_new): Likewise. * user-regs.c (user_reg_add_builtin): Likewise.
2013-12-28 23:31:23 +01:00
struct obstack *obstack = XNEW (struct obstack);
obstack_init (obstack);
Replace some xmalloc-family functions with XNEW-family ones This patch is part of the make-gdb-buildable-in-C++ effort. The idea is to change some calls to the xmalloc family of functions to calls to the equivalents in the XNEW family. This avoids adding an explicit cast, so it keeps the code a bit more readable. Some of them also map relatively well to a C++ equivalent (XNEW (struct foo) -> new foo), so it will be possible to do scripted replacements if needed. I only changed calls that were obviously allocating memory for one or multiple "objects". Allocation of variable sizes (such as strings or buffer handling) will be for later (and won't use XNEW). - xmalloc (sizeof (struct foo)) -> XNEW (struct foo) - xmalloc (num * sizeof (struct foo)) -> XNEWVEC (struct foo, num) - xcalloc (1, sizeof (struct foo)) -> XCNEW (struct foo) - xcalloc (num, sizeof (struct foo)) -> XCNEWVEC (struct foo, num) - xrealloc (p, num * sizeof (struct foo) -> XRESIZEVEC (struct foo, p, num) - obstack_alloc (ob, sizeof (struct foo)) -> XOBNEW (ob, struct foo) - obstack_alloc (ob, num * sizeof (struct foo)) -> XOBNEWVEC (ob, struct foo, num) - alloca (sizeof (struct foo)) -> XALLOCA (struct foo) - alloca (num * sizeof (struct foo)) -> XALLOCAVEC (struct foo, num) Some instances of xmalloc followed by memset to zero the buffer were replaced by XCNEW or XCNEWVEC. I regtested on x86-64, Ubuntu 14.04, but the patch touches many architecture-specific files. For those I'll have to rely on the buildbot or people complaining that I broke their gdb. gdb/ChangeLog: * aarch64-linux-nat.c (aarch64_add_process): Likewise. * aarch64-tdep.c (aarch64_gdbarch_init): Likewise. * ada-exp.y (write_ambiguous_var): Likewise. * ada-lang.c (resolve_subexp): Likewise. (user_select_syms): Likewise. (assign_aggregate): Likewise. (ada_evaluate_subexp): Likewise. (cache_symbol): Likewise. * addrmap.c (allocate_key): Likewise. (addrmap_create_mutable): Likewise. * aix-thread.c (sync_threadlists): Likewise. * alpha-tdep.c (alpha_push_dummy_call): Likewise. (alpha_gdbarch_init): Likewise. * amd64-windows-tdep.c (amd64_windows_push_arguments): Likewise. * arm-linux-nat.c (arm_linux_add_process): Likewise. * arm-linux-tdep.c (arm_linux_displaced_step_copy_insn): Likewise. * arm-tdep.c (push_stack_item): Likewise. (arm_displaced_step_copy_insn): Likewise. (arm_gdbarch_init): Likewise. (_initialize_arm_tdep): Likewise. * avr-tdep.c (push_stack_item): Likewise. * ax-general.c (new_agent_expr): Likewise. * block.c (block_initialize_namespace): Likewise. * breakpoint.c (alloc_counted_command_line): Likewise. (update_dprintf_command_list): Likewise. (parse_breakpoint_sals): Likewise. (decode_static_tracepoint_spec): Likewise. (until_break_command): Likewise. (clear_command): Likewise. (update_global_location_list): Likewise. (get_breakpoint_objfile_data) Likewise. * btrace.c (ftrace_new_function): Likewise. (btrace_set_insn_history): Likewise. (btrace_set_call_history): Likewise. * buildsym.c (add_symbol_to_list): Likewise. (record_pending_block): Likewise. (start_subfile): Likewise. (start_buildsym_compunit): Likewise. (push_subfile): Likewise. (end_symtab_get_static_block): Likewise. (buildsym_init): Likewise. * cli/cli-cmds.c (source_command): Likewise. * cli/cli-decode.c (add_cmd): Likewise. * cli/cli-script.c (build_command_line): Likewise. (setup_user_args): Likewise. (realloc_body_list): Likewise. (process_next_line): Likewise. (copy_command_lines): Likewise. * cli/cli-setshow.c (do_set_command): Likewise. * coff-pe-read.c (read_pe_exported_syms): Likewise. * coffread.c (coff_locate_sections): Likewise. (coff_symtab_read): Likewise. (coff_read_struct_type): Likewise. * common/cleanups.c (make_my_cleanup2): Likewise. * common/common-exceptions.c (throw_it): Likewise. * common/filestuff.c (make_cleanup_close): Likewise. * common/format.c (parse_format_string): Likewise. * common/queue.h (DEFINE_QUEUE_P): Likewise. * compile/compile-object-load.c (munmap_list_add): Likewise. (compile_object_load): Likewise. * compile/compile-object-run.c (compile_object_run): Likewise. * compile/compile.c (append_args): Likewise. * corefile.c (specify_exec_file_hook): Likewise. * cp-support.c (make_symbol_overload_list): Likewise. * cris-tdep.c (push_stack_item): Likewise. (cris_gdbarch_init): Likewise. * ctf.c (ctf_trace_file_writer_new): Likewise. * dbxread.c (init_header_files): Likewise. (add_new_header_file): Likewise. (init_bincl_list): Likewise. (dbx_end_psymtab): Likewise. (start_psymtab): Likewise. (dbx_end_psymtab): Likewise. * dcache.c (dcache_init): Likewise. * dictionary.c (dict_create_hashed): Likewise. (dict_create_hashed_expandable): Likewise. (dict_create_linear): Likewise. (dict_create_linear_expandable): Likewise. * dtrace-probe.c (dtrace_process_dof_probe): Likewise. * dummy-frame.c (register_dummy_frame_dtor): Likewise. * dwarf2-frame-tailcall.c (cache_new_ref1): Likewise. * dwarf2-frame.c (dwarf2_build_frame_info): Likewise. (decode_frame_entry_1): Likewise. * dwarf2expr.c (new_dwarf_expr_context): Likewise. * dwarf2loc.c (dwarf2_compile_expr_to_ax): Likewise. * dwarf2read.c (dwarf2_has_info): Likewise. (create_signatured_type_table_from_index): Likewise. (dwarf2_read_index): Likewise. (dw2_get_file_names_reader): Likewise. (create_all_type_units): Likewise. (read_cutu_die_from_dwo): Likewise. (init_tu_and_read_dwo_dies): Likewise. (init_cutu_and_read_dies): Likewise. (create_all_comp_units): Likewise. (queue_comp_unit): Likewise. (inherit_abstract_dies): Likewise. (read_call_site_scope): Likewise. (dwarf2_add_field): Likewise. (dwarf2_add_typedef): Likewise. (dwarf2_add_member_fn): Likewise. (attr_to_dynamic_prop): Likewise. (abbrev_table_alloc_abbrev): Likewise. (abbrev_table_read_table): Likewise. (add_include_dir): Likewise. (add_file_name): Likewise. (dwarf_decode_line_header): Likewise. (dwarf2_const_value_attr): Likewise. (dwarf_alloc_block): Likewise. (parse_macro_definition): Likewise. (set_die_type): Likewise. (write_psymtabs_to_index): Likewise. (create_cus_from_index): Likewise. (dwarf2_create_include_psymtab): Likewise. (process_psymtab_comp_unit_reader): Likewise. (build_type_psymtab_dependencies): Likewise. (read_comp_units_from_section): Likewise. (compute_compunit_symtab_includes): Likewise. (create_dwo_unit_in_dwp_v1): Likewise. (create_dwo_unit_in_dwp_v2): Likewise. (read_func_scope): Likewise. (process_structure_scope): Likewise. (mark_common_block_symbol_computed): Likewise. (load_partial_dies): Likewise. (dwarf2_symbol_mark_computed): Likewise. * elfread.c (elf_symfile_segments): Likewise. (elf_read_minimal_symbols): Likewise. * environ.c (make_environ): Likewise. * eval.c (evaluate_subexp_standard): Likewise. * event-loop.c (create_file_handler): Likewise. (create_async_signal_handler): Likewise. (create_async_event_handler): Likewise. (create_timer): Likewise. * exec.c (build_section_table): Likewise. * fbsd-nat.c (fbsd_remember_child): Likewise. * fork-child.c (fork_inferior): Likewise. * frv-tdep.c (new_variant): Likewise. * gdbarch.sh (gdbarch_alloc): Likewise. (append_name): Likewise. * gdbtypes.c (rank_function): Likewise. (copy_type_recursive): Likewise. (add_dyn_prop): Likewise. * gnu-nat.c (make_proc): Likewise. (make_inf): Likewise. (gnu_write_inferior): Likewise. * gnu-v3-abi.c (build_gdb_vtable_type): Likewise. (build_std_type_info_type): Likewise. * guile/scm-param.c (compute_enum_list): Likewise. * guile/scm-utils.c (gdbscm_parse_function_args): Likewise. * guile/scm-value.c (gdbscm_value_call): Likewise. * h8300-tdep.c (h8300_gdbarch_init): Likewise. * hppa-tdep.c (hppa_init_objfile_priv_data): Likewise. (read_unwind_info): Likewise. * ia64-tdep.c (ia64_gdbarch_init): Likewise. * infcall.c (dummy_frame_context_saver_setup): Likewise. (call_function_by_hand_dummy): Likewise. * infcmd.c (step_once): Likewise. (finish_forward): Likewise. (attach_command): Likewise. (notice_new_inferior): Likewise. * inferior.c (add_inferior_silent): Likewise. * infrun.c (add_displaced_stepping_state): Likewise. (save_infcall_control_state): Likewise. (save_inferior_ptid): Likewise. (_initialize_infrun): Likewise. * jit.c (bfd_open_from_target_memory): Likewise. (jit_gdbarch_data_init): Likewise. * language.c (add_language): Likewise. * linespec.c (decode_line_2): Likewise. * linux-nat.c (add_to_pid_list): Likewise. (add_initial_lwp): Likewise. * linux-thread-db.c (add_thread_db_info): Likewise. (record_thread): Likewise. (info_auto_load_libthread_db): Likewise. * m32c-tdep.c (m32c_gdbarch_init): Likewise. * m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise. * m68k-tdep.c (m68k_gdbarch_init): Likewise. * m88k-tdep.c (m88k_analyze_prologue): Likewise. * macrocmd.c (macro_define_command): Likewise. * macroexp.c (gather_arguments): Likewise. * macroscope.c (sal_macro_scope): Likewise. * macrotab.c (new_macro_table): Likewise. * mdebugread.c (push_parse_stack): Likewise. (parse_partial_symbols): Likewise. (parse_symbol): Likewise. (psymtab_to_symtab_1): Likewise. (new_block): Likewise. (new_psymtab): Likewise. (mdebug_build_psymtabs): Likewise. (add_pending): Likewise. (elfmdebug_build_psymtabs): Likewise. * mep-tdep.c (mep_gdbarch_init): Likewise. * mi/mi-main.c (mi_execute_command): Likewise. * mi/mi-parse.c (mi_parse_argv): Likewise. * minidebug.c (lzma_open): Likewise. * minsyms.c (terminate_minimal_symbol_table): Likewise. * mips-linux-nat.c (mips_linux_insert_watchpoint): Likewise. * mips-tdep.c (mips_gdbarch_init): Likewise. * mn10300-tdep.c (mn10300_gdbarch_init): Likewise. * msp430-tdep.c (msp430_gdbarch_init): Likewise. * mt-tdep.c (mt_registers_info): Likewise. * nat/aarch64-linux.c (aarch64_linux_new_thread): Likewise. * nat/linux-btrace.c (linux_enable_bts): Likewise. (linux_enable_pt): Likewise. * nat/linux-osdata.c (linux_xfer_osdata_processes): Likewise. (linux_xfer_osdata_processgroups): Likewise. * nios2-tdep.c (nios2_gdbarch_init): Likewise. * nto-procfs.c (procfs_meminfo): Likewise. * objc-lang.c (start_msglist): Likewise. (selectors_info): Likewise. (classes_info): Likewise. (find_methods): Likewise. * objfiles.c (allocate_objfile): Likewise. (update_section_map): Likewise. * osabi.c (gdbarch_register_osabi): Likewise. (gdbarch_register_osabi_sniffer): Likewise. * parse.c (start_arglist): Likewise. * ppc-linux-nat.c (hwdebug_find_thread_points_by_tid): Likewise. (hwdebug_insert_point): Likewise. * printcmd.c (display_command): Likewise. (ui_printf): Likewise. * procfs.c (create_procinfo): Likewise. (load_syscalls): Likewise. (proc_get_LDT_entry): Likewise. (proc_update_threads): Likewise. * prologue-value.c (make_pv_area): Likewise. (pv_area_store): Likewise. * psymtab.c (extend_psymbol_list): Likewise. (init_psymbol_list): Likewise. (allocate_psymtab): Likewise. * python/py-inferior.c (add_thread_object): Likewise. * python/py-param.c (compute_enum_values): Likewise. * python/py-value.c (valpy_call): Likewise. * python/py-varobj.c (py_varobj_iter_next): Likewise. * python/python.c (ensure_python_env): Likewise. * record-btrace.c (record_btrace_start_replaying): Likewise. * record-full.c (record_full_reg_alloc): Likewise. (record_full_mem_alloc): Likewise. (record_full_end_alloc): Likewise. (record_full_core_xfer_partial): Likewise. * regcache.c (get_thread_arch_aspace_regcache): Likewise. * remote-fileio.c (remote_fileio_init_fd_map): Likewise. * remote-notif.c (remote_notif_state_allocate): Likewise. * remote.c (demand_private_info): Likewise. (remote_notif_stop_alloc_reply): Likewise. (remote_enable_btrace): Likewise. * reverse.c (save_bookmark_command): Likewise. * rl78-tdep.c (rl78_gdbarch_init): Likewise. * rx-tdep.c (rx_gdbarch_init): Likewise. * s390-linux-nat.c (s390_insert_watchpoint): Likewise. * ser-go32.c (dos_get_tty_state): Likewise. (dos_copy_tty_state): Likewise. * ser-mingw.c (ser_windows_open): Likewise. (ser_console_wait_handle): Likewise. (ser_console_get_tty_state): Likewise. (make_pipe_state): Likewise. (net_windows_open): Likewise. * ser-unix.c (hardwire_get_tty_state): Likewise. (hardwire_copy_tty_state): Likewise. * solib-aix.c (solib_aix_new_lm_info): Likewise. * solib-dsbt.c (dsbt_current_sos): Likewise. (dsbt_relocate_main_executable): Likewise. * solib-frv.c (frv_current_sos): Likewise. (frv_relocate_main_executable): Likewise. * solib-spu.c (spu_bfd_fopen): Likewise. * solib-svr4.c (lm_info_read): Likewise. (svr4_copy_library_list): Likewise. (svr4_default_sos): Likewise. * source.c (find_source_lines): Likewise. (line_info): Likewise. (add_substitute_path_rule): Likewise. * spu-linux-nat.c (spu_bfd_open): Likewise. * spu-tdep.c (info_spu_dma_cmdlist): Likewise. * stabsread.c (dbx_lookup_type): Likewise. (read_type): Likewise. (read_member_functions): Likewise. (read_struct_fields): Likewise. (read_baseclasses): Likewise. (read_args): Likewise. (_initialize_stabsread): Likewise. * stack.c (func_command): Likewise. * stap-probe.c (handle_stap_probe): Likewise. * symfile.c (addrs_section_sort): Likewise. (addr_info_make_relative): Likewise. (load_section_callback): Likewise. (add_symbol_file_command): Likewise. (init_filename_language_table): Likewise. * symtab.c (create_filename_seen_cache): Likewise. (sort_search_symbols_remove_dups): Likewise. (search_symbols): Likewise. * target.c (make_cleanup_restore_target_terminal): Likewise. * thread.c (new_thread): Likewise. (enable_thread_stack_temporaries): Likewise. (make_cleanup_restore_current_thread): Likewise. (thread_apply_all_command): Likewise. * tic6x-tdep.c (tic6x_gdbarch_init): Likewise. * top.c (gdb_readline_wrapper): Likewise. * tracefile-tfile.c (tfile_trace_file_writer_new): Likewise. * tracepoint.c (trace_find_line_command): Likewise. (all_tracepoint_actions_and_cleanup): Likewise. (make_cleanup_restore_current_traceframe): Likewise. (get_uploaded_tp): Likewise. (get_uploaded_tsv): Likewise. * tui/tui-data.c (tui_alloc_generic_win_info): Likewise. (tui_alloc_win_info): Likewise. (tui_alloc_content): Likewise. (tui_add_content_elements): Likewise. * tui/tui-disasm.c (tui_find_disassembly_address): Likewise. (tui_set_disassem_content): Likewise. * ui-file.c (ui_file_new): Likewise. (stdio_file_new): Likewise. (tee_file_new): Likewise. * utils.c (make_cleanup_restore_integer): Likewise. (add_internal_problem_command): Likewise. * v850-tdep.c (v850_gdbarch_init): Likewise. * valops.c (find_oload_champ): Likewise. * value.c (allocate_value_lazy): Likewise. (record_latest_value): Likewise. (create_internalvar): Likewise. * varobj.c (install_variable): Likewise. (new_variable): Likewise. (new_root_variable): Likewise. (cppush): Likewise. (_initialize_varobj): Likewise. * windows-nat.c (windows_make_so): Likewise. * x86-nat.c (x86_add_process): Likewise. * xcoffread.c (arrange_linetable): Likewise. (allocate_include_entry): Likewise. (process_linenos): Likewise. (SYMBOL_DUP): Likewise. (xcoff_start_psymtab): Likewise. (xcoff_end_psymtab): Likewise. * xml-support.c (gdb_xml_parse_attr_ulongest): Likewise. * xtensa-tdep.c (xtensa_register_type): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. gdb/gdbserver/ChangeLog: * ax.c (gdb_parse_agent_expr): Likewise. (compile_bytecodes): Likewise. * dll.c (loaded_dll): Likewise. * event-loop.c (append_callback_event): Likewise. (create_file_handler): Likewise. (create_file_event): Likewise. * hostio.c (handle_open): Likewise. * inferiors.c (add_thread): Likewise. (add_process): Likewise. * linux-aarch64-low.c (aarch64_linux_new_process): Likewise. * linux-arm-low.c (arm_new_process): Likewise. (arm_new_thread): Likewise. * linux-low.c (add_to_pid_list): Likewise. (linux_add_process): Likewise. (handle_extended_wait): Likewise. (add_lwp): Likewise. (enqueue_one_deferred_signal): Likewise. (enqueue_pending_signal): Likewise. (linux_resume_one_lwp_throw): Likewise. (linux_resume_one_thread): Likewise. (linux_read_memory): Likewise. (linux_write_memory): Likewise. * linux-mips-low.c (mips_linux_new_process): Likewise. (mips_linux_new_thread): Likewise. (mips_add_watchpoint): Likewise. * linux-x86-low.c (initialize_low_arch): Likewise. * lynx-low.c (lynx_add_process): Likewise. * mem-break.c (set_raw_breakpoint_at): Likewise. (set_breakpoint): Likewise. (add_condition_to_breakpoint): Likewise. (add_commands_to_breakpoint): Likewise. (clone_agent_expr): Likewise. (clone_one_breakpoint): Likewise. * regcache.c (new_register_cache): Likewise. * remote-utils.c (look_up_one_symbol): Likewise. * server.c (queue_stop_reply): Likewise. (start_inferior): Likewise. (queue_stop_reply_callback): Likewise. (handle_target_event): Likewise. * spu-low.c (fetch_ppc_memory): Likewise. (store_ppc_memory): Likewise. * target.c (set_target_ops): Likewise. * thread-db.c (thread_db_load_search): Likewise. (try_thread_db_load_1): Likewise. * tracepoint.c (add_tracepoint): Likewise. (add_tracepoint_action): Likewise. (create_trace_state_variable): Likewise. (cmd_qtdpsrc): Likewise. (cmd_qtro): Likewise. (add_while_stepping_state): Likewise. * win32-low.c (child_add_thread): Likewise. (get_image_name): Likewise.
2015-08-26 23:16:07 +02:00
gdbarch = XOBNEW (obstack, struct gdbarch);
memset (gdbarch, 0, sizeof (*gdbarch));
gdbarch->obstack = obstack;
alloc_gdbarch_data (gdbarch);
gdbarch->tdep = tdep;
1999-08-31 03:14:27 +02:00
EOF
printf "\n"
function_list | while do_read
1999-08-31 03:14:27 +02:00
do
if class_is_info_p
then
printf " gdbarch->${function} = info->${function};\n"
fi
1999-08-31 03:14:27 +02:00
done
printf "\n"
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
printf " /* Force the explicit initialization of these. */\n"
function_list | while do_read
1999-08-31 03:14:27 +02:00
do
if class_is_function_p || class_is_variable_p
then
if [ -n "${predefault}" -a "x${predefault}" != "x0" ]
1999-08-31 03:14:27 +02:00
then
printf " gdbarch->${function} = ${predefault};\n"
1999-08-31 03:14:27 +02:00
fi
fi
1999-08-31 03:14:27 +02:00
done
cat <<EOF
/* gdbarch_alloc() */
return gdbarch;
1999-08-31 03:14:27 +02:00
}
EOF
# Free a gdbarch struct.
printf "\n"
printf "\n"
cat <<EOF
/* 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;
}
/* See gdbarch.h. */
char *
gdbarch_obstack_strdup (struct gdbarch *arch, const char *string)
{
return obstack_strdup (arch->obstack, string);
}
/* 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
1999-08-31 03:14:27 +02:00
# verify a new architecture
cat <<EOF
/* Ensure that all values in a GDBARCH are reasonable. */
1999-08-31 03:14:27 +02:00
static void
verify_gdbarch (struct gdbarch *gdbarch)
1999-08-31 03:14:27 +02:00
{
struct ui_file *log;
struct cleanup *cleanups;
long length;
char *buf;
log = mem_fileopen ();
cleanups = make_cleanup_ui_file_delete (log);
1999-08-31 03:14:27 +02:00
/* fundamental */
if (gdbarch->byte_order == BFD_ENDIAN_UNKNOWN)
fprintf_unfiltered (log, "\n\tbyte-order");
if (gdbarch->bfd_arch_info == NULL)
fprintf_unfiltered (log, "\n\tbfd_arch_info");
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
/* Check those that need to be defined for the given multi-arch level. */
1999-08-31 03:14:27 +02:00
EOF
function_list | while do_read
1999-08-31 03:14:27 +02:00
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
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
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 " gdbarch->${function} = ${postdefault};\n"
elif [ -n "${predefault}" -a -n "${postdefault}" ]
then
printf " if (gdbarch->${function} == ${predefault})\n"
printf " gdbarch->${function} = ${postdefault};\n"
elif [ -n "${postdefault}" ]
then
printf " if (gdbarch->${function} == 0)\n"
printf " gdbarch->${function} = ${postdefault};\n"
elif [ -n "${invalid_p}" ]
1999-08-31 03:14:27 +02:00
then
printf " if (${invalid_p})\n"
printf " fprintf_unfiltered (log, \"\\\\n\\\\t${function}\");\n"
elif [ -n "${predefault}" ]
1999-08-31 03:14:27 +02:00
then
printf " if (gdbarch->${function} == ${predefault})\n"
printf " fprintf_unfiltered (log, \"\\\\n\\\\t${function}\");\n"
1999-08-31 03:14:27 +02:00
fi
fi
1999-08-31 03:14:27 +02:00
done
cat <<EOF
buf = ui_file_xstrdup (log, &length);
make_cleanup (xfree, buf);
if (length > 0)
internal_error (__FILE__, __LINE__,
_("verify_gdbarch: the following are invalid ...%s"),
buf);
do_cleanups (cleanups);
1999-08-31 03:14:27 +02:00
}
EOF
# dump the structure
printf "\n"
printf "\n"
1999-08-31 03:14:27 +02:00
cat <<EOF
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
/* Print out the details of the current architecture. */
1999-08-31 03:14:27 +02:00
void
gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
1999-08-31 03:14:27 +02:00
{
const char *gdb_nm_file = "<not-defined>";
#if defined (GDB_NM_FILE)
gdb_nm_file = GDB_NM_FILE;
#endif
fprintf_unfiltered (file,
"gdbarch_dump: GDB_NM_FILE = %s\\n",
gdb_nm_file);
1999-08-31 03:14:27 +02:00
EOF
function_list | sort -t: -k 3 | while do_read
1999-08-31 03:14:27 +02:00
do
# First the predicate
if class_is_predicate_p
then
printf " fprintf_unfiltered (file,\n"
printf " \"gdbarch_dump: gdbarch_${function}_p() = %%d\\\\n\",\n"
printf " gdbarch_${function}_p (gdbarch));\n"
fi
# Print the corresponding value.
if class_is_function_p
then
printf " fprintf_unfiltered (file,\n"
printf " \"gdbarch_dump: ${function} = <%%s>\\\\n\",\n"
printf " host_address_to_string (gdbarch->${function}));\n"
else
# It is a variable
case "${print}:${returntype}" in
:CORE_ADDR )
fmt="%s"
print="core_addr_to_string_nz (gdbarch->${function})"
;;
:* )
fmt="%s"
print="plongest (gdbarch->${function})"
;;
* )
fmt="%s"
;;
esac
printf " fprintf_unfiltered (file,\n"
printf " \"gdbarch_dump: ${function} = %s\\\\n\",\n" "${fmt}"
printf " ${print});\n"
fi
1999-08-31 03:14:27 +02:00
done
cat <<EOF
if (gdbarch->dump_tdep != NULL)
gdbarch->dump_tdep (gdbarch, file);
}
EOF
1999-08-31 03:14:27 +02:00
# GET/SET
printf "\n"
1999-08-31 03:14:27 +02:00
cat <<EOF
struct gdbarch_tdep *
gdbarch_tdep (struct gdbarch *gdbarch)
{
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_tdep called\\n");
1999-08-31 03:14:27 +02:00
return gdbarch->tdep;
}
EOF
printf "\n"
function_list | while do_read
1999-08-31 03:14:27 +02:00
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" ]
1999-08-31 03:14:27 +02:00
then
printf "gdbarch_${function} (struct gdbarch *gdbarch)\n"
1999-08-31 03:14:27 +02:00
else
printf "gdbarch_${function} (struct gdbarch *gdbarch, ${formal})\n"
1999-08-31 03:14:27 +02:00
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" ]
1999-08-31 03:14:27 +02:00
then
printf " gdbarch->${function} (${params});\n"
1999-08-31 03:14:27 +02:00
else
printf " return gdbarch->${function} (${params});\n"
1999-08-31 03:14:27 +02:00
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}" ]
1999-08-31 03:14:27 +02:00
then
printf " /* Check variable is valid. */\n"
printf " gdb_assert (!(${invalid_p}));\n"
elif [ -n "${predefault}" ]
1999-08-31 03:14:27 +02:00
then
printf " /* Check variable changed from pre-default. */\n"
printf " gdb_assert (gdbarch->${function} != ${predefault});\n"
1999-08-31 03:14:27 +02:00
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
1999-08-31 03:14:27 +02:00
done
# All the trailing guff
cat <<EOF
/* Keep a registry of per-architecture data-pointers required by GDB
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
modules. */
1999-08-31 03:14:27 +02:00
struct gdbarch_data
{
unsigned index;
int init_p;
2004-03-15 Andrew Cagney <cagney@redhat.com> * gdbarch.sh (gdbarch_data_pre_init_fytpe) (gdbarch_data_register_pre_init, gdbarch_data_post_init_fytpe) (gdbarch_data_register_post_init): Replace gdbarch_data_init_ftype and register_gdbarch_data. (deprecated_set_gdbarch_data): Rename set_gdbarch_data. (struct gdbarch_data): Replace "init" by "pre_init" and "post_init". * gdbarch.h, gdbarch.c: Re-generate. * dwarf2-frame.c (dwarf2_frame_init): Replace "gdbarch" paramter with"obstack", use OBSTACK_ZALLOC. (dwarf2_frame_ops): Delete. (dwarf2_frame_set_init_reg): Use gdbarch_data. (dwarf2_frame_init_reg): Use gdbarch_data. (_initialize_dwarf2_frame): Use gdbarch_data_register_pre_init. * solib-svr4.c (set_solib_svr4_fetch_link_map_offsets) (_initialize_svr4_solib): Update. * user-regs.c (_initialize_user_regs): Update. * reggroups.c (_initialize_reggroup): Update. * regcache.c (_initialize_regcache): Update. * mips-linux-tdep.c (_initialize_mips_linux_tdep): Update. * libunwind-frame.c (_initialize_libunwind_frame): Update. * gnu-v3-abi.c (init_gnuv3_ops): Update. * frame-unwind.c (_initialize_frame_unwind): Update. * frame-base.c (_initialize_frame_base): Update. * user-regs.c (user_reg_add): Update. * reggroups.c (reggroup_add): Update. * mips-linux-tdep.c (set_mips_linux_register_addr): Update. * libunwind-frame.c (libunwind_frame_set_descr): Update. * frame-unwind.c (frame_unwind_append_sniffer): Update. * frame-base.c (frame_base_table): Update. * remote.c (_initialize_remote): Update. * gdb_obstack.h (OBSTACK_ZALLOC, OBSTACK_CALLOC): Define.
2004-03-15 21:38:08 +01:00
gdbarch_data_pre_init_ftype *pre_init;
gdbarch_data_post_init_ftype *post_init;
1999-08-31 03:14:27 +02:00
};
struct gdbarch_data_registration
{
struct gdbarch_data *data;
struct gdbarch_data_registration *next;
};
struct gdbarch_data_registry
1999-08-31 03:14:27 +02:00
{
unsigned nr;
1999-08-31 03:14:27 +02:00
struct gdbarch_data_registration *registrations;
};
struct gdbarch_data_registry gdbarch_data_registry =
1999-08-31 03:14:27 +02:00
{
0, NULL,
};
2004-03-15 Andrew Cagney <cagney@redhat.com> * gdbarch.sh (gdbarch_data_pre_init_fytpe) (gdbarch_data_register_pre_init, gdbarch_data_post_init_fytpe) (gdbarch_data_register_post_init): Replace gdbarch_data_init_ftype and register_gdbarch_data. (deprecated_set_gdbarch_data): Rename set_gdbarch_data. (struct gdbarch_data): Replace "init" by "pre_init" and "post_init". * gdbarch.h, gdbarch.c: Re-generate. * dwarf2-frame.c (dwarf2_frame_init): Replace "gdbarch" paramter with"obstack", use OBSTACK_ZALLOC. (dwarf2_frame_ops): Delete. (dwarf2_frame_set_init_reg): Use gdbarch_data. (dwarf2_frame_init_reg): Use gdbarch_data. (_initialize_dwarf2_frame): Use gdbarch_data_register_pre_init. * solib-svr4.c (set_solib_svr4_fetch_link_map_offsets) (_initialize_svr4_solib): Update. * user-regs.c (_initialize_user_regs): Update. * reggroups.c (_initialize_reggroup): Update. * regcache.c (_initialize_regcache): Update. * mips-linux-tdep.c (_initialize_mips_linux_tdep): Update. * libunwind-frame.c (_initialize_libunwind_frame): Update. * gnu-v3-abi.c (init_gnuv3_ops): Update. * frame-unwind.c (_initialize_frame_unwind): Update. * frame-base.c (_initialize_frame_base): Update. * user-regs.c (user_reg_add): Update. * reggroups.c (reggroup_add): Update. * mips-linux-tdep.c (set_mips_linux_register_addr): Update. * libunwind-frame.c (libunwind_frame_set_descr): Update. * frame-unwind.c (frame_unwind_append_sniffer): Update. * frame-base.c (frame_base_table): Update. * remote.c (_initialize_remote): Update. * gdb_obstack.h (OBSTACK_ZALLOC, OBSTACK_CALLOC): Define.
2004-03-15 21:38:08 +01:00
static struct gdbarch_data *
gdbarch_data_register (gdbarch_data_pre_init_ftype *pre_init,
gdbarch_data_post_init_ftype *post_init)
1999-08-31 03:14:27 +02:00
{
struct gdbarch_data_registration **curr;
/* Append the new registration. */
for (curr = &gdbarch_data_registry.registrations;
1999-08-31 03:14:27 +02:00
(*curr) != NULL;
curr = &(*curr)->next);
replace XMALLOC with XNEW This replaces XMALLOC with XNEW, and removes XMALLOC. The only non-mechanical bit here was remembering to edit gdbarch.sh. 2014-01-13 Tom Tromey <tromey@redhat.com> * defs.h (XMALLOC): Remove. * avr-tdep.c (avr_gdbarch_init): Use XNEW, not XMALLOC. * bfin-tdep.c (bfin_gdbarch_init): Likewise. * cli-out.c (struct ui_out *): Likewise. * cli/cli-dump.c (add_dump_command): Likewise. (add_dump_command): Likewise. * complaints.c (get_complaints): Likewise. (find_complaint): Likewise. * dwarf2-frame.c (execute_cfa_program): Likewise. * dwarf2read.c (abbrev_table_read_table): Likewise. * gdbarch.sh: Likewise. * gdbarch.c: Rebuild. * inf-ttrace.c (inf_ttrace_add_page): Likewise. * interps.c (interp_new): Likewise. * lm32-tdep.c (lm32_gdbarch_init): Likewise. * m32r-tdep.c (m32r_gdbarch_init): Likewise. * mi/mi-console.c (mi_console_file_new): Likewise. * mi/mi-interp.c (mi_interpreter_init): Likewise. * mi/mi-out.c (mi_out_new): Likewise. * mi/mi-parse.c (mi_parse): Likewise. * microblaze-tdep.c (microblaze_gdbarch_init): Likewise. * moxie-tdep.c (moxie_gdbarch_init): Likewise. * observer.c (xalloc_observer_list_node): Likewise. * regcache.c (regcache_xmalloc_1): Likewise. * reggroups.c (reggroup_new): Likewise. (_initialize_reggroup): Likewise. * registry.c (register_data_with_cleanup): Likewise. * remote.c (remote_notif_stop_alloc_reply): Likewise. * ser-base.c (serial_ttystate): Likewise. * ser-mingw.c (make_pipe_state): Likewise. * ser-pipe.c (pipe_open): Likewise. * serial.c (serial_open): Likewise. * sh64-tdep.c (sh64_gdbarch_init): Likewise. * tui/tui-data.c (tui_alloc_generic_win_info): Likewise. (tui_alloc_win_info): Likewise. (tui_add_content_elements): Likewise. * tui/tui-file.c (tui_file_new): Likewise. * tui/tui-out.c (tui_out_new): Likewise. * ui-file.c (mem_file_new): Likewise. * ui-out.c (push_level): Likewise. (make_cleanup_ui_out_end): Likewise. (append_header_to_list): Likewise. (ui_out_new): Likewise. * user-regs.c (user_reg_add_builtin): Likewise.
2013-12-28 23:31:23 +01:00
(*curr) = XNEW (struct gdbarch_data_registration);
1999-08-31 03:14:27 +02:00
(*curr)->next = NULL;
replace XMALLOC with XNEW This replaces XMALLOC with XNEW, and removes XMALLOC. The only non-mechanical bit here was remembering to edit gdbarch.sh. 2014-01-13 Tom Tromey <tromey@redhat.com> * defs.h (XMALLOC): Remove. * avr-tdep.c (avr_gdbarch_init): Use XNEW, not XMALLOC. * bfin-tdep.c (bfin_gdbarch_init): Likewise. * cli-out.c (struct ui_out *): Likewise. * cli/cli-dump.c (add_dump_command): Likewise. (add_dump_command): Likewise. * complaints.c (get_complaints): Likewise. (find_complaint): Likewise. * dwarf2-frame.c (execute_cfa_program): Likewise. * dwarf2read.c (abbrev_table_read_table): Likewise. * gdbarch.sh: Likewise. * gdbarch.c: Rebuild. * inf-ttrace.c (inf_ttrace_add_page): Likewise. * interps.c (interp_new): Likewise. * lm32-tdep.c (lm32_gdbarch_init): Likewise. * m32r-tdep.c (m32r_gdbarch_init): Likewise. * mi/mi-console.c (mi_console_file_new): Likewise. * mi/mi-interp.c (mi_interpreter_init): Likewise. * mi/mi-out.c (mi_out_new): Likewise. * mi/mi-parse.c (mi_parse): Likewise. * microblaze-tdep.c (microblaze_gdbarch_init): Likewise. * moxie-tdep.c (moxie_gdbarch_init): Likewise. * observer.c (xalloc_observer_list_node): Likewise. * regcache.c (regcache_xmalloc_1): Likewise. * reggroups.c (reggroup_new): Likewise. (_initialize_reggroup): Likewise. * registry.c (register_data_with_cleanup): Likewise. * remote.c (remote_notif_stop_alloc_reply): Likewise. * ser-base.c (serial_ttystate): Likewise. * ser-mingw.c (make_pipe_state): Likewise. * ser-pipe.c (pipe_open): Likewise. * serial.c (serial_open): Likewise. * sh64-tdep.c (sh64_gdbarch_init): Likewise. * tui/tui-data.c (tui_alloc_generic_win_info): Likewise. (tui_alloc_win_info): Likewise. (tui_add_content_elements): Likewise. * tui/tui-file.c (tui_file_new): Likewise. * tui/tui-out.c (tui_out_new): Likewise. * ui-file.c (mem_file_new): Likewise. * ui-out.c (push_level): Likewise. (make_cleanup_ui_out_end): Likewise. (append_header_to_list): Likewise. (ui_out_new): Likewise. * user-regs.c (user_reg_add_builtin): Likewise.
2013-12-28 23:31:23 +01:00
(*curr)->data = XNEW (struct gdbarch_data);
(*curr)->data->index = gdbarch_data_registry.nr++;
2004-03-15 Andrew Cagney <cagney@redhat.com> * gdbarch.sh (gdbarch_data_pre_init_fytpe) (gdbarch_data_register_pre_init, gdbarch_data_post_init_fytpe) (gdbarch_data_register_post_init): Replace gdbarch_data_init_ftype and register_gdbarch_data. (deprecated_set_gdbarch_data): Rename set_gdbarch_data. (struct gdbarch_data): Replace "init" by "pre_init" and "post_init". * gdbarch.h, gdbarch.c: Re-generate. * dwarf2-frame.c (dwarf2_frame_init): Replace "gdbarch" paramter with"obstack", use OBSTACK_ZALLOC. (dwarf2_frame_ops): Delete. (dwarf2_frame_set_init_reg): Use gdbarch_data. (dwarf2_frame_init_reg): Use gdbarch_data. (_initialize_dwarf2_frame): Use gdbarch_data_register_pre_init. * solib-svr4.c (set_solib_svr4_fetch_link_map_offsets) (_initialize_svr4_solib): Update. * user-regs.c (_initialize_user_regs): Update. * reggroups.c (_initialize_reggroup): Update. * regcache.c (_initialize_regcache): Update. * mips-linux-tdep.c (_initialize_mips_linux_tdep): Update. * libunwind-frame.c (_initialize_libunwind_frame): Update. * gnu-v3-abi.c (init_gnuv3_ops): Update. * frame-unwind.c (_initialize_frame_unwind): Update. * frame-base.c (_initialize_frame_base): Update. * user-regs.c (user_reg_add): Update. * reggroups.c (reggroup_add): Update. * mips-linux-tdep.c (set_mips_linux_register_addr): Update. * libunwind-frame.c (libunwind_frame_set_descr): Update. * frame-unwind.c (frame_unwind_append_sniffer): Update. * frame-base.c (frame_base_table): Update. * remote.c (_initialize_remote): Update. * gdb_obstack.h (OBSTACK_ZALLOC, OBSTACK_CALLOC): Define.
2004-03-15 21:38:08 +01:00
(*curr)->data->pre_init = pre_init;
(*curr)->data->post_init = post_init;
(*curr)->data->init_p = 1;
1999-08-31 03:14:27 +02:00
return (*curr)->data;
}
2004-03-15 Andrew Cagney <cagney@redhat.com> * gdbarch.sh (gdbarch_data_pre_init_fytpe) (gdbarch_data_register_pre_init, gdbarch_data_post_init_fytpe) (gdbarch_data_register_post_init): Replace gdbarch_data_init_ftype and register_gdbarch_data. (deprecated_set_gdbarch_data): Rename set_gdbarch_data. (struct gdbarch_data): Replace "init" by "pre_init" and "post_init". * gdbarch.h, gdbarch.c: Re-generate. * dwarf2-frame.c (dwarf2_frame_init): Replace "gdbarch" paramter with"obstack", use OBSTACK_ZALLOC. (dwarf2_frame_ops): Delete. (dwarf2_frame_set_init_reg): Use gdbarch_data. (dwarf2_frame_init_reg): Use gdbarch_data. (_initialize_dwarf2_frame): Use gdbarch_data_register_pre_init. * solib-svr4.c (set_solib_svr4_fetch_link_map_offsets) (_initialize_svr4_solib): Update. * user-regs.c (_initialize_user_regs): Update. * reggroups.c (_initialize_reggroup): Update. * regcache.c (_initialize_regcache): Update. * mips-linux-tdep.c (_initialize_mips_linux_tdep): Update. * libunwind-frame.c (_initialize_libunwind_frame): Update. * gnu-v3-abi.c (init_gnuv3_ops): Update. * frame-unwind.c (_initialize_frame_unwind): Update. * frame-base.c (_initialize_frame_base): Update. * user-regs.c (user_reg_add): Update. * reggroups.c (reggroup_add): Update. * mips-linux-tdep.c (set_mips_linux_register_addr): Update. * libunwind-frame.c (libunwind_frame_set_descr): Update. * frame-unwind.c (frame_unwind_append_sniffer): Update. * frame-base.c (frame_base_table): Update. * remote.c (_initialize_remote): Update. * gdb_obstack.h (OBSTACK_ZALLOC, OBSTACK_CALLOC): Define.
2004-03-15 21:38:08 +01:00
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);
}
1999-08-31 03:14:27 +02:00
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
/* 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
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
data-pointer. */
void
2004-03-15 Andrew Cagney <cagney@redhat.com> * gdbarch.sh (gdbarch_data_pre_init_fytpe) (gdbarch_data_register_pre_init, gdbarch_data_post_init_fytpe) (gdbarch_data_register_post_init): Replace gdbarch_data_init_ftype and register_gdbarch_data. (deprecated_set_gdbarch_data): Rename set_gdbarch_data. (struct gdbarch_data): Replace "init" by "pre_init" and "post_init". * gdbarch.h, gdbarch.c: Re-generate. * dwarf2-frame.c (dwarf2_frame_init): Replace "gdbarch" paramter with"obstack", use OBSTACK_ZALLOC. (dwarf2_frame_ops): Delete. (dwarf2_frame_set_init_reg): Use gdbarch_data. (dwarf2_frame_init_reg): Use gdbarch_data. (_initialize_dwarf2_frame): Use gdbarch_data_register_pre_init. * solib-svr4.c (set_solib_svr4_fetch_link_map_offsets) (_initialize_svr4_solib): Update. * user-regs.c (_initialize_user_regs): Update. * reggroups.c (_initialize_reggroup): Update. * regcache.c (_initialize_regcache): Update. * mips-linux-tdep.c (_initialize_mips_linux_tdep): Update. * libunwind-frame.c (_initialize_libunwind_frame): Update. * gnu-v3-abi.c (init_gnuv3_ops): Update. * frame-unwind.c (_initialize_frame_unwind): Update. * frame-base.c (_initialize_frame_base): Update. * user-regs.c (user_reg_add): Update. * reggroups.c (reggroup_add): Update. * mips-linux-tdep.c (set_mips_linux_register_addr): Update. * libunwind-frame.c (libunwind_frame_set_descr): Update. * frame-unwind.c (frame_unwind_append_sniffer): Update. * frame-base.c (frame_base_table): Update. * remote.c (_initialize_remote): Update. * gdb_obstack.h (OBSTACK_ZALLOC, OBSTACK_CALLOC): Define.
2004-03-15 21:38:08 +01:00
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);
2004-03-15 Andrew Cagney <cagney@redhat.com> * gdbarch.sh (gdbarch_data_pre_init_fytpe) (gdbarch_data_register_pre_init, gdbarch_data_post_init_fytpe) (gdbarch_data_register_post_init): Replace gdbarch_data_init_ftype and register_gdbarch_data. (deprecated_set_gdbarch_data): Rename set_gdbarch_data. (struct gdbarch_data): Replace "init" by "pre_init" and "post_init". * gdbarch.h, gdbarch.c: Re-generate. * dwarf2-frame.c (dwarf2_frame_init): Replace "gdbarch" paramter with"obstack", use OBSTACK_ZALLOC. (dwarf2_frame_ops): Delete. (dwarf2_frame_set_init_reg): Use gdbarch_data. (dwarf2_frame_init_reg): Use gdbarch_data. (_initialize_dwarf2_frame): Use gdbarch_data_register_pre_init. * solib-svr4.c (set_solib_svr4_fetch_link_map_offsets) (_initialize_svr4_solib): Update. * user-regs.c (_initialize_user_regs): Update. * reggroups.c (_initialize_reggroup): Update. * regcache.c (_initialize_regcache): Update. * mips-linux-tdep.c (_initialize_mips_linux_tdep): Update. * libunwind-frame.c (_initialize_libunwind_frame): Update. * gnu-v3-abi.c (init_gnuv3_ops): Update. * frame-unwind.c (_initialize_frame_unwind): Update. * frame-base.c (_initialize_frame_base): Update. * user-regs.c (user_reg_add): Update. * reggroups.c (reggroup_add): Update. * mips-linux-tdep.c (set_mips_linux_register_addr): Update. * libunwind-frame.c (libunwind_frame_set_descr): Update. * frame-unwind.c (frame_unwind_append_sniffer): Update. * frame-base.c (frame_base_table): Update. * remote.c (_initialize_remote): Update. * gdb_obstack.h (OBSTACK_ZALLOC, OBSTACK_CALLOC): Define.
2004-03-15 21:38:08 +01:00
gdb_assert (data->pre_init == NULL);
gdbarch->data[data->index] = pointer;
}
1999-08-31 03:14:27 +02:00
/* Return the current value of the specified per-architecture
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
data-pointer. */
1999-08-31 03:14:27 +02:00
void *
gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *data)
1999-08-31 03:14:27 +02:00
{
gdb_assert (data->index < gdbarch->nr_data);
2004-03-15 Andrew Cagney <cagney@redhat.com> * gdbarch.sh (gdbarch_data_pre_init_fytpe) (gdbarch_data_register_pre_init, gdbarch_data_post_init_fytpe) (gdbarch_data_register_post_init): Replace gdbarch_data_init_ftype and register_gdbarch_data. (deprecated_set_gdbarch_data): Rename set_gdbarch_data. (struct gdbarch_data): Replace "init" by "pre_init" and "post_init". * gdbarch.h, gdbarch.c: Re-generate. * dwarf2-frame.c (dwarf2_frame_init): Replace "gdbarch" paramter with"obstack", use OBSTACK_ZALLOC. (dwarf2_frame_ops): Delete. (dwarf2_frame_set_init_reg): Use gdbarch_data. (dwarf2_frame_init_reg): Use gdbarch_data. (_initialize_dwarf2_frame): Use gdbarch_data_register_pre_init. * solib-svr4.c (set_solib_svr4_fetch_link_map_offsets) (_initialize_svr4_solib): Update. * user-regs.c (_initialize_user_regs): Update. * reggroups.c (_initialize_reggroup): Update. * regcache.c (_initialize_regcache): Update. * mips-linux-tdep.c (_initialize_mips_linux_tdep): Update. * libunwind-frame.c (_initialize_libunwind_frame): Update. * gnu-v3-abi.c (init_gnuv3_ops): Update. * frame-unwind.c (_initialize_frame_unwind): Update. * frame-base.c (_initialize_frame_base): Update. * user-regs.c (user_reg_add): Update. * reggroups.c (reggroup_add): Update. * mips-linux-tdep.c (set_mips_linux_register_addr): Update. * libunwind-frame.c (libunwind_frame_set_descr): Update. * frame-unwind.c (frame_unwind_append_sniffer): Update. * frame-base.c (frame_base_table): Update. * remote.c (_initialize_remote): Update. * gdb_obstack.h (OBSTACK_ZALLOC, OBSTACK_CALLOC): Define.
2004-03-15 21:38:08 +01:00
if (gdbarch->data[data->index] == NULL)
{
2004-03-15 Andrew Cagney <cagney@redhat.com> * gdbarch.sh (gdbarch_data_pre_init_fytpe) (gdbarch_data_register_pre_init, gdbarch_data_post_init_fytpe) (gdbarch_data_register_post_init): Replace gdbarch_data_init_ftype and register_gdbarch_data. (deprecated_set_gdbarch_data): Rename set_gdbarch_data. (struct gdbarch_data): Replace "init" by "pre_init" and "post_init". * gdbarch.h, gdbarch.c: Re-generate. * dwarf2-frame.c (dwarf2_frame_init): Replace "gdbarch" paramter with"obstack", use OBSTACK_ZALLOC. (dwarf2_frame_ops): Delete. (dwarf2_frame_set_init_reg): Use gdbarch_data. (dwarf2_frame_init_reg): Use gdbarch_data. (_initialize_dwarf2_frame): Use gdbarch_data_register_pre_init. * solib-svr4.c (set_solib_svr4_fetch_link_map_offsets) (_initialize_svr4_solib): Update. * user-regs.c (_initialize_user_regs): Update. * reggroups.c (_initialize_reggroup): Update. * regcache.c (_initialize_regcache): Update. * mips-linux-tdep.c (_initialize_mips_linux_tdep): Update. * libunwind-frame.c (_initialize_libunwind_frame): Update. * gnu-v3-abi.c (init_gnuv3_ops): Update. * frame-unwind.c (_initialize_frame_unwind): Update. * frame-base.c (_initialize_frame_base): Update. * user-regs.c (user_reg_add): Update. * reggroups.c (reggroup_add): Update. * mips-linux-tdep.c (set_mips_linux_register_addr): Update. * libunwind-frame.c (libunwind_frame_set_descr): Update. * frame-unwind.c (frame_unwind_append_sniffer): Update. * frame-base.c (frame_base_table): Update. * remote.c (_initialize_remote): Update. * gdb_obstack.h (OBSTACK_ZALLOC, OBSTACK_CALLOC): Define.
2004-03-15 21:38:08 +01:00
/* 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];
1999-08-31 03:14:27 +02:00
}
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
/* Keep a registry of the architectures known by GDB. */
1999-08-31 03:14:27 +02:00
struct gdbarch_registration
1999-08-31 03:14:27 +02:00
{
enum bfd_architecture bfd_architecture;
gdbarch_init_ftype *init;
gdbarch_dump_tdep_ftype *dump_tdep;
1999-08-31 03:14:27 +02:00
struct gdbarch_list *arches;
struct gdbarch_registration *next;
1999-08-31 03:14:27 +02:00
};
static struct gdbarch_registration *gdbarch_registry = NULL;
1999-08-31 03:14:27 +02:00
static void
append_name (const char ***buf, int *nr, const char *name)
{
*buf = XRESIZEVEC (const char *, *buf, *nr + 1);
(*buf)[*nr] = name;
*nr += 1;
}
const char **
gdbarch_printable_names (void)
{
/* Accumulate a list of names based on the registed list of
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
architectures. */
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;
}
1999-08-31 03:14:27 +02:00
void
gdbarch_register (enum bfd_architecture bfd_architecture,
gdbarch_init_ftype *init,
gdbarch_dump_tdep_ftype *dump_tdep)
1999-08-31 03:14:27 +02:00
{
struct gdbarch_registration **curr;
1999-08-31 03:14:27 +02:00
const struct bfd_arch_info *bfd_arch_info;
/* Check that BFD recognizes this architecture */
1999-08-31 03:14:27 +02:00
bfd_arch_info = bfd_lookup_arch (bfd_architecture, 0);
if (bfd_arch_info == NULL)
{
internal_error (__FILE__, __LINE__,
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
_("gdbarch: Attempt to register "
"unknown architecture (%d)"),
bfd_architecture);
1999-08-31 03:14:27 +02:00
}
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
/* Check that we haven't seen this architecture before. */
for (curr = &gdbarch_registry;
1999-08-31 03:14:27 +02:00
(*curr) != NULL;
curr = &(*curr)->next)
{
if (bfd_architecture == (*curr)->bfd_architecture)
internal_error (__FILE__, __LINE__,
_("gdbarch: Duplicate registration "
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
"of architecture (%s)"),
bfd_arch_info->printable_name);
1999-08-31 03:14:27 +02:00
}
/* log it */
if (gdbarch_debug)
fprintf_unfiltered (gdb_stdlog, "register_gdbarch_init (%s, %s)\n",
1999-08-31 03:14:27 +02:00
bfd_arch_info->printable_name,
host_address_to_string (init));
1999-08-31 03:14:27 +02:00
/* Append it */
replace XMALLOC with XNEW This replaces XMALLOC with XNEW, and removes XMALLOC. The only non-mechanical bit here was remembering to edit gdbarch.sh. 2014-01-13 Tom Tromey <tromey@redhat.com> * defs.h (XMALLOC): Remove. * avr-tdep.c (avr_gdbarch_init): Use XNEW, not XMALLOC. * bfin-tdep.c (bfin_gdbarch_init): Likewise. * cli-out.c (struct ui_out *): Likewise. * cli/cli-dump.c (add_dump_command): Likewise. (add_dump_command): Likewise. * complaints.c (get_complaints): Likewise. (find_complaint): Likewise. * dwarf2-frame.c (execute_cfa_program): Likewise. * dwarf2read.c (abbrev_table_read_table): Likewise. * gdbarch.sh: Likewise. * gdbarch.c: Rebuild. * inf-ttrace.c (inf_ttrace_add_page): Likewise. * interps.c (interp_new): Likewise. * lm32-tdep.c (lm32_gdbarch_init): Likewise. * m32r-tdep.c (m32r_gdbarch_init): Likewise. * mi/mi-console.c (mi_console_file_new): Likewise. * mi/mi-interp.c (mi_interpreter_init): Likewise. * mi/mi-out.c (mi_out_new): Likewise. * mi/mi-parse.c (mi_parse): Likewise. * microblaze-tdep.c (microblaze_gdbarch_init): Likewise. * moxie-tdep.c (moxie_gdbarch_init): Likewise. * observer.c (xalloc_observer_list_node): Likewise. * regcache.c (regcache_xmalloc_1): Likewise. * reggroups.c (reggroup_new): Likewise. (_initialize_reggroup): Likewise. * registry.c (register_data_with_cleanup): Likewise. * remote.c (remote_notif_stop_alloc_reply): Likewise. * ser-base.c (serial_ttystate): Likewise. * ser-mingw.c (make_pipe_state): Likewise. * ser-pipe.c (pipe_open): Likewise. * serial.c (serial_open): Likewise. * sh64-tdep.c (sh64_gdbarch_init): Likewise. * tui/tui-data.c (tui_alloc_generic_win_info): Likewise. (tui_alloc_win_info): Likewise. (tui_add_content_elements): Likewise. * tui/tui-file.c (tui_file_new): Likewise. * tui/tui-out.c (tui_out_new): Likewise. * ui-file.c (mem_file_new): Likewise. * ui-out.c (push_level): Likewise. (make_cleanup_ui_out_end): Likewise. (append_header_to_list): Likewise. (ui_out_new): Likewise. * user-regs.c (user_reg_add_builtin): Likewise.
2013-12-28 23:31:23 +01:00
(*curr) = XNEW (struct gdbarch_registration);
1999-08-31 03:14:27 +02:00
(*curr)->bfd_architecture = bfd_architecture;
(*curr)->init = init;
(*curr)->dump_tdep = dump_tdep;
1999-08-31 03:14:27 +02:00
(*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);
1999-08-31 03:14:27 +02:00
}
/* Look for an architecture using gdbarch_info. */
1999-08-31 03:14:27 +02:00
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;
if (info->target_desc != arches->gdbarch->target_desc)
continue;
1999-08-31 03:14:27 +02:00
return arches;
}
return NULL;
}
/* Find an architecture that matches the specified INFO. Create a new
architecture if needed. Return that new architecture. */
1999-08-31 03:14:27 +02:00
struct gdbarch *
gdbarch_find_by_info (struct gdbarch_info info)
1999-08-31 03:14:27 +02:00
{
struct gdbarch *new_gdbarch;
struct gdbarch_registration *rego;
1999-08-31 03:14:27 +02:00
/* Fill in missing parts of the INFO struct using a number of
sources: "set ..."; INFOabfd supplied; and the global
defaults. */
gdbarch_info_fill (&info);
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
/* Must have found some sort of architecture. */
gdb_assert (info.bfd_arch_info != NULL);
1999-08-31 03:14:27 +02:00
if (gdbarch_debug)
{
fprintf_unfiltered (gdb_stdlog,
"gdbarch_find_by_info: info.bfd_arch_info %s\n",
1999-08-31 03:14:27 +02:00
(info.bfd_arch_info != NULL
? info.bfd_arch_info->printable_name
: "(null)"));
fprintf_unfiltered (gdb_stdlog,
"gdbarch_find_by_info: info.byte_order %d (%s)\n",
1999-08-31 03:14:27 +02:00
info.byte_order,
2002-01-05 05:30:46 +01:00
(info.byte_order == BFD_ENDIAN_BIG ? "big"
2001-12-15 17:53:24 +01:00
: info.byte_order == BFD_ENDIAN_LITTLE ? "little"
1999-08-31 03:14:27 +02:00
: "default"));
fprintf_unfiltered (gdb_stdlog,
"gdbarch_find_by_info: info.osabi %d (%s)\n",
info.osabi, gdbarch_osabi_name (info.osabi));
1999-08-31 03:14:27 +02:00
fprintf_unfiltered (gdb_stdlog,
"gdbarch_find_by_info: info.abfd %s\n",
host_address_to_string (info.abfd));
1999-08-31 03:14:27 +02:00
fprintf_unfiltered (gdb_stdlog,
"gdbarch_find_by_info: info.tdep_info %s\n",
host_address_to_string (info.tdep_info));
1999-08-31 03:14:27 +02:00
}
/* 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, "gdbarch_find_by_info: "
"No matching architecture\n");
return 0;
}
/* Ask the tdep code for an architecture that matches "info". */
1999-08-31 03:14:27 +02:00
new_gdbarch = rego->init (info, rego->arches);
/* Did the tdep code like it? No. Reject the change and revert to
the old architecture. */
1999-08-31 03:14:27 +02:00
if (new_gdbarch == NULL)
{
if (gdbarch_debug)
fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: "
"Target rejected architecture\n");
return NULL;
1999-08-31 03:14:27 +02:00
}
/* 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)
1999-08-31 03:14:27 +02:00
{
struct gdbarch_list **list;
struct gdbarch_list *self;
1999-08-31 03:14:27 +02:00
if (gdbarch_debug)
fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: "
"Previous architecture %s (%s) selected\n",
host_address_to_string (new_gdbarch),
1999-08-31 03:14:27 +02:00
new_gdbarch->bfd_arch_info->printable_name);
/* Find the existing arch in the list. */
for (list = &rego->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 SELF. */
self = (*list);
(*list) = self->next;
/* Insert SELF at the front. */
self->next = rego->arches;
rego->arches = self;
/* Return it. */
return new_gdbarch;
1999-08-31 03:14:27 +02:00
}
/* It's a new architecture. */
if (gdbarch_debug)
fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: "
"New architecture %s (%s) selected\n",
host_address_to_string (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 *self = XNEW (struct gdbarch_list);
self->next = rego->arches;
self->gdbarch = new_gdbarch;
rego->arches = self;
}
1999-08-31 03:14:27 +02:00
/* Check that the newly installed architecture is valid. Plug in
any post init values. */
new_gdbarch->dump_tdep = rego->dump_tdep;
1999-08-31 03:14:27 +02:00
verify_gdbarch (new_gdbarch);
new_gdbarch->initialized_p = 1;
1999-08-31 03:14:27 +02:00
if (gdbarch_debug)
gdbarch_dump (new_gdbarch, gdb_stdlog);
return new_gdbarch;
}
/* Make the specified architecture current. */
void
set_target_gdbarch (struct gdbarch *new_gdbarch)
{
gdb_assert (new_gdbarch != NULL);
gdb_assert (new_gdbarch->initialized_p);
gdb/ 2012-11-09 Pedro Alves <palves@redhat.com> * gdbarch.sh (target_gdbarch) <gdbarch.h>: Reimplement as macro. (get_target_gdbarch) <gdbarch.h>: New function. (startup_gdbarch) <gdbarch.h>: Declare. <gdbarch.c> (target_gdbarch): Delete. <gdbarch.c> (deprecated_target_gdbarch_select_hack): Set the current inferior's gdbarch. <gdbarch.c> (get_target_gdbarch): New function. * inferior.c: Include target-descriptions.h. (free_inferior): Free target description info. (add_inferior_with_spaces): Set the inferior's initial architecture. (clone_inferior_command): Copy the original inferior's target description if it was user specified. (initialize_inferiors): Add comment. * inferior.h (struct target_desc_info): Forward declare. (struct inferior) <gdbarch>: New field. * linux-nat.c: Include target-descriptions.h. (linux_child_follow_fork): Copy the parent's architecture and target description to the child. * target-descriptions.c: Include inferior.h. (struct target_desc_info): New structure, holding the equivalents of ... (target_desc_fetched, current_target_desc) (target_description_filename): ... these removed globals. (get_tdesc_info, target_desc_info_from_user_p) (copy_inferior_target_desc_info, target_desc_info_free): New. (target_desc_fetched, current_target_desc) (target_description_filename): Reimplemented as convenience macros. (tdesc_filename_cmd_string): New global. (set_tdesc_filename_cmd): Copy the string manipulated by the "set tdescs filename ..." commands to the per-inferior equivalent. (show_tdesc_filename_cmd): Get the value to show from the per-inferior description filename. (_initilize_target_descriptions): Change the "set/show tdesc filename" commands' variable. * target-descriptions.h (struct target_desc, struct target_desc_info) (struct inferior): Forward declare. (target_find_description, target_clear_description) (target_current_description): Adjust comments. (copy_inferior_target_desc_info, target_desc_info_free) (target_desc_info_from_user_p). Declare. gdb/testsuite/ 2012-11-09 Pedro Alves <palves@redhat.com> * gdb.multi/multi-arch.exp: New.
2012-11-09 02:47:20 +01:00
current_inferior ()->gdbarch = new_gdbarch;
gdb: * tui/tui-hooks.c: Include observer.h. (tui_event_default, tui_old_event_hooks, tui_event_hooks): Remove. (tui_bp_created_observer, tui_bp_deleted_observer, tui_bp_modified_observer): New globals. (tui_install_hooks): Use observers, not events. (tui_remove_hooks): Likewise. * mi/mi-cmd-break.c: Include observer.h, not gdb-events.h. (mi_breakpoint_observers_installed, mi_can_breakpoint_notify): New globals. (breakpoint_notify): Check mi_can_breakpoint_notify. (breakpoint_hooks): Remove. (mi_cmd_break_insert): Attach observers. Don't use events. * tracepoint.c: Include observer.h, not gdb-events.h. (tracepoint_operation, trace_pass_command): Notify observer. * interps.c: Don't include gdb-events.h. (clear_interpreter_hooks): Don't call clear_gdb_event_hooks. * gdbarch.c: Rebuild. * gdbarch.sh: Emit include for observer.h, not gdb-events.h. (deprecated_current_gdbarch_select_hack): Notify observer. * breakpoint.h: Don't include gdb-events.h. * breakpoint.c: Don't include gdb-events.h. (condition_command): Notify observer. (commands_command): Likewise. (commands_from_control_command): Likewise. (mention, delete_breakpoint, set_ignore_count): Likewise. (disable_breakpoint, do_enable_breakpoint): Likewise. * Makefile.in (gdb_events_h): Remove. (breakpoint_h): Update. (COMMON_OBS): Remove gdb-events.o. (gdb-events.o): Remove. (breakpoint.o, gdbarch.o, interps.o, tracepoint.o, gdbtk-bp.o, gdbtk-hooks.o, mi-cmd-break.o, tui-hooks.o): Update. * gdb-events.c: Remove. * gdb-events.h: Remove. * gdb-events.sh: Remove. gdb/doc: * observer.texi (GDB Observers): Document new observers: breakpoint_created, breakpoint_deleted, breakpoint_modified, tracepoint_created, tracepoint_deleted, tracepoint_modified, architecture_changed. gdb/gdbtk: * generic/gdbtk-hooks.c: Include observer.h, not gdb-events.h. (gdbtk_add_hooks): Use observers, not events. (gdbtk_architecture_changed): Add argument, for observer. * generic/gdbtk-bp.c: Include observer.h. (gdb_set_bp): Notify observer. (gdb_set_bp_addr): Likewise.
2008-07-25 18:12:03 +02:00
observer_notify_architecture_changed (new_gdbarch);
registers_changed ();
}
1999-08-31 03:14:27 +02:00
/* Return the current inferior's arch. */
gdb/ 2012-11-09 Pedro Alves <palves@redhat.com> * gdbarch.sh (target_gdbarch) <gdbarch.h>: Reimplement as macro. (get_target_gdbarch) <gdbarch.h>: New function. (startup_gdbarch) <gdbarch.h>: Declare. <gdbarch.c> (target_gdbarch): Delete. <gdbarch.c> (deprecated_target_gdbarch_select_hack): Set the current inferior's gdbarch. <gdbarch.c> (get_target_gdbarch): New function. * inferior.c: Include target-descriptions.h. (free_inferior): Free target description info. (add_inferior_with_spaces): Set the inferior's initial architecture. (clone_inferior_command): Copy the original inferior's target description if it was user specified. (initialize_inferiors): Add comment. * inferior.h (struct target_desc_info): Forward declare. (struct inferior) <gdbarch>: New field. * linux-nat.c: Include target-descriptions.h. (linux_child_follow_fork): Copy the parent's architecture and target description to the child. * target-descriptions.c: Include inferior.h. (struct target_desc_info): New structure, holding the equivalents of ... (target_desc_fetched, current_target_desc) (target_description_filename): ... these removed globals. (get_tdesc_info, target_desc_info_from_user_p) (copy_inferior_target_desc_info, target_desc_info_free): New. (target_desc_fetched, current_target_desc) (target_description_filename): Reimplemented as convenience macros. (tdesc_filename_cmd_string): New global. (set_tdesc_filename_cmd): Copy the string manipulated by the "set tdescs filename ..." commands to the per-inferior equivalent. (show_tdesc_filename_cmd): Get the value to show from the per-inferior description filename. (_initilize_target_descriptions): Change the "set/show tdesc filename" commands' variable. * target-descriptions.h (struct target_desc, struct target_desc_info) (struct inferior): Forward declare. (target_find_description, target_clear_description) (target_current_description): Adjust comments. (copy_inferior_target_desc_info, target_desc_info_free) (target_desc_info_from_user_p). Declare. gdb/testsuite/ 2012-11-09 Pedro Alves <palves@redhat.com> * gdb.multi/multi-arch.exp: New.
2012-11-09 02:47:20 +01:00
struct gdbarch *
target_gdbarch (void)
gdb/ 2012-11-09 Pedro Alves <palves@redhat.com> * gdbarch.sh (target_gdbarch) <gdbarch.h>: Reimplement as macro. (get_target_gdbarch) <gdbarch.h>: New function. (startup_gdbarch) <gdbarch.h>: Declare. <gdbarch.c> (target_gdbarch): Delete. <gdbarch.c> (deprecated_target_gdbarch_select_hack): Set the current inferior's gdbarch. <gdbarch.c> (get_target_gdbarch): New function. * inferior.c: Include target-descriptions.h. (free_inferior): Free target description info. (add_inferior_with_spaces): Set the inferior's initial architecture. (clone_inferior_command): Copy the original inferior's target description if it was user specified. (initialize_inferiors): Add comment. * inferior.h (struct target_desc_info): Forward declare. (struct inferior) <gdbarch>: New field. * linux-nat.c: Include target-descriptions.h. (linux_child_follow_fork): Copy the parent's architecture and target description to the child. * target-descriptions.c: Include inferior.h. (struct target_desc_info): New structure, holding the equivalents of ... (target_desc_fetched, current_target_desc) (target_description_filename): ... these removed globals. (get_tdesc_info, target_desc_info_from_user_p) (copy_inferior_target_desc_info, target_desc_info_free): New. (target_desc_fetched, current_target_desc) (target_description_filename): Reimplemented as convenience macros. (tdesc_filename_cmd_string): New global. (set_tdesc_filename_cmd): Copy the string manipulated by the "set tdescs filename ..." commands to the per-inferior equivalent. (show_tdesc_filename_cmd): Get the value to show from the per-inferior description filename. (_initilize_target_descriptions): Change the "set/show tdesc filename" commands' variable. * target-descriptions.h (struct target_desc, struct target_desc_info) (struct inferior): Forward declare. (target_find_description, target_clear_description) (target_current_description): Adjust comments. (copy_inferior_target_desc_info, target_desc_info_free) (target_desc_info_from_user_p). Declare. gdb/testsuite/ 2012-11-09 Pedro Alves <palves@redhat.com> * gdb.multi/multi-arch.exp: New.
2012-11-09 02:47:20 +01:00
{
return current_inferior ()->gdbarch;
}
1999-08-31 03:14:27 +02:00
extern void _initialize_gdbarch (void);
1999-08-31 03:14:27 +02:00
void
_initialize_gdbarch (void)
1999-08-31 03:14:27 +02:00
{
gdb/ * dwarf2loc.c (entry_values_debug): Add 'unsigned'. (_initialize_dwarf2loc): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * dwarf2loc.h: Update the declaration of 'entry_values_debug'. * dwarf2read.c (dwarf2_die_debug): Add 'unsigned'. (_initialize_dwarf2_read): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * darwin-nat.c (dwarwin_debug_flag): Add 'unsigned'. (_initialize_darwin_inferior): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * frame.c (frame_debug): Add 'unsigned'. (_intialize_frame): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * frame.h: Update the declaration of 'frame_debug'. * gdbtypes.c (overload_debug): Add 'unsigned'. (_initialize_gdbtypes): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * inferior.h: Update declaration of 'debug_infrun'. * infrun.c (debug_infrun): Add 'unsigned'. (_initialize_infrun): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * jit.c (jit_debug): Add 'unsigned'. (_initialize_jit): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * linux-nat.c (debug_linux_nat): Add 'unsigned'. (_initialize_linux_nat): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * linux-thread-db.c (libthread_db_debug): Add 'unsigned'. (_initialize_thread_db): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * machoread.c (mach_o_debug_level): Add 'unsigned'. (_initialize_machoread): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * mi/mi-cmd-var.c: Update the declaration of 'varobjdebug'. * microblaze-tdep.c (microblaze_debug_flag): Add 'unsigned'. (_initialize_microblaze_tdep): Call add_setshow_zuinteger_cmd intead of add_setshow_zinteger_cmd. * mips-tdep.c (mips_debug): Add 'unsigned'. (_initialize_mips_tdep): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * monitor.c (monitor_debug): Add 'unsigned'. (_initialize_remote_monitors): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * observer.c (observer_debug): Add 'unsigned'. (_initialize_observer): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * parse.c (expressiondebug): Add 'unsigned'. (_initialize_parse): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * record.c (record_debug): Add 'unsigned'. (_initialize_record): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * record.h: Update the declaration of 'record_debug'. * stap-probe.c (stap_expression_debug): Add 'unsigned'. (_initialize_stap_probe): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * serial.c (global_serial_debug_p): Add 'unsigned'. (_initialize_serial): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * solib-dsbt.c (solib_dsbt_debug): Add 'unsigned'. (_initialize_dsbt_solib): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * solib-frv.c (solib_frv_debug): Add 'unsigned'. (_initialize_frv_solib): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * target.c (targetdebug): Add 'unsigned'. (initialize_targets): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * valops.c (overload_debug): Add 'unsigned'. * varobj.c (varobjdebug): Add 'unsigned'. (_initialize_varobj): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * xtensa-tdep.c (xtensa_debug_level): Add 'unsigned'. (_initialize_xtensa_tdep): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * arch-utils.h: Remove the declaration of 'gdbarch_debug'. * gdbarch.sh (gdbarch_debug): Add 'unsigned'. (extern void _initialize_gdbarch): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * gdbarch.c, gdbarch.h: Re-generated.
2012-08-02 11:36:40 +02:00
add_setshow_zuinteger_cmd ("arch", class_maintenance, &gdbarch_debug, _("\\
Set architecture debugging."), _("\\
Show architecture debugging."), _("\\
When non-zero, architecture debugging is enabled."),
NULL,
2005-02-24 Andrew Cagney <cagney@gnu.org> Add show_VARIABLE functions, update add_setshow call. * varobj.c (_initialize_varobj, show_varobjdebug): Add and update. * valprint.c (_initialize_valprint, show_print_max) (show_stop_print_at_null, show_repeat_count_threshold) (show_prettyprint_structs, show_unionprint) (show_prettyprint_arrays, show_addressprint, show_input_radix) (show_output_radix): Ditto. * valops.c (_initialize_valops, show_overload_resolution): Ditto. * utils.c (initialize_utils, show_chars_per_line) (show_lines_per_page, show_demangle, show_pagination_enabled) (show_sevenbit_strings, show_asm_demangle): Ditto * tui/tui-win.c (_initialize_tui_win, show_tui_border_kind) (show_tui_border_mode, show_tui_active_border_mode): Ditto. * top.c (init_main, show_new_async_prompt) (show_async_command_editing_p, show_write_history_p) (show_history_size, show_history_filename, show_caution) (show_annotation_level, init_main): Ditto. * target.c (initialize_targets, show_targetdebug) (show_trust_readonly): Ditto. * symfile.c (_initialize_symfile, show_symbol_reloading) (show_ext_args, show_download_write_size) (show_debug_file_directory): Ditto. * source.c (_initialize_source, show_lines_to_list): Ditto. * solib.c (_initialize_solib, show_auto_solib_add) (show_solib_search_path): Ditto. * p-valprint.c (_initialize_pascal_valprint) (show_pascal_static_field_print): Ditto. * printcmd.c (_initialize_printcmd, show_max_symbolic_offset) (show_print_symbol_filename): Add and update. * parse.c (_initialize_parse, show_expressiondebug): Dito. * observer.c (_initialize_observer, show_observer_debug): Dito. * maint.c (_initialize_maint_cmds, show_watchdog) (show_maintenance_profile_p): Dito. * linux-nat.c (_initialize_linux_nat, show_debug_linux_nat): Dito. * infrun.c (_initialize_infrun, show_debug_infrun) (show_stop_on_solib_events, show_follow_fork_mode_string) (show_scheduler_mode, show_step_stop_if_no_debug): Ditto. * infcall.c (_initialize_infcall, show_coerce_float_to_double_p) (show_unwind_on_signal_p): Ditto. * gdbtypes.c (build_gdbtypes, show_opaque_type_resolution) (_initialize_gdbtypes, show_overload_debug): Ditto. * gdb-events.c, gdb-events.sh (_initialize_gdb_events) (show_gdb_events_debug): Ditto. * gdbarch.c, gdbarch.sh (show_gdbarch_debug) (_initialize_gdbarch): Ditto. * frame.c (_initialize_frame, show_backtrace_past_main) (show_backtrace_past_entry, show_backtrace_limit) (show_frame_debug): Ditto. * exec.c (_initialize_exec, show_write_files): Ditto. * dwarf2read.c (_initialize_dwarf2_read) (show_dwarf2_max_cache_age): Ditto. * demangle.c (_initialize_demangler) (show_demangling_style_names): Ditto. * dcache.c (_initialize_dcache, show_dcache_enabled_p): Ditto. * cp-valprint.c (show_static_field_print) (_initialize_cp_valprint, show_vtblprint, show_objectprint): Ditto. * corefile.c (_initialize_core, show_gnutarget_string): Ditto. * cli/cli-logging.c (_initialize_cli_logging) (show_logging_overwrite, show_logging_redirect) (show_logging_filename): Ditto. * cli/cli-cmds.c (show_info_verbose, show_history_expansion_p) (init_cli_cmds, show_baud_rate, show_remote_debug) (show_remote_timeout, show_max_user_call_depth): Ditto. * charset.c (show_host_charset_name, show_target_charset_name) (initialize_charset): Ditto. * breakpoint.c (show_can_use_hw_watchpoints) (show_pending_break_support, _initialize_breakpoint): Ditto.
2005-02-24 14:51:36 +01:00
show_gdbarch_debug,
&setdebuglist, &showdebuglist);
1999-08-31 03:14:27 +02:00
}
EOF
# close things off
exec 1>&2
#../move-if-change new-gdbarch.c gdbarch.c
2000-03-30 07:32:23 +02:00
compare_new gdbarch.c