mirror of
https://github.com/opnsense/src.git
synced 2026-06-11 09:41:03 -04:00
This commit was generated by cvs2svn to compensate for changes in r98944,
which included commits to RCS files with non-trunk default branches.
This commit is contained in:
commit
2bf844deae
514 changed files with 242816 additions and 44826 deletions
7746
contrib/gdb/ChangeLog
Normal file
7746
contrib/gdb/ChangeLog
Normal file
File diff suppressed because it is too large
Load diff
114
contrib/gdb/MAINTAINERS
Normal file
114
contrib/gdb/MAINTAINERS
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
Please feel free to add, edit, delete this file.
|
||||
Please do not make ChangeLog entries.
|
||||
|
||||
COPYING, COPYING.LIB, README
|
||||
http://gnu.org.
|
||||
|
||||
Makefile.in; configure; configure.in
|
||||
Please notify the following of any committed patches.
|
||||
binutils@sources.redhat.com
|
||||
gdb-patches@sources.redhat.com
|
||||
|
||||
bfd/; binutils/; gas/; gprof/; ld/; opcodes/; BFD's part of include/
|
||||
binutils: http://sources.redhat.com/binutils/
|
||||
Patches to binutils@sources.redhat.com.
|
||||
Please notify the following of any interface changes:
|
||||
gdb-patches@sources.redhat.com
|
||||
|
||||
cgen/; cgen parts of opcodes/, sim/ & include/
|
||||
cgen: http://sources.redhat.com/cgen/
|
||||
Patches to cgen@sources.redhat.com
|
||||
May need separate opcodes/ or sim/ approval for
|
||||
commits of regenerated files there.
|
||||
|
||||
config.guess; config.sub; dejagnu/config.guess;
|
||||
readline/support/config.sub; readline/support/config.guess
|
||||
config: http://savannah.gnu.org/projects/config
|
||||
Patches to config-patches@gnu.org.
|
||||
Changes need to be done in tandem with the official CONFIG
|
||||
sources or submitted to the master file maintainer and brought
|
||||
in via a merge.
|
||||
Please notify the following of any committed patches:
|
||||
binutils@sources.redhat.com
|
||||
gdb-patches@sources.redhat.com
|
||||
|
||||
dejagnu/
|
||||
Notify http://dejagnu.sourceforge.net/ of generic changes.
|
||||
Generic patches to gdb-patches@sources.redhat.com;
|
||||
Other dependents of dejagnu include sid@, binutils@, gcc@, etc.
|
||||
|
||||
gdb/; mmalloc/; readline/; sim/; GDB's part of include/ & dejagnu/
|
||||
gdb: http://sources.redhat.com/gdb/
|
||||
Patches to gdb-patches@sources.redhat.com.
|
||||
See also gdb/MAINTAINERS, sim/MAINTAINERS, mmalloc/MAINTAINERS.
|
||||
|
||||
include/
|
||||
See binutils/, gdb/, sid/, gcc/, libiberty/ etc.
|
||||
|
||||
libiberty/; libiberty's part of include/
|
||||
gcc: http://gcc.gnu.org
|
||||
Changes need to be done in tandem with the official GCC
|
||||
sources or submitted to the master file maintainer and brought
|
||||
in via a merge. Note: approved patches in gcc's libiberty
|
||||
are automatically approved in this libiberty also; feel free
|
||||
to merge them yourself if needed sooner than the next merge.
|
||||
Otherwise, changes are automatically merged, usually within
|
||||
a day.
|
||||
|
||||
ltconfig; ltmain.sh
|
||||
libtool: http://gnu.org
|
||||
Changes need to be done in tandem with the official LIBTOOL
|
||||
sources or submitted to the master file maintainer and brought
|
||||
in via a merge.
|
||||
|
||||
mkinstalldirs; move-if-change
|
||||
autoconf: http://gnu.org
|
||||
Patches to autoconf-patches@gnu.org.
|
||||
Changes need to be done in tandem with the official AUTOCONF
|
||||
sources or submitted to the master file maintainer and brought
|
||||
in via a merge.
|
||||
|
||||
symlink-tree
|
||||
gcc: http://gcc.gnu.org
|
||||
See libiberty.
|
||||
|
||||
newlib/; libgloss/
|
||||
http://sources.redhat.com/newlib/
|
||||
Patches to newlib@sources.redhat.com.
|
||||
|
||||
sid/; SID's part of cgen/ & dejagnu/
|
||||
sid: http://sources.redhat.com/sid/
|
||||
Patches to sid@sources.redhat.com
|
||||
|
||||
texinfo/texinfo.tex
|
||||
texinfo: http://ftp.gnu.org.
|
||||
Latest version can be found on ftp://ftp.gnu.org and can be
|
||||
imported at any (reasonable) time.
|
||||
Please not use GCC's texinfo. Please do not import texinfo.
|
||||
|
||||
tcl/; tix/; itcl/; tk/; libgui/
|
||||
insight: http://sources.redhat.com/insight/
|
||||
Contact insight@sources.redhat.com.
|
||||
|
||||
winsup/
|
||||
cygwin: http://sources.redhat.com/cygwin
|
||||
Patches to cygwin-patches@sources.redhat.com.
|
||||
General discussion cygwin@sources.redhat.com.
|
||||
See also winsup/MAINTAINERS.
|
||||
|
||||
expect/; config-ml.in; mpw-README; mpw-build.in; mpw-config.in;
|
||||
mpw-configure; mpw-install; setup.com; missing; makefile.vms; utils/;
|
||||
config/; config.if; makefile.vms; missing; ylwrap; mkdep; etc/;
|
||||
install-sh; intl/
|
||||
Ask DJ Delorie <dj@redhat.com> after reading the libiberty entry.
|
||||
|
||||
modules file
|
||||
Obviously changes to this file should not go through
|
||||
overseers@sources.redhat.com. If you understand the file
|
||||
format (or can cut-and-paste existing entries), modify it. If
|
||||
it scares you, get someone who does understand it to help you.
|
||||
Be prepared to fix it if you do break it.
|
||||
|
||||
/* Local variables: */
|
||||
/* change-log-default-name: "/dev/null" */
|
||||
/* End: */
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -72,14 +72,16 @@
|
|||
# We have to handle being invoked by both Cygnus configure and Autoconf.
|
||||
#
|
||||
# Cygnus configure incoming variables:
|
||||
# srcdir, subdir, target, arguments
|
||||
# srcdir, subdir, host, arguments
|
||||
#
|
||||
# Autoconf incoming variables:
|
||||
# srcdir, target, ac_configure_args
|
||||
# srcdir, host, ac_configure_args
|
||||
#
|
||||
# We *could* figure srcdir and target out, but we'd have to do work that
|
||||
# We *could* figure srcdir and host out, but we'd have to do work that
|
||||
# our caller has already done to figure them out and requiring these two
|
||||
# seems reasonable.
|
||||
# Note that `host' in this case is GCC's `target'. Target libraries are
|
||||
# configured for a particular host.
|
||||
|
||||
if [ -n "${ac_configure_args}" ]; then
|
||||
Makefile=${ac_file-Makefile}
|
||||
|
|
@ -204,7 +206,10 @@ for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do
|
|||
fi
|
||||
done
|
||||
|
||||
case "${target}" in
|
||||
# Target libraries are configured for the host they run on, so we check
|
||||
# $host here, not $target.
|
||||
|
||||
case "${host}" in
|
||||
arc-*-elf*)
|
||||
if [ x$enable_biendian != xyes ]
|
||||
then
|
||||
|
|
@ -218,6 +223,75 @@ arc-*-elf*)
|
|||
done
|
||||
fi
|
||||
;;
|
||||
arm-*-*)
|
||||
if [ x"$enable_fpu" = xno ]
|
||||
then
|
||||
old_multidirs=${multidirs}
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "${x}" in
|
||||
*fpu*) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x"$enable_26bit" = xno ]
|
||||
then
|
||||
old_multidirs=${multidirs}
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "${x}" in
|
||||
*26bit*) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x"$enable_underscore" = xno ]
|
||||
then
|
||||
old_multidirs=${multidirs}
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "${x}" in
|
||||
*under*) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x"$enable_interwork" = xno ]
|
||||
then
|
||||
old_multidirs=${multidirs}
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "${x}" in
|
||||
*interwork*) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x$enable_biendian = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*le* ) : ;;
|
||||
*be* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x"$enable_nofmult" = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*nofmult* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
;;
|
||||
m68*-*-*)
|
||||
if [ x$enable_softfloat = xno ]
|
||||
then
|
||||
|
|
@ -299,6 +373,28 @@ mips*-*-*)
|
|||
esac
|
||||
done
|
||||
fi
|
||||
case " $multidirs " in
|
||||
*" mabi=64 "*)
|
||||
# We will not be able to create libraries with -mabi=64 if
|
||||
# we cannot even link a trivial program. It usually
|
||||
# indicates the 64bit libraries are missing.
|
||||
if echo 'main() {}' > conftest.c &&
|
||||
${CC-gcc} -mabi=64 conftest.c -o conftest; then
|
||||
:
|
||||
else
|
||||
echo Could not link program with -mabi=64, disabling it.
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*mabi=64* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
rm -f conftest.c conftest
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
powerpc*-*-* | rs6000*-*-*)
|
||||
if [ x$enable_softfloat = xno ]
|
||||
|
|
@ -379,6 +475,30 @@ powerpc*-*-* | rs6000*-*-*)
|
|||
done
|
||||
fi
|
||||
;;
|
||||
sparc*-*-*)
|
||||
case " $multidirs " in
|
||||
*" m64 "*)
|
||||
# We will not be able to create libraries with -m64 if
|
||||
# we cannot even link a trivial program. It usually
|
||||
# indicates the 64bit libraries are missing.
|
||||
if echo 'main() {}' > conftest.c &&
|
||||
${CC-gcc} -m64 conftest.c -o conftest; then
|
||||
:
|
||||
else
|
||||
echo Could not link program with -m64, disabling it.
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*m64* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
rm -f conftest.c conftest
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
# Remove extraneous blanks from multidirs.
|
||||
|
|
@ -409,6 +529,8 @@ multi-do:
|
|||
flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
|
||||
if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) \
|
||||
CFLAGS="$(CFLAGS) $${flags}" \
|
||||
prefix="$(prefix)" \
|
||||
exec_prefix="$(exec_prefix)" \
|
||||
CXXFLAGS="$(CXXFLAGS) $${flags}" \
|
||||
LIBCFLAGS="$(LIBCFLAGS) $${flags}" \
|
||||
LIBCXXFLAGS="$(LIBCXXFLAGS) $${flags}" \
|
||||
|
|
@ -552,7 +674,24 @@ if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then
|
|||
echo "pwd: `pwd`"
|
||||
fi
|
||||
|
||||
if [ -d ${ml_dir} ]; then true; else mkdir ${ml_dir}; fi
|
||||
if [ -d ${ml_dir} ]; then true; else
|
||||
# ``mkdir -p ${ml_dir}'' See also mkinstalldirs.
|
||||
pathcomp=""
|
||||
for d in `echo ":${ml_dir}" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`; do
|
||||
pathcomp="$pathcomp$d"
|
||||
case "$pathcomp" in
|
||||
-* ) pathcomp=./$pathcomp ;;
|
||||
esac
|
||||
if test ! -d "$pathcomp"; then
|
||||
echo "mkdir $pathcomp" 1>&2
|
||||
mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$?
|
||||
fi
|
||||
if test ! -d "$pathcomp"; then
|
||||
exit $lasterr
|
||||
fi
|
||||
pathcomp="$pathcomp/"
|
||||
done
|
||||
fi
|
||||
if [ -d ${ml_dir}/${ml_libdir} ]; then true; else mkdir ${ml_dir}/${ml_libdir}; fi
|
||||
|
||||
# Eg: if ${ml_dir} = m68000/m68881, dotdot = ../../
|
||||
|
|
@ -603,9 +742,86 @@ if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then
|
|||
cd ${ml_dir}/${ml_libdir}
|
||||
|
||||
if [ -f ${ml_newsrcdir}/configure ]; then
|
||||
ml_recprog=${ml_newsrcdir}/configure
|
||||
ml_recprog="${ml_newsrcdir}/configure --cache-file=../config.cache"
|
||||
fi
|
||||
if eval ${ml_config_shell} ${ml_recprog} \
|
||||
|
||||
# find compiler flag corresponding to ${ml_dir}
|
||||
for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do
|
||||
dir=`echo $i | sed -e 's/;.*$//'`
|
||||
if [ "${dir}" = "${ml_dir}" ]; then
|
||||
flags=`echo $i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`
|
||||
break
|
||||
fi
|
||||
done
|
||||
ml_config_env='CC="${CC_}$flags" CXX="${CXX_}$flags"'
|
||||
|
||||
if [ "${with_target_subdir}" = "." ]; then
|
||||
CC_=$CC' '
|
||||
CXX_=$CXX' '
|
||||
else
|
||||
# Create a regular expression that matches any string as long
|
||||
# as ML_POPDIR.
|
||||
popdir_rx=`echo ${ML_POPDIR} | sed 's,.,.,g'`
|
||||
CC_=
|
||||
for arg in ${CC}; do
|
||||
case $arg in
|
||||
-[BIL]"${ML_POPDIR}"/*)
|
||||
CC_="${CC_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\1/p"`' ' ;;
|
||||
"${ML_POPDIR}"/*)
|
||||
CC_="${CC_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
|
||||
*)
|
||||
CC_="${CC_}${arg} " ;;
|
||||
esac
|
||||
done
|
||||
|
||||
CXX_=
|
||||
for arg in ${CXX}; do
|
||||
case $arg in
|
||||
-[BIL]"${ML_POPDIR}"/*)
|
||||
CXX_="${CXX_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
|
||||
"${ML_POPDIR}"/*)
|
||||
CXX_="${CXX_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
|
||||
*)
|
||||
CXX_="${CXX_}${arg} " ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test "x${LD_LIBRARY_PATH+set}" = xset; then
|
||||
LD_LIBRARY_PATH_=
|
||||
for arg in `echo "$LD_LIBRARY_PATH" | tr ':' ' '`; do
|
||||
case "$arg" in
|
||||
"${ML_POPDIR}"/*)
|
||||
arg=`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`
|
||||
;;
|
||||
esac
|
||||
if test "x$LD_LIBRARY_PATH_" != x; then
|
||||
LD_LIBRARY_PATH_=$LD_LIBRARY_PATH_:$arg
|
||||
else
|
||||
LD_LIBRARY_PATH_=$arg
|
||||
fi
|
||||
done
|
||||
ml_config_env="$ml_config_env LD_LIBRARY_PATH=$LD_LIBRARY_PATH_"
|
||||
fi
|
||||
|
||||
if test "x${SHLIB_PATH+set}" = xset; then
|
||||
SHLIB_PATH_=
|
||||
for arg in `echo "$SHLIB_PATH" | tr ':' ' '`; do
|
||||
case "$arg" in
|
||||
"${ML_POPDIR}"/*)
|
||||
arg=`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`
|
||||
;;
|
||||
esac
|
||||
if test "x$SHLIB_PATH_" != x; then
|
||||
SHLIB_PATH_=$SHLIB_PATH_:$arg
|
||||
else
|
||||
SHLIB_PATH_=$arg
|
||||
fi
|
||||
done
|
||||
ml_config_env="$ml_config_env SHLIB_PATH=$SHLIB_PATH_"
|
||||
fi
|
||||
fi
|
||||
|
||||
if eval ${ml_config_env} ${ml_config_shell} ${ml_recprog} \
|
||||
--with-multisubdir=${ml_dir} --with-multisrctop=${multisrctop} \
|
||||
${ml_arguments} ${ml_srcdiroption} ; then
|
||||
true
|
||||
|
|
|
|||
1046
contrib/gdb/config.guess
vendored
1046
contrib/gdb/config.guess
vendored
File diff suppressed because it is too large
Load diff
|
|
@ -21,9 +21,15 @@ else
|
|||
if_topsrcdir=${top_srcdir}
|
||||
fi
|
||||
|
||||
if [ -f ${if_topsrcdir}/libstdc++/Makefile.in ]; then
|
||||
if [ "${enable_libstdcxx_v3}" = "yes" ] ; then
|
||||
libstdcxx_srcdir=${if_topsrcdir}/libstdc++-v3
|
||||
else
|
||||
libstdcxx_srcdir=${if_topsrcdir}/libstdc++
|
||||
fi
|
||||
|
||||
if [ -f ${libstdcxx_srcdir}/Makefile.in ]; then
|
||||
# We check libstdc++ for libstdcxx_interface.
|
||||
libstdcxx_interface=`grep "^INTERFACE" ${if_topsrcdir}/libstdc++/Makefile.in | sed 's/INTERFACE[ ]*=[ ]*\(.*\)/\1/'`
|
||||
libstdcxx_interface=`grep "^INTERFACE" ${libstdcxx_srcdir}/Makefile.in | sed 's/INTERFACE[ ]*=[ ]*\(.*\)/\1/'`
|
||||
else
|
||||
libstdcxx_interface=
|
||||
fi
|
||||
|
|
@ -76,8 +82,8 @@ EOF
|
|||
exit 1
|
||||
fi
|
||||
else
|
||||
# Cross compiling. Assume glibc 2.1.
|
||||
libc_interface=-libc6.1-
|
||||
# Cross compiling. Assume glibc 2.2.
|
||||
libc_interface=-libc6.2-
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
|
|
|
|||
689
contrib/gdb/config.sub
vendored
689
contrib/gdb/config.sub
vendored
File diff suppressed because it is too large
Load diff
87
contrib/gdb/configure
vendored
87
contrib/gdb/configure
vendored
|
|
@ -3,7 +3,7 @@
|
|||
### WARNING: this file contains embedded tabs. Do not run untabify on this file.
|
||||
|
||||
# Configuration script
|
||||
# Copyright (C) 1988, 90, 91, 92, 93, 94, 95, 96, 1997
|
||||
# Copyright (C) 1988, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -86,7 +86,7 @@ subdirs=
|
|||
target_alias=NOTARGET
|
||||
target_makefile_frag=
|
||||
undefs=NOUNDEFS
|
||||
version="$Revision: 1.270 $"
|
||||
version="$Revision: 1.13 $"
|
||||
x11=default
|
||||
bindir='${exec_prefix}/bin'
|
||||
sbindir='${exec_prefix}/sbin'
|
||||
|
|
@ -237,7 +237,7 @@ do
|
|||
esac
|
||||
|
||||
enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
|
||||
eval "$enableopt='$optarg'"
|
||||
eval "$enableopt=\$optarg"
|
||||
enableoptions="$enableoptions '$option'"
|
||||
;;
|
||||
--exec-prefix* | --ex*)
|
||||
|
|
@ -370,7 +370,7 @@ do
|
|||
esac
|
||||
|
||||
withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
|
||||
eval $withopt="$optarg"
|
||||
eval $withopt="\$optarg"
|
||||
withoptions="$withoptions $option"
|
||||
;;
|
||||
--without-*)
|
||||
|
|
@ -450,7 +450,7 @@ case "${fatal}" in
|
|||
fi
|
||||
;;
|
||||
esac
|
||||
echo "Configuring for a ${host_alias} host." 1>&2
|
||||
echo "Configuring for a ${host_alias} host."
|
||||
arguments="--host=$host_alias $arguments"
|
||||
else
|
||||
echo 'Config.guess failed to determine the host type. You need to specify one.' 1>&2
|
||||
|
|
@ -518,7 +518,8 @@ fi
|
|||
|
||||
configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
|
||||
moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
|
||||
topsrcdir=`cd \`dirname ${progname}\`; pwd`
|
||||
## the sed command below emulates the dirname command
|
||||
topsrcdir=`cd \`echo ${progname} | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'\`; pwd`
|
||||
|
||||
|
||||
# this is a hack. sun4 must always be a valid host alias or this will fail.
|
||||
|
|
@ -576,7 +577,6 @@ case "${srcdir}" in
|
|||
fi
|
||||
esac
|
||||
|
||||
|
||||
# default exec_prefix
|
||||
case "${exec_prefixoption}" in
|
||||
"") exec_prefix="\$(prefix)" ;;
|
||||
|
|
@ -587,12 +587,12 @@ esac
|
|||
# the gcc version number changes.
|
||||
if [ "${with_gcc_version_trigger+set}" = set ]; then
|
||||
gcc_version_trigger="$with_gcc_version_trigger"
|
||||
gcc_version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < ${with_gcc_version_trigger}`
|
||||
gcc_version=`grep version_string ${with_gcc_version_trigger} | sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/'`
|
||||
else
|
||||
# If gcc's sources are available, define the trigger file.
|
||||
if [ -f ${topsrcdir}/gcc/version.c ] ; then
|
||||
gcc_version_trigger=${topsrcdir}/gcc/version.c
|
||||
gcc_version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < ${gcc_version_trigger}`
|
||||
gcc_version=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/'`
|
||||
case "$arguments" in
|
||||
*--with-gcc-version-trigger=$gcc_version_trigger* )
|
||||
;;
|
||||
|
|
@ -655,8 +655,8 @@ case "${TMPDIR}" in
|
|||
*) ;;
|
||||
esac
|
||||
|
||||
# keep this filename short for &%*%$*# 14 char file names
|
||||
tmpfile=${TMPDIR}/cONf$$
|
||||
# keep this filename short for &%*%$*# 14 char file names and 8+3 file names
|
||||
tmpfile=${TMPDIR}/cNf$$
|
||||
# Note that under many versions of sh a trap handler for 0 will *override* any
|
||||
# exit status you explicitly specify! At this point, the only non-error exit
|
||||
# is at the end of the script; these actions are duplicated there, minus
|
||||
|
|
@ -912,9 +912,10 @@ if [ "${build}" != "${host}" ]; then
|
|||
tools="${tools} HOST_PREFIX_1 LD LD_FOR_TARGET LEX MAKEINFO NM"
|
||||
tools="${tools} NM_FOR_TARGET RANLIB RANLIB_FOR_TARGET"
|
||||
tools="${tools} WINDRES WINDRES_FOR_TARGET YACC"
|
||||
tools="${tools} OBJCOPY OBJDUMP"
|
||||
|
||||
for var in ${tools}; do
|
||||
if [ -z "`eval 'echo $'"${var}"`" ] && [ -r Makefile ]; then
|
||||
if eval [ -z \"\$${var}\" ] && [ -r Makefile ]; then
|
||||
sed -n -e ':loop
|
||||
/\\$/ N
|
||||
s/\\\n//g
|
||||
|
|
@ -923,7 +924,7 @@ t loop
|
|||
< Makefile > Makefile.v
|
||||
t=`tail -1 Makefile.v`
|
||||
if [ -n "${t}" ]; then
|
||||
eval "${var}='${t}'"
|
||||
eval "${var}=\${t}"
|
||||
fi
|
||||
rm -f Makefile.v
|
||||
fi
|
||||
|
|
@ -955,6 +956,8 @@ t loop
|
|||
RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET-${target_alias}-ranlib}
|
||||
WINDRES=${WINDRES-${host_alias}-windres}
|
||||
WINDRES_FOR_TARGET=${WINDRES_FOR_TARGET-${target_alias}-windres}
|
||||
OBJCOPY=${OBJCOPY-${host_alias}-objcopy}
|
||||
OBJDUMP=${OBJDUMP-${host_alias}-objdump}
|
||||
|
||||
if [ -z "${YACC}" ]; then
|
||||
IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
|
||||
|
|
@ -1005,6 +1008,8 @@ t loop
|
|||
export NM
|
||||
export RANLIB
|
||||
export WINDRES
|
||||
export OBJCOPY
|
||||
export OBJDUMP
|
||||
else
|
||||
# If CC is still not set, try to get gcc.
|
||||
if [ -z "${CC}" ]; then
|
||||
|
|
@ -1057,6 +1062,27 @@ export CXX
|
|||
export CFLAGS
|
||||
export CXXFLAGS
|
||||
|
||||
# FIXME: This should be in configure.in, not configure
|
||||
case "$host" in
|
||||
*go32*)
|
||||
enable_gdbtk=no ;;
|
||||
*msdosdjgpp*)
|
||||
enable_gdbtk=no ;;
|
||||
esac
|
||||
|
||||
# FIXME: This should be in configure.in, not configure
|
||||
# Determine whether gdb needs tk/tcl or not.
|
||||
if [ "$enable_gdbtk" != "no" ]; then
|
||||
GDB_TK="all-tcl all-tk all-itcl all-tix all-libgui"
|
||||
else
|
||||
GDB_TK=""
|
||||
fi
|
||||
|
||||
all_build_modules=
|
||||
if test x"${build_alias}" != x"${host_alias}"
|
||||
then
|
||||
all_build_modules='$(ALL_BUILD_MODULES_LIST)'
|
||||
fi
|
||||
|
||||
for subdir in . ${subdirs} ; do
|
||||
|
||||
|
|
@ -1315,35 +1341,6 @@ EOF
|
|||
echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile}
|
||||
fi
|
||||
|
||||
# provide a proper gxx_include_dir to all subdirs.
|
||||
# Note, if you change the default, make sure to fix both here
|
||||
# and in the gcc subdirectory.
|
||||
# Check whether --with-gxx-include-dir or --without-gxx-include-dir was given.
|
||||
gxx_include_dir=
|
||||
if test -n "${with_gxx_include_dir}"; then
|
||||
case "${with_gxx_include_dir}" in
|
||||
yes )
|
||||
echo "configure: error: bad value ${withval} given for g++ include directory" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
no )
|
||||
;;
|
||||
* )
|
||||
gxx_include_dir=${with_gxx_include_dir}
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test x${gxx_include_dir} = x; then
|
||||
if test x${enable_version_specific_runtime_libs} = xyes; then
|
||||
echo gxx_include_dir = '${libsubdir}/include/g++' >> ${Makefile}
|
||||
else
|
||||
. ${topsrcdir}/config.if
|
||||
echo gxx_include_dir = '${prefix}/include/g++'-${libstdcxx_interface} >> ${Makefile}
|
||||
fi
|
||||
else
|
||||
echo gxx_include_dir = ${gxx_include_dir} >> ${Makefile}
|
||||
fi
|
||||
|
||||
# record if we want to build shared libs.
|
||||
if test -z "${enable_shared}"; then
|
||||
echo enable_shared = no >> ${Makefile}
|
||||
|
|
@ -1387,6 +1384,7 @@ EOF
|
|||
-e "s|^oldincludedir[ ]*=.*$|oldincludedir = ${oldincludedir}|" \
|
||||
-e "s|^infodir[ ]*=.*$|infodir = ${infodir}|" \
|
||||
-e "s|^mandir[ ]*=.*$|mandir = ${mandir}|" \
|
||||
-e "s|^ALL_BUILD_MODULES =.*|ALL_BUILD_MODULES =${all_build_modules}|" \
|
||||
-e "/^CC[ ]*=/{
|
||||
:loop1
|
||||
/\\\\$/ N
|
||||
|
|
@ -1422,17 +1420,20 @@ EOF
|
|||
-e "s:^program_suffix[ ]*=.*$:program_suffix = ${program_suffix}:" \
|
||||
-e "s:^program_transform_name[ ]*=.*$:program_transform_name = ${program_transform_name}:" \
|
||||
-e "s|^tooldir[ ]*=.*$|tooldir = ${tooldir}|" \
|
||||
-e "s|^build_tooldir[ ]*=.*$|build_tooldir = ${tooldir}|" \
|
||||
-e "s:^DEFAULT_YACC[ ]*=.*$:DEFAULT_YACC = ${DEFAULT_YACC}:" \
|
||||
-e "s:^DEFAULT_LEX[ ]*=.*$:DEFAULT_LEX = ${DEFAULT_LEX}:" \
|
||||
-e "s:^DEFAULT_M4[ ]*=.*$:DEFAULT_M4 = ${DEFAULT_M4}:" \
|
||||
${subdir}/Makefile.tem >> ${Makefile}
|
||||
|
||||
sed -e "s:^GDB_TK[ ]*=.*$:GDB_TK = ${GDB_TK}:" ${Makefile} >${Makefile}.tem
|
||||
mv -f ${Makefile}.tem ${Makefile}
|
||||
|
||||
# If this is a Canadian Cross, preset the values of many more
|
||||
# tools.
|
||||
if [ "${build}" != "${host}" ]; then
|
||||
for var in ${tools}; do
|
||||
val=`eval 'echo $'"${var}"`
|
||||
eval val=\$${var}
|
||||
sed -e "/^${var}[ ]*=/{
|
||||
:loop1
|
||||
/\\\\$/ N
|
||||
|
|
|
|||
|
|
@ -14,8 +14,7 @@
|
|||
## For more information on these two systems, check out the documentation
|
||||
## for 'Autoconf' (autoconf.texi) and 'Configure' (configure.texi).
|
||||
|
||||
# Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 1999
|
||||
# Free Software Foundation, Inc.
|
||||
# Copyright (C) 1992-99, 2000, 2001 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
|
|
@ -48,10 +47,14 @@ if [ "${enable_gdbgui}" = "yes" ] ; then
|
|||
host_libs="${host_libs} libgui"
|
||||
fi
|
||||
|
||||
libstdcxx_version="target-libstdc++-v3"
|
||||
# Don't use libstdc++-v3's flags to configure/build itself.
|
||||
libstdcxx_flags='`case $$dir in libstdc++-v3 | libjava) ;; *) test ! -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/testsuite_flags || $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/testsuite_flags --build-includes;; esac` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs'
|
||||
|
||||
# these tools are built for the host environment
|
||||
# Note, the powerpc-eabi build depends on sim occurring before gdb in order to
|
||||
# know that we are building the simulator.
|
||||
host_tools="byacc flex bison binutils ld gas gcc sim gdb make patch prms send-pr gprof gdbtest tgas etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool ispell grep diff rcs cvssrc fileutils shellutils time textutils wdiff find emacs emacs19 uudecode hello tar gzip indent recode release sed utils guile perl apache inet gawk findutils snavigator libtool gettext zip"
|
||||
host_tools="texinfo byacc flex bison binutils ld gas gcc cgen sid sim gdb make patch prms send-pr gprof gdbtest tgas etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool ispell grep diff rcs cvssrc fileutils shellutils time textutils wdiff find emacs emacs19 uudecode hello tar gzip indent recode release sed utils guile perl apache inet gawk findutils snavigator libtool gettext zip"
|
||||
|
||||
# these libraries are built for the target environment, and are built after
|
||||
# the host libraries and the host tools (which may be a cross compiler)
|
||||
|
|
@ -59,10 +62,15 @@ host_tools="byacc flex bison binutils ld gas gcc sim gdb make patch prms send-pr
|
|||
target_libs="target-libiberty \
|
||||
target-libgloss \
|
||||
target-newlib \
|
||||
target-libio \
|
||||
target-librx \
|
||||
target-libstdc++ \
|
||||
target-libg++"
|
||||
${libstdcxx_version} \
|
||||
target-libf2c \
|
||||
target-libchill \
|
||||
target-libffi \
|
||||
target-libjava \
|
||||
target-zlib \
|
||||
target-boehm-gc \
|
||||
target-qthreads \
|
||||
target-libobjc"
|
||||
|
||||
# these tools are built using the target libs, and are intended to run only
|
||||
# in the target environment
|
||||
|
|
@ -155,6 +163,9 @@ case "${host}" in
|
|||
mips*-*-sysv*)
|
||||
host_makefile_frag="${host_makefile_frag} config/mh-riscos"
|
||||
;;
|
||||
i370-ibm-opened*)
|
||||
host_makefile_frag="${host_makefile_frag} config/mh-openedition"
|
||||
;;
|
||||
i[3456]86-*-sysv5*)
|
||||
host_makefile_frag="${host_makefile_frag} config/mh-sysv5"
|
||||
;;
|
||||
|
|
@ -185,11 +196,8 @@ case "${host}" in
|
|||
i[3456]86-*-aix*)
|
||||
host_makefile_frag="${host_makefile_frag} config/mh-aix386"
|
||||
;;
|
||||
i[3456]86-*-go32*)
|
||||
host_makefile_frag="${host_makefile_frag} config/mh-go32"
|
||||
;;
|
||||
i[3456]86-*-msdosdjgpp*)
|
||||
host_makefile_frag="${host_makefile_frag} config/mh-go32"
|
||||
host_makefile_frag="${host_makefile_frag} config/mh-djgpp"
|
||||
;;
|
||||
*-cygwin*)
|
||||
host_makefile_frag="${host_makefile_frag} config/mh-cygwin"
|
||||
|
|
@ -197,6 +205,9 @@ case "${host}" in
|
|||
*-mingw32*)
|
||||
host_makefile_frag="${host_makefile_frag} config/mh-mingw32"
|
||||
;;
|
||||
*-interix*)
|
||||
host_makefile_frag="${host_makefile_frag} config/mh-interix"
|
||||
;;
|
||||
*-windows*)
|
||||
host_makefile_frag="${host_makefile_frag} config/mh-windows"
|
||||
;;
|
||||
|
|
@ -224,9 +235,6 @@ case "${host}" in
|
|||
*-*-lynxos*)
|
||||
host_makefile_frag="${host_makefile_frag} config/mh-lynxos"
|
||||
;;
|
||||
*-*-aix4.[3456789]* | *-*-aix[56789].*)
|
||||
host_makefile_frag="${host_makefile_frag} config/mh-aix43"
|
||||
;;
|
||||
*-*-sysv4*)
|
||||
host_makefile_frag="${host_makefile_frag} config/mh-sysv4"
|
||||
;;
|
||||
|
|
@ -277,25 +285,40 @@ esac
|
|||
|
||||
if [ x${shared} = xyes ]; then
|
||||
case "${host}" in
|
||||
hppa*)
|
||||
alpha*-*-linux*)
|
||||
host_makefile_frag="${host_makefile_frag} config/mh-elfalphapic"
|
||||
;;
|
||||
arm*-*-*)
|
||||
host_makefile_frag="${host_makefile_frag} config/mh-armpic"
|
||||
;;
|
||||
hppa*-*-*)
|
||||
host_makefile_frag="${host_makefile_frag} config/mh-papic"
|
||||
;;
|
||||
i[3456]86-*-cygwin*)
|
||||
# We don't want -fPIC on Cygwin.
|
||||
;;
|
||||
i[3456]86-*)
|
||||
i[3456]86-*-*)
|
||||
host_makefile_frag="${host_makefile_frag} config/mh-x86pic"
|
||||
;;
|
||||
sparc64-*)
|
||||
i370-*-*)
|
||||
host_makefile_frag="${host_makefile_frag} config/mh-i370pic"
|
||||
;;
|
||||
ia64-*-*)
|
||||
host_makefile_frag="${host_makefile_frag} config/mh-ia64pic"
|
||||
;;
|
||||
sparc64-*-*)
|
||||
host_makefile_frag="${host_makefile_frag} config/mh-sparcpic"
|
||||
;;
|
||||
powerpc*-*)
|
||||
powerpc*-*-aix*)
|
||||
# We don't want -fPIC on AIX.
|
||||
;;
|
||||
powerpc*-*-*)
|
||||
host_makefile_frag="${host_makefile_frag} config/mh-ppcpic"
|
||||
;;
|
||||
alpha*-*-linux*)
|
||||
host_makefile_frag="${host_makefile_frag} config/mh-elfalphapic"
|
||||
s390-* | s390x-*)
|
||||
host_makefile_frag="${host_makefile_frag} config/mh-s390pic"
|
||||
;;
|
||||
*)
|
||||
*-*-*)
|
||||
if test -f ${srcdir}/config/mh-${host_cpu}pic; then
|
||||
host_makefile_frag="${host_makefile_frag} config/mh-${host_cpu}pic"
|
||||
fi
|
||||
|
|
@ -324,9 +347,15 @@ case "${target}" in
|
|||
powerpc-*-netware*)
|
||||
target_makefile_frag="${target_makefile_frag} config/mt-netware"
|
||||
;;
|
||||
*-*-linux-gnu)
|
||||
*-*-linux-gnu*)
|
||||
target_makefile_frag="${target_makefile_frag} config/mt-linux"
|
||||
;;
|
||||
*-*-aix4.[3456789]* | *-*-aix[56789].*)
|
||||
target_makefile_frag="${target_makefile_frag} config/mt-aix43"
|
||||
;;
|
||||
mips*-*-pe | sh*-*-pe | *arm-wince-pe)
|
||||
target_makefile_frag="${target_makefile_frag} config/mt-wince"
|
||||
;;
|
||||
esac
|
||||
|
||||
# If --enable-target-optspace always use -Os instead of -O2 to build
|
||||
|
|
@ -336,8 +365,10 @@ case "${enable_target_optspace}:${target}" in
|
|||
yes:*)
|
||||
target_makefile_frag="${target_makefile_frag} config/mt-ospace"
|
||||
;;
|
||||
# CYGNUS LOCAL d10v, d30v, fr30
|
||||
:m32r-* | :d10v-* | :d30v-* | :fr30-*)
|
||||
:d30v-*)
|
||||
target_makefile_frag="${target_makefile_frag} config/mt-d30v"
|
||||
;;
|
||||
:m32r-* | :d10v-* | :fr30-*)
|
||||
target_makefile_frag="${target_makefile_frag} config/mt-ospace"
|
||||
;;
|
||||
no:* | :*)
|
||||
|
|
@ -397,6 +428,18 @@ if [ ! -d ${target_subdir} ] ; then
|
|||
fi
|
||||
fi
|
||||
|
||||
build_subdir=${build_alias}
|
||||
|
||||
if [ x"${build_alias}" != x"${host}" ] ; then
|
||||
if [ ! -d ${build_subdir} ] ; then
|
||||
if mkdir ${build_subdir} ; then true
|
||||
else
|
||||
echo "'*** could not make ${PWD=`pwd`}/${build_subdir}" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
copy_dirs=
|
||||
|
||||
# Handle --with-headers=XXX. The contents of the named directory are
|
||||
|
|
@ -511,20 +554,17 @@ case "${host}" in
|
|||
noconfigdirs="tcl expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff guile perl apache inet itcl tix db snavigator gnuserv gettext"
|
||||
;;
|
||||
i[3456]86-*-go32* | i[3456]86-*-msdosdjgpp*)
|
||||
noconfigdirs="tcl tk expect dejagnu make texinfo bison patch flex byacc send-pr uudecode dejagnu diff guile perl apache inet itcl tix db snavigator gnuserv gettext"
|
||||
noconfigdirs="tcl tk expect dejagnu make texinfo bison patch flex byacc send-pr uudecode dejagnu diff guile perl apache inet itcl tix db snavigator gnuserv gettext libffi"
|
||||
;;
|
||||
i[3456]86-*-mingw32*)
|
||||
# noconfigdirs="tcl tk expect dejagnu make texinfo bison patch flex byacc send-pr uudecode dejagnu diff guile perl apache inet itcl tix db snavigator gnuserv"
|
||||
noconfigdirs="expect dejagnu cvs autoconf automake send-pr gprof rcs guile perl texinfo apache inet libtool"
|
||||
noconfigdirs="expect dejagnu cvs autoconf automake send-pr rcs guile perl texinfo apache inet libtool"
|
||||
;;
|
||||
i[3456]86-*-beos*)
|
||||
noconfigdirs="$noconfigdirs tk itcl tix libgui gdb"
|
||||
;;
|
||||
*-*-cygwin*)
|
||||
noconfigdirs="autoconf automake send-pr gprof rcs guile perl texinfo apache inet"
|
||||
;;
|
||||
*-*-windows*)
|
||||
# This is only used to build WinGDB...
|
||||
# note that powerpc-eabi depends on sim configured before gdb.
|
||||
configdirs="bfd libiberty opcodes readline sim gdb"
|
||||
target_configdirs=
|
||||
noconfigdirs="autoconf automake send-pr rcs guile perl apache inet"
|
||||
;;
|
||||
*-*-netbsd*)
|
||||
noconfigdirs="rcs"
|
||||
|
|
@ -532,18 +572,48 @@ case "${host}" in
|
|||
ppc*-*-pe)
|
||||
noconfigdirs="patch diff make tk tcl expect dejagnu cvssrc autoconf automake texinfo bison send-pr gprof rcs guile perl apache inet itcl tix db snavigator gnuserv"
|
||||
;;
|
||||
powerpc-*-beos*)
|
||||
noconfigdirs="$noconfigdirs tk itcl tix libgui gdb dejagnu readline"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
# Save it here so that, even in case of --enable-libgcj, if the Java
|
||||
# front-end isn't enabled, we still get libgcj disabled.
|
||||
libgcj_saved=$libgcj
|
||||
case $enable_libgcj in
|
||||
yes)
|
||||
# If we reset it here, it won't get added to noconfigdirs in the
|
||||
# target-specific build rules, so it will be forcibly enabled
|
||||
# (unless the Java language itself isn't enabled).
|
||||
libgcj=
|
||||
;;
|
||||
no)
|
||||
# Make sure we get it printed in the list of not supported target libs.
|
||||
noconfigdirs="$noconfigdirs ${libgcj}"
|
||||
;;
|
||||
esac
|
||||
|
||||
case "${target}" in
|
||||
*-*-netbsd*)
|
||||
# Skip some stuff on all NetBSD configurations.
|
||||
skipdirs="$skipdirs target-newlib target-libiberty target-libgloss"
|
||||
|
||||
# Skip some stuff that's unsupported on some NetBSD configurations.
|
||||
case "${target}" in
|
||||
*)
|
||||
noconfigdirs="$noconfigdirs ${libgcj}"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*-*-netware)
|
||||
noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-librx target-newlib target-libiberty target-libgloss"
|
||||
noconfigdirs="$noconfigdirs ${libstdcxx_version} target-newlib target-libiberty target-libgloss target-libffi"
|
||||
;;
|
||||
*-*-rtems*)
|
||||
noconfigdirs="$noconfigdirs target-libgloss"
|
||||
noconfigdirs="$noconfigdirs target-libgloss target-libffi"
|
||||
;;
|
||||
*-*-vxworks*)
|
||||
noconfigdirs="$noconfigdirs target-newlib target-libgloss"
|
||||
noconfigdirs="$noconfigdirs target-newlib target-libgloss target-libffi"
|
||||
;;
|
||||
alpha*-dec-osf*)
|
||||
# ld works, but does not support shared libraries. emacs doesn't
|
||||
|
|
@ -552,90 +622,101 @@ case "${target}" in
|
|||
noconfigdirs="$noconfigdirs gas ld emacs fileutils target-newlib target-libgloss"
|
||||
;;
|
||||
alpha*-*-*vms*)
|
||||
noconfigdirs="$noconfigdirs gdb ld target-newlib target-libgloss"
|
||||
;;
|
||||
alpha*-*-linux*)
|
||||
# newlib is not 64 bit ready
|
||||
noconfigdirs="$noconfigdirs target-newlib target-libgloss"
|
||||
# linux has rx in libc
|
||||
skipdirs="$skipdirs target-librx"
|
||||
noconfigdirs="$noconfigdirs gdb ld target-newlib target-libgloss target-libffi"
|
||||
;;
|
||||
alpha*-*-*)
|
||||
# newlib is not 64 bit ready
|
||||
noconfigdirs="$noconfigdirs target-newlib target-libgloss"
|
||||
;;
|
||||
sh*-*-pe|mips*-*-pe|*arm-wince-pe)
|
||||
noconfigdirs="$noconfigdirs target-libjava target-libffi target-zlib"
|
||||
noconfigdirs="$noconfigdirs target-boehm-gc target-qthreads target-examples"
|
||||
noconfigdirs="$noconfigdirs target-libiberty texinfo send-pr"
|
||||
noconfigdirs="$noconfigdirs tcl tix tk itcl libgui sim"
|
||||
noconfigdirs="$noconfigdirs expect dejagnu"
|
||||
# the C++ libraries don't build on top of CE's C libraries
|
||||
noconfigdirs="$noconfigdirs ${libstdcxx_version}"
|
||||
skipdirs="$skipdirs target-newlib"
|
||||
case "${host}" in
|
||||
*-*-cygwin*) ;; # keep gdb and readline
|
||||
*) noconfigdirs="$noconfigdirs gdb readline ${libstdcxx_version}"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
arc-*-*)
|
||||
noconfigdirs="$noconfigdirs target-libgloss"
|
||||
noconfigdirs="$noconfigdirs target-libgloss target-libffi"
|
||||
;;
|
||||
arm-*-pe*)
|
||||
noconfigdirs="$noconfigdirs target-libgloss"
|
||||
;;
|
||||
arm-*-coff*)
|
||||
noconfigdirs="$noconfigdirs target-libgloss"
|
||||
;;
|
||||
arm-*-elf*)
|
||||
noconfigdirs="$noconfigdirs target-libgloss"
|
||||
if [ x${is_cross_compiler} != xno ] ; then
|
||||
target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
|
||||
fi
|
||||
;;
|
||||
arm-*-oabi*)
|
||||
noconfigdirs="$noconfigdirs target-libgloss"
|
||||
if [ x${is_cross_compiler} != xno ] ; then
|
||||
target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
|
||||
fi
|
||||
;;
|
||||
c4x-*-*)
|
||||
noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-libio target-librx target-libgloss"
|
||||
noconfigdirs="$noconfigdirs target-libgloss target-libffi"
|
||||
;;
|
||||
thumb-*-coff)
|
||||
noconfigdirs="$noconfigdirs target-libgloss"
|
||||
noconfigdirs="$noconfigdirs target-libgloss target-libffi"
|
||||
;;
|
||||
# CYGNUS LOCAL clm/arm-elf
|
||||
thumb-*-elf)
|
||||
noconfigdirs="$noconfigdirs target-libgloss"
|
||||
noconfigdirs="$noconfigdirs target-libgloss target-libffi"
|
||||
;;
|
||||
thumb-*-oabi)
|
||||
noconfigdirs="$noconfigdirs target-libgloss"
|
||||
noconfigdirs="$noconfigdirs target-libgloss target-libffi"
|
||||
;;
|
||||
# END CYGNUS LOCAL
|
||||
# CYGNUS LOCAL nickc/strongarm
|
||||
strongarm-*-elf)
|
||||
noconfigdirs="$noconfigdirs target-libgloss"
|
||||
noconfigdirs="$noconfigdirs target-libffi"
|
||||
if [ x${is_cross_compiler} != xno ] ; then
|
||||
target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
|
||||
target_configdirs="${target_configdirs} target-bsp target-cygmon"
|
||||
fi
|
||||
;;
|
||||
strongarm-*-coff)
|
||||
noconfigdirs="$noconfigdirs target-libgloss"
|
||||
noconfigdirs="$noconfigdirs target-libffi"
|
||||
if [ x${is_cross_compiler} != xno ] ; then
|
||||
target_configdirs="${target_configdirs} target-bsp target-cygmon"
|
||||
fi
|
||||
;;
|
||||
# END CYGNUS LOCAL
|
||||
thumb-*-pe) # CYGNUS LOCAL nickc/thumb
|
||||
noconfigdirs="$noconfigdirs target-libgloss"
|
||||
xscale-*-elf)
|
||||
noconfigdirs="$noconfigdirs target-libffi"
|
||||
if [ x${is_cross_compiler} != xno ] ; then
|
||||
target_configdirs="${target_configdirs} target-bsp target-cygmon"
|
||||
fi
|
||||
;;
|
||||
xscale-*-coff)
|
||||
noconfigdirs="$noconfigdirs target-libffi"
|
||||
if [ x${is_cross_compiler} != xno ] ; then
|
||||
target_configdirs="${target_configdirs} target-bsp target-cygmon"
|
||||
fi
|
||||
;;
|
||||
thumb-*-pe)
|
||||
noconfigdirs="$noconfigdirs target-libgloss target-libffi"
|
||||
;;
|
||||
arm-*-riscix*)
|
||||
noconfigdirs="$noconfigdirs ld target-libgloss"
|
||||
noconfigdirs="$noconfigdirs ld target-libgloss target-libffi"
|
||||
;;
|
||||
c4x-*-*)
|
||||
noconfigdirs="$noconfigdirs ${libstdcxx_version} target-libgloss target-libffi"
|
||||
;;
|
||||
c54x*-*-* | tic54x-*-*)
|
||||
noconfigdirs="$noconfigdirs ${libstdcxx_version} target-libgloss target-libffi gcc gdb newlib"
|
||||
;;
|
||||
d10v-*-*)
|
||||
noconfigdirs="$noconfigdirs target-librx target-libg++ target-libstdc++ target-libio target-libgloss"
|
||||
noconfigdirs="$noconfigdirs ${libstdcxx_version} target-libgloss target-libffi"
|
||||
;;
|
||||
# CYGNUS LOCAL d30v
|
||||
d30v-*-*)
|
||||
;;
|
||||
# END CYGNUS LOCAL
|
||||
# CYGNUS LOCAL fr30
|
||||
fr30-*-elf*)
|
||||
if [ x${is_cross_compiler} != xno ] ; then
|
||||
target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
|
||||
fi
|
||||
;;
|
||||
# END CYGNUS LOCAL
|
||||
h8300*-*-* | \
|
||||
h8300*-*-*)
|
||||
noconfigdirs="$noconfigdirs target-libgloss"
|
||||
;;
|
||||
h8500-*-*)
|
||||
noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-libio target-librx target-libgloss"
|
||||
noconfigdirs="$noconfigdirs ${libstdcxx_version} target-libgloss target-libffi"
|
||||
;;
|
||||
hppa*-*-*elf* | \
|
||||
hppa*-*-lites*)
|
||||
hppa*-*-linux-gnu* | \
|
||||
hppa*-*-lites* | \
|
||||
hppa*64*-*-*)
|
||||
# Do configure ld/binutils/gas for this case.
|
||||
;;
|
||||
hppa*-*-*)
|
||||
|
|
@ -646,7 +727,17 @@ case "${target}" in
|
|||
"" | cc*) noconfigdirs="$noconfigdirs emacs emacs19" ;;
|
||||
*) ;;
|
||||
esac
|
||||
noconfigdirs="$noconfigdirs ld shellutils"
|
||||
# According to Alexandre Oliva <aoliva@redhat.com>, libjava won't
|
||||
# build on HP-UX 10.20.
|
||||
noconfigdirs="$noconfigdirs ld shellutils ${libgcj}"
|
||||
;;
|
||||
ia64*-*-elf*)
|
||||
# No gdb support yet.
|
||||
noconfigdirs="$noconfigdirs tix readline mmalloc libgui itcl gdb"
|
||||
;;
|
||||
ia64*-**-hpux*)
|
||||
# No gdb or ld support yet.
|
||||
noconfigdirs="$noconfigdirs tix readline mmalloc libgui itcl gdb ld"
|
||||
;;
|
||||
i[3456]86-*-coff | i[3456]86-*-elf)
|
||||
if [ x${is_cross_compiler} != xno ] ; then
|
||||
|
|
@ -655,15 +746,11 @@ case "${target}" in
|
|||
;;
|
||||
i[3456]86-*-go32* | i[3456]-*-msdosdjgpp*)
|
||||
# but don't build gdb
|
||||
noconfigdirs="$noconfigdirs gdb target-libg++ target-libstdc++ target-libio target-librx"
|
||||
;;
|
||||
*-*-linux*)
|
||||
# linux has rx in libc
|
||||
skipdirs="$skipdirs target-librx"
|
||||
noconfigdirs="$noconfigdirs gdb ${libstdcxx_version} target-libffi"
|
||||
;;
|
||||
i[3456]86-*-mingw32*)
|
||||
target_configdirs="$target_configdirs target-mingw"
|
||||
noconfigdirs="$noconfigdirs expect target-libgloss"
|
||||
noconfigdirs="$noconfigdirs expect target-libgloss ${libgcj}"
|
||||
|
||||
# Can't build gdb for mingw32 if not native.
|
||||
case "${host}" in
|
||||
|
|
@ -674,7 +761,7 @@ case "${target}" in
|
|||
;;
|
||||
*-*-cygwin*)
|
||||
target_configdirs="$target_configdirs target-libtermcap target-winsup"
|
||||
noconfigdirs="$noconfigdirs target-libgloss"
|
||||
noconfigdirs="$noconfigdirs target-gperf target-libgloss ${libgcj}"
|
||||
# always build newlib.
|
||||
skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
|
||||
|
||||
|
|
@ -686,15 +773,15 @@ case "${target}" in
|
|||
esac
|
||||
;;
|
||||
i[3456]86-*-pe)
|
||||
noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-libio target-librx target-libgloss"
|
||||
noconfigdirs="$noconfigdirs ${libstdcxx_version} target-libgloss target-libffi"
|
||||
;;
|
||||
i[3456]86-*-sco3.2v5*)
|
||||
# The linker does not yet know about weak symbols in COFF,
|
||||
# and is not configured to handle mixed ELF and COFF.
|
||||
noconfigdirs="$noconfigdirs ld target-libgloss"
|
||||
noconfigdirs="$noconfigdirs ld target-libgloss target-libffi"
|
||||
;;
|
||||
i[3456]86-*-sco*)
|
||||
noconfigdirs="$noconfigdirs gprof target-libgloss"
|
||||
noconfigdirs="$noconfigdirs gprof target-libgloss target-libffi"
|
||||
;;
|
||||
i[3456]86-*-solaris2*)
|
||||
noconfigdirs="$noconfigdirs target-libgloss"
|
||||
|
|
@ -706,40 +793,52 @@ case "${target}" in
|
|||
*) ;;
|
||||
esac
|
||||
# but that's okay since emacs doesn't work anyway
|
||||
noconfigdirs="$noconfigdirs emacs emacs19 target-libgloss"
|
||||
noconfigdirs="$noconfigdirs emacs emacs19 target-libgloss target-libffi"
|
||||
;;
|
||||
m68k-*-*)
|
||||
i[3456]86-*-beos*)
|
||||
noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss ${libgcj}"
|
||||
;;
|
||||
m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)
|
||||
noconfigdirs="$noconfigdirs target-libiberty target-librx target-libg++ target-libstdc++ target-libio target-libf2c target-libchill target-zlib target-libobjc"
|
||||
;;
|
||||
m68k-*-elf*)
|
||||
if [ x${is_cross_compiler} != xno ] ; then
|
||||
target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
|
||||
target_configdirs="${target_configdirs} target-bsp target-cygmon"
|
||||
fi
|
||||
;;
|
||||
m68k-*-coff*)
|
||||
if [ x${is_cross_compiler} != xno ] ; then
|
||||
target_configdirs="${target_configdirs} target-bsp target-cygmon"
|
||||
fi
|
||||
;;
|
||||
mn10200-*-*)
|
||||
noconfigdirs="$noconfigdirs"
|
||||
noconfigdirs="$noconfigdirs target-libffi"
|
||||
if [ x${is_cross_compiler} != xno ] ; then
|
||||
target_configdirs="${target_configdirs} target-libstub target-cygmon"
|
||||
fi
|
||||
;;
|
||||
mn10300-*-*)
|
||||
noconfigdirs="$noconfigdirs"
|
||||
noconfigdirs="$noconfigdirs target-libffi"
|
||||
if [ x${is_cross_compiler} != xno ] ; then
|
||||
target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
|
||||
fi
|
||||
;;
|
||||
powerpc-*-aix*)
|
||||
# copied from rs6000-*-* entry
|
||||
noconfigdirs="$noconfigdirs gprof cvssrc target-libgloss"
|
||||
# This is needed until gcc and ld are fixed to work together.
|
||||
use_gnu_ld=no
|
||||
use_gnu_ld=yes
|
||||
;;
|
||||
powerpc*-*-winnt* | powerpc*-*-pe* | ppc*-*-pe)
|
||||
target_configdirs="$target_configdirs target-winsup"
|
||||
noconfigdirs="$noconfigdirs gdb tcl tk make expect target-libgloss itcl tix db snavigator gnuserv"
|
||||
noconfigdirs="$noconfigdirs gdb tcl tk make expect target-libgloss itcl tix db snavigator gnuserv target-libffi"
|
||||
# always build newlib.
|
||||
skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
|
||||
;;
|
||||
# This is temporary until we can link against shared libraries
|
||||
powerpcle-*-solaris*)
|
||||
noconfigdirs="$noconfigdirs gdb sim make tcl tk expect itcl tix db snavigator gnuserv"
|
||||
noconfigdirs="$noconfigdirs gdb sim make tcl tk expect itcl tix db snavigator gnuserv target-libffi"
|
||||
;;
|
||||
powerpc-*-beos*)
|
||||
noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss"
|
||||
;;
|
||||
powerpc-*-eabi)
|
||||
if [ x${is_cross_compiler} != xno ] ; then
|
||||
|
|
@ -748,19 +847,17 @@ case "${target}" in
|
|||
;;
|
||||
rs6000-*-lynxos*)
|
||||
# The CVS server code doesn't work on the RS/6000
|
||||
# Newlib makes problems for libg++ in crosses.
|
||||
noconfigdirs="$noconfigdirs target-newlib gprof cvssrc"
|
||||
noconfigdirs="$noconfigdirs target-newlib gprof cvssrc target-libffi"
|
||||
;;
|
||||
rs6000-*-aix*)
|
||||
noconfigdirs="$noconfigdirs gprof"
|
||||
# This is needed until gcc and ld are fixed to work together.
|
||||
use_gnu_ld=no
|
||||
noconfigdirs="$noconfigdirs gprof target-libffi"
|
||||
use_gnu_ld=yes
|
||||
;;
|
||||
rs6000-*-*)
|
||||
noconfigdirs="$noconfigdirs gprof"
|
||||
noconfigdirs="$noconfigdirs gprof target-libffi"
|
||||
;;
|
||||
m68k-apollo-*)
|
||||
noconfigdirs="$noconfigdirs ld binutils gprof target-libgloss"
|
||||
noconfigdirs="$noconfigdirs ld binutils gprof target-libgloss target-libffi"
|
||||
;;
|
||||
mips*-*-irix5*)
|
||||
# The GNU linker does not support shared libraries.
|
||||
|
|
@ -768,25 +865,29 @@ case "${target}" in
|
|||
noconfigdirs="$noconfigdirs ld gprof emacs target-libgloss"
|
||||
;;
|
||||
mips*-*-irix6*)
|
||||
# The GNU assembler and linker do not support IRIX 6.
|
||||
# The GNU assembler does not support IRIX 6.
|
||||
# emacs is emacs 18, which does not work on Irix 5 (emacs19 does work)
|
||||
noconfigdirs="$noconfigdirs ld gas gprof emacs target-libgloss"
|
||||
# Linking libjava exceeds command-line length limits on at least
|
||||
# IRIX 6.2, but not on IRIX 6.5.
|
||||
# Also, boehm-gc won't build on IRIX 6.5, according to Jeffrey Oldham
|
||||
# <oldham@codesourcery.com>
|
||||
noconfigdirs="$noconfigdirs gas gprof emacs target-libgloss ${libgcj}"
|
||||
;;
|
||||
mips*-dec-bsd*)
|
||||
noconfigdirs="$noconfigdirs gprof target-libgloss"
|
||||
noconfigdirs="$noconfigdirs gprof target-libgloss target-libffi"
|
||||
;;
|
||||
mips*-*-bsd*)
|
||||
noconfigdirs="$noconfigdirs gprof target-libgloss"
|
||||
noconfigdirs="$noconfigdirs gprof target-libgloss target-libffi"
|
||||
;;
|
||||
mipstx39-*-*)
|
||||
noconfigdirs="$noconfigdirs gprof" # same as generic mips
|
||||
noconfigdirs="$noconfigdirs gprof target-libffi" # same as generic mips
|
||||
target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
|
||||
;;
|
||||
mips*-*-*)
|
||||
noconfigdirs="$noconfigdirs gprof"
|
||||
noconfigdirs="$noconfigdirs gprof target-libffi"
|
||||
;;
|
||||
romp-*-*)
|
||||
noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss"
|
||||
noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss target-libffi"
|
||||
;;
|
||||
sh-*-*)
|
||||
case "${host}" in
|
||||
|
|
@ -795,7 +896,10 @@ case "${target}" in
|
|||
i[3456]86-*-msdosdjgpp*) ;; # don't add gprof back in
|
||||
*) skipdirs=`echo " ${skipdirs} " | sed -e 's/ gprof / /'` ;;
|
||||
esac
|
||||
noconfigdirs="$noconfigdirs target-libgloss"
|
||||
noconfigdirs="$noconfigdirs target-libgloss target-libffi"
|
||||
;;
|
||||
sh64-*-*)
|
||||
noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
|
||||
;;
|
||||
sparc-*-elf*)
|
||||
if [ x${is_cross_compiler} != xno ] ; then
|
||||
|
|
@ -806,11 +910,13 @@ case "${target}" in
|
|||
if [ x${is_cross_compiler} != xno ] ; then
|
||||
target_configdirs="${target_configdirs} target-libstub target-cygmon"
|
||||
fi
|
||||
noconfigdirs="$noconfigdirs target-libffi"
|
||||
;;
|
||||
sparclite-*-*)
|
||||
if [ x${is_cross_compiler} != xno ] ; then
|
||||
target_configdirs="${target_configdirs} target-libstub target-cygmon"
|
||||
target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
|
||||
fi
|
||||
noconfigdirs="$noconfigdirs target-libffi"
|
||||
;;
|
||||
sparc-*-sunos4*)
|
||||
if [ x${is_cross_compiler} != xno ] ; then
|
||||
|
|
@ -819,32 +925,43 @@ case "${target}" in
|
|||
use_gnu_ld=no
|
||||
fi
|
||||
;;
|
||||
sparc-*-solaris*)
|
||||
case "${host}" in
|
||||
sparc-*-solaris2.8)
|
||||
# According to Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>, libjava
|
||||
# won't build correctly on Solaris 8 if there's a
|
||||
# previously-installed version of GCC in the configured prefix.
|
||||
# This problem does not show up on earlier versions of Solaris.
|
||||
noconfigdirs="$noconfigdirs ${libgcj}"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
v810-*-*)
|
||||
noconfigdirs="$noconfigdirs bfd binutils gas gcc gdb ld target-libio target-libg++ target-libstdc++ opcodes target-libgloss"
|
||||
noconfigdirs="$noconfigdirs bfd binutils gas gcc gdb ld ${libstdcxx_version} opcodes target-libgloss target-libffi"
|
||||
;;
|
||||
v850-*-*)
|
||||
noconfigdirs="$noconfigdirs target-libgloss"
|
||||
noconfigdirs="$noconfigdirs target-libgloss target-libffi"
|
||||
;;
|
||||
v850e-*-*) # CYGNUS LOCAL v850e
|
||||
noconfigdirs="$noconfigdirs target-libgloss"
|
||||
v850e-*-*)
|
||||
noconfigdirs="$noconfigdirs target-libgloss target-libffi"
|
||||
;;
|
||||
v850ea-*-*)
|
||||
noconfigdirs="$noconfigdirs target-libgloss"
|
||||
;; # END CYGNUS LOCAL
|
||||
noconfigdirs="$noconfigdirs target-libgloss target-libffi"
|
||||
;;
|
||||
vax-*-vms)
|
||||
noconfigdirs="$noconfigdirs bfd binutils gdb ld target-newlib opcodes target-libgloss"
|
||||
noconfigdirs="$noconfigdirs bfd binutils gdb ld target-newlib opcodes target-libgloss target-libffi"
|
||||
;;
|
||||
vax-*-*)
|
||||
noconfigdirs="$noconfigdirs target-newlib target-libgloss"
|
||||
noconfigdirs="$noconfigdirs target-newlib target-libgloss target-libffi"
|
||||
;;
|
||||
*-*-lynxos*)
|
||||
# Newlib makes problems for libg++ in crosses.
|
||||
noconfigdirs="$noconfigdirs target-newlib target-libgloss"
|
||||
noconfigdirs="$noconfigdirs target-newlib target-libgloss target-libffi"
|
||||
;;
|
||||
*-*-macos* | \
|
||||
*-*-mpw*)
|
||||
# Macs want a resource compiler.
|
||||
configdirs="$configdirs grez"
|
||||
noconfigdirs="$noconfigdirs target-libffi"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
@ -867,6 +984,61 @@ if [ x$with_gnu_as = xno ]; then
|
|||
noconfigdirs="$noconfigdirs gas"
|
||||
fi
|
||||
|
||||
# Figure out what language subdirectories are present.
|
||||
# Look if the user specified --enable-languages="..."; if not, use
|
||||
# the environment variable $LANGUAGES if defined. $LANGUAGES might
|
||||
# go away some day.
|
||||
# NB: embedded tabs in this IF block -- do not untabify
|
||||
if test x"${enable_languages+set}" != xset; then
|
||||
if test x"${LANGUAGES+set}" = xset; then
|
||||
enable_languages="${LANGUAGES}"
|
||||
echo configure.in: warning: setting LANGUAGES is deprecated, use --enable-languages instead 1>&2
|
||||
else
|
||||
enable_languages=all
|
||||
fi
|
||||
else
|
||||
if test x"${enable_languages}" = x ||
|
||||
test x"${enable_languages}" = xyes;
|
||||
then
|
||||
echo configure.in: --enable-languages needs at least one language argument 1>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
enable_languages=`echo "${enable_languages}" | sed -e 's/[ ,][ ,]*/,/g' -e 's/,$//'`
|
||||
|
||||
subdirs=
|
||||
for lang in ${srcdir}/gcc/*/config-lang.in ..
|
||||
do
|
||||
case $lang in
|
||||
..) ;;
|
||||
# The odd quoting in the next line works around
|
||||
# an apparent bug in bash 1.12 on linux.
|
||||
${srcdir}/gcc/[*]/config-lang.in) ;;
|
||||
*)
|
||||
lang_alias=`sed -n -e 's,^language=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^language=\([^ ]*\).*$,\1,p' $lang`
|
||||
this_lang_libs=`sed -n -e 's,^target_libs=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^target_libs=\([^ ]*\).*$,\1,p' $lang`
|
||||
build_by_default=`sed -n -e 's,^build_by_default=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^build_by_default=\([^ ]*\).*$,\1,p' $lang`
|
||||
if test "x$lang_alias" = x
|
||||
then
|
||||
echo "$lang doesn't set \$language." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
case ${build_by_default},${enable_languages}, in
|
||||
*,$lang_alias,*) add_this_lang=yes ;;
|
||||
no,*) add_this_lang=no ;;
|
||||
*,all,*) add_this_lang=yes ;;
|
||||
*) add_this_lang=no ;;
|
||||
esac
|
||||
if test x"${add_this_lang}" = xyes; then
|
||||
eval target_libs='"$target_libs "'\"$this_lang_libs\"
|
||||
else
|
||||
eval noconfigdirs='"$noconfigdirs "'\"$this_lang_libs\"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
# Remove the entries in $skipdirs and $noconfigdirs from $configdirs and
|
||||
# $target_configdirs.
|
||||
# If we have the source for $noconfigdirs entries, add them to $notsupp.
|
||||
|
|
@ -1007,6 +1179,12 @@ if [ x${shared} = xyes ]; then
|
|||
i[3456]86-*)
|
||||
target_makefile_frag="${target_makefile_frag} config/mt-x86pic"
|
||||
;;
|
||||
ia64-*)
|
||||
target_makefile_frag="${target_makefile_frag} config/mt-ia64pic"
|
||||
;;
|
||||
powerpc*-*-aix*)
|
||||
# We don't want -fPIC on AIX.
|
||||
;;
|
||||
powerpc*-*)
|
||||
target_makefile_frag="${target_makefile_frag} config/mt-ppcpic"
|
||||
;;
|
||||
|
|
@ -1052,7 +1230,7 @@ rm -f conftest*
|
|||
case "${host}" in
|
||||
sparc-sun-solaris2*)
|
||||
CCBASE="`echo ${CC-cc} | sed 's/ .*$//'`"
|
||||
if [ "`/usr/bin/which $CCBASE`" = "/usr/ucb/cc" ] ; then
|
||||
if [ "`type $CCBASE | sed 's/^[^/]*//'`" = "/usr/ucb/cc" ] ; then
|
||||
could_use=
|
||||
[ -d /opt/SUNWspro/bin ] && could_use="/opt/SUNWspro/bin"
|
||||
if [ -d /opt/cygnus/bin ] ; then
|
||||
|
|
@ -1094,7 +1272,8 @@ if [ "${shared}" = "yes" ]; then
|
|||
esac
|
||||
fi
|
||||
|
||||
# Record target_configdirs and the configure arguments in Makefile.
|
||||
# Record target_configdirs and the configure arguments for target and
|
||||
# build configuration in Makefile.
|
||||
target_configdirs=`echo "${target_configdirs}" | sed -e 's/target-//g'`
|
||||
targargs=`echo "${arguments}" | \
|
||||
sed -e 's/--no[^ ]*//' \
|
||||
|
|
@ -1103,6 +1282,11 @@ targargs=`echo "${arguments}" | \
|
|||
-e 's/--bu[a-z-]*=[^ ]*//' \
|
||||
-e 's/--ta[a-z-]*=[^ ]*//'`
|
||||
|
||||
# For the build-side libraries, we just need to pretend we're native,
|
||||
# and not use the same cache file. Multilibs are neither needed nor
|
||||
# desired.
|
||||
buildargs="--cache-file=../config.cache --build=${build_alias} --host=${build_alias} ${targargs}"
|
||||
|
||||
# Passing a --with-cross-host argument lets the target libraries know
|
||||
# whether they are being built with a cross-compiler or being built
|
||||
# native. However, it would be better to use other mechanisms to make the
|
||||
|
|
@ -1123,10 +1307,170 @@ if [ x${with_newlib} != xno ] && echo " ${target_configdirs} " | grep " newlib "
|
|||
targargs="--with-newlib ${targargs}"
|
||||
fi
|
||||
|
||||
targargs="--host=${target_alias} --build=${build_alias} ${targargs}"
|
||||
# Pass the appropriate --host, --build, and --cache-file arguments.
|
||||
targargs="--cache-file=../config.cache --host=${target_alias} --build=${build_alias} ${targargs}"
|
||||
|
||||
# provide a proper gxx_include_dir.
|
||||
# Note, if you change the default, make sure to fix both here and in
|
||||
# the gcc, libio, and libstdc++ subdirectories.
|
||||
# Check whether --with-gxx-include-dir or --without-gxx-include-dir was given.
|
||||
gxx_include_dir=
|
||||
if test -n "${with_gxx_include_dir}"; then
|
||||
case "${with_gxx_include_dir}" in
|
||||
yes )
|
||||
echo "configure.in: error: bad value ${withval} given for g++ include directory" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
no )
|
||||
;;
|
||||
* )
|
||||
gxx_include_dir=${with_gxx_include_dir}
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test x${gxx_include_dir} = x; then
|
||||
if test x${enable_version_specific_runtime_libs} = xyes; then
|
||||
gxx_include_dir='${libsubdir}/include/g++'
|
||||
else
|
||||
. ${topsrcdir}/config.if
|
||||
gxx_include_dir='${prefix}/include/g++'-${libstdcxx_interface}
|
||||
fi
|
||||
else
|
||||
gxx_include_dir=${gxx_include_dir}
|
||||
fi
|
||||
|
||||
FLAGS_FOR_TARGET=
|
||||
case " $skipdirs " in
|
||||
*" target-newlib "*) ;;
|
||||
*)
|
||||
case "$target" in
|
||||
*-cygwin*)
|
||||
FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(TARGET_SUBDIR)/winsup -L$$r/$(TARGET_SUBDIR)/winsup/cygwin -L$$r/$(TARGET_SUBDIR)/winsup/w32api/lib -isystem $$s/winsup/include -isystem $$s/winsup/cygwin/include -isystem $$s/winsup/w32api/include -isystem $$s/newlib/libc/sys/cygwin -isystem $$s/newlib/libc/sys/cygwin32' ;;
|
||||
esac
|
||||
|
||||
# If we're not building GCC, don't discard standard headers.
|
||||
if test -d ${topsrcdir}/gcc; then
|
||||
FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -nostdinc'
|
||||
|
||||
if test "${build}" != "${host}"; then
|
||||
# On Canadian crosses, CC_FOR_TARGET will have already been set
|
||||
# by `configure', so we won't have an opportunity to add -Bgcc/
|
||||
# to it. This is right: we don't want to search that directory
|
||||
# for binaries, but we want the header files in there, so add
|
||||
# them explicitly.
|
||||
FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -isystem $$r/gcc/include'
|
||||
|
||||
# Someone might think of using the pre-installed headers on
|
||||
# Canadian crosses, in case the installed compiler is not fully
|
||||
# compatible with the compiler being built. In this case, it
|
||||
# would be better to flag an error than risking having
|
||||
# incompatible object files being constructed. We can't
|
||||
# guarantee that an error will be flagged, but let's hope the
|
||||
# compiler will do it, when presented with incompatible header
|
||||
# files.
|
||||
fi
|
||||
fi
|
||||
|
||||
case "${target}-${is_cross_compiler}" in
|
||||
i[3456]86-pc-linux*-no)
|
||||
# Here host == target, so we don't need to build gcc,
|
||||
# so we don't want to discard standard headers.
|
||||
FLAGS_FOR_TARGET=`echo " $FLAGS_FOR_TARGET " | sed -e 's/ -nostdinc / /'`
|
||||
FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$$r/$(TARGET_SUBDIR)/newlib/'
|
||||
;;
|
||||
*)
|
||||
# If we're building newlib, use its generic headers last, but search
|
||||
# for any libc-related directories first (so make it the last -B
|
||||
# switch).
|
||||
FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$$r/$(TARGET_SUBDIR)/newlib/ -isystem $$r/$(TARGET_SUBDIR)/newlib/targ-include -isystem $$s/newlib/libc/include'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
# On Canadian crosses, we'll be searching the right directories for
|
||||
# the previously-installed cross compiler, so don't bother to add
|
||||
# flags for directories within the install tree of the compiler
|
||||
# being built; programs in there won't even run.
|
||||
if test "${build}" = "${host}" && test -d ${topsrcdir}/gcc; then
|
||||
# Search for pre-installed headers if nothing else fits.
|
||||
FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$(build_tooldir)/bin/ -B$(build_tooldir)/lib/ -isystem $(build_tooldir)/include'
|
||||
fi
|
||||
|
||||
if test "x${use_gnu_ld}" = x && test "x${with_gnu_ld}" != xno &&
|
||||
echo " ${configdirs} " | grep " ld " > /dev/null &&
|
||||
test -d ${srcdir}/ld; then
|
||||
# Arrange for us to find uninstalled linker scripts.
|
||||
FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/ld'
|
||||
fi
|
||||
|
||||
if test "x${CC_FOR_TARGET+set}" = xset; then
|
||||
:
|
||||
elif test -d ${topsrcdir}/gcc; then
|
||||
CC_FOR_TARGET='$$r/gcc/xgcc -B$$r/gcc/'
|
||||
elif test "$host" = "$target"; then
|
||||
CC_FOR_TARGET='$(CC)'
|
||||
else
|
||||
CC_FOR_TARGET=`echo gcc | sed -e 's/x/x/' ${program_transform_name}`
|
||||
fi
|
||||
# On Canadian crosses, configure reads CC_FOR_TARGET from Makefile,
|
||||
# if Makefile exists. Prevent $(FLAGS_FOR_TARGET) from being duplicated.
|
||||
case $CC_FOR_TARGET in
|
||||
*' $(FLAGS_FOR_TARGET)') ;;
|
||||
*) CC_FOR_TARGET=$CC_FOR_TARGET' $(FLAGS_FOR_TARGET)' ;;
|
||||
esac
|
||||
|
||||
if test "x${CHILL_FOR_TARGET+set}" = xset; then
|
||||
:
|
||||
elif test -d ${topsrcdir}/gcc; then
|
||||
CHILL_FOR_TARGET='$$r/gcc/xgcc -B$$r/gcc/ -L$$r/gcc/ch/runtime/'
|
||||
elif test "$host" = "$target"; then
|
||||
CHILL_FOR_TARGET='$(CC)'
|
||||
else
|
||||
CHILL_FOR_TARGET=`echo gcc | sed -e 's/x/x/' ${program_transform_name}`
|
||||
fi
|
||||
case $CHILL_FOR_TARGET in
|
||||
*' $(FLAGS_FOR_TARGET)') ;;
|
||||
*) CHILL_FOR_TARGET=$CHILL_FOR_TARGET' $(FLAGS_FOR_TARGET)' ;;
|
||||
esac
|
||||
|
||||
if test "x${CXX_FOR_TARGET+set}" = xset; then
|
||||
:
|
||||
elif test -d ${topsrcdir}/gcc; then
|
||||
# We add -shared-libgcc to CXX_FOR_TARGET whenever we use xgcc instead
|
||||
# of g++ for linking C++ or Java, because g++ has -shared-libgcc by
|
||||
# default whereas gcc does not.
|
||||
CXX_FOR_TARGET='$$r/gcc/`case $$dir in libstdc++-v3 | libjava) echo xgcc -shared-libgcc ;; *) echo g++ ;; esac` -B$$r/gcc/ -nostdinc++ '$libstdcxx_flags
|
||||
elif test "$host" = "$target"; then
|
||||
CXX_FOR_TARGET='$(CXX)'
|
||||
else
|
||||
CXX_FOR_TARGET=`echo c++ | sed -e 's/x/x/' ${program_transform_name}`
|
||||
fi
|
||||
case $CXX_FOR_TARGET in
|
||||
*' $(FLAGS_FOR_TARGET)') ;;
|
||||
*) CXX_FOR_TARGET=$CXX_FOR_TARGET' $(FLAGS_FOR_TARGET)' ;;
|
||||
esac
|
||||
qCXX_FOR_TARGET=`echo "$CXX_FOR_TARGET" | sed 's,[&%],\\\&,g'`
|
||||
|
||||
# We want to defer the evaluation of `cmd`s and shell variables in
|
||||
# CXX_FOR_TARGET when recursing in the top-level Makefile, such as for
|
||||
# bootstrap. We'll enclose CXX_FOR_TARGET_FOR_RECURSIVE_MAKE in single
|
||||
# quotes, but we still have to duplicate `$'s so that shell variables
|
||||
# can be expanded by the nested make as shell variables, not as make
|
||||
# macros.
|
||||
qqCXX_FOR_TARGET=`echo "$qCXX_FOR_TARGET" | sed -e 's,[$][$],$$$$,g'`
|
||||
|
||||
sed -e "s:^TARGET_CONFIGDIRS[ ]*=.*$:TARGET_CONFIGDIRS = ${target_configdirs}:" \
|
||||
-e "s%^CONFIG_ARGUMENTS[ ]*=.*$%CONFIG_ARGUMENTS = ${targargs}%" \
|
||||
-e "s%^TARGET_CONFIGARGS[ ]*=.*$%TARGET_CONFIGARGS = ${targargs}%" \
|
||||
-e "s%^FLAGS_FOR_TARGET[ ]*=.*$%FLAGS_FOR_TARGET = ${FLAGS_FOR_TARGET}%" \
|
||||
-e "s%^CC_FOR_TARGET[ ]*=.*$%CC_FOR_TARGET = ${CC_FOR_TARGET}%" \
|
||||
-e "s%^CHILL_FOR_TARGET[ ]*=.*$%CHILL_FOR_TARGET = ${CHILL_FOR_TARGET}%" \
|
||||
-e "s%^CXX_FOR_TARGET[ ]*=.*$%CXX_FOR_TARGET = ${qCXX_FOR_TARGET}%" \
|
||||
-e "s%^CXX_FOR_TARGET_FOR_RECURSIVE_MAKE[ ]*=.*$%CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = ${qqCXX_FOR_TARGET}%" \
|
||||
-e "s%^TARGET_SUBDIR[ ]*=.*$%TARGET_SUBDIR = ${target_subdir}%" \
|
||||
-e "s%^BUILD_SUBDIR[ ]*=.*$%BUILD_SUBDIR = ${build_subdir}%" \
|
||||
-e "s%^BUILD_CONFIGARGS[ ]*=.*$%BUILD_CONFIGARGS = ${buildargs}%" \
|
||||
-e "s%^gxx_include_dir[ ]*=.*$%gxx_include_dir=${gxx_include_dir}%" \
|
||||
Makefile > Makefile.tem
|
||||
rm -f Makefile
|
||||
mv -f Makefile.tem Makefile
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ package. We welcome all of the above and feel free to ask on the GDB
|
|||
mailing lists if you are looking for feedback or for people to review
|
||||
a work in progress.
|
||||
|
||||
Ref: http://sourceware.cygnus.com/gdb
|
||||
Ref: http://www.gnu.org/software/gdb/
|
||||
|
||||
Finally, there are certain legal requirements and style issues which
|
||||
all contributors need to be aware of.
|
||||
|
|
@ -29,58 +29,29 @@ all contributors need to be aware of.
|
|||
o Coding Standards
|
||||
|
||||
All contributions must conform to the GNU Coding Standard.
|
||||
http://www.gnu.ai.mit.edu/prep/standards_toc.html
|
||||
Submissions which do not conform to the standards will be
|
||||
returned with a request to reformat the changes.
|
||||
|
||||
For GDB, that standard is more tightly defined. GDB's
|
||||
coding standard is determined by the output of
|
||||
gnu-indent.
|
||||
GDB has certain additional coding requirements. Those
|
||||
requirements are explained in the GDB internals documentation
|
||||
in the gdb/doc directory.
|
||||
|
||||
This situation came about because, by the start of '99,
|
||||
GDB's coding style was so bad an inconsistent that it was
|
||||
decided to restart things from scratch.
|
||||
Ref: http://www.gnu.org/prep/standards_toc.html
|
||||
|
||||
|
||||
o Copyright Assignment
|
||||
|
||||
There are certain legal requirements
|
||||
|
||||
Before we can accept code contributions from you, we need a
|
||||
copyright assignment form filled out.
|
||||
copyright assignment form filled out and filed with the FSF.
|
||||
|
||||
If you've developed some addition or patch to GDB that you
|
||||
would like to contribute, you should fill out a copyright
|
||||
assignment form and send it in to the FSF. We are unable to
|
||||
use code from you until this is on-file at the FSF, so get
|
||||
that paperwork in! This form covers one batch of changes.
|
||||
Ref: http://gcc.gnu.org/fsf-forms/assignment-instructions.html
|
||||
See some documentation by the FSF for details and contact us
|
||||
(either via the GDB mailing list or the GDB maintainer that is
|
||||
taking care of your contributions) to obtain the relevant
|
||||
forms.
|
||||
|
||||
If you think you're going to be doing continuing work on GDB, it
|
||||
would be easier to use a different form, which arranges to
|
||||
assign the copyright for all your future changes to GDB. It is
|
||||
called assign.future. Please note that if you switch
|
||||
employers, the new employer will need to fill out the
|
||||
disclaim.future form; there is no need to fill out the
|
||||
assign.future form again.
|
||||
Ref: http://gcc.gnu.org/fsf-forms/assign.future
|
||||
Ref: http://gcc.gnu.org/fsf-forms/disclaim.future
|
||||
Small changes can be accepted without a copyright assignment form on file.
|
||||
|
||||
There are several other forms you can fill out for different
|
||||
circumstances (e.g. to contribute an entirely new program, to
|
||||
contribute significant changes to a manual, etc.)
|
||||
Ref: http://gcc.gnu.org/fsf-forms/copyrights.html
|
||||
|
||||
Small changes can be accepted without a copyright assignment
|
||||
form on file.
|
||||
|
||||
This is pretty confusing! If you are unsure of what is
|
||||
necessary, just ask the GDB mailing list and we'll figure out
|
||||
what is best for you.
|
||||
|
||||
Note: Many of these forms have a place for "name of
|
||||
program". Insert the name of one program in that place -- in
|
||||
this case, "GDB".
|
||||
Ref: http://www.gnu.org/prep/maintain.html#SEC6
|
||||
|
||||
|
||||
o Submitting Patches
|
||||
|
|
@ -98,18 +69,17 @@ o Submitting Patches
|
|||
unlike some other projects, we do require ChangeLogs also for
|
||||
documentation (i.e., .texi files).
|
||||
|
||||
The patch itself. If you are accessing the CVS repository at:
|
||||
Cygnus, use "cvs update; cvs diff -c3p"; else, use "diff -c3p
|
||||
OLD NEW" or "diff -up OLD NEW". If your version of diff does
|
||||
not support these options, then get the latest version of GNU
|
||||
diff.
|
||||
The patch itself. If you are accessing the CVS repository use
|
||||
"cvs update; cvs diff -cp"; else, use "diff -cp OLD NEW" or
|
||||
"diff -up OLD NEW". If your version of diff does not support
|
||||
these options, then get the latest version of GNU diff.
|
||||
|
||||
We accept patches as plain text (preferred for the compilers
|
||||
themselves), MIME attachments (preferred for the web pages),
|
||||
or as uuencoded gzipped text.
|
||||
|
||||
When you have all these pieces, bundle them up in a mail
|
||||
message and send it to gdb-patches@sourceware.cygnus.com. All
|
||||
message and send it to gdb-patches@sources.redhat.com. All
|
||||
patches and related discussion should be sent to the
|
||||
gdb-patches mailinglist. For further information on the GDB
|
||||
CVS repository, see the Anonymous read-only CVS access and
|
||||
|
|
@ -151,3 +121,23 @@ o If ``gdb/configure.in'' is modified then you don't
|
|||
|
||||
The maintainer will re-generate those files
|
||||
using autoconf (2.13 as of 2000-02-29).
|
||||
|
||||
|
||||
o If ``gdb/gdbarch.sh'' is modified, you don't
|
||||
need to include patches to the generated files
|
||||
``gdbarch.h'' and ``gdbarch.c''.
|
||||
|
||||
See ``gdb/configure.in'' above.
|
||||
|
||||
|
||||
o When submitting a patch that fixes a bug
|
||||
in GDB's bug database a brief reference
|
||||
to the bug can be included in the ChangeLog
|
||||
vis
|
||||
|
||||
* CONTRIBUTE: Mention PR convention.
|
||||
Fix PR gdb/4705.
|
||||
|
||||
The text ``PR gdb/4705'' should also be included
|
||||
in the CVS commit message. That causes the
|
||||
patch to automatically be archived with the PR.
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
3155
contrib/gdb/gdb/ChangeLog-1990
Normal file
3155
contrib/gdb/gdb/ChangeLog-1990
Normal file
File diff suppressed because it is too large
Load diff
5175
contrib/gdb/gdb/ChangeLog-1991
Normal file
5175
contrib/gdb/gdb/ChangeLog-1991
Normal file
File diff suppressed because it is too large
Load diff
6285
contrib/gdb/gdb/ChangeLog-1992
Normal file
6285
contrib/gdb/gdb/ChangeLog-1992
Normal file
File diff suppressed because it is too large
Load diff
7597
contrib/gdb/gdb/ChangeLog-1993
Normal file
7597
contrib/gdb/gdb/ChangeLog-1993
Normal file
File diff suppressed because it is too large
Load diff
5705
contrib/gdb/gdb/ChangeLog-1994
Normal file
5705
contrib/gdb/gdb/ChangeLog-1994
Normal file
File diff suppressed because it is too large
Load diff
4915
contrib/gdb/gdb/ChangeLog-1995
Normal file
4915
contrib/gdb/gdb/ChangeLog-1995
Normal file
File diff suppressed because it is too large
Load diff
5116
contrib/gdb/gdb/ChangeLog-1996
Normal file
5116
contrib/gdb/gdb/ChangeLog-1996
Normal file
File diff suppressed because it is too large
Load diff
2909
contrib/gdb/gdb/ChangeLog-1997
Normal file
2909
contrib/gdb/gdb/ChangeLog-1997
Normal file
File diff suppressed because it is too large
Load diff
7220
contrib/gdb/gdb/ChangeLog-1998
Normal file
7220
contrib/gdb/gdb/ChangeLog-1998
Normal file
File diff suppressed because it is too large
Load diff
9296
contrib/gdb/gdb/ChangeLog-1999
Normal file
9296
contrib/gdb/gdb/ChangeLog-1999
Normal file
File diff suppressed because it is too large
Load diff
8204
contrib/gdb/gdb/ChangeLog-2000
Normal file
8204
contrib/gdb/gdb/ChangeLog-2000
Normal file
File diff suppressed because it is too large
Load diff
9895
contrib/gdb/gdb/ChangeLog-2001
Normal file
9895
contrib/gdb/gdb/ChangeLog-2001
Normal file
File diff suppressed because it is too large
Load diff
4838
contrib/gdb/gdb/ChangeLog-3.x
Normal file
4838
contrib/gdb/gdb/ChangeLog-3.x
Normal file
File diff suppressed because it is too large
Load diff
421
contrib/gdb/gdb/MAINTAINERS
Normal file
421
contrib/gdb/gdb/MAINTAINERS
Normal file
|
|
@ -0,0 +1,421 @@
|
|||
GDB Maintainers
|
||||
|
||||
|
||||
Blanket Write Privs
|
||||
(alphabetic)
|
||||
|
||||
Jim Blandy jimb@redhat.com
|
||||
Kevin Buettner kevinb@redhat.com
|
||||
Andrew Cagney ac131313@redhat.com
|
||||
J.T. Conklin jtc@redback.com
|
||||
Fred Fish fnf@ninemoons.com
|
||||
Mark Kettenis kettenis@gnu.org
|
||||
Peter Schauer Peter.Schauer@regent.e-technik.tu-muenchen.de
|
||||
Stan Shebs shebs@apple.com
|
||||
Michael Snyder msnyder@redhat.com
|
||||
Elena Zannoni ezannoni@redhat.com
|
||||
Eli Zaretskii eliz@gnu.org
|
||||
|
||||
|
||||
Various Maintainers
|
||||
|
||||
Note individuals who maintain parts of the debugger need approval to
|
||||
check in changes outside of the immediate domain that they maintain.
|
||||
|
||||
If there is no maintainer for a given domain then the responsibility
|
||||
falls to the head maintainer.
|
||||
|
||||
If there are several maintainers for a given domain then
|
||||
responsibility falls to the first maintainer. The first maintainer is
|
||||
free to devolve that responsibility among the other maintainers.
|
||||
|
||||
|
||||
The Obvious Fix Rule
|
||||
|
||||
All maintainers listed in this file are allowed to check in obvious
|
||||
fixes.
|
||||
|
||||
An "obvious fix" means that there is no possibility that anyone will
|
||||
disagree with the change.
|
||||
|
||||
A good mental test is "will the person who hates my work the most be
|
||||
able to find fault with the change" - if so, then it's not obvious and
|
||||
needs to be posted first. :-)
|
||||
|
||||
Something like changing or bypassing an interface is _not_ an obvious
|
||||
fix, since such a change without discussion will result in
|
||||
instantaneous and loud complaints.
|
||||
|
||||
|
||||
Target/Architecture:
|
||||
|
||||
Generic ISA (Instruction Set Architecture) issues, API variants, CPU
|
||||
variants. *-tdep.c. The Target/Architecture maintainer works with the
|
||||
host maintainer when resolving build issues. The Target/Architecture
|
||||
maintainer works with the native maintainer when resolving API issues.
|
||||
|
||||
a29k OBSOLETE
|
||||
|
||||
alpha --target=alpha-dec-osf4.0a -Werror
|
||||
Maintenance only
|
||||
OBSOLETE candidate, not multi-arch
|
||||
|
||||
arc --target=arc-elf ,-Werror
|
||||
Maintenance only
|
||||
OBSOLETE candidate, not multi-arch
|
||||
|
||||
arm --target=arm-elf -w
|
||||
Fernando Nasser fnasser@redhat.com
|
||||
Scott Bambrough scottb@netwinder.org
|
||||
Richard Earnshaw rearnsha@arm.com
|
||||
Not multi-arch
|
||||
|
||||
avr --target=avr ,-Werror
|
||||
Theodore A. Roth troth@verinet.com
|
||||
|
||||
cris --target=cris-elf -w
|
||||
Orjan Friberg orjanf@axis.com
|
||||
|
||||
d10v --target=d10v-elf ,-Werror
|
||||
Maintenance only
|
||||
|
||||
d30v --target=d30v-elf ,-Werror
|
||||
Maintenance only
|
||||
OBSOLETE candidate, not multi-arch
|
||||
|
||||
djgpp --target=i586-pc-msdosdjgpp ,-Werror
|
||||
(See native and host)
|
||||
|
||||
fr30 --target=fr30-elf -Werror
|
||||
Maintenance only
|
||||
OBSOLETE candidate, not multi-arch
|
||||
|
||||
h8300 --target=h8300hms -Werror
|
||||
Maintenance only
|
||||
Not multi-arch, work in progress
|
||||
|
||||
h8500 --target=h8500hms -Werror
|
||||
Maintenance only
|
||||
Not multi-arch, work in progress
|
||||
|
||||
i386 --target=i386-elf,i386-aout ,-Werror
|
||||
Mark Kettenis kettenis@gnu.org
|
||||
|
||||
i960 --target=i960-coff ,-Werror
|
||||
Maintenance only
|
||||
OBSOLETE candidate, not multi-arch
|
||||
|
||||
ia64 --target=ia64-linux ,-Werror
|
||||
Kevin Buettner kevinb@redhat.com
|
||||
|
||||
m32r --target=m32r-elf -Werror
|
||||
Michael Snyder msnyder@redhat.com
|
||||
Not multi-arch
|
||||
|
||||
m68hc11 --target=m68hc11-elf ,-Werror
|
||||
Stephane Carrez Stephane.Carrez@worldnet.fr
|
||||
|
||||
m68k --target=m68k-elf ,-Werror
|
||||
Maintenance only
|
||||
OBSOLETE candidate, not multi-arch
|
||||
|
||||
m88k --target=m88k ,-Werror
|
||||
Known problem in 5.1
|
||||
Maintenance only
|
||||
OBSOLETE candidate, not multi-arch
|
||||
|
||||
mcore --target=mcore-elf,mcore-pe ,-Werror
|
||||
Maintenance only
|
||||
OBSOLETE candidate, not multi-arch
|
||||
|
||||
mips --target=mips-elf,mips64-elf ,-Werror
|
||||
Andrew Cagney cagney@redhat.com
|
||||
|
||||
mn10200 --target=mn10200-elf ,-Werror
|
||||
Maintenance only
|
||||
OBSOLETE candidate, not multi-arch
|
||||
|
||||
mn10300 --target=mn10300-elf ,-Werror
|
||||
Maintenance only
|
||||
|
||||
ns32k --target=ns32k-netbsd ,-Werror
|
||||
Maintenance only
|
||||
OBSOLETE candidate, not multi-arch
|
||||
|
||||
pa (--target=hppa1.1-hp-proelf broken)
|
||||
Maintenance only
|
||||
OBSOLETE candidate, not multi-arch
|
||||
|
||||
powerpc --target=powerpc-eabi ,-Werror
|
||||
Kevin Buettner kevinb@redhat.com
|
||||
|
||||
rs6000 --target=rs6000-ibm-aix4.1 ,-Werror
|
||||
(see rs6000 native and ppc target)
|
||||
|
||||
s390 --target=s390-linux ,-Werror
|
||||
(contact DJ Barrow djbarrow@de.ibm.com)
|
||||
|
||||
sh --target=sh-hms,sh-elf ,-Werror
|
||||
Elena Zannoni ezannoni@redhat.com
|
||||
|
||||
sparc --target=sparc-elf,sparc64-elf ,-Werror
|
||||
Maintenance only
|
||||
|
||||
tic80 Deleted.
|
||||
|
||||
v850 --target=v850-elf ,-Werror
|
||||
Maintenance only
|
||||
OBSOLETE candidate, not multi-arch
|
||||
|
||||
vax --target=vax-dec-vms5.5 ,-Werror
|
||||
Maintenance only
|
||||
OBSOLETE candidate, not multi-arch
|
||||
|
||||
w65 Deleted.
|
||||
|
||||
x86-64 (--target=x86_64-linux-gnu broken)
|
||||
Maintenance only
|
||||
|
||||
xstormy16 --target=xstormy16-elf ,-Werror
|
||||
Corinna Vinschen vinschen@redhat.com
|
||||
|
||||
z8k --target=z8k-coff ,-Werror
|
||||
Known problem in 5.1
|
||||
Maintenance only
|
||||
OBSOLETE candidate, not multi-arch
|
||||
|
||||
All developers recognized by this file can make arbitrary changes to
|
||||
OBSOLETE targets.
|
||||
|
||||
All maintainers can test and thence approve non-trivial changes to
|
||||
``maintenance only'' targets submitted by recognized developers.
|
||||
|
||||
All recognized developers can make mechanical changes (by virtue of
|
||||
the obvious fix rule) to ``maintenance only'' targets. The change
|
||||
shall be sanity checked by compiling with one of the listed targets.
|
||||
|
||||
The GAWK segment:
|
||||
|
||||
awk < "${maintainers}" '
|
||||
$2 ~ /--target=.*/ {
|
||||
targets = gensub (/^.*--target=/, "", 1, $2)
|
||||
warnings = gensub (/[)]*$/, "", 1, $3)
|
||||
split (targets, targ, /,/)
|
||||
for (i in targ) {
|
||||
print targ[i], warnings
|
||||
}
|
||||
}'
|
||||
|
||||
can be used to generate a full list of --target=
|
||||
--enable-gdb-build-warning= pairs.
|
||||
|
||||
|
||||
|
||||
Host/Native:
|
||||
|
||||
The Native maintainer is responsible for target specific native
|
||||
support - typically shared libraries and quirks to procfs/ptrace/...
|
||||
The Native maintainer works with the Arch and Core maintainers when
|
||||
resolving more generic problems.
|
||||
|
||||
The host maintainer ensures that gdb (including mmalloc) can be built
|
||||
as a cross debugger on their platform.
|
||||
|
||||
AIX Peter Schauer Peter.Schauer@regent.e-technik.tu-muenchen.de
|
||||
Kevin Buettner kevinb@redhat.com
|
||||
|
||||
djgpp native Eli Zaretskii eliz@gnu.org
|
||||
DJ Delorie dj@redhat.com
|
||||
MS Windows (NT, CE, '00, 9x, Me) host & native
|
||||
Chris Faylor cgf@redhat.com
|
||||
GNU/Linux/x86 native & host
|
||||
Mark Kettenis kettenis@gnu.org
|
||||
Jim Blandy jimb@redhat.com
|
||||
GNU/Linux PPC native Kevin Buettner kevinb@redhat.com
|
||||
GNU/Linux MIPS native & host
|
||||
Daniel Jacobowitz dan@debian.org
|
||||
GNU/Linux m68k Andreas Schwab schwab@suse.de
|
||||
FreeBSD native & host Mark Kettenis kettenis@gnu.org
|
||||
David O'Brien obrien@freebsd.org
|
||||
hurd native Mark Kettenis kettenis@gnu.org
|
||||
SCO/Unixware Robert Lipe rjl@sco.com
|
||||
GNU/Linux ARM native Scott Bambrough scottb@netwinder.org
|
||||
Solaris/x86 native & host (devolved)
|
||||
Peter Schauer Peter.Schauer@regent.e-technik.tu-muenchen.de
|
||||
Solaris/SPARC native & host (devolved)
|
||||
Michael Snyder msnyder@redhat.com
|
||||
|
||||
|
||||
|
||||
Core: Generic components used by all of GDB
|
||||
|
||||
generic arch support Andrew Cagney cagney@redhat.com
|
||||
Any host/target maintainer can add to
|
||||
gdbarch.{c,h,sh}. Send tricky ones to cagney.
|
||||
target vector Andrew Cagney cagney@redhat.com
|
||||
main (main.c, top.c) Elena Zannoni ezannoni@redhat.com
|
||||
event loop Elena Zannoni ezannoni@redhat.com
|
||||
|
||||
generic symtabs Jim Blandy jimb@redhat.com
|
||||
Elena Zannoni ezannoni@redhat.com
|
||||
dwarf readers Jim Blandy jimb@redhat.com
|
||||
Elena Zannoni ezannoni@redhat.com
|
||||
elf reader Jim Blandy jimb@redhat.com
|
||||
Elena Zannoni ezannoni@redhat.com
|
||||
stabs reader Jim Blandy jimb@redhat.com
|
||||
Elena Zannoni ezannoni@redhat.com
|
||||
coff reader Philippe De Muyter phdm@macqel.be
|
||||
xcoff reader Any maintainer can modify this; please send tricky
|
||||
ones to Kevin Buettner <kevinb@redhat.com>
|
||||
linespec Jim Blandy jimb@redhat.com
|
||||
Elena Zannoni ezannoni@redhat.com
|
||||
Fernando Nasser fnasser@redhat.com
|
||||
|
||||
tracing bytecode stuff Jim Blandy jimb@redhat.com
|
||||
tracing Michael Snyder msnyder@redhat.com
|
||||
threads Michael Snyder msnyder@redhat.com
|
||||
Mark Kettenis kettenis@gnu.org
|
||||
breakpoints Michael Snyder msnyder@redhat.com
|
||||
Jim Blandy jimb@redhat.com
|
||||
language support (Blanket Write Privs Maintainers)
|
||||
C++ Daniel Jacobowitz dan@debian.org
|
||||
Java support (devolved)
|
||||
Per Bothner per@bothner.com
|
||||
Anthony Green green@redhat.com
|
||||
Pascal support Pierre Muller muller@sources.redhat.com
|
||||
Scheme support Jim Blandy jimb@redhat.com
|
||||
|
||||
shared libs (devolved) Jim Blandy jimb@redhat.com
|
||||
Kevin Buettner kevinb@redhat.com
|
||||
xcoffsolib Peter Schauer Peter.Schauer@regent.e-technik.tu-muenchen.de
|
||||
|
||||
remote.c Andrew Cagney cagney@redhat.com
|
||||
include/remote-sim.h, remote-sim.c
|
||||
Andrew Cagney cagney@redhat.com
|
||||
sds protocol Fernando Nasser fnasser@redhat.com
|
||||
rdi/adp protocol Fernando Nasser fnasser@redhat.com
|
||||
documentation Eli Zaretskii eliz@gnu.org
|
||||
testsuite Fernando Nasser fnasser@redhat.com
|
||||
config Mark Salter msalter@redhat.com
|
||||
lib Mark Salter msalter@redhat.com
|
||||
gdbtk (gdb.gdbtk) Keith Seitz keiths@redhat.com
|
||||
c++ (gdb.c++) Michael Chastain mec@shout.net
|
||||
mi tests (gdb.mi) Elena Zannoni ezannoni@redhat.com
|
||||
Andrew Cagney cagney@redhat.com
|
||||
stabs (gdb.stabs) Elena Zannoni ezannoni@redhat.com
|
||||
threads (gdb.threads) Michael Snyder msnyder@redhat.com
|
||||
trace (gdb.trace) Michael Snyder msnyder@redhat.com
|
||||
hp tests (gdb.hp) (vacant)
|
||||
Java tests (gdb.java) Anthony Green green@redhat.com
|
||||
Kernel Object Display Fernando Nasser fnasser@redhat.com
|
||||
|
||||
|
||||
UI: External (user) interfaces.
|
||||
|
||||
command interpreter Fernando Nasser fnasser@redhat.com
|
||||
gdbtk (c & tcl) Jim Ingham jingham@apple.com
|
||||
Fernando Nasser fnasser@redhat.com
|
||||
Keith Seitz keiths@redhat.com
|
||||
libgui (w/foundry, sn) Jim Ingham jingham@apple.com
|
||||
Keith Seitz keiths@redhat.com
|
||||
mi (gdb/mi) Andrew Cagney cagney@redhat.com
|
||||
Elena Zannoni ezannoni@redhat.com
|
||||
Fernando Nasser fnasser@redhat.com
|
||||
tui (vacant)
|
||||
Technical Contact Point wdb@cup.hp.com
|
||||
|
||||
|
||||
Misc:
|
||||
|
||||
gdb/gdbserver Daniel Jacobowitz dan@debian.org
|
||||
|
||||
Web pages. Jim Kingdon jkingdon@engr.sgi.com ++
|
||||
(anyone can edit; kingdon is just lead maintainer)
|
||||
|
||||
Makefile.in, configure* ALL
|
||||
|
||||
mmalloc/ ALL Host maintainers
|
||||
|
||||
sim/ See sim/MAINTAINERS
|
||||
|
||||
readline/ Master version: ftp://ftp.cwru.edu/pub/bash/
|
||||
Elena Zannoni ezannoni@redhat.com
|
||||
Host maintainers (host dependant parts)
|
||||
(but get your changes into the master version)
|
||||
|
||||
tcl/ tk/ itcl/ Ian Roxborough irox@redhat.com
|
||||
|
||||
Write After Approval
|
||||
(alphabetic)
|
||||
|
||||
To get recommended for the Write After Approval list you need a valid
|
||||
FSF assignment and have submitted one good patch.
|
||||
|
||||
David Anderson davea@sgi.com
|
||||
Philip Blundell philb@gnu.org
|
||||
Joel Brobecker brobecker@act-europe.fr
|
||||
Nick Clifton nickc@redhat.com
|
||||
Chris G. Demetriou cgd@broadcom.com
|
||||
Klee Dienes kdienes@apple.com
|
||||
Richard Earnshaw rearnsha@arm.com
|
||||
Matthew Green mrg@eterna.com.au
|
||||
Orjan Friberg orjanf@axis.com
|
||||
Ben Harris bjh21@netbsd.org
|
||||
Paul Hilfinger hilfinger@gnat.com
|
||||
Matt Hiller hiller@redhat.com
|
||||
Kazu Hirata kazu@hxi.com
|
||||
Jeff Holcomb jeffh@redhat.com
|
||||
Don Howard dhoward@redhat.com
|
||||
Martin Hunt hunt@redhat.com
|
||||
Jim Ingham jingham@apple.com
|
||||
Daniel Jacobowitz dan@debian.org
|
||||
Andreas Jaeger aj@suse.de
|
||||
Geoff Keating geoffk@redhat.com
|
||||
Jim Kingdon jkingdon@engr.sgi.com ++
|
||||
Jonathan Larmour jlarmour@redhat.co.uk
|
||||
H.J. Lu hjl@lucon.org
|
||||
Glen McCready gkm@redhat.com
|
||||
Greg McGary greg@mcgary.org
|
||||
Jason Merrill jason@redhat.com
|
||||
Jason Molenda jmolenda@apple.com
|
||||
Pierre Muller muller@sources.redhat.com
|
||||
Alexandre Oliva aoliva@redhat.com
|
||||
Tom Rix trix@redhat.com
|
||||
Theodore A. Roth troth@verinet.com
|
||||
Mark Salter msalter@redhat.com
|
||||
Andreas Schwab schwab@suse.de
|
||||
Keith Seitz keiths@redhat.com
|
||||
Jiri Smid smid@suse.cz
|
||||
David Smith dsmith@redhat.com
|
||||
Stephen P. Smith ischis2@home.com
|
||||
Jackie Smith Cashion jsmith@redhat.com
|
||||
Petr Sorfa petrs@caldera.com
|
||||
Gary Thomas gthomas@redhat.com
|
||||
Jason Thorpe thorpej@wasabisystems.com
|
||||
Tom Tromey tromey@redhat.com
|
||||
Corinna Vinschen vinschen@redhat.com
|
||||
Keith Walker keith.walker@arm.com
|
||||
|
||||
|
||||
|
||||
Past Maintainers
|
||||
|
||||
Jimmy Guo (gdb.hp, tui) guo at cup dot hp dot com
|
||||
Jeff Law (hppa) law at cygnus dot com
|
||||
Daniel Berlin (C++ support) dan at cgsoftware dot com
|
||||
Nick Duffek (powerpc, SCO, Sol/x86) nick at duffek dot com
|
||||
David Taylor (d10v, sparc, utils, defs,
|
||||
expression evaluator, language support) taylor at candd dot org
|
||||
J.T. Conklin (dcache, NetBSD, remote) jtc at redback dot com
|
||||
Frank Ch. Eigler (sim) fche at redhat dot com
|
||||
|
||||
|
||||
|
||||
Folks that have been caught up in a paper trail:
|
||||
|
||||
Jim Kingdon jkingdon@engr.sgi.com
|
||||
|
||||
--
|
||||
|
||||
(*) Indicates folks that don't have a Kerberos/SSH account in the GDB
|
||||
group.
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,13 +1,465 @@
|
|||
What has changed in GDB?
|
||||
(Organized release by release)
|
||||
|
||||
*** Changes since GDB 5.2:
|
||||
|
||||
* New targets.
|
||||
|
||||
Atmel AVR avr*-*-*
|
||||
|
||||
* Bug fixes
|
||||
|
||||
gdb/182: gdb/323: gdb/237: On alpha, gdb was reporting:
|
||||
mdebugread.c:2443: gdb-internal-error: sect_index_data not initialized
|
||||
Fix, by Joel Brobecker imported from mainline.
|
||||
|
||||
gdb/439: gdb/291: On some ELF object files, gdb was reporting:
|
||||
dwarf2read.c:1072: gdb-internal-error: sect_index_text not initialize
|
||||
Fix, by Fred Fish, imported from mainline.
|
||||
|
||||
*** Changes in GDB 5.2:
|
||||
|
||||
* New command "set trust-readonly-sections on[off]".
|
||||
|
||||
This command is a hint that tells gdb that read-only sections
|
||||
really are read-only (ie. that their contents will not change).
|
||||
In this mode, gdb will go to the object file rather than the
|
||||
target to read memory from read-only sections (such as ".text").
|
||||
This can be a significant performance improvement on some
|
||||
(notably embedded) targets.
|
||||
|
||||
* New command "generate-core-file" (or "gcore").
|
||||
|
||||
This new gdb command allows the user to drop a core file of the child
|
||||
process state at any time. So far it's been implemented only for
|
||||
GNU/Linux and Solaris, but should be relatively easily ported to other
|
||||
hosts. Argument is core file name (defaults to core.<pid>).
|
||||
|
||||
* New command line option
|
||||
|
||||
GDB now accepts --pid or -p followed by a process id.
|
||||
|
||||
* Change in command line behavior -- corefiles vs. process ids.
|
||||
|
||||
There is a subtle behavior in the way in which GDB handles
|
||||
command line arguments. The first non-flag argument is always
|
||||
a program to debug, but the second non-flag argument may either
|
||||
be a corefile or a process id. Previously, GDB would attempt to
|
||||
open the second argument as a corefile, and if that failed, would
|
||||
issue a superfluous error message and then attempt to attach it as
|
||||
a process. Now, if the second argument begins with a non-digit,
|
||||
it will be treated as a corefile. If it begins with a digit,
|
||||
GDB will attempt to attach it as a process, and if no such process
|
||||
is found, will then attempt to open it as a corefile.
|
||||
|
||||
* Changes in ARM configurations.
|
||||
|
||||
Multi-arch support is enabled for all ARM configurations. The ARM/NetBSD
|
||||
configuration is fully multi-arch.
|
||||
|
||||
* New native configurations
|
||||
|
||||
ARM NetBSD arm*-*-netbsd*
|
||||
x86 OpenBSD i[3456]86-*-openbsd*
|
||||
AMD x86-64 running GNU/Linux x86_64-*-linux-*
|
||||
Sparc64 running FreeBSD sparc64-*-freebsd*
|
||||
|
||||
* New targets
|
||||
|
||||
Sanyo XStormy16 xstormy16-elf
|
||||
|
||||
* OBSOLETE configurations and files
|
||||
|
||||
Configurations that have been declared obsolete in this release have
|
||||
been commented out. Unless there is activity to revive these
|
||||
configurations, the next release of GDB will have their sources
|
||||
permanently REMOVED.
|
||||
|
||||
AMD 29k family via UDI a29k-amd-udi, udi29k
|
||||
A29K VxWorks a29k-*-vxworks
|
||||
AMD 29000 embedded, using EBMON a29k-none-none
|
||||
AMD 29000 embedded with COFF a29k-none-coff
|
||||
AMD 29000 embedded with a.out a29k-none-aout
|
||||
|
||||
testsuite/gdb.hp/gdb.threads-hp/ directory
|
||||
|
||||
* REMOVED configurations and files
|
||||
|
||||
TI TMS320C80 tic80-*-*
|
||||
WDC 65816 w65-*-*
|
||||
PowerPC Solaris powerpcle-*-solaris*
|
||||
PowerPC Windows NT powerpcle-*-cygwin32
|
||||
PowerPC Netware powerpc-*-netware*
|
||||
Harris/CXUX m88k m88*-harris-cxux*
|
||||
Most ns32k hosts and targets ns32k-*-mach3* ns32k-umax-*
|
||||
ns32k-utek-sysv* ns32k-utek-*
|
||||
SunOS 4.0.Xi on i386 i[3456]86-*-sunos*
|
||||
Ultracomputer (29K) running Sym1 a29k-nyu-sym1 a29k-*-kern*
|
||||
Sony NEWS (68K) running NEWSOS 3.x m68*-sony-sysv news
|
||||
ISI Optimum V (3.05) under 4.3bsd. m68*-isi-*
|
||||
Apple Macintosh (MPW) host and target N/A host, powerpc-*-macos*
|
||||
|
||||
* Changes to command line processing
|
||||
|
||||
The new `--args' feature can be used to specify command-line arguments
|
||||
for the inferior from gdb's command line.
|
||||
|
||||
* Changes to key bindings
|
||||
|
||||
There is a new `operate-and-get-next' function bound to `C-o'.
|
||||
|
||||
*** Changes in GDB 5.1.1
|
||||
|
||||
Fix compile problem on DJGPP.
|
||||
|
||||
Fix a problem with floating-point registers on the i386 being
|
||||
corrupted.
|
||||
|
||||
Fix to stop GDB crashing on .debug_str debug info.
|
||||
|
||||
Numerous documentation fixes.
|
||||
|
||||
Numerous testsuite fixes.
|
||||
|
||||
*** Changes in GDB 5.1:
|
||||
|
||||
* New native configurations
|
||||
|
||||
Alpha FreeBSD alpha*-*-freebsd*
|
||||
x86 FreeBSD 3.x and 4.x i[3456]86*-freebsd[34]*
|
||||
MIPS GNU/Linux mips*-*-linux*
|
||||
MIPS SGI Irix 6.x mips*-sgi-irix6*
|
||||
ia64 AIX ia64-*-aix*
|
||||
s390 and s390x GNU/Linux {s390,s390x}-*-linux*
|
||||
|
||||
* New targets
|
||||
|
||||
Motorola 68HC11 and 68HC12 m68hc11-elf
|
||||
CRIS cris-axis
|
||||
UltraSparc running GNU/Linux sparc64-*-linux*
|
||||
|
||||
* OBSOLETE configurations and files
|
||||
|
||||
x86 FreeBSD before 2.2 i[3456]86*-freebsd{1,2.[01]}*,
|
||||
Harris/CXUX m88k m88*-harris-cxux*
|
||||
Most ns32k hosts and targets ns32k-*-mach3* ns32k-umax-*
|
||||
ns32k-utek-sysv* ns32k-utek-*
|
||||
TI TMS320C80 tic80-*-*
|
||||
WDC 65816 w65-*-*
|
||||
Ultracomputer (29K) running Sym1 a29k-nyu-sym1 a29k-*-kern*
|
||||
PowerPC Solaris powerpcle-*-solaris*
|
||||
PowerPC Windows NT powerpcle-*-cygwin32
|
||||
PowerPC Netware powerpc-*-netware*
|
||||
SunOS 4.0.Xi on i386 i[3456]86-*-sunos*
|
||||
Sony NEWS (68K) running NEWSOS 3.x m68*-sony-sysv news
|
||||
ISI Optimum V (3.05) under 4.3bsd. m68*-isi-*
|
||||
Apple Macintosh (MPW) host N/A
|
||||
|
||||
stuff.c (Program to stuff files into a specially prepared space in kdb)
|
||||
kdb-start.c (Main loop for the standalone kernel debugger)
|
||||
|
||||
Configurations that have been declared obsolete in this release have
|
||||
been commented out. Unless there is activity to revive these
|
||||
configurations, the next release of GDB will have their sources
|
||||
permanently REMOVED.
|
||||
|
||||
* REMOVED configurations and files
|
||||
|
||||
Altos 3068 m68*-altos-*
|
||||
Convex c1-*-*, c2-*-*
|
||||
Pyramid pyramid-*-*
|
||||
ARM RISCix arm-*-* (as host)
|
||||
Tahoe tahoe-*-*
|
||||
ser-ocd.c *-*-*
|
||||
|
||||
* GDB has been converted to ISO C.
|
||||
|
||||
GDB's source code has been converted to ISO C. In particular, the
|
||||
sources are fully protoized, and rely on standard headers being
|
||||
present.
|
||||
|
||||
* Other news:
|
||||
|
||||
* "info symbol" works on platforms which use COFF, ECOFF, XCOFF, and NLM.
|
||||
|
||||
* The MI enabled by default.
|
||||
|
||||
The new machine oriented interface (MI) introduced in GDB 5.0 has been
|
||||
revised and enabled by default. Packages which use GDB as a debugging
|
||||
engine behind a UI or another front end are encouraged to switch to
|
||||
using the GDB/MI interface, instead of the old annotations interface
|
||||
which is now deprecated.
|
||||
|
||||
* Support for debugging Pascal programs.
|
||||
|
||||
GDB now includes support for debugging Pascal programs. The following
|
||||
main features are supported:
|
||||
|
||||
- Pascal-specific data types such as sets;
|
||||
|
||||
- automatic recognition of Pascal sources based on file-name
|
||||
extension;
|
||||
|
||||
- Pascal-style display of data types, variables, and functions;
|
||||
|
||||
- a Pascal expression parser.
|
||||
|
||||
However, some important features are not yet supported.
|
||||
|
||||
- Pascal string operations are not supported at all;
|
||||
|
||||
- there are some problems with boolean types;
|
||||
|
||||
- Pascal type hexadecimal constants are not supported
|
||||
because they conflict with the internal variables format;
|
||||
|
||||
- support for Pascal objects and classes is not full yet;
|
||||
|
||||
- unlike Pascal, GDB is case-sensitive for symbol names.
|
||||
|
||||
* Changes in completion.
|
||||
|
||||
Commands such as `shell', `run' and `set args', which pass arguments
|
||||
to inferior programs, now complete on file names, similar to what
|
||||
users expect at the shell prompt.
|
||||
|
||||
Commands which accept locations, such as `disassemble', `print',
|
||||
`breakpoint', `until', etc. now complete on filenames as well as
|
||||
program symbols. Thus, if you type "break foob TAB", and the source
|
||||
files linked into the programs include `foobar.c', that file name will
|
||||
be one of the candidates for completion. However, file names are not
|
||||
considered for completion after you typed a colon that delimits a file
|
||||
name from a name of a function in that file, as in "break foo.c:bar".
|
||||
|
||||
`set demangle-style' completes on available demangling styles.
|
||||
|
||||
* New platform-independent commands:
|
||||
|
||||
It is now possible to define a post-hook for a command as well as a
|
||||
hook that runs before the command. For more details, see the
|
||||
documentation of `hookpost' in the GDB manual.
|
||||
|
||||
* Changes in GNU/Linux native debugging.
|
||||
|
||||
Support for debugging multi-threaded programs has been completely
|
||||
revised for all platforms except m68k and sparc. You can now debug as
|
||||
many threads as your system allows you to have.
|
||||
|
||||
Attach/detach is supported for multi-threaded programs.
|
||||
|
||||
Support for SSE registers was added for x86. This doesn't work for
|
||||
multi-threaded programs though.
|
||||
|
||||
* Changes in MIPS configurations.
|
||||
|
||||
Multi-arch support is enabled for all MIPS configurations.
|
||||
|
||||
GDB can now be built as native debugger on SGI Irix 6.x systems for
|
||||
debugging n32 executables. (Debugging 64-bit executables is not yet
|
||||
supported.)
|
||||
|
||||
* Unified support for hardware watchpoints in all x86 configurations.
|
||||
|
||||
Most (if not all) native x86 configurations support hardware-assisted
|
||||
breakpoints and watchpoints in a unified manner. This support
|
||||
implements debug register sharing between watchpoints, which allows to
|
||||
put a virtually infinite number of watchpoints on the same address,
|
||||
and also supports watching regions up to 16 bytes with several debug
|
||||
registers.
|
||||
|
||||
The new maintenance command `maintenance show-debug-regs' toggles
|
||||
debugging print-outs in functions that insert, remove, and test
|
||||
watchpoints and hardware breakpoints.
|
||||
|
||||
* Changes in the DJGPP native configuration.
|
||||
|
||||
New command ``info dos sysinfo'' displays assorted information about
|
||||
the CPU, OS, memory, and DPMI server.
|
||||
|
||||
New commands ``info dos gdt'', ``info dos ldt'', and ``info dos idt''
|
||||
display information about segment descriptors stored in GDT, LDT, and
|
||||
IDT.
|
||||
|
||||
New commands ``info dos pde'' and ``info dos pte'' display entries
|
||||
from Page Directory and Page Tables (for now works with CWSDPMI only).
|
||||
New command ``info dos address-pte'' displays the Page Table entry for
|
||||
a given linear address.
|
||||
|
||||
GDB can now pass command lines longer than 126 characters to the
|
||||
program being debugged (requires an update to the libdbg.a library
|
||||
which is part of the DJGPP development kit).
|
||||
|
||||
DWARF2 debug info is now supported.
|
||||
|
||||
It is now possible to `step' and `next' through calls to `longjmp'.
|
||||
|
||||
* Changes in documentation.
|
||||
|
||||
All GDB documentation was converted to GFDL, the GNU Free
|
||||
Documentation License.
|
||||
|
||||
Tracepoints-related commands are now fully documented in the GDB
|
||||
manual.
|
||||
|
||||
TUI, the Text-mode User Interface, is now documented in the manual.
|
||||
|
||||
Tracepoints-related commands are now fully documented in the GDB
|
||||
manual.
|
||||
|
||||
The "GDB Internals" manual now has an index. It also includes
|
||||
documentation of `ui_out' functions, GDB coding standards, x86
|
||||
hardware watchpoints, and memory region attributes.
|
||||
|
||||
* GDB's version number moved to ``version.in''
|
||||
|
||||
The Makefile variable VERSION has been replaced by the file
|
||||
``version.in''. People creating GDB distributions should update the
|
||||
contents of this file.
|
||||
|
||||
* gdba.el deleted
|
||||
|
||||
GUD support is now a standard part of the EMACS distribution.
|
||||
|
||||
*** Changes in GDB 5.0:
|
||||
|
||||
* Improved support for debugging FP programs on x86 targets
|
||||
|
||||
Unified and much-improved support for debugging floating-point
|
||||
programs on all x86 targets. In particular, ``info float'' now
|
||||
displays the FP registers in the same format on all x86 targets, with
|
||||
greater level of detail.
|
||||
|
||||
* Improvements and bugfixes in hardware-assisted watchpoints
|
||||
|
||||
It is now possible to watch array elements, struct members, and
|
||||
bitfields with hardware-assisted watchpoints. Data-read watchpoints
|
||||
on x86 targets no longer erroneously trigger when the address is
|
||||
written.
|
||||
|
||||
* Improvements in the native DJGPP version of GDB
|
||||
|
||||
The distribution now includes all the scripts and auxiliary files
|
||||
necessary to build the native DJGPP version on MS-DOS/MS-Windows
|
||||
machines ``out of the box''.
|
||||
|
||||
The DJGPP version can now debug programs that use signals. It is
|
||||
possible to catch signals that happened in the debuggee, deliver
|
||||
signals to it, interrupt it with Ctrl-C, etc. (Previously, a signal
|
||||
would kill the program being debugged.) Programs that hook hardware
|
||||
interrupts (keyboard, timer, etc.) can also be debugged.
|
||||
|
||||
It is now possible to debug DJGPP programs that redirect their
|
||||
standard handles or switch them to raw (as opposed to cooked) mode, or
|
||||
even close them. The command ``run < foo > bar'' works as expected,
|
||||
and ``info terminal'' reports useful information about the debuggee's
|
||||
terminal, including raw/cooked mode, redirection, etc.
|
||||
|
||||
The DJGPP version now uses termios functions for console I/O, which
|
||||
enables debugging graphics programs. Interrupting GDB with Ctrl-C
|
||||
also works.
|
||||
|
||||
DOS-style file names with drive letters are now fully supported by
|
||||
GDB.
|
||||
|
||||
It is now possible to debug DJGPP programs that switch their working
|
||||
directory. It is also possible to rerun the debuggee any number of
|
||||
times without restarting GDB; thus, you can use the same setup,
|
||||
breakpoints, etc. for many debugging sessions.
|
||||
|
||||
* New native configurations
|
||||
|
||||
ARM GNU/Linux arm*-*-linux*
|
||||
PowerPC GNU/Linux powerpc-*-linux*
|
||||
|
||||
* New targets
|
||||
|
||||
Motorola MCore mcore-*-*
|
||||
x86 VxWorks i[3456]86-*-vxworks*
|
||||
PowerPC VxWorks powerpc-*-vxworks*
|
||||
TI TMS320C80 tic80-*-*
|
||||
|
||||
* OBSOLETE configurations
|
||||
|
||||
Altos 3068 m68*-altos-*
|
||||
Convex c1-*-*, c2-*-*
|
||||
Pyramid pyramid-*-*
|
||||
ARM RISCix arm-*-* (as host)
|
||||
Tahoe tahoe-*-*
|
||||
|
||||
Configurations that have been declared obsolete will be commented out,
|
||||
but the code will be left in place. If there is no activity to revive
|
||||
these configurations before the next release of GDB, the sources will
|
||||
be permanently REMOVED.
|
||||
|
||||
* Gould support removed
|
||||
|
||||
Support for the Gould PowerNode and NP1 has been removed.
|
||||
|
||||
* New features for SVR4
|
||||
|
||||
On SVR4 native platforms (such as Solaris), if you attach to a process
|
||||
without first loading a symbol file, GDB will now attempt to locate and
|
||||
load symbols from the running process's executable file.
|
||||
|
||||
* Many C++ enhancements
|
||||
|
||||
C++ support has been greatly improved. Overload resolution now works properly
|
||||
in almost all cases. RTTI support is on the way.
|
||||
|
||||
* Remote targets can connect to a sub-program
|
||||
|
||||
A popen(3) style serial-device has been added. This device starts a
|
||||
sub-process (such as a stand-alone simulator) and then communicates
|
||||
with that. The sub-program to run is specified using the syntax
|
||||
``|<program> <args>'' vis:
|
||||
|
||||
(gdb) set remotedebug 1
|
||||
(gdb) target extended-remote |mn10300-elf-sim program-args
|
||||
|
||||
* MIPS 64 remote protocol
|
||||
|
||||
A long standing bug in the mips64 remote protocol where by GDB
|
||||
expected certain 32 bit registers (ex SR) to be transfered as 32
|
||||
instead of 64 bits has been fixed.
|
||||
|
||||
The command ``set remote-mips64-transfers-32bit-regs on'' has been
|
||||
added to provide backward compatibility with older versions of GDB.
|
||||
|
||||
* ``set remotebinarydownload'' replaced by ``set remote X-packet''
|
||||
|
||||
The command ``set remotebinarydownload'' command has been replaced by
|
||||
``set remote X-packet''. Other commands in ``set remote'' family
|
||||
include ``set remote P-packet''.
|
||||
|
||||
* Breakpoint commands accept ranges.
|
||||
|
||||
The breakpoint commands ``enable'', ``disable'', and ``delete'' now
|
||||
accept a range of breakpoints, e.g. ``5-7''. The tracepoint command
|
||||
``tracepoint passcount'' also accepts a range of tracepoints.
|
||||
|
||||
* ``apropos'' command added.
|
||||
|
||||
The ``apropos'' command searches through command names and
|
||||
documentation strings, printing out matches, making it much easier to
|
||||
try to find a command that does what you are looking for.
|
||||
|
||||
* New MI interface
|
||||
|
||||
A new machine oriented interface (MI) has been added to GDB. This
|
||||
interface is designed for debug environments running GDB as a separate
|
||||
process. This is part of the long term libGDB project. See the
|
||||
"GDB/MI" chapter of the GDB manual for further information. It can be
|
||||
enabled by configuring with:
|
||||
|
||||
.../configure --enable-gdbmi
|
||||
|
||||
*** Changes in GDB-4.18:
|
||||
|
||||
* New native configurations
|
||||
|
||||
HP-UX 10.20 hppa*-*-hpux10.20
|
||||
HP-UX 11.x hppa*-*-hpux11.0*
|
||||
M68K Linux m68*-*-linux*
|
||||
M68K GNU/Linux m68*-*-linux*
|
||||
|
||||
* New targets
|
||||
|
||||
|
|
@ -568,7 +1020,7 @@ breakpoints in shared libraries before the executable is run.
|
|||
There is a new hardware breakpoint for the watch command for sparclite
|
||||
targets. See gdb/sparclite/hw_breakpoint.note.
|
||||
|
||||
Hardware watchpoints are also now supported under Linux.
|
||||
Hardware watchpoints are also now supported under GNU/Linux.
|
||||
|
||||
* Annotations
|
||||
|
||||
|
|
@ -1072,7 +1524,7 @@ read after argv processing.
|
|||
|
||||
Solaris-2.0 !!! sparc-sun-solaris2 or sun4sol2
|
||||
|
||||
Linux support i386-unknown-linux or linux
|
||||
GNU/Linux support i386-unknown-linux or linux
|
||||
|
||||
We are also including code to support the HP/PA running BSD and HPUX. This
|
||||
is almost guaranteed not to work, as we didn't have time to test or build it
|
||||
|
|
|
|||
32
contrib/gdb/gdb/PROBLEMS
Normal file
32
contrib/gdb/gdb/PROBLEMS
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
|
||||
Known problems in GDB 5.2
|
||||
|
||||
See also: http://www.gnu.org/software/gdb/bugs/
|
||||
|
||||
|
||||
hppa2.0-hp-hpux10.20
|
||||
--------------------
|
||||
|
||||
gdb/487: The top level make files used to build GDB are not compatible
|
||||
with HP/UX make. As a workaround, use GNU make.
|
||||
|
||||
gdb/486: The HP/UX C compiler defaults to K&R mode but GDB only builds
|
||||
with an ISO C compiler. The top level configuration incorrectly sets
|
||||
CC to `cc' instead of `cc -Ae'. As a workaround, the correct compiler
|
||||
can be specified as part of the configuration vis:
|
||||
|
||||
$ 'CC=cc -Ae' ./configure
|
||||
|
||||
|
||||
s390*-*-*
|
||||
---------
|
||||
|
||||
gdb/513: GDB does not build on s390 GNU/Linux. The problem should be
|
||||
fixed in more recent sources.
|
||||
|
||||
|
||||
i386-*-freebsd4.4*
|
||||
------------------
|
||||
|
||||
gdb/455: GDB doesn't build on a FreeBSD 4.4-STABLE system. The
|
||||
problem is still being investigated.
|
||||
|
|
@ -1,95 +1,121 @@
|
|||
README for gdb-4.18 release
|
||||
Updated 4 Apr 1999 by Jim Blandy
|
||||
README for gdb-5.2 release
|
||||
Updated 17 April, 2002 by Andrew Cagney
|
||||
|
||||
This is GDB, the GNU source-level debugger.
|
||||
A summary of new features is in the file `NEWS'.
|
||||
|
||||
See the GDB home page at http://www.cygnus.com/gdb/ for up to date
|
||||
release information, mailing list links and archives, etc.
|
||||
A summary of new features is in the file `gdb/NEWS'.
|
||||
|
||||
Check the GDB home page at http://www.gnu.org/software/gdb/ for up to
|
||||
date release information, mailing list links and archives, etc.
|
||||
|
||||
The file `gdb/PROBLEMS' contains information on problems identified
|
||||
late in the release cycle. GDB's bug tracking data base at
|
||||
http://www.gnu.org/software/gdb/bugs/ contains a more complete list of
|
||||
bugs.
|
||||
|
||||
|
||||
Unpacking and Installation -- quick overview
|
||||
==========================
|
||||
|
||||
In this release, the GDB debugger sources, the generic GNU include
|
||||
In this release, the GDB debugger sources, the generic GNU include
|
||||
files, the BFD ("binary file description") library, the readline
|
||||
library, and other libraries all have directories of their own
|
||||
underneath the gdb-4.18 directory. The idea is that a variety of GNU
|
||||
underneath the gdb-5.2 directory. The idea is that a variety of GNU
|
||||
tools can share a common copy of these things. Be aware of variation
|
||||
over time--for example don't try to build gdb with a copy of bfd from
|
||||
a release other than the gdb release (such as a binutils or gas
|
||||
release), especially if the releases are more than a few weeks apart.
|
||||
a release other than the gdb release (such as a binutils release),
|
||||
especially if the releases are more than a few weeks apart.
|
||||
Configuration scripts and makefiles exist to cruise up and down this
|
||||
directory tree and automatically build all the pieces in the right
|
||||
order.
|
||||
|
||||
When you unpack the gdb-4.18.tar.gz file, you'll find a directory
|
||||
called `gdb-4.18', which contains:
|
||||
When you unpack the gdb-5.2.tar.gz file, you'll find a directory
|
||||
called `gdb-5.2', which contains:
|
||||
|
||||
COPYING config.sub* libiberty/ opcodes/
|
||||
COPYING.LIB configure* mmalloc/ readline/
|
||||
Makefile.in configure.in move-if-change* sim/
|
||||
README etc/ mpw-README texinfo/
|
||||
bfd/ gdb/ mpw-build.in utils/
|
||||
config/ include/ mpw-config.in
|
||||
config.guess* install.sh* mpw-configure
|
||||
COPYING config.sub intl missing opcodes
|
||||
COPYING.LIB configure libiberty mkinstalldirs readline
|
||||
Makefile.in configure.in libtool.m4 mmalloc sim
|
||||
README djunpack.bat ltcf-c.sh move-if-change symlink-tree
|
||||
bfd etc ltcf-cxx.sh mpw-README texinfo
|
||||
config gdb ltcf-gcj.sh mpw-build.in utils
|
||||
config-ml.in gettext.m4 ltconfig mpw-config.in ylwrap
|
||||
config.guess include ltmain.sh mpw-configure
|
||||
config.if install-sh md5.sum mpw-install
|
||||
|
||||
To build GDB, you can just do:
|
||||
You can build GDB right in the source directory:
|
||||
|
||||
cd gdb-4.18
|
||||
./configure
|
||||
make
|
||||
cp gdb/gdb /usr/local/bin/gdb (or wherever you want)
|
||||
cd gdb-5.2
|
||||
./configure
|
||||
make
|
||||
cp gdb/gdb /usr/local/bin/gdb (or wherever you want)
|
||||
|
||||
This will configure and build all the libraries as well as GDB.
|
||||
If `configure' can't determine your system type, specify one as its
|
||||
argument, e.g., sun4 or decstation.
|
||||
However, we recommend that an empty directory be used instead.
|
||||
This way you do not clutter your source tree with binary files
|
||||
and will be able to create different builds with different
|
||||
configuration options.
|
||||
|
||||
If you get compiler warnings during this stage, see the `Reporting Bugs'
|
||||
section below; there are a few known problems.
|
||||
You can build GDB in any empty build directory:
|
||||
|
||||
GDB requires an ANSI C compiler. If you do not have an ANSI C
|
||||
compiler for your system, you may be able to download and install the
|
||||
GNU CC compiler. It is available via anonymous FTP from ftp.gnu.org,
|
||||
in /pub/gnu/gcc (as a URL, that's ftp://ftp.gnu.org/pub/gnu/gcc).
|
||||
mkdir build
|
||||
cd build
|
||||
<full path to your sources>/gdb-5.2/configure
|
||||
make
|
||||
cp gdb/gdb /usr/local/bin/gdb (or wherever you want)
|
||||
|
||||
GDB can be used as a cross-debugger, running on a machine of one type
|
||||
while debugging a program running on a machine of another type. See below.
|
||||
(Building GDB with DJGPP tools for MS-DOS/MS-Windows is slightly
|
||||
different; see the file gdb-5.2/gdb/config/djgpp/README for details.)
|
||||
|
||||
This will configure and build all the libraries as well as GDB. If
|
||||
`configure' can't determine your system type, specify one as its
|
||||
argument, e.g., `./configure sun4' or `./configure decstation'.
|
||||
|
||||
If you get compiler errors during this stage, see the `Reporting
|
||||
Bugs' section below; there are a few known problems.
|
||||
|
||||
GDB requires an ISO C (ANSI C) compiler. If you do not have an ISO
|
||||
C compiler for your system, you may be able to download and install
|
||||
the GNU CC compiler. It is available via anonymous FTP from the
|
||||
directory `ftp://ftp.gnu.org/pub/gnu/gcc'.
|
||||
|
||||
GDB can be used as a cross-debugger, running on a machine of one
|
||||
type while debugging a program running on a machine of another type.
|
||||
See below.
|
||||
|
||||
|
||||
More Documentation
|
||||
******************
|
||||
|
||||
All the documentation for GDB comes as part of the machine-readable
|
||||
distribution. The documentation is written in Texinfo format, which is
|
||||
a documentation system that uses a single source file to produce both
|
||||
on-line information and a printed manual. You can use one of the Info
|
||||
formatting commands to create the on-line version of the documentation
|
||||
and TeX (or `texi2roff') to typeset the printed version.
|
||||
distribution. The documentation is written in Texinfo format, which
|
||||
is a documentation system that uses a single source file to produce
|
||||
both on-line information and a printed manual. You can use one of the
|
||||
Info formatting commands to create the on-line version of the
|
||||
documentation and TeX (or `texi2roff') to typeset the printed version.
|
||||
|
||||
GDB includes an already formatted copy of the on-line Info version of
|
||||
this manual in the `gdb/doc' subdirectory. The main Info file is
|
||||
`gdb-4.18/gdb/doc/gdb.info', and it refers to subordinate files matching
|
||||
`gdb.info*' in the same directory. If necessary, you can print out
|
||||
these files, or read them with any editor; but they are easier to read
|
||||
using the `info' subsystem in GNU Emacs or the standalone `info' program,
|
||||
available as part of the GNU Texinfo distribution.
|
||||
GDB includes an already formatted copy of the on-line Info version
|
||||
of this manual in the `gdb/doc' subdirectory. The main Info file is
|
||||
`gdb-5.2/gdb/doc/gdb.info', and it refers to subordinate files
|
||||
matching `gdb.info*' in the same directory. If necessary, you can
|
||||
print out these files, or read them with any editor; but they are
|
||||
easier to read using the `info' subsystem in GNU Emacs or the
|
||||
standalone `info' program, available as part of the GNU Texinfo
|
||||
distribution.
|
||||
|
||||
If you want to format these Info files yourself, you need one of the
|
||||
Info formatting programs, such as `texinfo-format-buffer' or
|
||||
`makeinfo'.
|
||||
|
||||
If you have `makeinfo' installed, and are in the top level GDB
|
||||
source directory (`gdb-4.18', in the case of version 4.18), you can make
|
||||
source directory (`gdb-5.2', in the case of version 5.2), you can make
|
||||
the Info file by typing:
|
||||
|
||||
cd gdb/doc
|
||||
make info
|
||||
cd gdb/doc
|
||||
make info
|
||||
|
||||
If you want to typeset and print copies of this manual, you need
|
||||
TeX, a program to print its DVI output files, and `texinfo.tex', the
|
||||
Texinfo definitions file. This file is included in the GDB
|
||||
distribution, in the directory `gdb-4.18/texinfo'.
|
||||
distribution, in the directory `gdb-5.2/texinfo'.
|
||||
|
||||
TeX is a typesetting program; it does not print files directly, but
|
||||
produces output files called DVI files. To print a typeset document,
|
||||
|
|
@ -103,13 +129,20 @@ without any extension or a `.dvi' extension.
|
|||
This file tells TeX how to typeset a document written in Texinfo
|
||||
format. On its own, TeX cannot read, much less typeset a Texinfo file.
|
||||
`texinfo.tex' is distributed with GDB and is located in the
|
||||
`gdb-4.18/texinfo' directory.
|
||||
`gdb-5.2/texinfo' directory.
|
||||
|
||||
If you have TeX and a DVI printer program installed, you can typeset
|
||||
and print this manual. First switch to the the `gdb' subdirectory of
|
||||
the main source directory (for example, to `gdb-4.18/gdb') and then type:
|
||||
the main source directory (for example, to `gdb-5.2/gdb') and then type:
|
||||
|
||||
make gdb.dvi
|
||||
make doc/gdb.dvi
|
||||
|
||||
If you prefer to have the manual in PDF format, type this from the
|
||||
`gdb/doc' subdirectory of the main source directory:
|
||||
|
||||
make gdb.pdf
|
||||
|
||||
For this to work, you will need the PDFTeX package to be installed.
|
||||
|
||||
|
||||
Installing GDB
|
||||
|
|
@ -123,68 +156,73 @@ preparing GDB for installation; you can then use `make' to build the
|
|||
a single directory, whose name is usually composed by appending the
|
||||
version number to `gdb'.
|
||||
|
||||
For example, the GDB version 4.18 distribution is in the `gdb-4.18'
|
||||
For example, the GDB version 5.2 distribution is in the `gdb-5.2'
|
||||
directory. That directory contains:
|
||||
|
||||
`gdb-4.18/{COPYING,COPYING.LIB}'
|
||||
`gdb-5.2/{COPYING,COPYING.LIB}'
|
||||
Standard GNU license files. Please read them.
|
||||
|
||||
`gdb-4.18/bfd'
|
||||
`gdb-5.2/bfd'
|
||||
source for the Binary File Descriptor library
|
||||
|
||||
`gdb-4.18/config*'
|
||||
`gdb-5.2/config*'
|
||||
script for configuring GDB, along with other support files
|
||||
|
||||
`gdb-4.18/gdb'
|
||||
`gdb-5.2/gdb'
|
||||
the source specific to GDB itself
|
||||
|
||||
`gdb-4.18/include'
|
||||
`gdb-5.2/include'
|
||||
GNU include files
|
||||
|
||||
`gdb-4.18/libiberty'
|
||||
`gdb-5.2/libiberty'
|
||||
source for the `-liberty' free software library
|
||||
|
||||
`gdb-4.18/mmalloc'
|
||||
`gdb-5.2/mmalloc'
|
||||
source for the GNU memory-mapped malloc package
|
||||
|
||||
`gdb-4.18/opcodes'
|
||||
`gdb-5.2/opcodes'
|
||||
source for the library of opcode tables and disassemblers
|
||||
|
||||
`gdb-4.18/readline'
|
||||
`gdb-5.2/readline'
|
||||
source for the GNU command-line interface
|
||||
NOTE: The readline library is compiled for use by GDB, but will
|
||||
not be installed on your system when "make install" is issued.
|
||||
|
||||
`gdb-4.18/sim'
|
||||
`gdb-5.2/sim'
|
||||
source for some simulators (ARM, D10V, SPARC, M32R, MIPS, PPC, V850, etc)
|
||||
|
||||
`gdb-4.18/intl'
|
||||
`gdb-5.2/intl'
|
||||
source for the GNU gettext library, for internationalization.
|
||||
This is slightly modified from the standalone gettext
|
||||
distribution you can get from GNU.
|
||||
|
||||
`gdb-4.18/texinfo'
|
||||
`gdb-5.2/texinfo'
|
||||
The `texinfo.tex' file, which you need in order to make a printed
|
||||
manual using TeX.
|
||||
|
||||
`gdb-4.18/etc'
|
||||
`gdb-5.2/etc'
|
||||
Coding standards, useful files for editing GDB, and other
|
||||
miscellanea.
|
||||
|
||||
`gdb-4.18/utils'
|
||||
`gdb-5.2/utils'
|
||||
A grab bag of random utilities.
|
||||
|
||||
Note: the following instructions are for building GDB on Unix or
|
||||
Unix-like systems. Instructions for building with DJGPP for
|
||||
MS-DOS/MS-Windows are in the file gdb/config/djgpp/README.
|
||||
|
||||
The simplest way to configure and build GDB is to run `configure'
|
||||
from the `gdb-VERSION-NUMBER' source directory, which in this example
|
||||
is the `gdb-4.18' directory.
|
||||
is the `gdb-5.2' directory.
|
||||
|
||||
First switch to the `gdb-VERSION-NUMBER' source directory if you are
|
||||
not already in it; then run `configure'.
|
||||
|
||||
For example:
|
||||
|
||||
cd gdb-4.18
|
||||
./configure
|
||||
make
|
||||
cd gdb-5.2
|
||||
./configure
|
||||
make
|
||||
|
||||
Running `configure' followed by `make' builds the `bfd',
|
||||
`readline', `mmalloc', and `libiberty' libraries, then `gdb' itself.
|
||||
|
|
@ -195,11 +233,11 @@ corresponding source directories.
|
|||
does not recognize this automatically when you run a different shell,
|
||||
you may need to run `sh' on it explicitly:
|
||||
|
||||
sh configure
|
||||
sh configure
|
||||
|
||||
If you run `configure' from a directory that contains source
|
||||
directories for multiple libraries or programs, such as the `gdb-4.18'
|
||||
source directory for version 4.18, `configure' creates configuration
|
||||
directories for multiple libraries or programs, such as the `gdb-5.2'
|
||||
source directory for version 5.2, `configure' creates configuration
|
||||
files for every directory level underneath (unless you tell it not to,
|
||||
with the `--norecursion' option).
|
||||
|
||||
|
|
@ -207,11 +245,11 @@ with the `--norecursion' option).
|
|||
directories in the GDB distribution, if you only want to configure that
|
||||
subdirectory; but be sure to specify a path to it.
|
||||
|
||||
For example, with version 4.18, type the following to configure only
|
||||
For example, with version 5.2, type the following to configure only
|
||||
the `bfd' subdirectory:
|
||||
|
||||
cd gdb-4.18/bfd
|
||||
../configure
|
||||
cd gdb-5.2/bfd
|
||||
../configure
|
||||
|
||||
You can install `gdb' anywhere; it has no hardwired paths. However,
|
||||
you should make sure that the shell on your path (named by the `SHELL'
|
||||
|
|
@ -239,13 +277,13 @@ directory. If the path to `configure' would be the same as the
|
|||
argument to `--srcdir', you can leave out the `--srcdir' option; it
|
||||
will be assumed.)
|
||||
|
||||
For example, with version 4.18, you can build GDB in a separate
|
||||
For example, with version 5.2, you can build GDB in a separate
|
||||
directory for a Sun 4 like this:
|
||||
|
||||
cd gdb-4.18
|
||||
cd gdb-5.2
|
||||
mkdir ../gdb-sun4
|
||||
cd ../gdb-sun4
|
||||
../gdb-4.18/configure sun4
|
||||
../gdb-5.2/configure
|
||||
make
|
||||
|
||||
When `configure' builds a configuration using a remote source
|
||||
|
|
@ -266,8 +304,8 @@ called `configure' (or one of its subdirectories).
|
|||
|
||||
The `Makefile' that `configure' generates in each source directory
|
||||
also runs recursively. If you type `make' in a source directory such
|
||||
as `gdb-4.18' (or in a separate configured directory configured with
|
||||
`--srcdir=PATH/gdb-4.18'), you will build all the required libraries,
|
||||
as `gdb-5.2' (or in a separate configured directory configured with
|
||||
`--srcdir=PATH/gdb-5.2'), you will build all the required libraries,
|
||||
and then build GDB.
|
||||
|
||||
When you have multiple hosts or targets configured in separate
|
||||
|
|
@ -310,7 +348,7 @@ you can use it to test your guesses on abbreviations--for example:
|
|||
Invalid configuration `i786v': machine `i786v' not recognized
|
||||
|
||||
`config.sub' is also distributed in the GDB source directory
|
||||
(`gdb-4.18', for version 4.18).
|
||||
(`gdb-5.2', for version 5.2).
|
||||
|
||||
|
||||
`configure' options
|
||||
|
|
@ -364,11 +402,13 @@ prefer; but you may abbreviate option names if you use `--'.
|
|||
code which looks even vaguely suspicious. You should only using
|
||||
this feature if you're compiling with GNU CC. It passes the
|
||||
following flags:
|
||||
-Wall
|
||||
-Wimplicit
|
||||
-Wreturn-type
|
||||
-Wcomment
|
||||
-Wtrigraphs
|
||||
-Wformat
|
||||
-Wparentheses
|
||||
-Wpointer-arith
|
||||
-Wstrict-prototypes
|
||||
-Wmissing-prototypes
|
||||
-Wmissing-declarations
|
||||
|
||||
`--target=TARGET'
|
||||
Configure GDB for cross-debugging programs running on the specified
|
||||
|
|
@ -393,41 +433,25 @@ other GNU tools recursively; but these are the only options that affect
|
|||
GDB or its supporting libraries.
|
||||
|
||||
|
||||
Languages other than C
|
||||
=======================
|
||||
|
||||
See the GDB manual (gdb/doc/gdb.texinfo) for information on this.
|
||||
|
||||
|
||||
Kernel debugging
|
||||
=================
|
||||
|
||||
I have't done this myself so I can't really offer any advice.
|
||||
Remote debugging over serial lines works fine, but the kernel debugging
|
||||
code in here has not been tested in years. Van Jacobson has
|
||||
better kernel debugging, but the UC lawyers won't let FSF have it.
|
||||
|
||||
|
||||
Remote debugging
|
||||
=================
|
||||
|
||||
The files m68k-stub.c, i386-stub.c, and sparc-stub.c are examples of
|
||||
remote stubs to be used with remote.c. They are designed to run
|
||||
standalone on an m68k, i386, or SPARC cpu and communicate properly with
|
||||
the remote.c stub over a serial line.
|
||||
The files m68k-stub.c, i386-stub.c, and sparc-stub.c are examples
|
||||
of remote stubs to be used with remote.c. They are designed to run
|
||||
standalone on an m68k, i386, or SPARC cpu and communicate properly
|
||||
with the remote.c stub over a serial line.
|
||||
|
||||
The directory gdb/gdbserver/ contains `gdbserver', a program that
|
||||
The directory gdb/gdbserver/ contains `gdbserver', a program that
|
||||
allows remote debugging for Unix applications. gdbserver is only
|
||||
supported for some native configurations, including Sun 3, Sun 4,
|
||||
and Linux.
|
||||
supported for some native configurations, including Sun 3, Sun 4, and
|
||||
Linux.
|
||||
|
||||
There are a number of remote interfaces for talking to existing ROM
|
||||
There are a number of remote interfaces for talking to existing ROM
|
||||
monitors and other hardware:
|
||||
|
||||
remote-adapt.c AMD 29000 "Adapt"
|
||||
remote-array.c Array Tech RAID controller
|
||||
remote-bug.c Motorola BUG monitor
|
||||
remote-d10v.c GDB protocol, talking to a d10v chip
|
||||
remote-e7000.c Hitachi E7000 ICE
|
||||
remote-eb.c AMD 29000 "EBMON"
|
||||
remote-es.c Ericsson 1800 monitor
|
||||
|
|
@ -446,138 +470,67 @@ monitors and other hardware:
|
|||
remote-udi.c AMD 29000 using the AMD "Universal Debug Interface"
|
||||
remote-vx.c VxWorks realtime kernel
|
||||
|
||||
Remote-vx.c and the vx-share subdirectory contain a remote interface for the
|
||||
VxWorks realtime kernel, which communicates over TCP using the Sun
|
||||
RPC library. This would be a useful starting point for other remote-
|
||||
via-ethernet back ends.
|
||||
Remote-vx.c and the vx-share subdirectory contain a remote
|
||||
interface for the VxWorks realtime kernel, which communicates over TCP
|
||||
using the Sun RPC library. This would be a useful starting point for
|
||||
other remote- via-ethernet back ends.
|
||||
|
||||
Remote-udi.c and the 29k-share subdirectory contain a remote interface
|
||||
for AMD 29000 programs, which uses the AMD "Universal Debug Interface".
|
||||
This allows GDB to talk to software simulators, emulators, and/or bare
|
||||
hardware boards, via network or serial interfaces. Note that GDB only
|
||||
provides an interface that speaks UDI, not a complete solution. You
|
||||
will need something on the other end that also speaks UDI.
|
||||
Remote-udi.c and the 29k-share subdirectory contain a remote
|
||||
interface for AMD 29000 programs, which uses the AMD "Universal Debug
|
||||
Interface". This allows GDB to talk to software simulators,
|
||||
emulators, and/or bare hardware boards, via network or serial
|
||||
interfaces. Note that GDB only provides an interface that speaks UDI,
|
||||
not a complete solution. You will need something on the other end
|
||||
that also speaks UDI.
|
||||
|
||||
|
||||
Reporting Bugs
|
||||
===============
|
||||
|
||||
The correct address for reporting bugs found in gdb is
|
||||
"bug-gdb@gnu.org". Please email all bugs, and all requests for
|
||||
help with GDB, to that address. Please include the GDB version number
|
||||
(e.g., gdb-4.18), and how you configured it (e.g., "sun4" or "mach386
|
||||
host, i586-intel-synopsys target"). Since GDB now supports so many
|
||||
different configurations, it is important that you be precise about this.
|
||||
If at all possible, you should include the actual banner that GDB prints
|
||||
when it starts up, or failing that, the actual configure command that
|
||||
you used when configuring GDB.
|
||||
|
||||
For more information on how/whether to report bugs, see the GDB Bugs
|
||||
section of the GDB manual (gdb/doc/gdb.texinfo).
|
||||
|
||||
Known bugs:
|
||||
|
||||
* Under Ultrix 4.2 (DECstation-3100) or Alphas under OSF/1, we have
|
||||
seen problems with backtraces after interrupting the inferior out
|
||||
of a read(). The problem is caused by ptrace() returning an
|
||||
incorrect value for the frame pointer register (register 15 or
|
||||
30). As far as we can tell, this is a kernel problem. Any help
|
||||
with this would be greatly appreciated.
|
||||
|
||||
* Under Ultrix 4.4 (DECstation-3100), setting the TERMCAP environment
|
||||
variable to a string without a trailing ':' can cause GDB to dump
|
||||
core upon startup. Although the core file makes it look as though
|
||||
GDB code failed, the crash actually occurs within a call to the
|
||||
termcap library function tgetent(). The problem can be solved by
|
||||
using the GNU Termcap library.
|
||||
|
||||
Alphas running OSF/1 (versions 1.0 through 2.1) have the same buggy
|
||||
termcap code, but GDB behaves strangely rather than crashing.
|
||||
|
||||
* On DECstations there are warnings about shift counts out of range in
|
||||
various BFD modules. None of them is a cause for alarm, they are actually
|
||||
a result of bugs in the DECstation compiler.
|
||||
|
||||
* Notes for the DEC Alpha using OSF/1:
|
||||
The debugging output of native cc has two known problems; we view these
|
||||
as compiler bugs.
|
||||
The linker miscompacts symbol tables, which causes gdb to confuse the
|
||||
type of variables or results in `struct <illegal>' type outputs.
|
||||
dbx has the same problems with those executables. A workaround is to
|
||||
specify -Wl,-b when linking, but that will increase the executable size
|
||||
considerably.
|
||||
If a structure has incomplete type in one file (e.g., "struct foo *"
|
||||
without a definition for "struct foo"), gdb will be unable to find the
|
||||
structure definition from another file.
|
||||
It has been reported that the Ultrix 4.3A compiler on decstations has the
|
||||
same problems.
|
||||
|
||||
* Notes for Solaris 2.x, using the SPARCworks cc compiler:
|
||||
You have to compile your program with the -xs option of the SPARCworks
|
||||
compiler to be able to debug your program with gdb.
|
||||
Under Solaris 2.3 you also need patch 101409-03 (Jumbo linker patch).
|
||||
Under Solaris 2.2, if you have patch 101052 installed, make sure
|
||||
that it is at least at revision 101052-06.
|
||||
|
||||
* Under Irix 5 for SGIs, you must have installed the `compiler_dev.hdr'
|
||||
subsystem that is on the IDO CD, otherwise you will get complaints
|
||||
that certain files such as `/usr/include/syms.h' cannot be found.
|
||||
|
||||
* Notes for BSD/386:
|
||||
To compile gdb-4.18 on BSD/386, you must run the configure script and
|
||||
its subscripts with bash. Here is an easy way to do this:
|
||||
|
||||
bash -c 'CONFIG_SHELL=/bin/bash ./configure'
|
||||
|
||||
(configure will report i386-unknown-bsd). Then, compile with the
|
||||
standard "make" command.
|
||||
|
||||
GDB can produce warnings about symbols that it does not understand. By
|
||||
default, these warnings are disabled. You can enable them by executing
|
||||
`set complaint 10' (which you can put in your ~/.gdbinit if you like).
|
||||
I recommend doing this if you are working on a compiler, assembler,
|
||||
linker, or GDB, since it will point out problems that you may be able
|
||||
to fix. Warnings produced during symbol reading indicate some mismatch
|
||||
between the object file and GDB's symbol reading code. In many cases,
|
||||
it's a mismatch between the specs for the object file format, and what
|
||||
the compiler actually outputs or the debugger actually understands.
|
||||
|
||||
|
||||
X Windows versus GDB
|
||||
Reporting Bugs in GDB
|
||||
=====================
|
||||
|
||||
You should check out DDD, the Data Display Debugger. Here's the blurb
|
||||
from the DDD web site, http://www.cs.tu-bs.de/softech/ddd:
|
||||
There are several ways of reporting bugs in GDB. The prefered
|
||||
method is to use the World Wide Web:
|
||||
|
||||
The Data Display Debugger (DDD) is a popular graphical user
|
||||
interface for command-line debuggers such as GDB, DBX, JDB, WDB,
|
||||
XDB, the Perl debugger, and the Python debugger. Besides ``usual''
|
||||
front-end features such as viewing source texts, DDD has become
|
||||
famous through its interactive graphical data display, where data
|
||||
structures are displayed as graphs. A simple mouse click
|
||||
dereferences pointers or views structure contents, updated each
|
||||
time the program stops. Using DDD, you can reason about your
|
||||
application by watching its data, not just by viewing it execute
|
||||
lines of source code.
|
||||
http://www.gnu.org/software/gdb/bugs/
|
||||
|
||||
Emacs users will very likely enjoy the Grand Unified Debugger mode;
|
||||
As an alternative, the bug report can be submitted, via e-mail, to the
|
||||
address "bug-gdb@gnu.org".
|
||||
|
||||
When submitting a bug, please include the GDB version number (e.g.,
|
||||
gdb-5.2), and how you configured it (e.g., "sun4" or "mach386 host,
|
||||
i586-intel-synopsys target"). Since GDB now supports so many
|
||||
different configurations, it is important that you be precise about
|
||||
this. If at all possible, you should include the actual banner that
|
||||
GDB prints when it starts up, or failing that, the actual configure
|
||||
command that you used when configuring GDB.
|
||||
|
||||
For more information on how/whether to report bugs, see the
|
||||
Reporting Bugs chapter of the GDB manual (gdb/doc/gdb.texinfo).
|
||||
|
||||
|
||||
Graphical interface to GDB -- X Windows, MS Windows
|
||||
==========================
|
||||
|
||||
Several graphical interfaces to GDB are available. You should
|
||||
check:
|
||||
|
||||
http://www.gnu.org/software/gdb/gui/
|
||||
|
||||
for an up-to-date list.
|
||||
|
||||
Emacs users will very likely enjoy the Grand Unified Debugger mode;
|
||||
try typing `M-x gdb RET'.
|
||||
|
||||
Those interested in experimenting with a new kind of gdb-mode
|
||||
should load gdb/gdba.el into GNU Emacs 19.25 or later. Comments
|
||||
on this mode are also welcome.
|
||||
|
||||
|
||||
Writing Code for GDB
|
||||
=====================
|
||||
|
||||
There is a lot of information about writing code for GDB in the
|
||||
There is a lot of information about writing code for GDB in the
|
||||
internals manual, distributed with GDB in gdb/doc/gdbint.texinfo. You
|
||||
can read it by hand, print it by using TeX and texinfo, or process it
|
||||
into an `info' file for use with Emacs' info mode or the standalone
|
||||
`info' program.
|
||||
|
||||
If you are pondering writing anything but a short patch, especially
|
||||
If you are pondering writing anything but a short patch, especially
|
||||
take note of the information about copyrights in the node Submitting
|
||||
Patches. It can take quite a while to get all the paperwork done, so
|
||||
we encourage you to start that process as soon as you decide you are
|
||||
|
|
@ -588,26 +541,33 @@ think you will be ready to submit the patches.
|
|||
GDB Testsuite
|
||||
=============
|
||||
|
||||
There is a DejaGNU based testsuite available for testing your newly
|
||||
built GDB, or for regression testing GDBs with local modifications.
|
||||
Included with the GDB distribution is a DejaGNU based testsuite
|
||||
that can either be used to test your newly built GDB, or for
|
||||
regression testing a GDB with local modifications.
|
||||
|
||||
Running the testsuite requires the prior installation of DejaGNU,
|
||||
which is generally available via ftp; you'll need a pretty recent
|
||||
release. Once DejaGNU is installed, you can run the tests in one of
|
||||
two ways:
|
||||
Running the testsuite requires the prior installation of DejaGNU,
|
||||
which is generally available via ftp. The directory
|
||||
ftp://sources.redhat.com/pub/dejagnu/ will contain a recent snapshot.
|
||||
Once DejaGNU is installed, you can run the tests in one of the
|
||||
following ways:
|
||||
|
||||
(1) cd gdb-4.18/gdb (assuming you also unpacked gdb)
|
||||
(1) cd gdb-5.2
|
||||
make check-gdb
|
||||
|
||||
or
|
||||
|
||||
(2) cd gdb-5.2/gdb
|
||||
make check
|
||||
|
||||
or
|
||||
|
||||
(2) cd gdb-4.18/gdb/testsuite
|
||||
(3) cd gdb-5.2/gdb/testsuite
|
||||
make site.exp (builds the site specific file)
|
||||
runtest -tool gdb GDB=../gdb (or GDB=<somepath> as appropriate)
|
||||
|
||||
The second method gives you slightly more control in case of problems with
|
||||
building one or more test executables or if you are using the testsuite
|
||||
'standalone', without it being part of the GDB source tree.
|
||||
The last method gives you slightly more control in case of problems
|
||||
with building one or more test executables or if you are using the
|
||||
testsuite `standalone', without it being part of the GDB source tree.
|
||||
|
||||
See the DejaGNU documentation for further details.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,470 +1,350 @@
|
|||
If you find inaccuracies in this list, please send mail to
|
||||
bug-gdb@prep.ai.mit.edu. If you would like to work on any of these,
|
||||
you should consider sending mail to the same address, to find out
|
||||
whether anyone else is working on it.
|
||||
gdb-patches@sources.redhat.com. If you would like to work on any
|
||||
of these, you should consider sending mail to the same address, to
|
||||
find out whether anyone else is working on it.
|
||||
|
||||
General To Do List
|
||||
------------------
|
||||
|
||||
This list is probably not up to date, and opinions vary about the
|
||||
importance or even desirability of some of the items.
|
||||
GDB 5.1 - Fixes
|
||||
===============
|
||||
|
||||
Add an "info bfd" command that displays supported object formats,
|
||||
similarly to objdump -i.
|
||||
Below is a list of problems identified during the GDB 5.0 release
|
||||
cycle. People hope to have these problems fixed in 5.1.
|
||||
|
||||
START_INFERIOR_TRAPS_EXPECTED need never be defined to 2, since that
|
||||
is its default value. Clean this up.
|
||||
--
|
||||
|
||||
It should be possible to use symbols from shared libraries before we know
|
||||
exactly where the libraries will be loaded. E.g. "b perror" before running
|
||||
the program. This could maybe be done as an extension of the "breakpoint
|
||||
re-evaluation" after new symbols are loaded.
|
||||
Wow, three bug reports for the same problem in one day! We should
|
||||
probably make fixing this a real priority :-).
|
||||
|
||||
Make single_step() insert and remove breakpoints in one operation.
|
||||
Anyway, thanks for reporting.
|
||||
|
||||
Speed up single stepping by avoiding extraneous ptrace calls.
|
||||
The following patch will fix the problems with setting breakpoints in
|
||||
dynamically loaded objects:
|
||||
|
||||
Speed up single stepping by not inserting and removing breakpoints
|
||||
each time the inferior starts and stops.
|
||||
http://sources.redhat.com/ml/gdb-patches/2000-05/msg00230.html
|
||||
|
||||
Breakpoints should not be inserted and deleted all the time. Only the
|
||||
one(s) there should be removed when we have to step over one. Support
|
||||
breakpoints that don't have to be removed to step over them.
|
||||
This patch isn't checked in yet (ping Michael/JimB), but I hope this
|
||||
will be in the next GDB release.
|
||||
|
||||
Update gdbint.texinfo to include doc on the directory structure and
|
||||
the various tricks of building gdb.
|
||||
There should really be a test in the testsuite for this problem, since
|
||||
it keeps coming up :-(. Any volunteers?
|
||||
|
||||
Do a tutorial in gdb.texinfo on how to do simple things in gdb.
|
||||
E.g. how to set a breakpoint that just prints something and continues.
|
||||
How to break on aborts. Etc.
|
||||
Mark
|
||||
|
||||
Provide "voodoo" debugging of core files. This creates a zombie
|
||||
process as a child of the debugger, and loads it up with the data,
|
||||
stack, and regs of the core file. This allows you to call functions
|
||||
in the executable, to manipulate the data in the core file.
|
||||
--
|
||||
|
||||
GDB reopens the source file on every line, as you "next" through it.
|
||||
GDB 5.1 - New features
|
||||
======================
|
||||
|
||||
Referencing the vtbl member of a struct doesn't work. It prints OK
|
||||
if you print the struct, but it gets 0 if you try to deref it.
|
||||
The following new features should be included in 5.1.
|
||||
|
||||
Persistent command history: A feature where you could save off a list
|
||||
of the commands you did, so you can edit it into something that will bring
|
||||
the target to the same place every time you source it.
|
||||
This would also be useful for automated fast watchpointing; if you go
|
||||
past the place where it watchpoints, you just start it over again and
|
||||
do it more carefully.
|
||||
--
|
||||
|
||||
Deal with the SunOS 4.0 and 4.1.1 ptrace bug that loses the registers if
|
||||
the stack is paged out.
|
||||
GDB 5.1 - Cleanups
|
||||
==================
|
||||
|
||||
Finish the C++ exception handling stub routines. Lint points them out
|
||||
as unused statics functions.
|
||||
The following code cleanups will hopefully be applied to GDB 5.1.
|
||||
|
||||
Perhaps "i source" should take an argument like that of "list".
|
||||
--
|
||||
|
||||
See if core-aout.c's fetch_core_registers can be used on more machines.
|
||||
E.g. MIPS (mips-xdep.c).
|
||||
GDB 5.1 - Known Problems
|
||||
========================
|
||||
|
||||
unpack_double() does not handle IEEE float on the target unless the host
|
||||
is also IEEE. Death on a vax.
|
||||
--
|
||||
|
||||
Set up interface between GDB and INFO so that you can hop into interactive
|
||||
INFO and back out again. When running under Emacs, should use Emacs
|
||||
info, else fork the info program. Installation of GDB should install
|
||||
its texinfo files into the info tree automagically, including the readline
|
||||
texinfo files.
|
||||
z8k
|
||||
|
||||
"help address" ought to find the "help set print address" entry.
|
||||
The z8k has suffered bit rot and is known to not build. The problem
|
||||
was occuring in the opcodes directory.
|
||||
|
||||
Remove the VTBL internal guts from printouts of C++ structs, unless
|
||||
vtblprint is set.
|
||||
--
|
||||
|
||||
Remove "at 0xnnnn" from the "b foo" response, if `print address off' and if
|
||||
it matches the source line indicated.
|
||||
The BFD directory requires bug-fixed AUTOMAKE et.al.
|
||||
|
||||
The prompt at end of screen should accept space as well as CR.
|
||||
AUTOMAKE 1.4 incorrectly set the TEXINPUTS environment variable. It
|
||||
contained the full path to texinfo.tex when it should have only
|
||||
contained the directory. The bug has been fixed in the current
|
||||
AUTOMAKE sources. Automake snapshots can be found in:
|
||||
ftp://sources.redhat.com/pub/gdb/infrastructure
|
||||
and ftp://sources.redhat.com/pub/binutils
|
||||
|
||||
Check STORE_RETURN_VALUE on all architectures. Check near it in tm-sparc.h
|
||||
for other bogosities.
|
||||
--
|
||||
|
||||
Check for storage leaks in GDB, I'm sure there are a lot!
|
||||
Solaris 8 x86 CURSES_H problem
|
||||
http://sources.redhat.com/ml/gdb/2000-07/msg00038.html
|
||||
|
||||
vtblprint of a vtbl should demangle the names it's printing.
|
||||
The original problem was worked around with:
|
||||
|
||||
Backtrace should point out what the currently selected frame is, in
|
||||
its display, perhaps showing "@3 foo (bar, ...)" or ">3 foo (bar,
|
||||
...)" rather than "#3 foo (bar, ...)".
|
||||
2000-06-06 Michael Snyder <msnyder@cygnus.com>
|
||||
|
||||
"i program" should work for core files, and display more info, like what
|
||||
actually caused it to die.
|
||||
* configure.in: Enable autoconf to find curses.h on Solaris 2.8.
|
||||
* configure: Regenerate.
|
||||
|
||||
"x/10i" should shorten the long name, if any, on subsequent lines.
|
||||
When building both GDB and SID using the same source tree the problem
|
||||
will still occure. sid/component/configure.in mis-configures
|
||||
<curses.h> and leaves wrong information in the config cache.
|
||||
|
||||
Check through the code for FIXME comments and fix them. dbxread.c,
|
||||
blockframe.c, and plenty more. (I count 634 as of 940621 - sts)
|
||||
--
|
||||
|
||||
"next" over a function that longjumps, never stops until next time you happen
|
||||
to get to that spot by accident. E.g. "n" over execute_command which has
|
||||
an error.
|
||||
GDB 5.2 - Fixes
|
||||
===============
|
||||
|
||||
"set zeroprint off", don't bother printing members of structs which
|
||||
are entirely zero. Useful for those big structs with few useful
|
||||
members.
|
||||
--
|
||||
|
||||
GDB does four ioctl's for every command, probably switching terminal modes
|
||||
to/from inferior or for readline or something.
|
||||
GDB 5.2 - New features
|
||||
======================
|
||||
|
||||
terminal_ours versus terminal_inferior: cache state. Switch should be a noop
|
||||
if the state is the same, too.
|
||||
--
|
||||
|
||||
ptype $i6 = void??!
|
||||
GCC 3.0 ABI support (but hopefully sooner...).
|
||||
|
||||
Clean up invalid_float handling so gdb doesn't coredump when it tries to
|
||||
access a NaN. While this might work on SPARC, other machines are not
|
||||
configured right.
|
||||
--
|
||||
|
||||
"b value_at ; commands ; continue ; end" stops EVERY OTHER TIME!
|
||||
Then once you enter a command, it does the command, runs two more
|
||||
times, and then stops again! Bizarre... (This behaviour has been
|
||||
modified, but it is not yet 100% predictable when e.g. the commands
|
||||
call functions in the child, and while there, the child is interrupted
|
||||
with a signal, or hits a breakpoint.)
|
||||
Objective C/C++ support (but hopefully sooner...).
|
||||
|
||||
help completion, help history should work.
|
||||
--
|
||||
|
||||
Check that we can handle stack trace through varargs AND alloca in same
|
||||
function, on 29K.
|
||||
Import of readline 4.2
|
||||
|
||||
wait_for_inferior loops forever if wait() gives it an error.
|
||||
--
|
||||
|
||||
"i frame" shows wrong "arglist at" location, doesn't show where the args
|
||||
should be found, only their actual values.
|
||||
GDB 5.2 - Cleanups
|
||||
==================
|
||||
|
||||
There should be a way for "set" commands to validate the new setting
|
||||
before it takes effect.
|
||||
The following cleanups have been identified as part of GDB 5.2.
|
||||
|
||||
A mess of floating point opcodes are missing from sparc-opcode.h.
|
||||
Also, a little program should test the table for bits that are
|
||||
overspecified or underspecified. E.g. if the must-be-ones bits
|
||||
and the must-be-zeroes bits leave some fields unexamined, and the format
|
||||
string leaves them unprinted, then point this out. If multiple
|
||||
non-alias patterns match, point this out too. Finally, there should
|
||||
be a sparc-optest.s file that tries each pattern out. This file
|
||||
should end up coming back the same (modulo transformation comments)
|
||||
if fed to "gas" then the .o is fed to gdb for disassembly.
|
||||
--
|
||||
|
||||
Eliminate all the core_file_command's in all the xdep files.
|
||||
Eliminate separate declarations of registers[] everywhere.
|
||||
Remove old code that does not use ui_out functions and all the related
|
||||
"ifdef"s. This also allows the elimination of -DUI_OUT from
|
||||
Makefile.in and configure.in.
|
||||
|
||||
"ena d" is ambiguous, why? "ena delete" seems to think it is a command!
|
||||
--
|
||||
|
||||
Perhaps move the tdep, xdep, and nat files, into the config
|
||||
subdirectories. If not, at least straighten out their names so that
|
||||
they all start with the machine name.
|
||||
Compiler warnings.
|
||||
|
||||
inferior_status should include stop_print_frame. It won't need to be
|
||||
reset in wait_for_inferior after bpstat_stop_status call, then.
|
||||
Eliminate warnings for all targets on at least one host for one of the
|
||||
-W flags. Flags up for debate include: -Wswitch -Wcomment -trigraphs
|
||||
-Wtrigraphs -Wunused-function -Wunused-label -Wunused-variable
|
||||
-Wunused-value -Wchar-subscripts -Wtraditional -Wshadow -Wcast-qual
|
||||
-Wcast-align -Wwrite-strings -Wconversion -Wstrict-prototypes
|
||||
-Wmissing-prototypes -Wmissing-declarations -Wredundant-decls
|
||||
-Woverloaded-virtual -Winline
|
||||
|
||||
i line VAR produces "Line number not known for symbol ``var''.". I
|
||||
thought we were stashing that info now!
|
||||
--
|
||||
|
||||
We should be able to write to random files at hex offsets like adb.
|
||||
Deprecate, if not delete, the following:
|
||||
|
||||
Make "target xxx" command interruptible.
|
||||
register[]
|
||||
register_valid[]
|
||||
REGISTER_BYTE()
|
||||
Replaced by, on the target side
|
||||
supply_register()
|
||||
and on core-gdb side:
|
||||
{read,write}_register_gen()
|
||||
Remote.c will need to use something
|
||||
other than REGISTER_BYTE() and
|
||||
REGISTER_RAW_SIZE() when unpacking
|
||||
[gG] packets.
|
||||
|
||||
Handle add_file with separate text, data, and bss addresses. Maybe
|
||||
handle separate addresses for each segment in the object file?
|
||||
STORE_PSEUDO_REGISTER
|
||||
FETCH_PSEUDO_REGISTER
|
||||
Now handed by the methods
|
||||
gdbarch_{read,write}_register()
|
||||
which sits between core GDB and
|
||||
the register cache.
|
||||
|
||||
Handle free_named_symtab to cope with multiply-loaded object files
|
||||
in a dynamic linking environment. Should remember the last copy loaded,
|
||||
but not get too snowed if it finds references to the older copy.
|
||||
REGISTER_CONVERTIBLE
|
||||
REGISTER_CONVERT_TO_RAW
|
||||
REGISTER_CONVERT_TO_VIRTUAL
|
||||
I think these three are redundant.
|
||||
gdbarch_register_{read,write} can
|
||||
do any conversion it likes.
|
||||
|
||||
Generalize and Standardize the RPC interface to a target program,
|
||||
improve it beyond the "ptrace" interface, and see if it can become a
|
||||
standard for remote debugging. (This is talking about the vxworks
|
||||
interface. Seems unlikely to me that there will be "a standard" for
|
||||
remote debugging anytime soon --kingdon, 8 Nov 1994).
|
||||
REGISTER_VIRTUAL_SIZE
|
||||
MAX_REGISTER_VIRTUAL_SIZE
|
||||
REGISTER_VIRTUAL_TYPE
|
||||
I think these can be replaced by
|
||||
the pair:
|
||||
FRAME_REGISTER_TYPE(frame, regnum)
|
||||
REGISTER_TYPE(regnum)
|
||||
|
||||
Remove all references to:
|
||||
text_offset
|
||||
data_offset
|
||||
text_data_start
|
||||
text_end
|
||||
exec_data_offset
|
||||
...
|
||||
now that we have BFD. All remaining are in machine dependent files.
|
||||
DO_REGISTERS_INFO
|
||||
Replace with
|
||||
FRAME_REGISTER_INFO (frame, ...)
|
||||
|
||||
When quitting with a running program, if a core file was previously
|
||||
examined, you get "Couldn't read float regs from core file"...if
|
||||
indeed it can't. generic_mourn_inferior...
|
||||
REGISTER_SIM_REGNO()
|
||||
If nothing else rename this so that
|
||||
how it relates to rawreg and the
|
||||
regnum is clear.
|
||||
|
||||
Have remote targets give a warning on a signal argument to
|
||||
target_resume. Or better yet, extend the protocols so that it works
|
||||
like it does on the Unix-like systems.
|
||||
REGISTER_BYTES
|
||||
The size of the cache can be computed
|
||||
on the fly.
|
||||
|
||||
Sort help and info output.
|
||||
IS_TRAPPED_INTERNALVAR
|
||||
The pseudo registers should eventually make
|
||||
this redundant.
|
||||
|
||||
Re-organize help categories into things that tend to fit on a screen
|
||||
and hang together.
|
||||
--
|
||||
|
||||
renote-nindy.c handles interrupts poorly; it error()s out of badly
|
||||
chosen places, e.g. leaving current_frame zero, which causes core dumps
|
||||
on the next command.
|
||||
Obsolete the targets:
|
||||
|
||||
Add in commands like ADB's for searching for patterns, etc. We should
|
||||
be able to examine and patch raw unsymboled binaries as well in gdb as
|
||||
we can in adb. (E.g. increase the timeout in /bin/login without source).
|
||||
arm*-wince-pe
|
||||
mips*-*-pe
|
||||
sh*-*-pe
|
||||
|
||||
Those xdep files that call register_addr without defining it are
|
||||
probably simply broken. When reconfiguring this part of gdb, I could
|
||||
only make guesses about how to redo some of those files, and I
|
||||
probably guessed wrong, or left them "for later" when I have a
|
||||
machine that can attempt to build them.
|
||||
--
|
||||
|
||||
When doing "step" or "next", if a few lines of source are skipped between
|
||||
the previous line and the current one, print those lines, not just the
|
||||
last line of a multiline statement.
|
||||
Obsolete the protocols:
|
||||
|
||||
When searching for C++ superclasses in value_cast in valops.c, we must
|
||||
not search the "fields", only the "superclasses". There might be a
|
||||
struct with a field name that matches the superclass name. This can
|
||||
happen when the struct was defined before the superclass (before the
|
||||
name became a typedef).
|
||||
RDB?
|
||||
|
||||
Handling of "&" address-of operator needs some serious overhaul
|
||||
for ANSI C and consistency on arrays and functions.
|
||||
For "float point[15];":
|
||||
ptype &point[4] ==> Attempt to take address of non-lvalue.
|
||||
For "char *malloc();":
|
||||
ptype malloc ==> "char *()"; should be same as
|
||||
ptype &malloc ==> "char *(*)()"
|
||||
call printf ("%x\n", malloc) ==> weird value, should be same as
|
||||
call printf ("%x\n", &malloc) ==> correct value
|
||||
``As of version 5.3, WindRiver has removed the RDB server (RDB
|
||||
protocol support is built into gdb).'' -- Till.
|
||||
|
||||
Fix dbxread.c symbol reading in the presence of interrupts. It
|
||||
currently leaves a cleanup to blow away the entire symbol table when a
|
||||
QUIT occurs. (What's wrong with that? -kingdon, 28 Oct 1993).
|
||||
--
|
||||
|
||||
Mipsread.c reads include files depth-first, because the dependencies
|
||||
in the psymtabs are way too inclusive (it seems to me). Figure out what
|
||||
really depends on what, to avoid recursing 20 or 30 times while reading
|
||||
real symtabs.
|
||||
Restructure gdb directory tree so that it avoids any 8.3 and 14
|
||||
filename problems.
|
||||
|
||||
value_add() should be subtracting the lower bound of arrays, if known,
|
||||
and possibly checking against the upper bound for error reporting.
|
||||
--
|
||||
|
||||
mipsread.c symbol table allocation and deallocation should be checked.
|
||||
My suspicion is that it's full of memory leaks.
|
||||
Convert GDB build process to AUTOMAKE.
|
||||
|
||||
SunOS should have a target_lookup_symbol() for common'd things allocated
|
||||
by the shared library linker ld.so.
|
||||
See also sub-directory configure below.
|
||||
|
||||
When listing source lines, check for a preceding \n, to verify that
|
||||
the file hasn't changed out from under us.
|
||||
The current convention is (kind of) to use $(<header>_h) in all
|
||||
dependency lists. It isn't done in a consistent way.
|
||||
|
||||
When listing source lines, eat leading whitespace corresponding to the
|
||||
line-number prefix we print. This avoids long lines wrapping.
|
||||
--
|
||||
|
||||
mipsread.c needs to check for old symtabs and psymtabs for the same
|
||||
files, the way it happens for dbxread.c and coffread.c, for VxWorks
|
||||
incremental symbol table reloading.
|
||||
GDB 5.2 - Known Problems
|
||||
========================
|
||||
|
||||
Get all the remote systems (where the protocol allows it) to be able to
|
||||
stop the remote system when the GDB user types ^C (like remote.c
|
||||
does). For ebmon, use ^Ak.
|
||||
|
||||
Possible feature: A version of the "disassemble" command which shows
|
||||
both source and assembly code ("set symbol-filename on" is a partial
|
||||
solution).
|
||||
--
|
||||
|
||||
investigate "x/s 0" (right now stops early) (I think maybe GDB is
|
||||
using a 0 address for bad purposes internally).
|
||||
|
||||
Make "info path" and path_command work again (but independent of the
|
||||
environment either of gdb or that we'll pass to the inferior).
|
||||
Code Cleanups: General
|
||||
======================
|
||||
|
||||
Make GDB understand the GCC feature for putting octal constants in
|
||||
enums. Make it so overflow on an enum constant does not error_type
|
||||
the whole type. Allow arbitrarily large enums with type attributes.
|
||||
Put all this stuff in the testsuite.
|
||||
The following are more general cleanups and fixes. They are not tied
|
||||
to any specific release.
|
||||
|
||||
Make TYPE_CODE_ERROR with a non-zero TYPE_LENGTH more useful (print
|
||||
the value in hex; process type attributes). Add this to the
|
||||
testsuite. This way future compilers can add new types and old
|
||||
versions of GDB can do something halfway reasonable.
|
||||
|
||||
Clean up formatting of "info registers" on MIPS and 88k. See if it
|
||||
is possible to do this generically across all target architectures.
|
||||
New Features and Fixes
|
||||
======================
|
||||
|
||||
GDB gets bfd/corefile.c and gdb/corefile.c confused (this should be easy to
|
||||
repeat even with something more recent than GDB 4.9).
|
||||
These are harder than cleanups but easier than work involving
|
||||
fundamental architectural change.
|
||||
|
||||
Check that unmatched RBRAC doesn't abort().
|
||||
--
|
||||
|
||||
Fix mdebugread.c:parse_type to do fundamental types right (see
|
||||
rs6000_builtin_type in stabsread.c for what "right" is--the point is
|
||||
that the debug format fixes the sizes of these things and it shouldn't
|
||||
depend on stuff like TARGET_PTR_BIT and so on. For mdebug, there seem
|
||||
to be separate bt* codes for 64 bit and 32 bit things, and GDB should
|
||||
be aware of that). Also use a switch statement for clarity and speed.
|
||||
Language Support
|
||||
================
|
||||
|
||||
Investigate adding symbols in target_load--some targets do, some
|
||||
don't.
|
||||
New languages come onto the scene all the time.
|
||||
|
||||
Put dirname in psymtabs and change lookup*symtab to use dirname (so
|
||||
/foo/bar.c works whether compiled by cc /foo/bar.c, or cd /foo; cc
|
||||
bar.c).
|
||||
--
|
||||
|
||||
Merge xcoffread.c and coffread.c. Use breakpoint_re_set instead of
|
||||
fixup_breakpoints.
|
||||
Re: Various C++ things
|
||||
|
||||
Fix byte order and int size sins in tm-a29k.h
|
||||
(EXTRACT_RETURN_VALUE). Perhaps should reproduce bug and verify fix
|
||||
(or perhaps should just fix it...).
|
||||
value_headof/value_from_vtable_info are worthless, and should be
|
||||
removed. The one place in printcmd.c that uses it should use the RTTI
|
||||
functions.
|
||||
|
||||
Make a watchpoint on a constant expression an error (or warning
|
||||
perhaps)
|
||||
RTTI for g++ should be using the typeinfo functions rather than the
|
||||
vtables. The typeinfo functions are always at offset 4 from the
|
||||
beginning of the vtable, and are always right. The vtables will have
|
||||
weird names like E::VB sometimes. The typeinfo function will always
|
||||
be "E type_info function", or somesuch.
|
||||
|
||||
Make a watchpoint which contains a function call an error (it is
|
||||
broken now, making it work is probably not worth the effort).
|
||||
value_virtual_fn_field needs to be fixed so there are no failures for
|
||||
virtual functions for C++ using g++.
|
||||
|
||||
Re-do calls to signal() in remote.c, and inflow.c (set_sigint_trap and
|
||||
so on) to be independent of the debugging target, using target_stop to
|
||||
stop the inferior. Probably the part which is now handled by
|
||||
interrupt_query in remote.c can be done without any new features in
|
||||
the debugging target.
|
||||
Testsuite cases are the major priority right now for C++ support,
|
||||
since i have to make a lot of changes that could potentially break
|
||||
each other.
|
||||
|
||||
New test case based on weird.exp but in which type numbers are not
|
||||
renumbered (thus multiply defining a type). This currently causes an
|
||||
infinite loop on "p v_comb".
|
||||
--
|
||||
|
||||
Nuke baseclass_addr.
|
||||
|
||||
Nuke USG define.
|
||||
Symbol Support
|
||||
==============
|
||||
|
||||
"source file more recent" loses on re-read
|
||||
--
|
||||
|
||||
Fix 386 floating point so that floating point registers are real
|
||||
registers (but code can deal at run-time if they are missing, like
|
||||
mips and 68k). This would clean up "info float" and related stuff.
|
||||
Investiagate ways of reducing memory.
|
||||
|
||||
Look at Solaris bug in interrupt.exp. Can get out of syscall with
|
||||
PRSABORT (syscall will return EINTR) but merely doing that leads to a
|
||||
"can't read memory" error.
|
||||
--
|
||||
|
||||
gcc -g -c enummask.c then gdb enummask.o, then "p v". GDB complains
|
||||
about not being able to access memory location 0.
|
||||
Investigate ways of improving load time.
|
||||
|
||||
-------------------- enummask.c
|
||||
enum mask
|
||||
{
|
||||
ANIMAL = 0,
|
||||
VEGETABLE = 1,
|
||||
MINERAL = 2,
|
||||
BASIC_CATEGORY = 3,
|
||||
--
|
||||
|
||||
WHITE = 0,
|
||||
BLUE = 4,
|
||||
GREEN = 8,
|
||||
BLACK = 0xc,
|
||||
COLOR = 0xc,
|
||||
Testsuite Support
|
||||
=================
|
||||
|
||||
ALIVE = 0x10,
|
||||
There are never to many testcases.
|
||||
|
||||
LARGE = 0x20
|
||||
} v;
|
||||
--
|
||||
|
||||
If try to modify value in file with "set write off" should give
|
||||
appropriate error not "cannot access memory at address 0x65e0".
|
||||
Better thread testsuite.
|
||||
|
||||
Why do we allow a target to omit standard register names (NO_STD_REGS
|
||||
in tm-z8k.h)? I thought the standard register names were supposed to
|
||||
be just that, standard.
|
||||
--
|
||||
|
||||
Make DEBUG_EXPRESSIONS a maintenance command, dependent on
|
||||
MAINTENANCE_COMMANDS.
|
||||
Better C++ testsuite.
|
||||
|
||||
Allow core file without exec file on RS/6000.
|
||||
--
|
||||
|
||||
Make sure "shell" with no arguments works right on DOS.
|
||||
Architectural Changes: General
|
||||
==============================
|
||||
|
||||
Make gdb.ini (as well as .gdbinit) be checked on all platforms, so
|
||||
the same directory can be NFS-mounted on unix or DOS, and work the
|
||||
same way.
|
||||
These are harder than simple cleanups / fixes and, consequently
|
||||
involve more work. Typically an Architectural Change will be broken
|
||||
down into a more digestible set of cleanups and fixes.
|
||||
|
||||
cd ~/tmp/<M-?> causes infinite loop (where ~/tmp is a directory).
|
||||
--
|
||||
|
||||
Get SECT_OFF_TEXT stuff out of objfile_relocate (might be needed to
|
||||
get RS/6000 to work right, might not be immediately relevant).
|
||||
Architectural Change: Multi-arch et al.
|
||||
=======================================
|
||||
|
||||
Clean up add_toc_to_loadinfo
|
||||
The long term objective is to remove all assumptions that there is a
|
||||
single target with a single address space with a single instruction
|
||||
set architecture and single application binary interface.
|
||||
|
||||
Think about attached processes and sharing terminal.
|
||||
This is an ongoing effort. The first milestone is to enable
|
||||
``multi-arch'' where by all architectural decisions are made at
|
||||
runtime.
|
||||
|
||||
John sez in reference to ignoring errors from tcsegpgrp if attach_flag:
|
||||
set_tty_state should not have any trouble with attached processes.
|
||||
Instead, the tty handling should leave the pgrp of the tty alone when
|
||||
attaching to processes (perhaps pass terminal_init_inferior a flag
|
||||
saying whether we're attaching).
|
||||
It should be noted that ``gdbarch'' is really ``gdbabi'' and
|
||||
``gdbisa''. Once things are multi-arched breaking that down correctly
|
||||
will become much easier.
|
||||
|
||||
PAGE_SIZE redefined warnings on AIX. Probably should be using
|
||||
BFD_PAGE_SIZE throughout BFD.
|
||||
--
|
||||
|
||||
Rewrite proceed, wait_for_inferior, and normal_stop to clean them up.
|
||||
Suggestions:
|
||||
Architectural Change: MI, LIBGDB and scripting languages
|
||||
========================================================
|
||||
|
||||
1) Make each test in wait_for_inferior a seperate subroutine
|
||||
call.
|
||||
2) Combine wait_for_inferior and normal_stop to clean up
|
||||
communication via global variables.
|
||||
3) See if you can find some way to clean up the global
|
||||
variables that are used; possibly group them by data flow
|
||||
and information content?
|
||||
See also architectural changes related to the event loop. LIBGDB
|
||||
can't be finished until there is a generic event loop being used by
|
||||
all targets.
|
||||
|
||||
Work out some kind of way to allow running the inferior to be done as
|
||||
a sub-execution of, eg. breakpoint command lists. Currently running
|
||||
the inferior interupts any command list execution. This would require
|
||||
some rewriting of wait_for_inferior & friends, and hence should
|
||||
probably be done in concert with the above.
|
||||
The long term objective is it to be possible to integrate GDB into
|
||||
scripting languages.
|
||||
|
||||
Add function arguments to gdb user defined functions.
|
||||
--
|
||||
|
||||
Add convenience variables that refer to exec file, symbol file,
|
||||
selected frame source file, selected frame function, selected frame
|
||||
line number, etc.
|
||||
Architectural Change: Async
|
||||
===========================
|
||||
|
||||
Add a "suspend" subcommand of the "continue" command to suspend gdb
|
||||
while continuing execution of the subprocess. Useful when you are
|
||||
debugging servers and you want to dodge out and initiate a connection
|
||||
to a server running under gdb.
|
||||
While GDB uses an event loop when prompting the user for input. That
|
||||
event loop is not exploited by targets when they allow the target
|
||||
program to continue. Typically targets still block in (target_wait())
|
||||
until the program again halts.
|
||||
|
||||
Add stab information to allow reasonable debugging of inline functions
|
||||
(possibly they should show up on a stack backtrace? With a note
|
||||
indicating that they weren't "real"?).
|
||||
The closest a target comes to supporting full asynchronous mode are
|
||||
the remote targets ``async'' and ``extended-async''.
|
||||
|
||||
Modify the naked "until" command to step until past the current source
|
||||
line, rather than past the current pc value. This is tricky simply
|
||||
because the low level routines have no way of specifying a multi-line
|
||||
step range, and there is no way of saying "don't print stuff when we
|
||||
stop" from above (otherwise could just call step many times).
|
||||
|
||||
Modify the handling of symbols grouped through BINCL/EINCL stabs to
|
||||
allocate a partial symtab for each BINCL/EINCL grouping. This will
|
||||
seriously decrease the size of inter-psymtab dependencies and hence
|
||||
lessen the amount that needs to be read in when a new source file is
|
||||
accessed.
|
||||
|
||||
Do an "x/i $pc" after each stepi or nexti.
|
||||
|
||||
Modify all of the disassemblers to use printf_filtered to get correct
|
||||
more filtering.
|
||||
|
||||
Modify gdb to work correctly with Pascal.
|
||||
|
||||
Add a command for searching memory, a la adb. It specifies size,
|
||||
mask, value, start address. ADB searches until it finds it or hits
|
||||
an error (or is interrupted).
|
||||
--
|
||||
|
||||
# Local Variables:
|
||||
# mode: text
|
||||
|
|
|
|||
|
|
@ -493,7 +493,7 @@ AC_DEFUN(CY_AC_PATH_ITCLCONFIG, [
|
|||
if test x"${no_itcl}" = x ; then
|
||||
# we reset no_itcl in case something fails here
|
||||
no_itcl=true
|
||||
AC_ARG_WITH(itclconfig, [ --with-itclconfig directory containing itcl configuration (itclConfig.sh)],
|
||||
AC_ARG_WITH(itclconfig, [ --with-itclconfig Directory containing itcl configuration (itclConfig.sh)],
|
||||
with_itclconfig=${withval})
|
||||
AC_MSG_CHECKING([for Itcl configuration])
|
||||
AC_CACHE_VAL(ac_cv_c_itclconfig,[
|
||||
|
|
@ -619,7 +619,7 @@ AC_DEFUN(CY_AC_PATH_ITKCONFIG, [
|
|||
if test x"${no_itk}" = x ; then
|
||||
# we reset no_itk in case something fails here
|
||||
no_itk=true
|
||||
AC_ARG_WITH(itkconfig, [ --with-itkconfig directory containing itk configuration (itkConfig.sh)],
|
||||
AC_ARG_WITH(itkconfig, [ --with-itkconfig Directory containing itk configuration (itkConfig.sh)],
|
||||
with_itkconfig=${withval})
|
||||
AC_MSG_CHECKING([for Itk configuration])
|
||||
AC_CACHE_VAL(ac_cv_c_itkconfig,[
|
||||
|
|
@ -765,7 +765,7 @@ AC_DEFUN(CY_AC_PATH_TIXCONFIG, [
|
|||
if test x"${no_tix}" = x ; then
|
||||
# we reset no_tix in case something fails here
|
||||
no_tix=true
|
||||
AC_ARG_WITH(tixconfig, [ --with-tixconfig directory containing tix configuration (tixConfig.sh)],
|
||||
AC_ARG_WITH(tixconfig, [ --with-tixconfig Directory containing tix configuration (tixConfig.sh)],
|
||||
with_tixconfig=${withval})
|
||||
AC_MSG_CHECKING([for Tix configuration])
|
||||
AC_CACHE_VAL(ac_cv_c_tixconfig,[
|
||||
|
|
@ -859,3 +859,120 @@ dnl AC_SUBST(TIX_BUILD_INCLUDES)
|
|||
AC_SUBST(TIX_BUILD_LIB_SPEC)
|
||||
dnl AC_SUBST(TIX_LIB_SPEC)
|
||||
])
|
||||
|
||||
dnl sinclude(../gettext.m4) already included by bfd/acinclude.m4
|
||||
dnl The lines below arrange for aclocal not to bring gettext.m4's
|
||||
dnl CY_GNU_GETTEXT into aclocal.m4.
|
||||
ifelse(yes,no,[
|
||||
AC_DEFUN([CY_GNU_GETTEXT],)
|
||||
])
|
||||
|
||||
## ----------------------------------------- ##
|
||||
## ANSIfy the C compiler whenever possible. ##
|
||||
## From Franc,ois Pinard ##
|
||||
## ----------------------------------------- ##
|
||||
|
||||
# Copyright 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# serial 1
|
||||
|
||||
# @defmac AC_PROG_CC_STDC
|
||||
# @maindex PROG_CC_STDC
|
||||
# @ovindex CC
|
||||
# If the C compiler in not in ANSI C mode by default, try to add an option
|
||||
# to output variable @code{CC} to make it so. This macro tries various
|
||||
# options that select ANSI C on some system or another. It considers the
|
||||
# compiler to be in ANSI C mode if it handles function prototypes correctly.
|
||||
#
|
||||
# If you use this macro, you should check after calling it whether the C
|
||||
# compiler has been set to accept ANSI C; if not, the shell variable
|
||||
# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
|
||||
# code in ANSI C, you can make an un-ANSIfied copy of it by using the
|
||||
# program @code{ansi2knr}, which comes with Ghostscript.
|
||||
# @end defmac
|
||||
|
||||
AC_DEFUN([AM_PROG_CC_STDC],
|
||||
[AC_REQUIRE([AC_PROG_CC])
|
||||
AC_BEFORE([$0], [AC_C_INLINE])
|
||||
AC_BEFORE([$0], [AC_C_CONST])
|
||||
dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
|
||||
dnl a magic option to avoid problems with ANSI preprocessor commands
|
||||
dnl like #elif.
|
||||
dnl FIXME: can't do this because then AC_AIX won't work due to a
|
||||
dnl circular dependency.
|
||||
dnl AC_BEFORE([$0], [AC_PROG_CPP])
|
||||
AC_MSG_CHECKING([for ${CC-cc} option to accept ANSI C])
|
||||
AC_CACHE_VAL(am_cv_prog_cc_stdc,
|
||||
[am_cv_prog_cc_stdc=no
|
||||
ac_save_CC="$CC"
|
||||
# Don't try gcc -ansi; that turns off useful extensions and
|
||||
# breaks some systems' header files.
|
||||
# AIX -qlanglvl=ansi
|
||||
# Ultrix and OSF/1 -std1
|
||||
# HP-UX 10.20 and later -Ae
|
||||
# HP-UX older versions -Aa -D_HPUX_SOURCE
|
||||
# SVR4 -Xc -D__EXTENSIONS__
|
||||
for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
|
||||
do
|
||||
CC="$ac_save_CC $ac_arg"
|
||||
AC_TRY_COMPILE(
|
||||
[#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
|
||||
struct buf { int x; };
|
||||
FILE * (*rcsopen) (struct buf *, struct stat *, int);
|
||||
static char *e (p, i)
|
||||
char **p;
|
||||
int i;
|
||||
{
|
||||
return p[i];
|
||||
}
|
||||
static char *f (char * (*g) (char **, int), char **p, ...)
|
||||
{
|
||||
char *s;
|
||||
va_list v;
|
||||
va_start (v,p);
|
||||
s = g (p, va_arg (v,int));
|
||||
va_end (v);
|
||||
return s;
|
||||
}
|
||||
int test (int i, double x);
|
||||
struct s1 {int (*f) (int a);};
|
||||
struct s2 {int (*f) (double a);};
|
||||
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
|
||||
int argc;
|
||||
char **argv;
|
||||
], [
|
||||
return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
|
||||
],
|
||||
[am_cv_prog_cc_stdc="$ac_arg"; break])
|
||||
done
|
||||
CC="$ac_save_CC"
|
||||
])
|
||||
if test -z "$am_cv_prog_cc_stdc"; then
|
||||
AC_MSG_RESULT([none needed])
|
||||
else
|
||||
AC_MSG_RESULT([$am_cv_prog_cc_stdc])
|
||||
fi
|
||||
case "x$am_cv_prog_cc_stdc" in
|
||||
x|xno) ;;
|
||||
*) CC="$CC $am_cv_prog_cc_stdc" ;;
|
||||
esac
|
||||
])
|
||||
|
|
|
|||
409
contrib/gdb/gdb/aclocal.m4
vendored
409
contrib/gdb/gdb/aclocal.m4
vendored
|
|
@ -505,7 +505,7 @@ AC_DEFUN(CY_AC_PATH_ITCLCONFIG, [
|
|||
if test x"${no_itcl}" = x ; then
|
||||
# we reset no_itcl in case something fails here
|
||||
no_itcl=true
|
||||
AC_ARG_WITH(itclconfig, [ --with-itclconfig directory containing itcl configuration (itclConfig.sh)],
|
||||
AC_ARG_WITH(itclconfig, [ --with-itclconfig Directory containing itcl configuration (itclConfig.sh)],
|
||||
with_itclconfig=${withval})
|
||||
AC_MSG_CHECKING([for Itcl configuration])
|
||||
AC_CACHE_VAL(ac_cv_c_itclconfig,[
|
||||
|
|
@ -631,7 +631,7 @@ AC_DEFUN(CY_AC_PATH_ITKCONFIG, [
|
|||
if test x"${no_itk}" = x ; then
|
||||
# we reset no_itk in case something fails here
|
||||
no_itk=true
|
||||
AC_ARG_WITH(itkconfig, [ --with-itkconfig directory containing itk configuration (itkConfig.sh)],
|
||||
AC_ARG_WITH(itkconfig, [ --with-itkconfig Directory containing itk configuration (itkConfig.sh)],
|
||||
with_itkconfig=${withval})
|
||||
AC_MSG_CHECKING([for Itk configuration])
|
||||
AC_CACHE_VAL(ac_cv_c_itkconfig,[
|
||||
|
|
@ -777,7 +777,7 @@ AC_DEFUN(CY_AC_PATH_TIXCONFIG, [
|
|||
if test x"${no_tix}" = x ; then
|
||||
# we reset no_tix in case something fails here
|
||||
no_tix=true
|
||||
AC_ARG_WITH(tixconfig, [ --with-tixconfig directory containing tix configuration (tixConfig.sh)],
|
||||
AC_ARG_WITH(tixconfig, [ --with-tixconfig Directory containing tix configuration (tixConfig.sh)],
|
||||
with_tixconfig=${withval})
|
||||
AC_MSG_CHECKING([for Tix configuration])
|
||||
AC_CACHE_VAL(ac_cv_c_tixconfig,[
|
||||
|
|
@ -872,6 +872,30 @@ dnl AC_SUBST(TIX_BUILD_INCLUDES)
|
|||
dnl AC_SUBST(TIX_LIB_SPEC)
|
||||
])
|
||||
|
||||
dnl sinclude(../gettext.m4) already included by bfd/acinclude.m4
|
||||
dnl The lines below arrange for aclocal not to bring gettext.m4's
|
||||
dnl CY_GNU_GETTEXT into aclocal.m4.
|
||||
ifelse(yes,no,[
|
||||
AC_DEFUN([CY_GNU_GETTEXT],)
|
||||
])
|
||||
|
||||
|
||||
# Copyright 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# serial 1
|
||||
|
||||
|
|
@ -890,7 +914,7 @@ dnl AC_SUBST(TIX_LIB_SPEC)
|
|||
# program @code{ansi2knr}, which comes with Ghostscript.
|
||||
# @end defmac
|
||||
|
||||
AC_DEFUN(AM_PROG_CC_STDC,
|
||||
AC_DEFUN([AM_PROG_CC_STDC],
|
||||
[AC_REQUIRE([AC_PROG_CC])
|
||||
AC_BEFORE([$0], [AC_C_INLINE])
|
||||
AC_BEFORE([$0], [AC_C_CONST])
|
||||
|
|
@ -900,7 +924,7 @@ dnl like #elif.
|
|||
dnl FIXME: can't do this because then AC_AIX won't work due to a
|
||||
dnl circular dependency.
|
||||
dnl AC_BEFORE([$0], [AC_PROG_CPP])
|
||||
AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
|
||||
AC_MSG_CHECKING([for ${CC-cc} option to accept ANSI C])
|
||||
AC_CACHE_VAL(am_cv_prog_cc_stdc,
|
||||
[am_cv_prog_cc_stdc=no
|
||||
ac_save_CC="$CC"
|
||||
|
|
@ -908,9 +932,10 @@ ac_save_CC="$CC"
|
|||
# breaks some systems' header files.
|
||||
# AIX -qlanglvl=ansi
|
||||
# Ultrix and OSF/1 -std1
|
||||
# HP-UX -Aa -D_HPUX_SOURCE
|
||||
# HP-UX 10.20 and later -Ae
|
||||
# HP-UX older versions -Aa -D_HPUX_SOURCE
|
||||
# SVR4 -Xc -D__EXTENSIONS__
|
||||
for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
|
||||
for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
|
||||
do
|
||||
CC="$ac_save_CC $ac_arg"
|
||||
AC_TRY_COMPILE(
|
||||
|
|
@ -952,7 +977,7 @@ CC="$ac_save_CC"
|
|||
if test -z "$am_cv_prog_cc_stdc"; then
|
||||
AC_MSG_RESULT([none needed])
|
||||
else
|
||||
AC_MSG_RESULT($am_cv_prog_cc_stdc)
|
||||
AC_MSG_RESULT([$am_cv_prog_cc_stdc])
|
||||
fi
|
||||
case "x$am_cv_prog_cc_stdc" in
|
||||
x|xno) ;;
|
||||
|
|
@ -960,348 +985,36 @@ case "x$am_cv_prog_cc_stdc" in
|
|||
esac
|
||||
])
|
||||
|
||||
# This file is derived from `gettext.m4'. The difference is that the
|
||||
# included macros assume Cygnus-style source and build trees.
|
||||
|
||||
# Macro to add for using GNU gettext.
|
||||
# Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||
#
|
||||
# This file file be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU Public License
|
||||
# but which still want to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code is *not* freely available.
|
||||
|
||||
# serial 3
|
||||
|
||||
AC_DEFUN(CY_WITH_NLS,
|
||||
[AC_MSG_CHECKING([whether NLS is requested])
|
||||
dnl Default is enabled NLS
|
||||
AC_ARG_ENABLE(nls,
|
||||
[ --disable-nls do not use Native Language Support],
|
||||
USE_NLS=$enableval, USE_NLS=yes)
|
||||
AC_MSG_RESULT($USE_NLS)
|
||||
AC_SUBST(USE_NLS)
|
||||
|
||||
USE_INCLUDED_LIBINTL=no
|
||||
|
||||
dnl If we use NLS figure out what method
|
||||
if test "$USE_NLS" = "yes"; then
|
||||
AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if NLS is requested])
|
||||
AC_MSG_CHECKING([whether included gettext is requested])
|
||||
AC_ARG_WITH(included-gettext,
|
||||
[ --with-included-gettext use the GNU gettext library included here],
|
||||
nls_cv_force_use_gnu_gettext=$withval,
|
||||
nls_cv_force_use_gnu_gettext=no)
|
||||
AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
|
||||
|
||||
nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
|
||||
if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
|
||||
dnl User does not insist on using GNU NLS library. Figure out what
|
||||
dnl to use. If gettext or catgets are available (in this order) we
|
||||
dnl use this. Else we have to fall back to GNU NLS library.
|
||||
dnl catgets is only used if permitted by option --with-catgets.
|
||||
nls_cv_header_intl=
|
||||
nls_cv_header_libgt=
|
||||
CATOBJEXT=NONE
|
||||
|
||||
AC_CHECK_HEADER(libintl.h,
|
||||
[AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
|
||||
[AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
|
||||
gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
|
||||
|
||||
if test "$gt_cv_func_gettext_libc" != "yes"; then
|
||||
AC_CHECK_LIB(intl, bindtextdomain,
|
||||
[AC_CACHE_CHECK([for gettext in libintl],
|
||||
gt_cv_func_gettext_libintl,
|
||||
[AC_TRY_LINK([], [return (int) gettext ("")],
|
||||
gt_cv_func_gettext_libintl=yes,
|
||||
gt_cv_func_gettext_libintl=no)])])
|
||||
fi
|
||||
|
||||
if test "$gt_cv_func_gettext_libc" = "yes" \
|
||||
|| test "$gt_cv_func_gettext_libintl" = "yes"; then
|
||||
AC_DEFINE(HAVE_GETTEXT, 1,
|
||||
[Define as 1 if you have gettext and don't want to use GNU gettext.])
|
||||
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
|
||||
if test "$MSGFMT" != "no"; then
|
||||
AC_CHECK_FUNCS(dcgettext)
|
||||
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
|
||||
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
||||
AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
|
||||
return _nl_msg_cat_cntr],
|
||||
[CATOBJEXT=.gmo
|
||||
DATADIRNAME=share],
|
||||
[CATOBJEXT=.mo
|
||||
DATADIRNAME=lib])
|
||||
INSTOBJEXT=.mo
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
dnl In the standard gettext, we would now check for catgets.
|
||||
dnl However, we never want to use catgets for our releases.
|
||||
|
||||
if test "$CATOBJEXT" = "NONE"; then
|
||||
dnl Neither gettext nor catgets in included in the C library.
|
||||
dnl Fall back on GNU gettext library.
|
||||
nls_cv_use_gnu_gettext=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$nls_cv_use_gnu_gettext" = "yes"; then
|
||||
dnl Mark actions used to generate GNU NLS library.
|
||||
INTLOBJS="\$(GETTOBJS)"
|
||||
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
|
||||
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
|
||||
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
||||
AC_SUBST(MSGFMT)
|
||||
USE_INCLUDED_LIBINTL=yes
|
||||
CATOBJEXT=.gmo
|
||||
INSTOBJEXT=.mo
|
||||
DATADIRNAME=share
|
||||
INTLDEPS='$(top_builddir)/../intl/libintl.a'
|
||||
INTLLIBS=$INTLDEPS
|
||||
LIBS=`echo $LIBS | sed -e 's/-lintl//'`
|
||||
nls_cv_header_intl=libintl.h
|
||||
nls_cv_header_libgt=libgettext.h
|
||||
fi
|
||||
|
||||
dnl Test whether we really found GNU xgettext.
|
||||
if test "$XGETTEXT" != ":"; then
|
||||
dnl If it is no GNU xgettext we define it as : so that the
|
||||
dnl Makefiles still can work.
|
||||
if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
|
||||
: ;
|
||||
else
|
||||
AC_MSG_RESULT(
|
||||
[found xgettext programs is not GNU xgettext; ignore it])
|
||||
XGETTEXT=":"
|
||||
fi
|
||||
fi
|
||||
|
||||
# We need to process the po/ directory.
|
||||
POSUB=po
|
||||
else
|
||||
DATADIRNAME=share
|
||||
nls_cv_header_intl=libintl.h
|
||||
nls_cv_header_libgt=libgettext.h
|
||||
fi
|
||||
|
||||
# If this is used in GNU gettext we have to set USE_NLS to `yes'
|
||||
# because some of the sources are only built for this goal.
|
||||
if test "$PACKAGE" = gettext; then
|
||||
USE_NLS=yes
|
||||
USE_INCLUDED_LIBINTL=yes
|
||||
fi
|
||||
|
||||
dnl These rules are solely for the distribution goal. While doing this
|
||||
dnl we only have to keep exactly one list of the available catalogs
|
||||
dnl in configure.in.
|
||||
for lang in $ALL_LINGUAS; do
|
||||
GMOFILES="$GMOFILES $lang.gmo"
|
||||
POFILES="$POFILES $lang.po"
|
||||
done
|
||||
|
||||
dnl Make all variables we use known to autoconf.
|
||||
AC_SUBST(USE_INCLUDED_LIBINTL)
|
||||
AC_SUBST(CATALOGS)
|
||||
AC_SUBST(CATOBJEXT)
|
||||
AC_SUBST(DATADIRNAME)
|
||||
AC_SUBST(GMOFILES)
|
||||
AC_SUBST(INSTOBJEXT)
|
||||
AC_SUBST(INTLDEPS)
|
||||
AC_SUBST(INTLLIBS)
|
||||
AC_SUBST(INTLOBJS)
|
||||
AC_SUBST(POFILES)
|
||||
AC_SUBST(POSUB)
|
||||
])
|
||||
|
||||
AC_DEFUN(CY_GNU_GETTEXT,
|
||||
[AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
AC_REQUIRE([AC_ISC_POSIX])dnl
|
||||
AC_REQUIRE([AC_HEADER_STDC])dnl
|
||||
AC_REQUIRE([AC_C_CONST])dnl
|
||||
AC_REQUIRE([AC_C_INLINE])dnl
|
||||
AC_REQUIRE([AC_TYPE_OFF_T])dnl
|
||||
AC_REQUIRE([AC_TYPE_SIZE_T])dnl
|
||||
AC_REQUIRE([AC_FUNC_ALLOCA])dnl
|
||||
AC_REQUIRE([AC_FUNC_MMAP])dnl
|
||||
|
||||
AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
|
||||
unistd.h values.h sys/param.h])
|
||||
AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
|
||||
__argz_count __argz_stringify __argz_next])
|
||||
|
||||
if test "${ac_cv_func_stpcpy+set}" != "set"; then
|
||||
AC_CHECK_FUNCS(stpcpy)
|
||||
fi
|
||||
if test "${ac_cv_func_stpcpy}" = "yes"; then
|
||||
AC_DEFINE(HAVE_STPCPY, 1, [Define if you have the stpcpy function])
|
||||
fi
|
||||
|
||||
AM_LC_MESSAGES
|
||||
CY_WITH_NLS
|
||||
|
||||
if test "x$CATOBJEXT" != "x"; then
|
||||
if test "x$ALL_LINGUAS" = "x"; then
|
||||
LINGUAS=
|
||||
else
|
||||
AC_MSG_CHECKING(for catalogs to be installed)
|
||||
NEW_LINGUAS=
|
||||
for lang in ${LINGUAS=$ALL_LINGUAS}; do
|
||||
case "$ALL_LINGUAS" in
|
||||
*$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
|
||||
esac
|
||||
done
|
||||
LINGUAS=$NEW_LINGUAS
|
||||
AC_MSG_RESULT($LINGUAS)
|
||||
fi
|
||||
|
||||
dnl Construct list of names of catalog files to be constructed.
|
||||
if test -n "$LINGUAS"; then
|
||||
for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl The reference to <locale.h> in the installed <libintl.h> file
|
||||
dnl must be resolved because we cannot expect the users of this
|
||||
dnl to define HAVE_LOCALE_H.
|
||||
if test $ac_cv_header_locale_h = yes; then
|
||||
INCLUDE_LOCALE_H="#include <locale.h>"
|
||||
else
|
||||
INCLUDE_LOCALE_H="\
|
||||
/* The system does not provide the header <locale.h>. Take care yourself. */"
|
||||
fi
|
||||
AC_SUBST(INCLUDE_LOCALE_H)
|
||||
|
||||
dnl Determine which catalog format we have (if any is needed)
|
||||
dnl For now we know about two different formats:
|
||||
dnl Linux libc-5 and the normal X/Open format
|
||||
if test -f $srcdir/po2tbl.sed.in; then
|
||||
if test "$CATOBJEXT" = ".cat"; then
|
||||
AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
|
||||
|
||||
dnl Transform the SED scripts while copying because some dumb SEDs
|
||||
dnl cannot handle comments.
|
||||
sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed
|
||||
fi
|
||||
dnl po2tbl.sed is always needed.
|
||||
sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
|
||||
$srcdir/po2tbl.sed.in > po2tbl.sed
|
||||
fi
|
||||
|
||||
dnl In the intl/Makefile.in we have a special dependency which makes
|
||||
dnl only sense for gettext. We comment this out for non-gettext
|
||||
dnl packages.
|
||||
if test "$PACKAGE" = "gettext"; then
|
||||
GT_NO="#NO#"
|
||||
GT_YES=
|
||||
else
|
||||
GT_NO=
|
||||
GT_YES="#YES#"
|
||||
fi
|
||||
AC_SUBST(GT_NO)
|
||||
AC_SUBST(GT_YES)
|
||||
|
||||
MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs"
|
||||
AC_SUBST(MKINSTALLDIRS)
|
||||
|
||||
dnl *** For now the libtool support in intl/Makefile is not for real.
|
||||
l=
|
||||
AC_SUBST(l)
|
||||
|
||||
dnl Generate list of files to be processed by xgettext which will
|
||||
dnl be included in po/Makefile. But only do this if the po directory
|
||||
dnl exists in srcdir.
|
||||
if test -d $srcdir/po; then
|
||||
test -d po || mkdir po
|
||||
if test "x$srcdir" != "x."; then
|
||||
if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
|
||||
posrcprefix="$srcdir/"
|
||||
else
|
||||
posrcprefix="../$srcdir/"
|
||||
fi
|
||||
else
|
||||
posrcprefix="../"
|
||||
fi
|
||||
rm -f po/POTFILES
|
||||
sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
|
||||
< $srcdir/po/POTFILES.in > po/POTFILES
|
||||
fi
|
||||
])
|
||||
|
||||
# Search path for a program which passes the given test.
|
||||
# Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||
#
|
||||
# This file file be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU Public License
|
||||
# but which still want to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code is *not* freely available.
|
||||
# Add --enable-maintainer-mode option to configure.
|
||||
# From Jim Meyering
|
||||
|
||||
# serial 1
|
||||
|
||||
dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
|
||||
dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
|
||||
AC_DEFUN(AM_PATH_PROG_WITH_TEST,
|
||||
[# Extract the first word of "$2", so it can be a program name with args.
|
||||
set dummy $2; ac_word=[$]2
|
||||
AC_MSG_CHECKING([for $ac_word])
|
||||
AC_CACHE_VAL(ac_cv_path_$1,
|
||||
[case "[$]$1" in
|
||||
/*)
|
||||
ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in ifelse([$5], , $PATH, [$5]); do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/$ac_word; then
|
||||
if [$3]; then
|
||||
ac_cv_path_$1="$ac_dir/$ac_word"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
dnl If no 4th arg is given, leave the cache variable unset,
|
||||
dnl so AC_PATH_PROGS will keep looking.
|
||||
ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
|
||||
])dnl
|
||||
;;
|
||||
esac])dnl
|
||||
$1="$ac_cv_path_$1"
|
||||
if test -n "[$]$1"; then
|
||||
AC_MSG_RESULT([$]$1)
|
||||
AC_DEFUN(AM_MAINTAINER_MODE,
|
||||
[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
|
||||
dnl maintainer-mode is disabled by default
|
||||
AC_ARG_ENABLE(maintainer-mode,
|
||||
[ --enable-maintainer-mode enable make rules and dependencies not useful
|
||||
(and sometimes confusing) to the casual installer],
|
||||
USE_MAINTAINER_MODE=$enableval,
|
||||
USE_MAINTAINER_MODE=no)
|
||||
AC_MSG_RESULT($USE_MAINTAINER_MODE)
|
||||
AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
|
||||
MAINT=$MAINTAINER_MODE_TRUE
|
||||
AC_SUBST(MAINT)dnl
|
||||
]
|
||||
)
|
||||
|
||||
# Define a conditional.
|
||||
|
||||
AC_DEFUN(AM_CONDITIONAL,
|
||||
[AC_SUBST($1_TRUE)
|
||||
AC_SUBST($1_FALSE)
|
||||
if $2; then
|
||||
$1_TRUE=
|
||||
$1_FALSE='#'
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
AC_SUBST($1)dnl
|
||||
])
|
||||
|
||||
# Check whether LC_MESSAGES is available in <locale.h>.
|
||||
# Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||
#
|
||||
# This file file be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU Public License
|
||||
# but which still want to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code is *not* freely available.
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_LC_MESSAGES,
|
||||
[if test $ac_cv_header_locale_h = yes; then
|
||||
AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
|
||||
[AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
|
||||
am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
|
||||
if test $am_cv_val_LC_MESSAGES = yes; then
|
||||
AC_DEFINE(HAVE_LC_MESSAGES, 1,
|
||||
[Define if your locale.h file contains LC_MESSAGES.])
|
||||
fi
|
||||
fi])
|
||||
$1_TRUE='#'
|
||||
$1_FALSE=
|
||||
fi])
|
||||
|
||||
|
|
|
|||
211
contrib/gdb/gdb/alphabsd-nat.c
Normal file
211
contrib/gdb/gdb/alphabsd-nat.c
Normal file
|
|
@ -0,0 +1,211 @@
|
|||
/* Native-dependent code for Alpha BSD's.
|
||||
Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "inferior.h"
|
||||
#include "regcache.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/ptrace.h>
|
||||
#include <machine/reg.h>
|
||||
|
||||
#ifdef HAVE_SYS_PROCFS_H
|
||||
#include <sys/procfs.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GREGSET_T
|
||||
typedef struct reg gregset_t;
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_FPREGSET_T
|
||||
typedef struct fpreg fpregset_t;
|
||||
#endif
|
||||
|
||||
#include "gregset.h"
|
||||
|
||||
/* Number of general-purpose registers. */
|
||||
#define NUM_GREGS 32
|
||||
|
||||
/* Number of floating point registers. */
|
||||
#define NUM_FPREGS 31
|
||||
|
||||
|
||||
/* Transfering the registers between GDB, inferiors and core files. */
|
||||
|
||||
/* Fill GDB's register array with the general-purpose register values
|
||||
in *GREGSETP. */
|
||||
|
||||
void
|
||||
supply_gregset (gregset_t *gregsetp)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NUM_GREGS; i++)
|
||||
{
|
||||
if (CANNOT_FETCH_REGISTER (i))
|
||||
supply_register (i, NULL);
|
||||
else
|
||||
supply_register (i, (char *) &gregsetp->r_regs[i]);
|
||||
}
|
||||
|
||||
/* The PC travels in the R_ZERO slot. */
|
||||
supply_register (PC_REGNUM, (char *) &gregsetp->r_regs[R_ZERO]);
|
||||
}
|
||||
|
||||
/* Fill register REGNO (if it is a general-purpose register) in
|
||||
*GREGSETPS with the value in GDB's register array. If REGNO is -1,
|
||||
do this for all registers. */
|
||||
|
||||
void
|
||||
fill_gregset (gregset_t *gregsetp, int regno)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NUM_GREGS; i++)
|
||||
if ((regno == -1 || regno == i) && ! CANNOT_STORE_REGISTER (i))
|
||||
regcache_collect (i, (char *) &gregsetp->r_regs[i]);
|
||||
|
||||
/* The PC travels in the R_ZERO slot. */
|
||||
if (regno == -1 || regno == PC_REGNUM)
|
||||
regcache_collect (PC_REGNUM, (char *) &gregsetp->r_regs[R_ZERO]);
|
||||
}
|
||||
|
||||
/* Fill GDB's register array with the floating-point register values
|
||||
in *FPREGSETP. */
|
||||
|
||||
void
|
||||
supply_fpregset (fpregset_t *fpregsetp)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = FP0_REGNUM; i < FP0_REGNUM + NUM_FPREGS; i++)
|
||||
{
|
||||
if (CANNOT_FETCH_REGISTER (i))
|
||||
supply_register (i, NULL);
|
||||
else
|
||||
supply_register (i, (char *) &fpregsetp->fpr_regs[i - FP0_REGNUM]);
|
||||
}
|
||||
|
||||
supply_register (FPCR_REGNUM, (char *) &fpregsetp->fpr_cr);
|
||||
}
|
||||
|
||||
/* Fill register REGNO (if it is a floating-point register) in
|
||||
*FPREGSETP with the value in GDB's register array. If REGNO is -1,
|
||||
do this for all registers. */
|
||||
|
||||
void
|
||||
fill_fpregset (fpregset_t *fpregsetp, int regno)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = FP0_REGNUM; i < FP0_REGNUM + NUM_FPREGS; i++)
|
||||
if ((regno == -1 || regno == i) && ! CANNOT_STORE_REGISTER (i))
|
||||
regcache_collect (i, (char *) &fpregsetp->fpr_regs[i - FP0_REGNUM]);
|
||||
|
||||
if (regno == -1 || regno == FPCR_REGNUM)
|
||||
regcache_collect (FPCR_REGNUM, (char *) &fpregsetp->fpr_cr);
|
||||
}
|
||||
|
||||
|
||||
/* Determine if PT_GETREGS fetches this register. */
|
||||
|
||||
static int
|
||||
getregs_supplies (int regno)
|
||||
{
|
||||
|
||||
return ((regno >= V0_REGNUM && regno <= ZERO_REGNUM)
|
||||
|| regno >= PC_REGNUM);
|
||||
}
|
||||
|
||||
|
||||
/* Fetch register REGNO from the inferior. If REGNO is -1, do this
|
||||
for all registers (including the floating point registers). */
|
||||
|
||||
void
|
||||
fetch_inferior_registers (int regno)
|
||||
{
|
||||
|
||||
if (regno == -1 || getregs_supplies (regno))
|
||||
{
|
||||
gregset_t gregs;
|
||||
|
||||
if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &gregs, 0) == -1)
|
||||
perror_with_name ("Couldn't get registers");
|
||||
|
||||
supply_gregset (&gregs);
|
||||
if (regno != -1)
|
||||
return;
|
||||
}
|
||||
|
||||
if (regno == -1 || regno >= FP0_REGNUM)
|
||||
{
|
||||
fpregset_t fpregs;
|
||||
|
||||
if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
|
||||
perror_with_name ("Couldn't get floating point status");
|
||||
|
||||
supply_fpregset (&fpregs);
|
||||
}
|
||||
|
||||
/* Reset virtual frame pointer. */
|
||||
supply_register (FP_REGNUM, NULL);
|
||||
}
|
||||
|
||||
/* Store register REGNO back into the inferior. If REGNO is -1, do
|
||||
this for all registers (including the floating point registers). */
|
||||
|
||||
void
|
||||
store_inferior_registers (int regno)
|
||||
{
|
||||
|
||||
if (regno == -1 || getregs_supplies (regno))
|
||||
{
|
||||
gregset_t gregs;
|
||||
if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &gregs, 0) == -1)
|
||||
perror_with_name ("Couldn't get registers");
|
||||
|
||||
fill_gregset (&gregs, regno);
|
||||
|
||||
if (ptrace (PT_SETREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &gregs, 0) == -1)
|
||||
perror_with_name ("Couldn't write registers");
|
||||
|
||||
if (regno != -1)
|
||||
return;
|
||||
}
|
||||
|
||||
if (regno == -1 || regno >= FP0_REGNUM)
|
||||
{
|
||||
fpregset_t fpregs;
|
||||
|
||||
if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
|
||||
perror_with_name ("Couldn't get floating point status");
|
||||
|
||||
fill_fpregset (&fpregs, regno);
|
||||
|
||||
if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
|
||||
perror_with_name ("Couldn't write floating point status");
|
||||
}
|
||||
}
|
||||
53
contrib/gdb/gdb/alphafbsd-tdep.c
Normal file
53
contrib/gdb/gdb/alphafbsd-tdep.c
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
/* Target-dependent code for FreeBSD/Alpha.
|
||||
Copyright 2001 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "value.h"
|
||||
|
||||
int
|
||||
alphafbsd_use_struct_convention (int gcc_p, struct type *type)
|
||||
{
|
||||
enum type_code code;
|
||||
int i;
|
||||
|
||||
/* All aggregate types that won't fit in a register must be returned
|
||||
in memory. */
|
||||
if (TYPE_LENGTH (type) > REGISTER_SIZE)
|
||||
return 1;
|
||||
|
||||
/* The only aggregate types that can be returned in a register are
|
||||
structs and unions. Arrays must be returned in memory. */
|
||||
code = TYPE_CODE (type);
|
||||
if (code != TYPE_CODE_STRUCT && code != TYPE_CODE_UNION)
|
||||
return 1;
|
||||
|
||||
/* We need to check if this struct/union is "integer" like. For
|
||||
this to be true, the offset of each adressable subfield must be
|
||||
zero. Note that bit fields are not addressable. */
|
||||
for (i = 0; i < TYPE_NFIELDS (type); i++)
|
||||
{
|
||||
/* If the field bitsize is non-zero, it isn't adressable. */
|
||||
if (TYPE_FIELD_BITPOS (type, i) != 0
|
||||
&& TYPE_FIELD_BITSIZE (type, i) == 0)
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,21 +1,23 @@
|
|||
/* Annotation routines for GDB.
|
||||
Copyright 1986, 89, 90, 91, 92, 95, 1998 Free Software Foundation, Inc.
|
||||
Copyright 1986, 1989, 1990, 1991, 1992, 1994, 1995, 1996, 1998, 1999,
|
||||
2000 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "annotate.h"
|
||||
|
|
@ -27,18 +29,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||
|
||||
/* Prototypes for local functions. */
|
||||
|
||||
static void print_value_flags PARAMS ((struct type *));
|
||||
extern void _initialize_annotate (void);
|
||||
|
||||
static void breakpoint_changed PARAMS ((struct breakpoint *));
|
||||
static void print_value_flags (struct type *);
|
||||
|
||||
void (*annotate_starting_hook) PARAMS ((void));
|
||||
void (*annotate_stopped_hook) PARAMS ((void));
|
||||
void (*annotate_signalled_hook) PARAMS ((void));
|
||||
void (*annotate_exited_hook) PARAMS ((void));
|
||||
static void breakpoint_changed (struct breakpoint *);
|
||||
|
||||
void (*annotate_starting_hook) (void);
|
||||
void (*annotate_stopped_hook) (void);
|
||||
void (*annotate_signalled_hook) (void);
|
||||
void (*annotate_signal_hook) (void);
|
||||
void (*annotate_exited_hook) (void);
|
||||
|
||||
static int ignore_count_changed = 0;
|
||||
|
||||
static void
|
||||
print_value_flags (t)
|
||||
struct type *t;
|
||||
print_value_flags (struct type *t)
|
||||
{
|
||||
if (can_dereference (t))
|
||||
printf_filtered ("*");
|
||||
|
|
@ -47,41 +53,53 @@ print_value_flags (t)
|
|||
}
|
||||
|
||||
void
|
||||
breakpoints_changed ()
|
||||
breakpoints_changed (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
{
|
||||
target_terminal_ours ();
|
||||
printf_unfiltered ("\n\032\032breakpoints-invalid\n");
|
||||
if (ignore_count_changed)
|
||||
ignore_count_changed = 0; /* Avoid multiple break annotations. */
|
||||
}
|
||||
}
|
||||
|
||||
/* The GUI needs to be informed of ignore_count changes, but we don't
|
||||
want to provide successive multiple breakpoints-invalid messages
|
||||
that are all caused by the fact that the ignore count is changing
|
||||
(which could keep the GUI very busy). One is enough, after the
|
||||
target actually "stops". */
|
||||
|
||||
void
|
||||
annotate_breakpoint (num)
|
||||
int num;
|
||||
annotate_ignore_count_change (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
ignore_count_changed = 1;
|
||||
}
|
||||
|
||||
void
|
||||
annotate_breakpoint (int num)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032breakpoint %d\n", num);
|
||||
}
|
||||
|
||||
void
|
||||
annotate_catchpoint (num)
|
||||
int num;
|
||||
annotate_catchpoint (int num)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032catchpoint %d\n", num);
|
||||
}
|
||||
|
||||
void
|
||||
annotate_watchpoint (num)
|
||||
int num;
|
||||
annotate_watchpoint (int num)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032watchpoint %d\n", num);
|
||||
}
|
||||
|
||||
void
|
||||
annotate_starting ()
|
||||
annotate_starting (void)
|
||||
{
|
||||
|
||||
if (annotate_starting_hook)
|
||||
|
|
@ -89,39 +107,43 @@ annotate_starting ()
|
|||
else
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
{
|
||||
printf_filtered ("\n\032\032starting\n");
|
||||
}
|
||||
{
|
||||
printf_filtered ("\n\032\032starting\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
annotate_stopped ()
|
||||
annotate_stopped (void)
|
||||
{
|
||||
if (annotate_stopped_hook)
|
||||
annotate_stopped_hook ();
|
||||
else
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032stopped\n");
|
||||
printf_filtered ("\n\032\032stopped\n");
|
||||
}
|
||||
if (annotation_level > 1 && ignore_count_changed)
|
||||
{
|
||||
ignore_count_changed = 0;
|
||||
breakpoints_changed ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
annotate_exited (exitstatus)
|
||||
int exitstatus;
|
||||
annotate_exited (int exitstatus)
|
||||
{
|
||||
if (annotate_exited_hook)
|
||||
annotate_exited_hook ();
|
||||
else
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032exited %d\n", exitstatus);
|
||||
printf_filtered ("\n\032\032exited %d\n", exitstatus);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
annotate_signalled ()
|
||||
annotate_signalled (void)
|
||||
{
|
||||
if (annotate_signalled_hook)
|
||||
annotate_signalled_hook ();
|
||||
|
|
@ -131,78 +153,80 @@ annotate_signalled ()
|
|||
}
|
||||
|
||||
void
|
||||
annotate_signal_name ()
|
||||
annotate_signal_name (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032signal-name\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_signal_name_end ()
|
||||
annotate_signal_name_end (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032signal-name-end\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_signal_string ()
|
||||
annotate_signal_string (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032signal-string\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_signal_string_end ()
|
||||
annotate_signal_string_end (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032signal-string-end\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_signal ()
|
||||
annotate_signal (void)
|
||||
{
|
||||
if (annotate_signal_hook)
|
||||
annotate_signal_hook ();
|
||||
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032signal\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_breakpoints_headers ()
|
||||
annotate_breakpoints_headers (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032breakpoints-headers\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_field (num)
|
||||
int num;
|
||||
annotate_field (int num)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032field %d\n", num);
|
||||
}
|
||||
|
||||
void
|
||||
annotate_breakpoints_table ()
|
||||
annotate_breakpoints_table (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032breakpoints-table\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_record ()
|
||||
annotate_record (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032record\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_breakpoints_table_end ()
|
||||
annotate_breakpoints_table_end (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032breakpoints-table-end\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_frames_invalid ()
|
||||
annotate_frames_invalid (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
{
|
||||
|
|
@ -212,8 +236,7 @@ annotate_frames_invalid ()
|
|||
}
|
||||
|
||||
void
|
||||
annotate_field_begin (type)
|
||||
struct type *type;
|
||||
annotate_field_begin (struct type *type)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
{
|
||||
|
|
@ -224,51 +247,49 @@ annotate_field_begin (type)
|
|||
}
|
||||
|
||||
void
|
||||
annotate_field_name_end ()
|
||||
annotate_field_name_end (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032field-name-end\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_field_value ()
|
||||
annotate_field_value (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032field-value\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_field_end ()
|
||||
annotate_field_end (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032field-end\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_quit ()
|
||||
annotate_quit (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032quit\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_error ()
|
||||
annotate_error (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032error\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_error_begin ()
|
||||
annotate_error_begin (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
fprintf_filtered (gdb_stderr, "\n\032\032error-begin\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_value_history_begin (histindex, type)
|
||||
int histindex;
|
||||
struct type *type;
|
||||
annotate_value_history_begin (int histindex, struct type *type)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
{
|
||||
|
|
@ -279,8 +300,7 @@ annotate_value_history_begin (histindex, type)
|
|||
}
|
||||
|
||||
void
|
||||
annotate_value_begin (type)
|
||||
struct type *type;
|
||||
annotate_value_begin (struct type *type)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
{
|
||||
|
|
@ -291,92 +311,91 @@ annotate_value_begin (type)
|
|||
}
|
||||
|
||||
void
|
||||
annotate_value_history_value ()
|
||||
annotate_value_history_value (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032value-history-value\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_value_history_end ()
|
||||
annotate_value_history_end (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032value-history-end\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_value_end ()
|
||||
annotate_value_end (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032value-end\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_display_begin ()
|
||||
annotate_display_begin (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032display-begin\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_display_number_end ()
|
||||
annotate_display_number_end (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032display-number-end\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_display_format ()
|
||||
annotate_display_format (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032display-format\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_display_expression ()
|
||||
annotate_display_expression (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032display-expression\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_display_expression_end ()
|
||||
annotate_display_expression_end (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032display-expression-end\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_display_value ()
|
||||
annotate_display_value (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032display-value\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_display_end ()
|
||||
annotate_display_end (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032display-end\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_arg_begin ()
|
||||
annotate_arg_begin (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032arg-begin\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_arg_name_end ()
|
||||
annotate_arg_name_end (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032arg-name-end\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_arg_value (type)
|
||||
struct type *type;
|
||||
annotate_arg_value (struct type *type)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
{
|
||||
|
|
@ -387,19 +406,14 @@ annotate_arg_value (type)
|
|||
}
|
||||
|
||||
void
|
||||
annotate_arg_end ()
|
||||
annotate_arg_end (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032arg-end\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_source (filename, line, character, mid, pc)
|
||||
char *filename;
|
||||
int line;
|
||||
int character;
|
||||
int mid;
|
||||
CORE_ADDR pc;
|
||||
annotate_source (char *filename, int line, int character, int mid, CORE_ADDR pc)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032source ");
|
||||
|
|
@ -414,9 +428,7 @@ annotate_source (filename, line, character, mid, pc)
|
|||
}
|
||||
|
||||
void
|
||||
annotate_frame_begin (level, pc)
|
||||
int level;
|
||||
CORE_ADDR pc;
|
||||
annotate_frame_begin (int level, CORE_ADDR pc)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
{
|
||||
|
|
@ -427,100 +439,98 @@ annotate_frame_begin (level, pc)
|
|||
}
|
||||
|
||||
void
|
||||
annotate_function_call ()
|
||||
annotate_function_call (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032function-call\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_signal_handler_caller ()
|
||||
annotate_signal_handler_caller (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032signal-handler-caller\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_frame_address ()
|
||||
annotate_frame_address (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032frame-address\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_frame_address_end ()
|
||||
annotate_frame_address_end (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032frame-address-end\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_frame_function_name ()
|
||||
annotate_frame_function_name (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032frame-function-name\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_frame_args ()
|
||||
annotate_frame_args (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032frame-args\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_frame_source_begin ()
|
||||
annotate_frame_source_begin (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032frame-source-begin\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_frame_source_file ()
|
||||
annotate_frame_source_file (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032frame-source-file\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_frame_source_file_end ()
|
||||
annotate_frame_source_file_end (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032frame-source-file-end\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_frame_source_line ()
|
||||
annotate_frame_source_line (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032frame-source-line\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_frame_source_end ()
|
||||
annotate_frame_source_end (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032frame-source-end\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_frame_where ()
|
||||
annotate_frame_where (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032frame-where\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_frame_end ()
|
||||
annotate_frame_end (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032frame-end\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_array_section_begin (index, elttype)
|
||||
int index;
|
||||
struct type *elttype;
|
||||
annotate_array_section_begin (int index, struct type *elttype)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
{
|
||||
|
|
@ -531,43 +541,41 @@ annotate_array_section_begin (index, elttype)
|
|||
}
|
||||
|
||||
void
|
||||
annotate_elt_rep (repcount)
|
||||
unsigned int repcount;
|
||||
annotate_elt_rep (unsigned int repcount)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032elt-rep %u\n", repcount);
|
||||
}
|
||||
|
||||
void
|
||||
annotate_elt_rep_end ()
|
||||
annotate_elt_rep_end (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032elt-rep-end\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_elt ()
|
||||
annotate_elt (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032elt\n");
|
||||
}
|
||||
|
||||
void
|
||||
annotate_array_section_end ()
|
||||
annotate_array_section_end (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
printf_filtered ("\n\032\032array-section-end\n");
|
||||
}
|
||||
|
||||
static void
|
||||
breakpoint_changed (b)
|
||||
struct breakpoint *b;
|
||||
breakpoint_changed (struct breakpoint *b)
|
||||
{
|
||||
breakpoints_changed ();
|
||||
}
|
||||
|
||||
void
|
||||
_initialize_annotate ()
|
||||
_initialize_annotate (void)
|
||||
{
|
||||
if (annotation_level > 1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,104 +1,106 @@
|
|||
/* Annotation routines for GDB.
|
||||
Copyright 1986, 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
|
||||
Copyright 1986, 1989, 1990, 1991, 1992, 1994, 1998, 1999, 2000
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "symtab.h"
|
||||
#include "gdbtypes.h"
|
||||
|
||||
extern void breakpoints_changed PARAMS ((void));
|
||||
extern void breakpoints_changed (void);
|
||||
|
||||
extern void annotate_breakpoint PARAMS ((int));
|
||||
extern void annotate_catchpoint PARAMS ((int));
|
||||
extern void annotate_watchpoint PARAMS ((int));
|
||||
extern void annotate_starting PARAMS ((void));
|
||||
extern void annotate_stopped PARAMS ((void));
|
||||
extern void annotate_exited PARAMS ((int));
|
||||
extern void annotate_signalled PARAMS ((void));
|
||||
extern void annotate_signal_name PARAMS ((void));
|
||||
extern void annotate_signal_name_end PARAMS ((void));
|
||||
extern void annotate_signal_string PARAMS ((void));
|
||||
extern void annotate_signal_string_end PARAMS ((void));
|
||||
extern void annotate_signal PARAMS ((void));
|
||||
extern void annotate_ignore_count_change (void);
|
||||
extern void annotate_breakpoint (int);
|
||||
extern void annotate_catchpoint (int);
|
||||
extern void annotate_watchpoint (int);
|
||||
extern void annotate_starting (void);
|
||||
extern void annotate_stopped (void);
|
||||
extern void annotate_exited (int);
|
||||
extern void annotate_signalled (void);
|
||||
extern void annotate_signal_name (void);
|
||||
extern void annotate_signal_name_end (void);
|
||||
extern void annotate_signal_string (void);
|
||||
extern void annotate_signal_string_end (void);
|
||||
extern void annotate_signal (void);
|
||||
|
||||
extern void annotate_breakpoints_headers PARAMS ((void));
|
||||
extern void annotate_field PARAMS ((int));
|
||||
extern void annotate_breakpoints_table PARAMS ((void));
|
||||
extern void annotate_record PARAMS ((void));
|
||||
extern void annotate_breakpoints_table_end PARAMS ((void));
|
||||
extern void annotate_breakpoints_headers (void);
|
||||
extern void annotate_field (int);
|
||||
extern void annotate_breakpoints_table (void);
|
||||
extern void annotate_record (void);
|
||||
extern void annotate_breakpoints_table_end (void);
|
||||
|
||||
extern void annotate_frames_invalid PARAMS ((void));
|
||||
extern void annotate_frames_invalid (void);
|
||||
|
||||
#ifdef __STDC__
|
||||
struct type;
|
||||
#endif
|
||||
|
||||
extern void annotate_field_begin PARAMS ((struct type *));
|
||||
extern void annotate_field_name_end PARAMS ((void));
|
||||
extern void annotate_field_value PARAMS ((void));
|
||||
extern void annotate_field_end PARAMS ((void));
|
||||
extern void annotate_field_begin (struct type *);
|
||||
extern void annotate_field_name_end (void);
|
||||
extern void annotate_field_value (void);
|
||||
extern void annotate_field_end (void);
|
||||
|
||||
extern void annotate_quit PARAMS ((void));
|
||||
extern void annotate_error PARAMS ((void));
|
||||
extern void annotate_error_begin PARAMS ((void));
|
||||
extern void annotate_quit (void);
|
||||
extern void annotate_error (void);
|
||||
extern void annotate_error_begin (void);
|
||||
|
||||
extern void annotate_value_history_begin PARAMS ((int, struct type *));
|
||||
extern void annotate_value_begin PARAMS ((struct type *));
|
||||
extern void annotate_value_history_value PARAMS ((void));
|
||||
extern void annotate_value_history_end PARAMS ((void));
|
||||
extern void annotate_value_end PARAMS ((void));
|
||||
extern void annotate_value_history_begin (int, struct type *);
|
||||
extern void annotate_value_begin (struct type *);
|
||||
extern void annotate_value_history_value (void);
|
||||
extern void annotate_value_history_end (void);
|
||||
extern void annotate_value_end (void);
|
||||
|
||||
extern void annotate_display_begin PARAMS ((void));
|
||||
extern void annotate_display_number_end PARAMS ((void));
|
||||
extern void annotate_display_format PARAMS ((void));
|
||||
extern void annotate_display_expression PARAMS ((void));
|
||||
extern void annotate_display_expression_end PARAMS ((void));
|
||||
extern void annotate_display_value PARAMS ((void));
|
||||
extern void annotate_display_end PARAMS ((void));
|
||||
extern void annotate_display_begin (void);
|
||||
extern void annotate_display_number_end (void);
|
||||
extern void annotate_display_format (void);
|
||||
extern void annotate_display_expression (void);
|
||||
extern void annotate_display_expression_end (void);
|
||||
extern void annotate_display_value (void);
|
||||
extern void annotate_display_end (void);
|
||||
|
||||
extern void annotate_arg_begin PARAMS ((void));
|
||||
extern void annotate_arg_name_end PARAMS ((void));
|
||||
extern void annotate_arg_value PARAMS ((struct type *));
|
||||
extern void annotate_arg_end PARAMS ((void));
|
||||
extern void annotate_arg_begin (void);
|
||||
extern void annotate_arg_name_end (void);
|
||||
extern void annotate_arg_value (struct type *);
|
||||
extern void annotate_arg_end (void);
|
||||
|
||||
extern void annotate_source PARAMS ((char *, int, int, int, CORE_ADDR));
|
||||
extern void annotate_source (char *, int, int, int, CORE_ADDR);
|
||||
|
||||
extern void annotate_frame_begin PARAMS ((int, CORE_ADDR));
|
||||
extern void annotate_function_call PARAMS ((void));
|
||||
extern void annotate_signal_handler_caller PARAMS ((void));
|
||||
extern void annotate_frame_address PARAMS ((void));
|
||||
extern void annotate_frame_address_end PARAMS ((void));
|
||||
extern void annotate_frame_function_name PARAMS ((void));
|
||||
extern void annotate_frame_args PARAMS ((void));
|
||||
extern void annotate_frame_source_begin PARAMS ((void));
|
||||
extern void annotate_frame_source_file PARAMS ((void));
|
||||
extern void annotate_frame_source_file_end PARAMS ((void));
|
||||
extern void annotate_frame_source_line PARAMS ((void));
|
||||
extern void annotate_frame_source_end PARAMS ((void));
|
||||
extern void annotate_frame_where PARAMS ((void));
|
||||
extern void annotate_frame_end PARAMS ((void));
|
||||
extern void annotate_frame_begin (int, CORE_ADDR);
|
||||
extern void annotate_function_call (void);
|
||||
extern void annotate_signal_handler_caller (void);
|
||||
extern void annotate_frame_address (void);
|
||||
extern void annotate_frame_address_end (void);
|
||||
extern void annotate_frame_function_name (void);
|
||||
extern void annotate_frame_args (void);
|
||||
extern void annotate_frame_source_begin (void);
|
||||
extern void annotate_frame_source_file (void);
|
||||
extern void annotate_frame_source_file_end (void);
|
||||
extern void annotate_frame_source_line (void);
|
||||
extern void annotate_frame_source_end (void);
|
||||
extern void annotate_frame_where (void);
|
||||
extern void annotate_frame_end (void);
|
||||
|
||||
extern void annotate_array_section_begin PARAMS ((int, struct type *));
|
||||
extern void annotate_elt_rep PARAMS ((unsigned int));
|
||||
extern void annotate_elt_rep_end PARAMS ((void));
|
||||
extern void annotate_elt PARAMS ((void));
|
||||
extern void annotate_array_section_end PARAMS ((void));
|
||||
extern void annotate_array_section_begin (int, struct type *);
|
||||
extern void annotate_elt_rep (unsigned int);
|
||||
extern void annotate_elt_rep_end (void);
|
||||
extern void annotate_elt (void);
|
||||
extern void annotate_array_section_end (void);
|
||||
|
||||
extern void (*annotate_starting_hook) PARAMS ((void));
|
||||
extern void (*annotate_stopped_hook) PARAMS ((void));
|
||||
extern void (*annotate_signalled_hook) PARAMS ((void));
|
||||
extern void (*annotate_exited_hook) PARAMS ((void));
|
||||
extern void (*annotate_starting_hook) (void);
|
||||
extern void (*annotate_stopped_hook) (void);
|
||||
extern void (*annotate_signalled_hook) (void);
|
||||
extern void (*annotate_signal_hook) (void);
|
||||
extern void (*annotate_exited_hook) (void);
|
||||
|
|
|
|||
|
|
@ -1,21 +1,22 @@
|
|||
/* ARC target-dependent stuff.
|
||||
Copyright (C) 1995, 1997 Free Software Foundation, Inc.
|
||||
Copyright 1995, 1996, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "frame.h"
|
||||
|
|
@ -25,6 +26,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||
#include "floatformat.h"
|
||||
#include "symtab.h"
|
||||
#include "gdbcmd.h"
|
||||
#include "regcache.h"
|
||||
|
||||
/* Local functions */
|
||||
|
||||
static int arc_set_cpu_type (char *str);
|
||||
|
||||
/* Current CPU, set with the "set cpu" command. */
|
||||
static int arc_bfd_mach_type;
|
||||
|
|
@ -32,12 +38,18 @@ char *arc_cpu_type;
|
|||
char *tmp_arc_cpu_type;
|
||||
|
||||
/* Table of cpu names. */
|
||||
struct {
|
||||
char *name;
|
||||
int value;
|
||||
} arc_cpu_type_table[] = {
|
||||
{ "base", bfd_mach_arc_base },
|
||||
{ NULL, 0 }
|
||||
struct
|
||||
{
|
||||
char *name;
|
||||
int value;
|
||||
}
|
||||
arc_cpu_type_table[] =
|
||||
{
|
||||
{ "arc5", bfd_mach_arc_5 },
|
||||
{ "arc6", bfd_mach_arc_6 },
|
||||
{ "arc7", bfd_mach_arc_7 },
|
||||
{ "arc8", bfd_mach_arc_8 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
/* Used by simulator. */
|
||||
|
|
@ -77,13 +89,14 @@ int debug_pipeline_p;
|
|||
| ((d) & 511))
|
||||
|
||||
/* Codestream stuff. */
|
||||
static void codestream_read PARAMS ((unsigned int *, int));
|
||||
static void codestream_seek PARAMS ((CORE_ADDR));
|
||||
static unsigned int codestream_fill PARAMS ((int));
|
||||
static void codestream_read (unsigned int *, int);
|
||||
static void codestream_seek (CORE_ADDR);
|
||||
static unsigned int codestream_fill (int);
|
||||
|
||||
#define CODESTREAM_BUFSIZ 16
|
||||
#define CODESTREAM_BUFSIZ 16
|
||||
static CORE_ADDR codestream_next_addr;
|
||||
static CORE_ADDR codestream_addr;
|
||||
/* FIXME assumes sizeof (int) == 32? */
|
||||
static unsigned int codestream_buf[CODESTREAM_BUFSIZ];
|
||||
static int codestream_off;
|
||||
static int codestream_cnt;
|
||||
|
|
@ -99,9 +112,8 @@ static int codestream_cnt;
|
|||
? codestream_fill (0) \
|
||||
: codestream_buf[codestream_off++])
|
||||
|
||||
static unsigned int
|
||||
codestream_fill (peek_flag)
|
||||
int peek_flag;
|
||||
static unsigned int
|
||||
codestream_fill (int peek_flag)
|
||||
{
|
||||
codestream_addr = codestream_next_addr;
|
||||
codestream_next_addr += CODESTREAM_BUFSIZ * sizeof (codestream_buf[0]);
|
||||
|
|
@ -111,17 +123,16 @@ codestream_fill (peek_flag)
|
|||
CODESTREAM_BUFSIZ * sizeof (codestream_buf[0]));
|
||||
/* FIXME: check return code? */
|
||||
|
||||
/* Handle byte order differences. */
|
||||
if (HOST_BYTE_ORDER != TARGET_BYTE_ORDER)
|
||||
{
|
||||
register unsigned int i, j, n = sizeof (codestream_buf[0]);
|
||||
register char tmp, *p;
|
||||
for (i = 0, p = (char *) codestream_buf; i < CODESTREAM_BUFSIZ;
|
||||
++i, p += n)
|
||||
for (j = 0; j < n / 2; ++j)
|
||||
tmp = p[j], p[j] = p[n - 1 - j], p[n - 1 - j] = tmp;
|
||||
}
|
||||
|
||||
|
||||
/* Handle byte order differences -> convert to host byte ordering. */
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < CODESTREAM_BUFSIZ; i++)
|
||||
codestream_buf[i] =
|
||||
extract_unsigned_integer (&codestream_buf[i],
|
||||
sizeof (codestream_buf[i]));
|
||||
}
|
||||
|
||||
if (peek_flag)
|
||||
return codestream_peek ();
|
||||
else
|
||||
|
|
@ -129,8 +140,7 @@ codestream_fill (peek_flag)
|
|||
}
|
||||
|
||||
static void
|
||||
codestream_seek (place)
|
||||
CORE_ADDR place;
|
||||
codestream_seek (CORE_ADDR place)
|
||||
{
|
||||
codestream_next_addr = place / CODESTREAM_BUFSIZ;
|
||||
codestream_next_addr *= CODESTREAM_BUFSIZ;
|
||||
|
|
@ -143,9 +153,7 @@ codestream_seek (place)
|
|||
/* This function is currently unused but leave in for now. */
|
||||
|
||||
static void
|
||||
codestream_read (buf, count)
|
||||
unsigned int *buf;
|
||||
int count;
|
||||
codestream_read (unsigned int *buf, int count)
|
||||
{
|
||||
unsigned int *p;
|
||||
int i;
|
||||
|
|
@ -157,8 +165,7 @@ codestream_read (buf, count)
|
|||
/* Set up prologue scanning and return the first insn. */
|
||||
|
||||
static unsigned int
|
||||
setup_prologue_scan (pc)
|
||||
CORE_ADDR pc;
|
||||
setup_prologue_scan (CORE_ADDR pc)
|
||||
{
|
||||
unsigned int insn;
|
||||
|
||||
|
|
@ -176,8 +183,7 @@ setup_prologue_scan (pc)
|
|||
*/
|
||||
|
||||
static long
|
||||
arc_get_frame_setup (pc)
|
||||
CORE_ADDR pc;
|
||||
arc_get_frame_setup (CORE_ADDR pc)
|
||||
{
|
||||
unsigned int insn;
|
||||
/* Size of frame or -1 if unrecognizable prologue. */
|
||||
|
|
@ -203,16 +209,16 @@ arc_get_frame_setup (pc)
|
|||
{
|
||||
insn = codestream_get ();
|
||||
/* Frame may not be necessary, even though blink is saved.
|
||||
At least this is something we recognize. */
|
||||
At least this is something we recognize. */
|
||||
frame_size = 0;
|
||||
}
|
||||
|
||||
if ((insn & BUILD_INSN (-1, 0, -1, -1, -1)) /* st fp,[sp] */
|
||||
if ((insn & BUILD_INSN (-1, 0, -1, -1, -1)) /* st fp,[sp] */
|
||||
== BUILD_INSN (2, 0, SP_REGNUM, FP_REGNUM, 0))
|
||||
{
|
||||
{
|
||||
insn = codestream_get ();
|
||||
if ((insn & BUILD_INSN (-1, -1, -1, -1, 0))
|
||||
!= BUILD_INSN (12, FP_REGNUM, SP_REGNUM, SP_REGNUM, 0))
|
||||
!= BUILD_INSN (12, FP_REGNUM, SP_REGNUM, SP_REGNUM, 0))
|
||||
return -1;
|
||||
|
||||
/* Check for stack adjustment sub sp,sp,N. */
|
||||
|
|
@ -229,12 +235,12 @@ arc_get_frame_setup (pc)
|
|||
if (frame_size < 0)
|
||||
return -1;
|
||||
|
||||
codestream_get ();
|
||||
codestream_get ();
|
||||
|
||||
/* This sequence is used to get the address of the return
|
||||
buffer for a function that returns a structure. */
|
||||
insn = codestream_peek ();
|
||||
if (insn & OPMASK == 0x60000000)
|
||||
if ((insn & OPMASK) == 0x60000000)
|
||||
codestream_get ();
|
||||
}
|
||||
/* Frameless fn. */
|
||||
|
|
@ -264,9 +270,7 @@ arc_get_frame_setup (pc)
|
|||
This allows a quicker answer. */
|
||||
|
||||
CORE_ADDR
|
||||
skip_prologue (pc, frameless_p)
|
||||
CORE_ADDR pc;
|
||||
int frameless_p;
|
||||
arc_skip_prologue (CORE_ADDR pc, int frameless_p)
|
||||
{
|
||||
unsigned int insn;
|
||||
int i, frame_size;
|
||||
|
|
@ -283,8 +287,8 @@ skip_prologue (pc, frameless_p)
|
|||
insn = codestream_peek ();
|
||||
if ((insn & BUILD_INSN (-1, 0, -1, 0, 0))
|
||||
!= BUILD_INSN (2, 0, SP_REGNUM, 0, 0))
|
||||
break; /* not st insn */
|
||||
if (! ARC_CALL_SAVED_REG (X_C (insn)))
|
||||
break; /* not st insn */
|
||||
if (!ARC_CALL_SAVED_REG (X_C (insn)))
|
||||
break;
|
||||
codestream_get ();
|
||||
}
|
||||
|
|
@ -297,8 +301,7 @@ skip_prologue (pc, frameless_p)
|
|||
This is taken from frameless_look_for_prologue. */
|
||||
|
||||
CORE_ADDR
|
||||
arc_frame_saved_pc (frame)
|
||||
struct frame_info *frame;
|
||||
arc_frame_saved_pc (struct frame_info *frame)
|
||||
{
|
||||
CORE_ADDR func_start;
|
||||
unsigned int insn;
|
||||
|
|
@ -344,9 +347,7 @@ arc_frame_saved_pc (frame)
|
|||
*/
|
||||
|
||||
void
|
||||
frame_find_saved_regs (fip, fsrp)
|
||||
struct frame_info *fip;
|
||||
struct frame_saved_regs *fsrp;
|
||||
frame_find_saved_regs (struct frame_info *fip, struct frame_saved_regs *fsrp)
|
||||
{
|
||||
long locals;
|
||||
unsigned int insn;
|
||||
|
|
@ -360,11 +361,11 @@ frame_find_saved_regs (fip, fsrp)
|
|||
dummy_bottom = fip->frame - 4 - REGISTER_BYTES - CALL_DUMMY_LENGTH;
|
||||
|
||||
/* Check if the PC is in the stack, in a dummy frame. */
|
||||
if (dummy_bottom <= fip->pc && fip->pc <= fip->frame)
|
||||
if (dummy_bottom <= fip->pc && fip->pc <= fip->frame)
|
||||
{
|
||||
/* all regs were saved by push_call_dummy () */
|
||||
adr = fip->frame;
|
||||
for (i = 0; i < NUM_REGS; i++)
|
||||
for (i = 0; i < NUM_REGS; i++)
|
||||
{
|
||||
adr -= REGISTER_RAW_SIZE (i);
|
||||
fsrp->regs[i] = adr;
|
||||
|
|
@ -374,7 +375,7 @@ frame_find_saved_regs (fip, fsrp)
|
|||
|
||||
locals = arc_get_frame_setup (get_pc_function_start (fip->pc));
|
||||
|
||||
if (locals >= 0)
|
||||
if (locals >= 0)
|
||||
{
|
||||
/* Set `adr' to the value of `sp'. */
|
||||
adr = fip->frame - locals;
|
||||
|
|
@ -382,9 +383,9 @@ frame_find_saved_regs (fip, fsrp)
|
|||
{
|
||||
insn = codestream_get ();
|
||||
if ((insn & BUILD_INSN (-1, 0, -1, 0, 0))
|
||||
!= BUILD_INSN (2, 0, SP_REGNUM, 0, 0))
|
||||
!= BUILD_INSN (2, 0, SP_REGNUM, 0, 0))
|
||||
break;
|
||||
regnum = X_C (insn);
|
||||
regnum = X_C (insn);
|
||||
offset = X_D (insn);
|
||||
fsrp->regs[regnum] = adr + offset;
|
||||
}
|
||||
|
|
@ -395,14 +396,14 @@ frame_find_saved_regs (fip, fsrp)
|
|||
}
|
||||
|
||||
void
|
||||
push_dummy_frame ()
|
||||
arc_push_dummy_frame (void)
|
||||
{
|
||||
CORE_ADDR sp = read_register (SP_REGNUM);
|
||||
int regnum;
|
||||
char regbuf[MAX_REGISTER_RAW_SIZE];
|
||||
|
||||
read_register_gen (PC_REGNUM, regbuf);
|
||||
write_memory (sp+4, regbuf, REGISTER_SIZE);
|
||||
write_memory (sp + 4, regbuf, REGISTER_SIZE);
|
||||
read_register_gen (FP_REGNUM, regbuf);
|
||||
write_memory (sp, regbuf, REGISTER_SIZE);
|
||||
write_register (FP_REGNUM, sp);
|
||||
|
|
@ -411,22 +412,22 @@ push_dummy_frame ()
|
|||
read_register_gen (regnum, regbuf);
|
||||
sp = push_bytes (sp, regbuf, REGISTER_RAW_SIZE (regnum));
|
||||
}
|
||||
sp += (2*REGISTER_SIZE);
|
||||
sp += (2 * REGISTER_SIZE);
|
||||
write_register (SP_REGNUM, sp);
|
||||
}
|
||||
|
||||
void
|
||||
pop_frame ()
|
||||
arc_pop_frame (void)
|
||||
{
|
||||
struct frame_info *frame = get_current_frame ();
|
||||
CORE_ADDR fp;
|
||||
int regnum;
|
||||
struct frame_saved_regs fsr;
|
||||
char regbuf[MAX_REGISTER_RAW_SIZE];
|
||||
|
||||
|
||||
fp = FRAME_FP (frame);
|
||||
get_frame_saved_regs (frame, &fsr);
|
||||
for (regnum = 0; regnum < NUM_REGS; regnum++)
|
||||
for (regnum = 0; regnum < NUM_REGS; regnum++)
|
||||
{
|
||||
CORE_ADDR adr;
|
||||
adr = fsr.regs[regnum];
|
||||
|
|
@ -447,45 +448,48 @@ pop_frame ()
|
|||
|
||||
typedef enum
|
||||
{
|
||||
NORMAL4, /* a normal 4 byte insn */
|
||||
NORMAL8, /* a normal 8 byte insn */
|
||||
BRANCH4, /* a 4 byte branch insn, including ones without delay slots */
|
||||
BRANCH8, /* an 8 byte branch insn, including ones with delay slots */
|
||||
} insn_type;
|
||||
NORMAL4, /* a normal 4 byte insn */
|
||||
NORMAL8, /* a normal 8 byte insn */
|
||||
BRANCH4, /* a 4 byte branch insn, including ones without delay slots */
|
||||
BRANCH8, /* an 8 byte branch insn, including ones with delay slots */
|
||||
}
|
||||
insn_type;
|
||||
|
||||
/* Return the type of INSN and store in TARGET the destination address of a
|
||||
branch if this is one. */
|
||||
/* ??? Need to verify all cases are properly handled. */
|
||||
|
||||
static insn_type
|
||||
get_insn_type (insn, pc, target)
|
||||
unsigned long insn;
|
||||
CORE_ADDR pc, *target;
|
||||
get_insn_type (unsigned long insn, CORE_ADDR pc, CORE_ADDR *target)
|
||||
{
|
||||
unsigned long limm;
|
||||
|
||||
switch (insn >> 27)
|
||||
{
|
||||
case 0 : case 1 : case 2 : /* load/store insns */
|
||||
case 0:
|
||||
case 1:
|
||||
case 2: /* load/store insns */
|
||||
if (LIMM_P (X_A (insn))
|
||||
|| LIMM_P (X_B (insn))
|
||||
|| LIMM_P (X_C (insn)))
|
||||
return NORMAL8;
|
||||
return NORMAL4;
|
||||
case 4 : case 5 : case 6 : /* branch insns */
|
||||
case 4:
|
||||
case 5:
|
||||
case 6: /* branch insns */
|
||||
*target = pc + 4 + X_L (insn);
|
||||
/* ??? It isn't clear that this is always the right answer.
|
||||
The problem occurs when the next insn is an 8 byte insn. If the
|
||||
branch is conditional there's no worry as there shouldn't be an 8
|
||||
byte insn following. The programmer may be cheating if s/he knows
|
||||
the branch will never be taken, but we don't deal with that.
|
||||
Note that the programmer is also allowed to play games by putting
|
||||
an insn with long immediate data in the delay slot and then duplicate
|
||||
the long immediate data at the branch target. Ugh! */
|
||||
The problem occurs when the next insn is an 8 byte insn. If the
|
||||
branch is conditional there's no worry as there shouldn't be an 8
|
||||
byte insn following. The programmer may be cheating if s/he knows
|
||||
the branch will never be taken, but we don't deal with that.
|
||||
Note that the programmer is also allowed to play games by putting
|
||||
an insn with long immediate data in the delay slot and then duplicate
|
||||
the long immediate data at the branch target. Ugh! */
|
||||
if (X_N (insn) == 0)
|
||||
return BRANCH4;
|
||||
return BRANCH8;
|
||||
case 7 : /* jump insns */
|
||||
case 7: /* jump insns */
|
||||
if (LIMM_P (X_B (insn)))
|
||||
{
|
||||
limm = read_memory_integer (pc + 4, 4);
|
||||
|
|
@ -499,7 +503,7 @@ get_insn_type (insn, pc, target)
|
|||
if (X_Q (insn) == 0 && X_N (insn) == 0)
|
||||
return BRANCH4;
|
||||
return BRANCH8;
|
||||
default : /* arithmetic insns, etc. */
|
||||
default: /* arithmetic insns, etc. */
|
||||
if (LIMM_P (X_A (insn))
|
||||
|| LIMM_P (X_B (insn))
|
||||
|| LIMM_P (X_C (insn)))
|
||||
|
|
@ -517,9 +521,8 @@ get_insn_type (insn, pc, target)
|
|||
set up a simulated single-step, we undo our damage. */
|
||||
|
||||
void
|
||||
arc_software_single_step (ignore, insert_breakpoints_p)
|
||||
enum target_signal ignore; /* sig but we don't need it */
|
||||
int insert_breakpoints_p;
|
||||
arc_software_single_step (enum target_signal ignore, /* sig but we don't need it */
|
||||
int insert_breakpoints_p)
|
||||
{
|
||||
static CORE_ADDR next_pc, target;
|
||||
static int brktrg_p;
|
||||
|
|
@ -543,10 +546,10 @@ arc_software_single_step (ignore, insert_breakpoints_p)
|
|||
brktrg_p = 0;
|
||||
|
||||
if ((type == BRANCH4 || type == BRANCH8)
|
||||
/* Watch out for branches to the following location.
|
||||
We just stored a breakpoint there and another call to
|
||||
target_insert_breakpoint will think the real insn is the
|
||||
breakpoint we just stored there. */
|
||||
/* Watch out for branches to the following location.
|
||||
We just stored a breakpoint there and another call to
|
||||
target_insert_breakpoint will think the real insn is the
|
||||
breakpoint we just stored there. */
|
||||
&& target != next_pc)
|
||||
{
|
||||
brktrg_p = 1;
|
||||
|
|
@ -568,22 +571,23 @@ arc_software_single_step (ignore, insert_breakpoints_p)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef GET_LONGJMP_TARGET
|
||||
/* Because of Multi-arch, GET_LONGJMP_TARGET is always defined. So test
|
||||
for a definition of JB_PC. */
|
||||
#ifdef JB_PC
|
||||
/* Figure out where the longjmp will land. Slurp the args out of the stack.
|
||||
We expect the first arg to be a pointer to the jmp_buf structure from which
|
||||
we extract the pc (JB_PC) that we will land at. The pc is copied into PC.
|
||||
This routine returns true on success. */
|
||||
|
||||
int
|
||||
get_longjmp_target(pc)
|
||||
CORE_ADDR *pc;
|
||||
get_longjmp_target (CORE_ADDR *pc)
|
||||
{
|
||||
char buf[TARGET_PTR_BIT / TARGET_CHAR_BIT];
|
||||
CORE_ADDR sp, jb_addr;
|
||||
|
||||
sp = read_register (SP_REGNUM);
|
||||
|
||||
if (target_read_memory (sp + SP_ARG0, /* Offset of first arg on stack */
|
||||
if (target_read_memory (sp + SP_ARG0, /* Offset of first arg on stack */
|
||||
buf,
|
||||
TARGET_PTR_BIT / TARGET_CHAR_BIT))
|
||||
return 0;
|
||||
|
|
@ -603,9 +607,7 @@ get_longjmp_target(pc)
|
|||
/* Disassemble one instruction. */
|
||||
|
||||
static int
|
||||
arc_print_insn (vma, info)
|
||||
bfd_vma vma;
|
||||
disassemble_info *info;
|
||||
arc_print_insn (bfd_vma vma, disassemble_info *info)
|
||||
{
|
||||
static int current_mach;
|
||||
static int current_endian;
|
||||
|
|
@ -617,8 +619,7 @@ arc_print_insn (vma, info)
|
|||
{
|
||||
current_mach = arc_bfd_mach_type;
|
||||
current_endian = TARGET_BYTE_ORDER;
|
||||
current_disasm = arc_get_disassembler (current_mach,
|
||||
current_endian == BIG_ENDIAN);
|
||||
current_disasm = arc_get_disassembler (NULL);
|
||||
}
|
||||
|
||||
return (*current_disasm) (vma, info);
|
||||
|
|
@ -627,9 +628,7 @@ arc_print_insn (vma, info)
|
|||
/* Command to set cpu type. */
|
||||
|
||||
void
|
||||
arc_set_cpu_type_command (args, from_tty)
|
||||
char *args;
|
||||
int from_tty;
|
||||
arc_set_cpu_type_command (char *args, int from_tty)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -640,32 +639,29 @@ arc_set_cpu_type_command (args, from_tty)
|
|||
printf_unfiltered ("%s\n", arc_cpu_type_table[i].name);
|
||||
|
||||
/* Restore the value. */
|
||||
tmp_arc_cpu_type = strsave (arc_cpu_type);
|
||||
tmp_arc_cpu_type = xstrdup (arc_cpu_type);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!arc_set_cpu_type (tmp_arc_cpu_type))
|
||||
{
|
||||
error ("Unknown cpu type `%s'.", tmp_arc_cpu_type);
|
||||
/* Restore its value. */
|
||||
tmp_arc_cpu_type = strsave (arc_cpu_type);
|
||||
tmp_arc_cpu_type = xstrdup (arc_cpu_type);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
arc_show_cpu_type_command (args, from_tty)
|
||||
char *args;
|
||||
int from_tty;
|
||||
arc_show_cpu_type_command (char *args, int from_tty)
|
||||
{
|
||||
}
|
||||
|
||||
/* Modify the actual cpu type.
|
||||
Result is a boolean indicating success. */
|
||||
|
||||
int
|
||||
arc_set_cpu_type (str)
|
||||
char *str;
|
||||
static int
|
||||
arc_set_cpu_type (char *str)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
|
|
@ -686,7 +682,7 @@ arc_set_cpu_type (str)
|
|||
}
|
||||
|
||||
void
|
||||
_initialize_arc_tdep ()
|
||||
_initialize_arc_tdep (void)
|
||||
{
|
||||
struct cmd_list_element *c;
|
||||
|
||||
|
|
@ -698,13 +694,13 @@ change the cpu being debugged. It also gives one access to\n\
|
|||
cpu-type-specific registers and recognize cpu-type-specific instructions.\
|
||||
",
|
||||
&setlist);
|
||||
c->function.cfunc = arc_set_cpu_type_command;
|
||||
set_cmd_cfunc (c, arc_set_cpu_type_command);
|
||||
c = add_show_from_set (c, &showlist);
|
||||
c->function.cfunc = arc_show_cpu_type_command;
|
||||
set_cmd_cfunc (c, arc_show_cpu_type_command);
|
||||
|
||||
/* We have to use strsave here because the `set' command frees it before
|
||||
setting a new value. */
|
||||
tmp_arc_cpu_type = strsave (DEFAULT_ARC_CPU_TYPE);
|
||||
/* We have to use xstrdup() here because the `set' command frees it
|
||||
before setting a new value. */
|
||||
tmp_arc_cpu_type = xstrdup (DEFAULT_ARC_CPU_TYPE);
|
||||
arc_set_cpu_type (tmp_arc_cpu_type);
|
||||
|
||||
c = add_set_cmd ("displaypipeline", class_support, var_zinteger,
|
||||
|
|
|
|||
861
contrib/gdb/gdb/arch-utils.c
Normal file
861
contrib/gdb/gdb/arch-utils.c
Normal file
|
|
@ -0,0 +1,861 @@
|
|||
/* Dynamic architecture support for GDB, the GNU debugger.
|
||||
Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
#if GDB_MULTI_ARCH
|
||||
#include "arch-utils.h"
|
||||
#include "gdbcmd.h"
|
||||
#include "inferior.h" /* enum CALL_DUMMY_LOCATION et.al. */
|
||||
#else
|
||||
/* Just include everything in sight so that the every old definition
|
||||
of macro is visible. */
|
||||
#include "gdb_string.h"
|
||||
#include "symtab.h"
|
||||
#include "frame.h"
|
||||
#include "inferior.h"
|
||||
#include "breakpoint.h"
|
||||
#include "gdb_wait.h"
|
||||
#include "gdbcore.h"
|
||||
#include "gdbcmd.h"
|
||||
#include "target.h"
|
||||
#include "annotate.h"
|
||||
#endif
|
||||
#include "regcache.h"
|
||||
#include "gdb_assert.h"
|
||||
|
||||
#include "version.h"
|
||||
|
||||
#include "floatformat.h"
|
||||
|
||||
/* Use the program counter to determine the contents and size
|
||||
of a breakpoint instruction. If no target-dependent macro
|
||||
BREAKPOINT_FROM_PC has been defined to implement this function,
|
||||
assume that the breakpoint doesn't depend on the PC, and
|
||||
use the values of the BIG_BREAKPOINT and LITTLE_BREAKPOINT macros.
|
||||
Return a pointer to a string of bytes that encode a breakpoint
|
||||
instruction, stores the length of the string to *lenptr,
|
||||
and optionally adjust the pc to point to the correct memory location
|
||||
for inserting the breakpoint. */
|
||||
|
||||
unsigned char *
|
||||
legacy_breakpoint_from_pc (CORE_ADDR * pcptr, int *lenptr)
|
||||
{
|
||||
/* {BIG_,LITTLE_}BREAKPOINT is the sequence of bytes we insert for a
|
||||
breakpoint. On some machines, breakpoints are handled by the
|
||||
target environment and we don't have to worry about them here. */
|
||||
#ifdef BIG_BREAKPOINT
|
||||
if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
|
||||
{
|
||||
static unsigned char big_break_insn[] = BIG_BREAKPOINT;
|
||||
*lenptr = sizeof (big_break_insn);
|
||||
return big_break_insn;
|
||||
}
|
||||
#endif
|
||||
#ifdef LITTLE_BREAKPOINT
|
||||
if (TARGET_BYTE_ORDER != BFD_ENDIAN_BIG)
|
||||
{
|
||||
static unsigned char little_break_insn[] = LITTLE_BREAKPOINT;
|
||||
*lenptr = sizeof (little_break_insn);
|
||||
return little_break_insn;
|
||||
}
|
||||
#endif
|
||||
#ifdef BREAKPOINT
|
||||
{
|
||||
static unsigned char break_insn[] = BREAKPOINT;
|
||||
*lenptr = sizeof (break_insn);
|
||||
return break_insn;
|
||||
}
|
||||
#endif
|
||||
*lenptr = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
generic_frameless_function_invocation_not (struct frame_info *fi)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
generic_return_value_on_stack_not (struct type *type)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
CORE_ADDR
|
||||
generic_skip_trampoline_code (CORE_ADDR pc)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
generic_in_solib_call_trampoline (CORE_ADDR pc, char *name)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
generic_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *
|
||||
legacy_register_name (int i)
|
||||
{
|
||||
#ifdef REGISTER_NAMES
|
||||
static char *names[] = REGISTER_NAMES;
|
||||
if (i < 0 || i >= (sizeof (names) / sizeof (*names)))
|
||||
return NULL;
|
||||
else
|
||||
return names[i];
|
||||
#else
|
||||
internal_error (__FILE__, __LINE__,
|
||||
"legacy_register_name: called.");
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined (CALL_DUMMY)
|
||||
LONGEST legacy_call_dummy_words[] = CALL_DUMMY;
|
||||
#else
|
||||
LONGEST legacy_call_dummy_words[1];
|
||||
#endif
|
||||
int legacy_sizeof_call_dummy_words = sizeof (legacy_call_dummy_words);
|
||||
|
||||
void
|
||||
generic_remote_translate_xfer_address (CORE_ADDR gdb_addr, int gdb_len,
|
||||
CORE_ADDR * rem_addr, int *rem_len)
|
||||
{
|
||||
*rem_addr = gdb_addr;
|
||||
*rem_len = gdb_len;
|
||||
}
|
||||
|
||||
int
|
||||
generic_prologue_frameless_p (CORE_ADDR ip)
|
||||
{
|
||||
#ifdef SKIP_PROLOGUE_FRAMELESS_P
|
||||
return ip == SKIP_PROLOGUE_FRAMELESS_P (ip);
|
||||
#else
|
||||
return ip == SKIP_PROLOGUE (ip);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* New/multi-arched targets should use the correct gdbarch field
|
||||
instead of using this global pointer. */
|
||||
int
|
||||
legacy_print_insn (bfd_vma vma, disassemble_info *info)
|
||||
{
|
||||
return (*tm_print_insn) (vma, info);
|
||||
}
|
||||
|
||||
/* Helper functions for INNER_THAN */
|
||||
|
||||
int
|
||||
core_addr_lessthan (CORE_ADDR lhs, CORE_ADDR rhs)
|
||||
{
|
||||
return (lhs < rhs);
|
||||
}
|
||||
|
||||
int
|
||||
core_addr_greaterthan (CORE_ADDR lhs, CORE_ADDR rhs)
|
||||
{
|
||||
return (lhs > rhs);
|
||||
}
|
||||
|
||||
|
||||
/* Helper functions for TARGET_{FLOAT,DOUBLE}_FORMAT */
|
||||
|
||||
const struct floatformat *
|
||||
default_float_format (struct gdbarch *gdbarch)
|
||||
{
|
||||
#if GDB_MULTI_ARCH
|
||||
int byte_order = gdbarch_byte_order (gdbarch);
|
||||
#else
|
||||
int byte_order = TARGET_BYTE_ORDER;
|
||||
#endif
|
||||
switch (byte_order)
|
||||
{
|
||||
case BFD_ENDIAN_BIG:
|
||||
return &floatformat_ieee_single_big;
|
||||
case BFD_ENDIAN_LITTLE:
|
||||
return &floatformat_ieee_single_little;
|
||||
default:
|
||||
internal_error (__FILE__, __LINE__,
|
||||
"default_float_format: bad byte order");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const struct floatformat *
|
||||
default_double_format (struct gdbarch *gdbarch)
|
||||
{
|
||||
#if GDB_MULTI_ARCH
|
||||
int byte_order = gdbarch_byte_order (gdbarch);
|
||||
#else
|
||||
int byte_order = TARGET_BYTE_ORDER;
|
||||
#endif
|
||||
switch (byte_order)
|
||||
{
|
||||
case BFD_ENDIAN_BIG:
|
||||
return &floatformat_ieee_double_big;
|
||||
case BFD_ENDIAN_LITTLE:
|
||||
return &floatformat_ieee_double_little;
|
||||
default:
|
||||
internal_error (__FILE__, __LINE__,
|
||||
"default_double_format: bad byte order");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
default_print_float_info (void)
|
||||
{
|
||||
#ifdef FLOAT_INFO
|
||||
#if GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL
|
||||
#error "FLOAT_INFO defined in multi-arch"
|
||||
#endif
|
||||
FLOAT_INFO;
|
||||
#else
|
||||
printf_filtered ("No floating point info available for this processor.\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Misc helper functions for targets. */
|
||||
|
||||
int
|
||||
frame_num_args_unknown (struct frame_info *fi)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
generic_register_convertible_not (int num)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Under some ABI's that specify the `struct convention' for returning
|
||||
structures by value, by the time we've returned from the function,
|
||||
the return value is sitting there in the caller's buffer, but GDB
|
||||
has no way to find the address of that buffer.
|
||||
|
||||
On such architectures, use this function as your
|
||||
extract_struct_value_address method. When asked to a struct
|
||||
returned by value in this fashion, GDB will print a nice error
|
||||
message, instead of garbage. */
|
||||
CORE_ADDR
|
||||
generic_cannot_extract_struct_value_address (char *dummy)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
default_register_sim_regno (int num)
|
||||
{
|
||||
return num;
|
||||
}
|
||||
|
||||
|
||||
CORE_ADDR
|
||||
core_addr_identity (CORE_ADDR addr)
|
||||
{
|
||||
return addr;
|
||||
}
|
||||
|
||||
int
|
||||
no_op_reg_to_regnum (int reg)
|
||||
{
|
||||
return reg;
|
||||
}
|
||||
|
||||
/* For use by frame_args_address and frame_locals_address. */
|
||||
CORE_ADDR
|
||||
default_frame_address (struct frame_info *fi)
|
||||
{
|
||||
return fi->frame;
|
||||
}
|
||||
|
||||
/* Default prepare_to_procced(). */
|
||||
int
|
||||
default_prepare_to_proceed (int select_it)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Generic prepare_to_proceed(). This one should be suitable for most
|
||||
targets that support threads. */
|
||||
int
|
||||
generic_prepare_to_proceed (int select_it)
|
||||
{
|
||||
ptid_t wait_ptid;
|
||||
struct target_waitstatus wait_status;
|
||||
|
||||
/* Get the last target status returned by target_wait(). */
|
||||
get_last_target_status (&wait_ptid, &wait_status);
|
||||
|
||||
/* Make sure we were stopped either at a breakpoint, or because
|
||||
of a Ctrl-C. */
|
||||
if (wait_status.kind != TARGET_WAITKIND_STOPPED
|
||||
|| (wait_status.value.sig != TARGET_SIGNAL_TRAP &&
|
||||
wait_status.value.sig != TARGET_SIGNAL_INT))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!ptid_equal (wait_ptid, minus_one_ptid)
|
||||
&& !ptid_equal (inferior_ptid, wait_ptid))
|
||||
{
|
||||
/* Switched over from WAIT_PID. */
|
||||
CORE_ADDR wait_pc = read_pc_pid (wait_ptid);
|
||||
|
||||
if (wait_pc != read_pc ())
|
||||
{
|
||||
if (select_it)
|
||||
{
|
||||
/* Switch back to WAIT_PID thread. */
|
||||
inferior_ptid = wait_ptid;
|
||||
|
||||
/* FIXME: This stuff came from switch_to_thread() in
|
||||
thread.c (which should probably be a public function). */
|
||||
flush_cached_frames ();
|
||||
registers_changed ();
|
||||
stop_pc = wait_pc;
|
||||
select_frame (get_current_frame (), 0);
|
||||
}
|
||||
/* We return 1 to indicate that there is a breakpoint here,
|
||||
so we need to step over it before continuing to avoid
|
||||
hitting it straight away. */
|
||||
if (breakpoint_here_p (wait_pc))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
init_frame_pc_noop (int fromleaf, struct frame_info *prev)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
init_frame_pc_default (int fromleaf, struct frame_info *prev)
|
||||
{
|
||||
if (fromleaf)
|
||||
prev->pc = SAVED_PC_AFTER_CALL (prev->next);
|
||||
else if (prev->next != NULL)
|
||||
prev->pc = FRAME_SAVED_PC (prev->next);
|
||||
else
|
||||
prev->pc = read_pc ();
|
||||
}
|
||||
|
||||
void
|
||||
default_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
default_coff_make_msymbol_special (int val, struct minimal_symbol *msym)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
cannot_register_not (int regnum)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Legacy version of target_virtual_frame_pointer(). Assumes that
|
||||
there is an FP_REGNUM and that it is the same, cooked or raw. */
|
||||
|
||||
void
|
||||
legacy_virtual_frame_pointer (CORE_ADDR pc,
|
||||
int *frame_regnum,
|
||||
LONGEST *frame_offset)
|
||||
{
|
||||
gdb_assert (FP_REGNUM >= 0);
|
||||
*frame_regnum = FP_REGNUM;
|
||||
*frame_offset = 0;
|
||||
}
|
||||
|
||||
/* Assume the world is flat. Every register is large enough to fit a
|
||||
target integer. */
|
||||
|
||||
int
|
||||
generic_register_raw_size (int regnum)
|
||||
{
|
||||
gdb_assert (regnum >= 0 && regnum < NUM_REGS + NUM_PSEUDO_REGS);
|
||||
return TARGET_INT_BIT / HOST_CHAR_BIT;
|
||||
}
|
||||
|
||||
/* Assume the virtual size corresponds to the virtual type. */
|
||||
|
||||
int
|
||||
generic_register_virtual_size (int regnum)
|
||||
{
|
||||
return TYPE_LENGTH (REGISTER_VIRTUAL_TYPE (regnum));
|
||||
}
|
||||
|
||||
|
||||
/* Functions to manipulate the endianness of the target. */
|
||||
|
||||
/* ``target_byte_order'' is only used when non- multi-arch.
|
||||
Multi-arch targets obtain the current byte order using the
|
||||
TARGET_BYTE_ORDER gdbarch method.
|
||||
|
||||
The choice of initial value is entirely arbitrary. During startup,
|
||||
the function initialize_current_architecture() updates this value
|
||||
based on default byte-order information extracted from BFD. */
|
||||
int target_byte_order = BFD_ENDIAN_BIG;
|
||||
int target_byte_order_auto = 1;
|
||||
|
||||
static const char endian_big[] = "big";
|
||||
static const char endian_little[] = "little";
|
||||
static const char endian_auto[] = "auto";
|
||||
static const char *endian_enum[] =
|
||||
{
|
||||
endian_big,
|
||||
endian_little,
|
||||
endian_auto,
|
||||
NULL,
|
||||
};
|
||||
static const char *set_endian_string;
|
||||
|
||||
/* Called by ``show endian''. */
|
||||
|
||||
static void
|
||||
show_endian (char *args, int from_tty)
|
||||
{
|
||||
if (TARGET_BYTE_ORDER_AUTO)
|
||||
printf_unfiltered ("The target endianness is set automatically (currently %s endian)\n",
|
||||
(TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? "big" : "little"));
|
||||
else
|
||||
printf_unfiltered ("The target is assumed to be %s endian\n",
|
||||
(TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? "big" : "little"));
|
||||
}
|
||||
|
||||
static void
|
||||
set_endian (char *ignore_args, int from_tty, struct cmd_list_element *c)
|
||||
{
|
||||
if (set_endian_string == endian_auto)
|
||||
{
|
||||
target_byte_order_auto = 1;
|
||||
}
|
||||
else if (set_endian_string == endian_little)
|
||||
{
|
||||
target_byte_order_auto = 0;
|
||||
if (GDB_MULTI_ARCH)
|
||||
{
|
||||
struct gdbarch_info info;
|
||||
gdbarch_info_init (&info);
|
||||
info.byte_order = BFD_ENDIAN_LITTLE;
|
||||
if (! gdbarch_update_p (info))
|
||||
{
|
||||
printf_unfiltered ("Little endian target not supported by GDB\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
target_byte_order = BFD_ENDIAN_LITTLE;
|
||||
}
|
||||
}
|
||||
else if (set_endian_string == endian_big)
|
||||
{
|
||||
target_byte_order_auto = 0;
|
||||
if (GDB_MULTI_ARCH)
|
||||
{
|
||||
struct gdbarch_info info;
|
||||
gdbarch_info_init (&info);
|
||||
info.byte_order = BFD_ENDIAN_BIG;
|
||||
if (! gdbarch_update_p (info))
|
||||
{
|
||||
printf_unfiltered ("Big endian target not supported by GDB\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
target_byte_order = BFD_ENDIAN_BIG;
|
||||
}
|
||||
}
|
||||
else
|
||||
internal_error (__FILE__, __LINE__,
|
||||
"set_endian: bad value");
|
||||
show_endian (NULL, from_tty);
|
||||
}
|
||||
|
||||
/* Set the endianness from a BFD. */
|
||||
|
||||
static void
|
||||
set_endian_from_file (bfd *abfd)
|
||||
{
|
||||
int want;
|
||||
if (GDB_MULTI_ARCH)
|
||||
internal_error (__FILE__, __LINE__,
|
||||
"set_endian_from_file: not for multi-arch");
|
||||
if (bfd_big_endian (abfd))
|
||||
want = BFD_ENDIAN_BIG;
|
||||
else
|
||||
want = BFD_ENDIAN_LITTLE;
|
||||
if (TARGET_BYTE_ORDER_AUTO)
|
||||
target_byte_order = want;
|
||||
else if (TARGET_BYTE_ORDER != want)
|
||||
warning ("%s endian file does not match %s endian target.",
|
||||
want == BFD_ENDIAN_BIG ? "big" : "little",
|
||||
TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? "big" : "little");
|
||||
}
|
||||
|
||||
|
||||
/* Functions to manipulate the architecture of the target */
|
||||
|
||||
enum set_arch { set_arch_auto, set_arch_manual };
|
||||
|
||||
int target_architecture_auto = 1;
|
||||
|
||||
const char *set_architecture_string;
|
||||
|
||||
/* Old way of changing the current architecture. */
|
||||
|
||||
extern const struct bfd_arch_info bfd_default_arch_struct;
|
||||
const struct bfd_arch_info *target_architecture = &bfd_default_arch_struct;
|
||||
int (*target_architecture_hook) (const struct bfd_arch_info *ap);
|
||||
|
||||
static int
|
||||
arch_ok (const struct bfd_arch_info *arch)
|
||||
{
|
||||
if (GDB_MULTI_ARCH)
|
||||
internal_error (__FILE__, __LINE__,
|
||||
"arch_ok: not multi-arched");
|
||||
/* Should be performing the more basic check that the binary is
|
||||
compatible with GDB. */
|
||||
/* Check with the target that the architecture is valid. */
|
||||
return (target_architecture_hook == NULL
|
||||
|| target_architecture_hook (arch));
|
||||
}
|
||||
|
||||
static void
|
||||
set_arch (const struct bfd_arch_info *arch,
|
||||
enum set_arch type)
|
||||
{
|
||||
if (GDB_MULTI_ARCH)
|
||||
internal_error (__FILE__, __LINE__,
|
||||
"set_arch: not multi-arched");
|
||||
switch (type)
|
||||
{
|
||||
case set_arch_auto:
|
||||
if (!arch_ok (arch))
|
||||
warning ("Target may not support %s architecture",
|
||||
arch->printable_name);
|
||||
target_architecture = arch;
|
||||
break;
|
||||
case set_arch_manual:
|
||||
if (!arch_ok (arch))
|
||||
{
|
||||
printf_unfiltered ("Target does not support `%s' architecture.\n",
|
||||
arch->printable_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
target_architecture_auto = 0;
|
||||
target_architecture = arch;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (gdbarch_debug)
|
||||
gdbarch_dump (current_gdbarch, gdb_stdlog);
|
||||
}
|
||||
|
||||
/* Set the architecture from arch/machine (deprecated) */
|
||||
|
||||
void
|
||||
set_architecture_from_arch_mach (enum bfd_architecture arch,
|
||||
unsigned long mach)
|
||||
{
|
||||
const struct bfd_arch_info *wanted = bfd_lookup_arch (arch, mach);
|
||||
if (GDB_MULTI_ARCH)
|
||||
internal_error (__FILE__, __LINE__,
|
||||
"set_architecture_from_arch_mach: not multi-arched");
|
||||
if (wanted != NULL)
|
||||
set_arch (wanted, set_arch_manual);
|
||||
else
|
||||
internal_error (__FILE__, __LINE__,
|
||||
"gdbarch: hardwired architecture/machine not recognized");
|
||||
}
|
||||
|
||||
/* Set the architecture from a BFD (deprecated) */
|
||||
|
||||
static void
|
||||
set_architecture_from_file (bfd *abfd)
|
||||
{
|
||||
const struct bfd_arch_info *wanted = bfd_get_arch_info (abfd);
|
||||
if (GDB_MULTI_ARCH)
|
||||
internal_error (__FILE__, __LINE__,
|
||||
"set_architecture_from_file: not multi-arched");
|
||||
if (target_architecture_auto)
|
||||
{
|
||||
set_arch (wanted, set_arch_auto);
|
||||
}
|
||||
else if (wanted != target_architecture)
|
||||
{
|
||||
warning ("%s architecture file may be incompatible with %s target.",
|
||||
wanted->printable_name,
|
||||
target_architecture->printable_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Called if the user enters ``show architecture'' without an
|
||||
argument. */
|
||||
|
||||
static void
|
||||
show_architecture (char *args, int from_tty)
|
||||
{
|
||||
const char *arch;
|
||||
arch = TARGET_ARCHITECTURE->printable_name;
|
||||
if (target_architecture_auto)
|
||||
printf_filtered ("The target architecture is set automatically (currently %s)\n", arch);
|
||||
else
|
||||
printf_filtered ("The target architecture is assumed to be %s\n", arch);
|
||||
}
|
||||
|
||||
|
||||
/* Called if the user enters ``set architecture'' with or without an
|
||||
argument. */
|
||||
|
||||
static void
|
||||
set_architecture (char *ignore_args, int from_tty, struct cmd_list_element *c)
|
||||
{
|
||||
if (strcmp (set_architecture_string, "auto") == 0)
|
||||
{
|
||||
target_architecture_auto = 1;
|
||||
}
|
||||
else if (GDB_MULTI_ARCH)
|
||||
{
|
||||
struct gdbarch_info info;
|
||||
gdbarch_info_init (&info);
|
||||
info.bfd_arch_info = bfd_scan_arch (set_architecture_string);
|
||||
if (info.bfd_arch_info == NULL)
|
||||
internal_error (__FILE__, __LINE__,
|
||||
"set_architecture: bfd_scan_arch failed");
|
||||
if (gdbarch_update_p (info))
|
||||
target_architecture_auto = 0;
|
||||
else
|
||||
printf_unfiltered ("Architecture `%s' not recognized.\n",
|
||||
set_architecture_string);
|
||||
}
|
||||
else
|
||||
{
|
||||
const struct bfd_arch_info *arch
|
||||
= bfd_scan_arch (set_architecture_string);
|
||||
if (arch == NULL)
|
||||
internal_error (__FILE__, __LINE__,
|
||||
"set_architecture: bfd_scan_arch failed");
|
||||
set_arch (arch, set_arch_manual);
|
||||
}
|
||||
show_architecture (NULL, from_tty);
|
||||
}
|
||||
|
||||
/* Set the dynamic target-system-dependent parameters (architecture,
|
||||
byte-order) using information found in the BFD */
|
||||
|
||||
void
|
||||
set_gdbarch_from_file (bfd *abfd)
|
||||
{
|
||||
if (GDB_MULTI_ARCH)
|
||||
{
|
||||
struct gdbarch_info info;
|
||||
gdbarch_info_init (&info);
|
||||
info.abfd = abfd;
|
||||
if (! gdbarch_update_p (info))
|
||||
error ("Architecture of file not recognized.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
set_architecture_from_file (abfd);
|
||||
set_endian_from_file (abfd);
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize the current architecture. Update the ``set
|
||||
architecture'' command so that it specifies a list of valid
|
||||
architectures. */
|
||||
|
||||
#ifdef DEFAULT_BFD_ARCH
|
||||
extern const bfd_arch_info_type DEFAULT_BFD_ARCH;
|
||||
static const bfd_arch_info_type *default_bfd_arch = &DEFAULT_BFD_ARCH;
|
||||
#else
|
||||
static const bfd_arch_info_type *default_bfd_arch;
|
||||
#endif
|
||||
|
||||
#ifdef DEFAULT_BFD_VEC
|
||||
extern const bfd_target DEFAULT_BFD_VEC;
|
||||
static const bfd_target *default_bfd_vec = &DEFAULT_BFD_VEC;
|
||||
#else
|
||||
static const bfd_target *default_bfd_vec;
|
||||
#endif
|
||||
|
||||
void
|
||||
initialize_current_architecture (void)
|
||||
{
|
||||
const char **arches = gdbarch_printable_names ();
|
||||
|
||||
/* determine a default architecture and byte order. */
|
||||
struct gdbarch_info info;
|
||||
gdbarch_info_init (&info);
|
||||
|
||||
/* Find a default architecture. */
|
||||
if (info.bfd_arch_info == NULL
|
||||
&& default_bfd_arch != NULL)
|
||||
info.bfd_arch_info = default_bfd_arch;
|
||||
if (info.bfd_arch_info == NULL)
|
||||
{
|
||||
/* Choose the architecture by taking the first one
|
||||
alphabetically. */
|
||||
const char *chosen = arches[0];
|
||||
const char **arch;
|
||||
for (arch = arches; *arch != NULL; arch++)
|
||||
{
|
||||
if (strcmp (*arch, chosen) < 0)
|
||||
chosen = *arch;
|
||||
}
|
||||
if (chosen == NULL)
|
||||
internal_error (__FILE__, __LINE__,
|
||||
"initialize_current_architecture: No arch");
|
||||
info.bfd_arch_info = bfd_scan_arch (chosen);
|
||||
if (info.bfd_arch_info == NULL)
|
||||
internal_error (__FILE__, __LINE__,
|
||||
"initialize_current_architecture: Arch not found");
|
||||
}
|
||||
|
||||
/* Take several guesses at a byte order. */
|
||||
if (info.byte_order == BFD_ENDIAN_UNKNOWN
|
||||
&& default_bfd_vec != NULL)
|
||||
{
|
||||
/* Extract BFD's default vector's byte order. */
|
||||
switch (default_bfd_vec->byteorder)
|
||||
{
|
||||
case BFD_ENDIAN_BIG:
|
||||
info.byte_order = BFD_ENDIAN_BIG;
|
||||
break;
|
||||
case BFD_ENDIAN_LITTLE:
|
||||
info.byte_order = BFD_ENDIAN_LITTLE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (info.byte_order == BFD_ENDIAN_UNKNOWN)
|
||||
{
|
||||
/* look for ``*el-*'' in the target name. */
|
||||
const char *chp;
|
||||
chp = strchr (target_name, '-');
|
||||
if (chp != NULL
|
||||
&& chp - 2 >= target_name
|
||||
&& strncmp (chp - 2, "el", 2) == 0)
|
||||
info.byte_order = BFD_ENDIAN_LITTLE;
|
||||
}
|
||||
if (info.byte_order == BFD_ENDIAN_UNKNOWN)
|
||||
{
|
||||
/* Wire it to big-endian!!! */
|
||||
info.byte_order = BFD_ENDIAN_BIG;
|
||||
}
|
||||
|
||||
if (GDB_MULTI_ARCH)
|
||||
{
|
||||
if (! gdbarch_update_p (info))
|
||||
{
|
||||
internal_error (__FILE__, __LINE__,
|
||||
"initialize_current_architecture: Selection of initial architecture failed");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If the multi-arch logic comes up with a byte-order (from BFD)
|
||||
use it for the non-multi-arch case. */
|
||||
if (info.byte_order != BFD_ENDIAN_UNKNOWN)
|
||||
target_byte_order = info.byte_order;
|
||||
initialize_non_multiarch ();
|
||||
}
|
||||
|
||||
/* Create the ``set architecture'' command appending ``auto'' to the
|
||||
list of architectures. */
|
||||
{
|
||||
struct cmd_list_element *c;
|
||||
/* Append ``auto''. */
|
||||
int nr;
|
||||
for (nr = 0; arches[nr] != NULL; nr++);
|
||||
arches = xrealloc (arches, sizeof (char*) * (nr + 2));
|
||||
arches[nr + 0] = "auto";
|
||||
arches[nr + 1] = NULL;
|
||||
/* FIXME: add_set_enum_cmd() uses an array of ``char *'' instead
|
||||
of ``const char *''. We just happen to know that the casts are
|
||||
safe. */
|
||||
c = add_set_enum_cmd ("architecture", class_support,
|
||||
arches, &set_architecture_string,
|
||||
"Set architecture of target.",
|
||||
&setlist);
|
||||
set_cmd_sfunc (c, set_architecture);
|
||||
add_alias_cmd ("processor", "architecture", class_support, 1, &setlist);
|
||||
/* Don't use set_from_show - need to print both auto/manual and
|
||||
current setting. */
|
||||
add_cmd ("architecture", class_support, show_architecture,
|
||||
"Show the current target architecture", &showlist);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Initialize a gdbarch info to values that will be automatically
|
||||
overridden. Note: Originally, this ``struct info'' was initialized
|
||||
using memset(0). Unfortunatly, that ran into problems, namely
|
||||
BFD_ENDIAN_BIG is zero. An explicit initialization function that
|
||||
can explicitly set each field to a well defined value is used. */
|
||||
|
||||
void
|
||||
gdbarch_info_init (struct gdbarch_info *info)
|
||||
{
|
||||
memset (info, 0, sizeof (struct gdbarch_info));
|
||||
info->byte_order = BFD_ENDIAN_UNKNOWN;
|
||||
}
|
||||
|
||||
/* */
|
||||
|
||||
extern initialize_file_ftype _initialize_gdbarch_utils;
|
||||
|
||||
void
|
||||
_initialize_gdbarch_utils (void)
|
||||
{
|
||||
struct cmd_list_element *c;
|
||||
c = add_set_enum_cmd ("endian", class_support,
|
||||
endian_enum, &set_endian_string,
|
||||
"Set endianness of target.",
|
||||
&setlist);
|
||||
set_cmd_sfunc (c, set_endian);
|
||||
/* Don't use set_from_show - need to print both auto/manual and
|
||||
current setting. */
|
||||
add_cmd ("endian", class_support, show_endian,
|
||||
"Show the current byte-order", &showlist);
|
||||
}
|
||||
163
contrib/gdb/gdb/arch-utils.h
Normal file
163
contrib/gdb/gdb/arch-utils.h
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
/* Dynamic architecture support for GDB, the GNU debugger.
|
||||
Copyright 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef GDBARCH_UTILS_H
|
||||
#define GDBARCH_UTILS_H
|
||||
|
||||
/* gdbarch trace variable */
|
||||
extern int gdbarch_debug;
|
||||
|
||||
/* Fallback for register convertible. */
|
||||
extern gdbarch_register_convertible_ftype generic_register_convertible_not;
|
||||
|
||||
extern CORE_ADDR generic_cannot_extract_struct_value_address (char *dummy);
|
||||
|
||||
/* Helper function for targets that don't know how my arguments are
|
||||
being passed */
|
||||
extern gdbarch_frame_num_args_ftype frame_num_args_unknown;
|
||||
|
||||
/* Implementation of breakpoint from PC using any of the deprecated
|
||||
macros BREAKPOINT, LITTLE_BREAKPOINT, BIG_BREAPOINT. For legacy
|
||||
targets that don't yet implement their own breakpoint_from_pc(). */
|
||||
extern gdbarch_breakpoint_from_pc_ftype legacy_breakpoint_from_pc;
|
||||
|
||||
/* Frameless functions not identifable. */
|
||||
extern gdbarch_frameless_function_invocation_ftype generic_frameless_function_invocation_not;
|
||||
|
||||
/* Only structures, unions, and arrays are returned using the struct
|
||||
convention. Note that arrays are never passed by value in the C
|
||||
language family, so that case is irrelevant for C. */
|
||||
extern gdbarch_return_value_on_stack_ftype generic_return_value_on_stack_not;
|
||||
|
||||
/* Map onto old REGISTER_NAMES. */
|
||||
extern char *legacy_register_name (int i);
|
||||
|
||||
/* Accessor for old global function pointer for disassembly. */
|
||||
extern int legacy_print_insn (bfd_vma vma, disassemble_info *info);
|
||||
|
||||
/* Backward compatible call_dummy_words. */
|
||||
extern LONGEST legacy_call_dummy_words[];
|
||||
extern int legacy_sizeof_call_dummy_words;
|
||||
|
||||
/* Typical remote_translate_xfer_address */
|
||||
extern gdbarch_remote_translate_xfer_address_ftype generic_remote_translate_xfer_address;
|
||||
|
||||
/* Generic implementation of prologue_frameless_p. Just calls
|
||||
SKIP_PROLOG and checks the return value to see if it actually
|
||||
changed. */
|
||||
extern gdbarch_prologue_frameless_p_ftype generic_prologue_frameless_p;
|
||||
|
||||
/* The only possible cases for inner_than. */
|
||||
extern int core_addr_lessthan (CORE_ADDR lhs, CORE_ADDR rhs);
|
||||
extern int core_addr_greaterthan (CORE_ADDR lhs, CORE_ADDR rhs);
|
||||
|
||||
/* Floating point values. */
|
||||
extern const struct floatformat *default_float_format (struct gdbarch *gdbarch);
|
||||
extern const struct floatformat *default_double_format (struct gdbarch *gdbarch);
|
||||
|
||||
/* Helper function for targets that don't know how my arguments are
|
||||
being passed */
|
||||
extern int frame_num_args_unknown (struct frame_info *fi);
|
||||
|
||||
|
||||
/* The following DEPRECATED interfaces are for pre- multi-arch legacy
|
||||
targets. */
|
||||
|
||||
/* DEPRECATED pre- multi-arch interface. Explicitly set the dynamic
|
||||
target-system-dependent parameters based on bfd_architecture and
|
||||
machine. This function is deprecated, use
|
||||
set_gdbarch_from_arch_machine(). */
|
||||
|
||||
extern void set_architecture_from_arch_mach (enum bfd_architecture, unsigned long);
|
||||
|
||||
/* DEPRECATED pre- multi-arch interface. Notify the target dependent
|
||||
backend of a change to the selected architecture. A zero return
|
||||
status indicates that the target did not like the change. */
|
||||
|
||||
extern int (*target_architecture_hook) (const struct bfd_arch_info *);
|
||||
|
||||
|
||||
/* Default raw->sim register re-numbering - does nothing. */
|
||||
|
||||
extern int default_register_sim_regno (int reg_nr);
|
||||
|
||||
/* Identity function on a CORE_ADDR. Just returns its parameter. */
|
||||
|
||||
extern CORE_ADDR core_addr_identity (CORE_ADDR addr);
|
||||
|
||||
/* No-op conversion of reg to regnum. */
|
||||
|
||||
extern int no_op_reg_to_regnum (int reg);
|
||||
|
||||
/* Default frame_args_address and frame_locals_address. */
|
||||
|
||||
extern CORE_ADDR default_frame_address (struct frame_info *);
|
||||
|
||||
/* Default prepare_to_procced. */
|
||||
|
||||
extern int default_prepare_to_proceed (int select_it);
|
||||
|
||||
extern int generic_prepare_to_proceed (int select_it);
|
||||
|
||||
/* Versions of init_frame_pc(). Do nothing; do the default. */
|
||||
|
||||
void init_frame_pc_noop (int fromleaf, struct frame_info *prev);
|
||||
|
||||
void init_frame_pc_default (int fromleaf, struct frame_info *prev);
|
||||
|
||||
/* Do nothing version of elf_make_msymbol_special. */
|
||||
|
||||
void default_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym);
|
||||
|
||||
/* Do nothing version of coff_make_msymbol_special. */
|
||||
|
||||
void default_coff_make_msymbol_special (int val, struct minimal_symbol *msym);
|
||||
|
||||
/* Version of cannot_fetch_register() / cannot_store_register() that
|
||||
always fails. */
|
||||
|
||||
int cannot_register_not (int regnum);
|
||||
|
||||
/* Legacy version of target_virtual_frame_pointer(). Assumes that
|
||||
there is an FP_REGNUM and that it is the same, cooked or raw. */
|
||||
|
||||
extern gdbarch_virtual_frame_pointer_ftype legacy_virtual_frame_pointer;
|
||||
|
||||
extern CORE_ADDR generic_skip_trampoline_code (CORE_ADDR pc);
|
||||
|
||||
extern int generic_in_solib_call_trampoline (CORE_ADDR pc, char *name);
|
||||
|
||||
extern int generic_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc);
|
||||
|
||||
extern void default_print_float_info (void);
|
||||
|
||||
/* Assume all registers are the same size and a size identical to that
|
||||
of the integer type. */
|
||||
extern int generic_register_raw_size (int regnum);
|
||||
|
||||
/* Assume the virtual size of registers corresponds to the virtual type. */
|
||||
|
||||
extern int generic_register_virtual_size (int regnum);
|
||||
|
||||
/* Initialize a ``struct info''. Can't use memset(0) since some
|
||||
default values are not zero. */
|
||||
extern void gdbarch_info_init (struct gdbarch_info *info);
|
||||
|
||||
#endif
|
||||
698
contrib/gdb/gdb/arm-linux-nat.c
Normal file
698
contrib/gdb/gdb/arm-linux-nat.c
Normal file
|
|
@ -0,0 +1,698 @@
|
|||
/* GNU/Linux on ARM native support.
|
||||
Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "inferior.h"
|
||||
#include "gdbcore.h"
|
||||
#include "gdb_string.h"
|
||||
#include "regcache.h"
|
||||
|
||||
#include "arm-tdep.h"
|
||||
|
||||
#include <sys/user.h>
|
||||
#include <sys/ptrace.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <sys/procfs.h>
|
||||
|
||||
/* Prototypes for supply_gregset etc. */
|
||||
#include "gregset.h"
|
||||
|
||||
extern int arm_apcs_32;
|
||||
|
||||
#define typeNone 0x00
|
||||
#define typeSingle 0x01
|
||||
#define typeDouble 0x02
|
||||
#define typeExtended 0x03
|
||||
#define FPWORDS 28
|
||||
#define ARM_CPSR_REGNUM 16
|
||||
|
||||
typedef union tagFPREG
|
||||
{
|
||||
unsigned int fSingle;
|
||||
unsigned int fDouble[2];
|
||||
unsigned int fExtended[3];
|
||||
}
|
||||
FPREG;
|
||||
|
||||
typedef struct tagFPA11
|
||||
{
|
||||
FPREG fpreg[8]; /* 8 floating point registers */
|
||||
unsigned int fpsr; /* floating point status register */
|
||||
unsigned int fpcr; /* floating point control register */
|
||||
unsigned char fType[8]; /* type of floating point value held in
|
||||
floating point registers. */
|
||||
int initflag; /* NWFPE initialization flag. */
|
||||
}
|
||||
FPA11;
|
||||
|
||||
/* The following variables are used to determine the version of the
|
||||
underlying GNU/Linux operating system. Examples:
|
||||
|
||||
GNU/Linux 2.0.35 GNU/Linux 2.2.12
|
||||
os_version = 0x00020023 os_version = 0x0002020c
|
||||
os_major = 2 os_major = 2
|
||||
os_minor = 0 os_minor = 2
|
||||
os_release = 35 os_release = 12
|
||||
|
||||
Note: os_version = (os_major << 16) | (os_minor << 8) | os_release
|
||||
|
||||
These are initialized using get_linux_version() from
|
||||
_initialize_arm_linux_nat(). */
|
||||
|
||||
static unsigned int os_version, os_major, os_minor, os_release;
|
||||
|
||||
/* On GNU/Linux, threads are implemented as pseudo-processes, in which
|
||||
case we may be tracing more than one process at a time. In that
|
||||
case, inferior_ptid will contain the main process ID and the
|
||||
individual thread (process) ID. get_thread_id () is used to get
|
||||
the thread id if it's available, and the process id otherwise. */
|
||||
|
||||
int
|
||||
get_thread_id (ptid_t ptid)
|
||||
{
|
||||
int tid = TIDGET (ptid);
|
||||
if (0 == tid)
|
||||
tid = PIDGET (ptid);
|
||||
return tid;
|
||||
}
|
||||
#define GET_THREAD_ID(PTID) get_thread_id ((PTID));
|
||||
|
||||
static void
|
||||
fetch_nwfpe_single (unsigned int fn, FPA11 * fpa11)
|
||||
{
|
||||
unsigned int mem[3];
|
||||
|
||||
mem[0] = fpa11->fpreg[fn].fSingle;
|
||||
mem[1] = 0;
|
||||
mem[2] = 0;
|
||||
supply_register (ARM_F0_REGNUM + fn, (char *) &mem[0]);
|
||||
}
|
||||
|
||||
static void
|
||||
fetch_nwfpe_double (unsigned int fn, FPA11 * fpa11)
|
||||
{
|
||||
unsigned int mem[3];
|
||||
|
||||
mem[0] = fpa11->fpreg[fn].fDouble[1];
|
||||
mem[1] = fpa11->fpreg[fn].fDouble[0];
|
||||
mem[2] = 0;
|
||||
supply_register (ARM_F0_REGNUM + fn, (char *) &mem[0]);
|
||||
}
|
||||
|
||||
static void
|
||||
fetch_nwfpe_none (unsigned int fn)
|
||||
{
|
||||
unsigned int mem[3] =
|
||||
{0, 0, 0};
|
||||
|
||||
supply_register (ARM_F0_REGNUM + fn, (char *) &mem[0]);
|
||||
}
|
||||
|
||||
static void
|
||||
fetch_nwfpe_extended (unsigned int fn, FPA11 * fpa11)
|
||||
{
|
||||
unsigned int mem[3];
|
||||
|
||||
mem[0] = fpa11->fpreg[fn].fExtended[0]; /* sign & exponent */
|
||||
mem[1] = fpa11->fpreg[fn].fExtended[2]; /* ls bits */
|
||||
mem[2] = fpa11->fpreg[fn].fExtended[1]; /* ms bits */
|
||||
supply_register (ARM_F0_REGNUM + fn, (char *) &mem[0]);
|
||||
}
|
||||
|
||||
static void
|
||||
fetch_nwfpe_register (int regno, FPA11 * fpa11)
|
||||
{
|
||||
int fn = regno - ARM_F0_REGNUM;
|
||||
|
||||
switch (fpa11->fType[fn])
|
||||
{
|
||||
case typeSingle:
|
||||
fetch_nwfpe_single (fn, fpa11);
|
||||
break;
|
||||
|
||||
case typeDouble:
|
||||
fetch_nwfpe_double (fn, fpa11);
|
||||
break;
|
||||
|
||||
case typeExtended:
|
||||
fetch_nwfpe_extended (fn, fpa11);
|
||||
break;
|
||||
|
||||
default:
|
||||
fetch_nwfpe_none (fn);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
store_nwfpe_single (unsigned int fn, FPA11 *fpa11)
|
||||
{
|
||||
unsigned int mem[3];
|
||||
|
||||
regcache_collect (ARM_F0_REGNUM + fn, (char *) &mem[0]);
|
||||
fpa11->fpreg[fn].fSingle = mem[0];
|
||||
fpa11->fType[fn] = typeSingle;
|
||||
}
|
||||
|
||||
static void
|
||||
store_nwfpe_double (unsigned int fn, FPA11 *fpa11)
|
||||
{
|
||||
unsigned int mem[3];
|
||||
|
||||
regcache_collect (ARM_F0_REGNUM + fn, (char *) &mem[0]);
|
||||
fpa11->fpreg[fn].fDouble[1] = mem[0];
|
||||
fpa11->fpreg[fn].fDouble[0] = mem[1];
|
||||
fpa11->fType[fn] = typeDouble;
|
||||
}
|
||||
|
||||
void
|
||||
store_nwfpe_extended (unsigned int fn, FPA11 *fpa11)
|
||||
{
|
||||
unsigned int mem[3];
|
||||
|
||||
regcache_collect (ARM_F0_REGNUM + fn, (char *) &mem[0]);
|
||||
fpa11->fpreg[fn].fExtended[0] = mem[0]; /* sign & exponent */
|
||||
fpa11->fpreg[fn].fExtended[2] = mem[1]; /* ls bits */
|
||||
fpa11->fpreg[fn].fExtended[1] = mem[2]; /* ms bits */
|
||||
fpa11->fType[fn] = typeDouble;
|
||||
}
|
||||
|
||||
void
|
||||
store_nwfpe_register (int regno, FPA11 * fpa11)
|
||||
{
|
||||
if (register_cached (regno))
|
||||
{
|
||||
unsigned int fn = regno - ARM_F0_REGNUM;
|
||||
switch (fpa11->fType[fn])
|
||||
{
|
||||
case typeSingle:
|
||||
store_nwfpe_single (fn, fpa11);
|
||||
break;
|
||||
|
||||
case typeDouble:
|
||||
store_nwfpe_double (fn, fpa11);
|
||||
break;
|
||||
|
||||
case typeExtended:
|
||||
store_nwfpe_extended (fn, fpa11);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Get the value of a particular register from the floating point
|
||||
state of the process and store it into regcache. */
|
||||
|
||||
static void
|
||||
fetch_fpregister (int regno)
|
||||
{
|
||||
int ret, tid;
|
||||
FPA11 fp;
|
||||
|
||||
/* Get the thread id for the ptrace call. */
|
||||
tid = GET_THREAD_ID (inferior_ptid);
|
||||
|
||||
/* Read the floating point state. */
|
||||
ret = ptrace (PT_GETFPREGS, tid, 0, &fp);
|
||||
if (ret < 0)
|
||||
{
|
||||
warning ("Unable to fetch floating point register.");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Fetch fpsr. */
|
||||
if (ARM_FPS_REGNUM == regno)
|
||||
supply_register (ARM_FPS_REGNUM, (char *) &fp.fpsr);
|
||||
|
||||
/* Fetch the floating point register. */
|
||||
if (regno >= ARM_F0_REGNUM && regno <= ARM_F7_REGNUM)
|
||||
{
|
||||
int fn = regno - ARM_F0_REGNUM;
|
||||
|
||||
switch (fp.fType[fn])
|
||||
{
|
||||
case typeSingle:
|
||||
fetch_nwfpe_single (fn, &fp);
|
||||
break;
|
||||
|
||||
case typeDouble:
|
||||
fetch_nwfpe_double (fn, &fp);
|
||||
break;
|
||||
|
||||
case typeExtended:
|
||||
fetch_nwfpe_extended (fn, &fp);
|
||||
break;
|
||||
|
||||
default:
|
||||
fetch_nwfpe_none (fn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Get the whole floating point state of the process and store it
|
||||
into regcache. */
|
||||
|
||||
static void
|
||||
fetch_fpregs (void)
|
||||
{
|
||||
int ret, regno, tid;
|
||||
FPA11 fp;
|
||||
|
||||
/* Get the thread id for the ptrace call. */
|
||||
tid = GET_THREAD_ID (inferior_ptid);
|
||||
|
||||
/* Read the floating point state. */
|
||||
ret = ptrace (PT_GETFPREGS, tid, 0, &fp);
|
||||
if (ret < 0)
|
||||
{
|
||||
warning ("Unable to fetch the floating point registers.");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Fetch fpsr. */
|
||||
supply_register (ARM_FPS_REGNUM, (char *) &fp.fpsr);
|
||||
|
||||
/* Fetch the floating point registers. */
|
||||
for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++)
|
||||
{
|
||||
int fn = regno - ARM_F0_REGNUM;
|
||||
|
||||
switch (fp.fType[fn])
|
||||
{
|
||||
case typeSingle:
|
||||
fetch_nwfpe_single (fn, &fp);
|
||||
break;
|
||||
|
||||
case typeDouble:
|
||||
fetch_nwfpe_double (fn, &fp);
|
||||
break;
|
||||
|
||||
case typeExtended:
|
||||
fetch_nwfpe_extended (fn, &fp);
|
||||
break;
|
||||
|
||||
default:
|
||||
fetch_nwfpe_none (fn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Save a particular register into the floating point state of the
|
||||
process using the contents from regcache. */
|
||||
|
||||
static void
|
||||
store_fpregister (int regno)
|
||||
{
|
||||
int ret, tid;
|
||||
FPA11 fp;
|
||||
|
||||
/* Get the thread id for the ptrace call. */
|
||||
tid = GET_THREAD_ID (inferior_ptid);
|
||||
|
||||
/* Read the floating point state. */
|
||||
ret = ptrace (PT_GETFPREGS, tid, 0, &fp);
|
||||
if (ret < 0)
|
||||
{
|
||||
warning ("Unable to fetch the floating point registers.");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Store fpsr. */
|
||||
if (ARM_FPS_REGNUM == regno && register_cached (ARM_FPS_REGNUM))
|
||||
regcache_collect (ARM_FPS_REGNUM, (char *) &fp.fpsr);
|
||||
|
||||
/* Store the floating point register. */
|
||||
if (regno >= ARM_F0_REGNUM && regno <= ARM_F7_REGNUM)
|
||||
{
|
||||
store_nwfpe_register (regno, &fp);
|
||||
}
|
||||
|
||||
ret = ptrace (PTRACE_SETFPREGS, tid, 0, &fp);
|
||||
if (ret < 0)
|
||||
{
|
||||
warning ("Unable to store floating point register.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Save the whole floating point state of the process using
|
||||
the contents from regcache. */
|
||||
|
||||
static void
|
||||
store_fpregs (void)
|
||||
{
|
||||
int ret, regno, tid;
|
||||
FPA11 fp;
|
||||
|
||||
/* Get the thread id for the ptrace call. */
|
||||
tid = GET_THREAD_ID (inferior_ptid);
|
||||
|
||||
/* Read the floating point state. */
|
||||
ret = ptrace (PT_GETFPREGS, tid, 0, &fp);
|
||||
if (ret < 0)
|
||||
{
|
||||
warning ("Unable to fetch the floating point registers.");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Store fpsr. */
|
||||
if (register_cached (ARM_FPS_REGNUM))
|
||||
regcache_collect (ARM_FPS_REGNUM, (char *) &fp.fpsr);
|
||||
|
||||
/* Store the floating point registers. */
|
||||
for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++)
|
||||
{
|
||||
fetch_nwfpe_register (regno, &fp);
|
||||
}
|
||||
|
||||
ret = ptrace (PTRACE_SETFPREGS, tid, 0, &fp);
|
||||
if (ret < 0)
|
||||
{
|
||||
warning ("Unable to store floating point registers.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Fetch a general register of the process and store into
|
||||
regcache. */
|
||||
|
||||
static void
|
||||
fetch_register (int regno)
|
||||
{
|
||||
int ret, tid;
|
||||
elf_gregset_t regs;
|
||||
|
||||
/* Get the thread id for the ptrace call. */
|
||||
tid = GET_THREAD_ID (inferior_ptid);
|
||||
|
||||
ret = ptrace (PTRACE_GETREGS, tid, 0, ®s);
|
||||
if (ret < 0)
|
||||
{
|
||||
warning ("Unable to fetch general register.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (regno >= ARM_A1_REGNUM && regno < ARM_PC_REGNUM)
|
||||
supply_register (regno, (char *) ®s[regno]);
|
||||
|
||||
if (ARM_PS_REGNUM == regno)
|
||||
{
|
||||
if (arm_apcs_32)
|
||||
supply_register (ARM_PS_REGNUM, (char *) ®s[ARM_CPSR_REGNUM]);
|
||||
else
|
||||
supply_register (ARM_PS_REGNUM, (char *) ®s[ARM_PC_REGNUM]);
|
||||
}
|
||||
|
||||
if (ARM_PC_REGNUM == regno)
|
||||
{
|
||||
regs[ARM_PC_REGNUM] = ADDR_BITS_REMOVE (regs[ARM_PC_REGNUM]);
|
||||
supply_register (ARM_PC_REGNUM, (char *) ®s[ARM_PC_REGNUM]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Fetch all general registers of the process and store into
|
||||
regcache. */
|
||||
|
||||
static void
|
||||
fetch_regs (void)
|
||||
{
|
||||
int ret, regno, tid;
|
||||
elf_gregset_t regs;
|
||||
|
||||
/* Get the thread id for the ptrace call. */
|
||||
tid = GET_THREAD_ID (inferior_ptid);
|
||||
|
||||
ret = ptrace (PTRACE_GETREGS, tid, 0, ®s);
|
||||
if (ret < 0)
|
||||
{
|
||||
warning ("Unable to fetch general registers.");
|
||||
return;
|
||||
}
|
||||
|
||||
for (regno = ARM_A1_REGNUM; regno < ARM_PC_REGNUM; regno++)
|
||||
supply_register (regno, (char *) ®s[regno]);
|
||||
|
||||
if (arm_apcs_32)
|
||||
supply_register (ARM_PS_REGNUM, (char *) ®s[ARM_CPSR_REGNUM]);
|
||||
else
|
||||
supply_register (ARM_PS_REGNUM, (char *) ®s[ARM_PC_REGNUM]);
|
||||
|
||||
regs[ARM_PC_REGNUM] = ADDR_BITS_REMOVE (regs[ARM_PC_REGNUM]);
|
||||
supply_register (ARM_PC_REGNUM, (char *) ®s[ARM_PC_REGNUM]);
|
||||
}
|
||||
|
||||
/* Store all general registers of the process from the values in
|
||||
regcache. */
|
||||
|
||||
static void
|
||||
store_register (int regno)
|
||||
{
|
||||
int ret, tid;
|
||||
elf_gregset_t regs;
|
||||
|
||||
if (!register_cached (regno))
|
||||
return;
|
||||
|
||||
/* Get the thread id for the ptrace call. */
|
||||
tid = GET_THREAD_ID (inferior_ptid);
|
||||
|
||||
/* Get the general registers from the process. */
|
||||
ret = ptrace (PTRACE_GETREGS, tid, 0, ®s);
|
||||
if (ret < 0)
|
||||
{
|
||||
warning ("Unable to fetch general registers.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (regno >= ARM_A1_REGNUM && regno <= ARM_PC_REGNUM)
|
||||
regcache_collect (regno, (char *) ®s[regno]);
|
||||
|
||||
ret = ptrace (PTRACE_SETREGS, tid, 0, ®s);
|
||||
if (ret < 0)
|
||||
{
|
||||
warning ("Unable to store general register.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
store_regs (void)
|
||||
{
|
||||
int ret, regno, tid;
|
||||
elf_gregset_t regs;
|
||||
|
||||
/* Get the thread id for the ptrace call. */
|
||||
tid = GET_THREAD_ID (inferior_ptid);
|
||||
|
||||
/* Fetch the general registers. */
|
||||
ret = ptrace (PTRACE_GETREGS, tid, 0, ®s);
|
||||
if (ret < 0)
|
||||
{
|
||||
warning ("Unable to fetch general registers.");
|
||||
return;
|
||||
}
|
||||
|
||||
for (regno = ARM_A1_REGNUM; regno <= ARM_PC_REGNUM; regno++)
|
||||
{
|
||||
if (register_cached (regno))
|
||||
regcache_collect (regno, (char *) ®s[regno]);
|
||||
}
|
||||
|
||||
ret = ptrace (PTRACE_SETREGS, tid, 0, ®s);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
warning ("Unable to store general registers.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Fetch registers from the child process. Fetch all registers if
|
||||
regno == -1, otherwise fetch all general registers or all floating
|
||||
point registers depending upon the value of regno. */
|
||||
|
||||
void
|
||||
fetch_inferior_registers (int regno)
|
||||
{
|
||||
if (-1 == regno)
|
||||
{
|
||||
fetch_regs ();
|
||||
fetch_fpregs ();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (regno < ARM_F0_REGNUM || regno > ARM_FPS_REGNUM)
|
||||
fetch_register (regno);
|
||||
|
||||
if (regno >= ARM_F0_REGNUM && regno <= ARM_FPS_REGNUM)
|
||||
fetch_fpregister (regno);
|
||||
}
|
||||
}
|
||||
|
||||
/* Store registers back into the inferior. Store all registers if
|
||||
regno == -1, otherwise store all general registers or all floating
|
||||
point registers depending upon the value of regno. */
|
||||
|
||||
void
|
||||
store_inferior_registers (int regno)
|
||||
{
|
||||
if (-1 == regno)
|
||||
{
|
||||
store_regs ();
|
||||
store_fpregs ();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((regno < ARM_F0_REGNUM) || (regno > ARM_FPS_REGNUM))
|
||||
store_register (regno);
|
||||
|
||||
if ((regno >= ARM_F0_REGNUM) && (regno <= ARM_FPS_REGNUM))
|
||||
store_fpregister (regno);
|
||||
}
|
||||
}
|
||||
|
||||
/* Fill register regno (if it is a general-purpose register) in
|
||||
*gregsetp with the appropriate value from GDB's register array.
|
||||
If regno is -1, do this for all registers. */
|
||||
|
||||
void
|
||||
fill_gregset (gdb_gregset_t *gregsetp, int regno)
|
||||
{
|
||||
if (-1 == regno)
|
||||
{
|
||||
int regnum;
|
||||
for (regnum = ARM_A1_REGNUM; regnum <= ARM_PC_REGNUM; regnum++)
|
||||
regcache_collect (regnum, (char *) &(*gregsetp)[regnum]);
|
||||
}
|
||||
else if (regno >= ARM_A1_REGNUM && regno <= ARM_PC_REGNUM)
|
||||
regcache_collect (regno, (char *) &(*gregsetp)[regno]);
|
||||
|
||||
if (ARM_PS_REGNUM == regno || -1 == regno)
|
||||
{
|
||||
if (arm_apcs_32)
|
||||
regcache_collect (ARM_PS_REGNUM,
|
||||
(char *) &(*gregsetp)[ARM_CPSR_REGNUM]);
|
||||
else
|
||||
regcache_collect (ARM_PC_REGNUM,
|
||||
(char *) &(*gregsetp)[ARM_PC_REGNUM]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Fill GDB's register array with the general-purpose register values
|
||||
in *gregsetp. */
|
||||
|
||||
void
|
||||
supply_gregset (gdb_gregset_t *gregsetp)
|
||||
{
|
||||
int regno, reg_pc;
|
||||
|
||||
for (regno = ARM_A1_REGNUM; regno < ARM_PC_REGNUM; regno++)
|
||||
supply_register (regno, (char *) &(*gregsetp)[regno]);
|
||||
|
||||
if (arm_apcs_32)
|
||||
supply_register (ARM_PS_REGNUM, (char *) &(*gregsetp)[ARM_CPSR_REGNUM]);
|
||||
else
|
||||
supply_register (ARM_PS_REGNUM, (char *) &(*gregsetp)[ARM_PC_REGNUM]);
|
||||
|
||||
reg_pc = ADDR_BITS_REMOVE ((CORE_ADDR)(*gregsetp)[ARM_PC_REGNUM]);
|
||||
supply_register (ARM_PC_REGNUM, (char *) ®_pc);
|
||||
}
|
||||
|
||||
/* Fill register regno (if it is a floating-point register) in
|
||||
*fpregsetp with the appropriate value from GDB's register array.
|
||||
If regno is -1, do this for all registers. */
|
||||
|
||||
void
|
||||
fill_fpregset (gdb_fpregset_t *fpregsetp, int regno)
|
||||
{
|
||||
FPA11 *fp = (FPA11 *) fpregsetp;
|
||||
|
||||
if (-1 == regno)
|
||||
{
|
||||
int regnum;
|
||||
for (regnum = ARM_F0_REGNUM; regnum <= ARM_F7_REGNUM; regnum++)
|
||||
store_nwfpe_register (regnum, fp);
|
||||
}
|
||||
else if (regno >= ARM_F0_REGNUM && regno <= ARM_F7_REGNUM)
|
||||
{
|
||||
store_nwfpe_register (regno, fp);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Store fpsr. */
|
||||
if (ARM_FPS_REGNUM == regno || -1 == regno)
|
||||
regcache_collect (ARM_FPS_REGNUM, (char *) &fp->fpsr);
|
||||
}
|
||||
|
||||
/* Fill GDB's register array with the floating-point register values
|
||||
in *fpregsetp. */
|
||||
|
||||
void
|
||||
supply_fpregset (gdb_fpregset_t *fpregsetp)
|
||||
{
|
||||
int regno;
|
||||
FPA11 *fp = (FPA11 *) fpregsetp;
|
||||
|
||||
/* Fetch fpsr. */
|
||||
supply_register (ARM_FPS_REGNUM, (char *) &fp->fpsr);
|
||||
|
||||
/* Fetch the floating point registers. */
|
||||
for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++)
|
||||
{
|
||||
fetch_nwfpe_register (regno, fp);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
arm_linux_kernel_u_size (void)
|
||||
{
|
||||
return (sizeof (struct user));
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
get_linux_version (unsigned int *vmajor,
|
||||
unsigned int *vminor,
|
||||
unsigned int *vrelease)
|
||||
{
|
||||
struct utsname info;
|
||||
char *pmajor, *pminor, *prelease, *tail;
|
||||
|
||||
if (-1 == uname (&info))
|
||||
{
|
||||
warning ("Unable to determine GNU/Linux version.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
pmajor = strtok (info.release, ".");
|
||||
pminor = strtok (NULL, ".");
|
||||
prelease = strtok (NULL, ".");
|
||||
|
||||
*vmajor = (unsigned int) strtoul (pmajor, &tail, 0);
|
||||
*vminor = (unsigned int) strtoul (pminor, &tail, 0);
|
||||
*vrelease = (unsigned int) strtoul (prelease, &tail, 0);
|
||||
|
||||
return ((*vmajor << 16) | (*vminor << 8) | *vrelease);
|
||||
}
|
||||
|
||||
void
|
||||
_initialize_arm_linux_nat (void)
|
||||
{
|
||||
os_version = get_linux_version (&os_major, &os_minor, &os_release);
|
||||
}
|
||||
547
contrib/gdb/gdb/arm-linux-tdep.c
Normal file
547
contrib/gdb/gdb/arm-linux-tdep.c
Normal file
|
|
@ -0,0 +1,547 @@
|
|||
/* GNU/Linux on ARM target support.
|
||||
Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "target.h"
|
||||
#include "value.h"
|
||||
#include "gdbtypes.h"
|
||||
#include "floatformat.h"
|
||||
#include "gdbcore.h"
|
||||
#include "frame.h"
|
||||
#include "regcache.h"
|
||||
#include "doublest.h"
|
||||
|
||||
#include "arm-tdep.h"
|
||||
|
||||
/* For shared library handling. */
|
||||
#include "symtab.h"
|
||||
#include "symfile.h"
|
||||
#include "objfiles.h"
|
||||
|
||||
/* Under ARM GNU/Linux the traditional way of performing a breakpoint
|
||||
is to execute a particular software interrupt, rather than use a
|
||||
particular undefined instruction to provoke a trap. Upon exection
|
||||
of the software interrupt the kernel stops the inferior with a
|
||||
SIGTRAP, and wakes the debugger. Since ARM GNU/Linux is little
|
||||
endian, and doesn't support Thumb at the moment we only override
|
||||
the ARM little-endian breakpoint. */
|
||||
|
||||
static const char arm_linux_arm_le_breakpoint[] = {0x01,0x00,0x9f,0xef};
|
||||
|
||||
/* CALL_DUMMY_WORDS:
|
||||
This sequence of words is the instructions
|
||||
|
||||
mov lr, pc
|
||||
mov pc, r4
|
||||
swi bkpt_swi
|
||||
|
||||
Note this is 12 bytes. */
|
||||
|
||||
LONGEST arm_linux_call_dummy_words[] =
|
||||
{
|
||||
0xe1a0e00f, 0xe1a0f004, 0xef9f001
|
||||
};
|
||||
|
||||
/* Description of the longjmp buffer. */
|
||||
#define JB_ELEMENT_SIZE INT_REGISTER_RAW_SIZE
|
||||
#define JB_PC 21
|
||||
|
||||
/* Extract from an array REGBUF containing the (raw) register state
|
||||
a function return value of type TYPE, and copy that, in virtual format,
|
||||
into VALBUF. */
|
||||
/* FIXME rearnsha/2002-02-23: This function shouldn't be necessary.
|
||||
The ARM generic one should be able to handle the model used by
|
||||
linux and the low-level formatting of the registers should be
|
||||
hidden behind the regcache abstraction. */
|
||||
static void
|
||||
arm_linux_extract_return_value (struct type *type,
|
||||
char regbuf[REGISTER_BYTES],
|
||||
char *valbuf)
|
||||
{
|
||||
/* ScottB: This needs to be looked at to handle the different
|
||||
floating point emulators on ARM GNU/Linux. Right now the code
|
||||
assumes that fetch inferior registers does the right thing for
|
||||
GDB. I suspect this won't handle NWFPE registers correctly, nor
|
||||
will the default ARM version (arm_extract_return_value()). */
|
||||
|
||||
int regnum = ((TYPE_CODE_FLT == TYPE_CODE (type))
|
||||
? ARM_F0_REGNUM : ARM_A1_REGNUM);
|
||||
memcpy (valbuf, ®buf[REGISTER_BYTE (regnum)], TYPE_LENGTH (type));
|
||||
}
|
||||
|
||||
/* Note: ScottB
|
||||
|
||||
This function does not support passing parameters using the FPA
|
||||
variant of the APCS. It passes any floating point arguments in the
|
||||
general registers and/or on the stack.
|
||||
|
||||
FIXME: This and arm_push_arguments should be merged. However this
|
||||
function breaks on a little endian host, big endian target
|
||||
using the COFF file format. ELF is ok.
|
||||
|
||||
ScottB. */
|
||||
|
||||
/* Addresses for calling Thumb functions have the bit 0 set.
|
||||
Here are some macros to test, set, or clear bit 0 of addresses. */
|
||||
#define IS_THUMB_ADDR(addr) ((addr) & 1)
|
||||
#define MAKE_THUMB_ADDR(addr) ((addr) | 1)
|
||||
#define UNMAKE_THUMB_ADDR(addr) ((addr) & ~1)
|
||||
|
||||
static CORE_ADDR
|
||||
arm_linux_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
|
||||
int struct_return, CORE_ADDR struct_addr)
|
||||
{
|
||||
char *fp;
|
||||
int argnum, argreg, nstack_size;
|
||||
|
||||
/* Walk through the list of args and determine how large a temporary
|
||||
stack is required. Need to take care here as structs may be
|
||||
passed on the stack, and we have to to push them. */
|
||||
nstack_size = -4 * REGISTER_SIZE; /* Some arguments go into A1-A4. */
|
||||
|
||||
if (struct_return) /* The struct address goes in A1. */
|
||||
nstack_size += REGISTER_SIZE;
|
||||
|
||||
/* Walk through the arguments and add their size to nstack_size. */
|
||||
for (argnum = 0; argnum < nargs; argnum++)
|
||||
{
|
||||
int len;
|
||||
struct type *arg_type;
|
||||
|
||||
arg_type = check_typedef (VALUE_TYPE (args[argnum]));
|
||||
len = TYPE_LENGTH (arg_type);
|
||||
|
||||
/* ANSI C code passes float arguments as integers, K&R code
|
||||
passes float arguments as doubles. Correct for this here. */
|
||||
if (TYPE_CODE_FLT == TYPE_CODE (arg_type) && REGISTER_SIZE == len)
|
||||
nstack_size += FP_REGISTER_VIRTUAL_SIZE;
|
||||
else
|
||||
nstack_size += len;
|
||||
}
|
||||
|
||||
/* Allocate room on the stack, and initialize our stack frame
|
||||
pointer. */
|
||||
fp = NULL;
|
||||
if (nstack_size > 0)
|
||||
{
|
||||
sp -= nstack_size;
|
||||
fp = (char *) sp;
|
||||
}
|
||||
|
||||
/* Initialize the integer argument register pointer. */
|
||||
argreg = ARM_A1_REGNUM;
|
||||
|
||||
/* The struct_return pointer occupies the first parameter passing
|
||||
register. */
|
||||
if (struct_return)
|
||||
write_register (argreg++, struct_addr);
|
||||
|
||||
/* Process arguments from left to right. Store as many as allowed
|
||||
in the parameter passing registers (A1-A4), and save the rest on
|
||||
the temporary stack. */
|
||||
for (argnum = 0; argnum < nargs; argnum++)
|
||||
{
|
||||
int len;
|
||||
char *val;
|
||||
CORE_ADDR regval;
|
||||
enum type_code typecode;
|
||||
struct type *arg_type, *target_type;
|
||||
|
||||
arg_type = check_typedef (VALUE_TYPE (args[argnum]));
|
||||
target_type = TYPE_TARGET_TYPE (arg_type);
|
||||
len = TYPE_LENGTH (arg_type);
|
||||
typecode = TYPE_CODE (arg_type);
|
||||
val = (char *) VALUE_CONTENTS (args[argnum]);
|
||||
|
||||
/* ANSI C code passes float arguments as integers, K&R code
|
||||
passes float arguments as doubles. The .stabs record for
|
||||
for ANSI prototype floating point arguments records the
|
||||
type as FP_INTEGER, while a K&R style (no prototype)
|
||||
.stabs records the type as FP_FLOAT. In this latter case
|
||||
the compiler converts the float arguments to double before
|
||||
calling the function. */
|
||||
if (TYPE_CODE_FLT == typecode && REGISTER_SIZE == len)
|
||||
{
|
||||
DOUBLEST dblval;
|
||||
dblval = extract_floating (val, len);
|
||||
len = TARGET_DOUBLE_BIT / TARGET_CHAR_BIT;
|
||||
val = alloca (len);
|
||||
store_floating (val, len, dblval);
|
||||
}
|
||||
|
||||
/* If the argument is a pointer to a function, and it is a Thumb
|
||||
function, set the low bit of the pointer. */
|
||||
if (TYPE_CODE_PTR == typecode
|
||||
&& NULL != target_type
|
||||
&& TYPE_CODE_FUNC == TYPE_CODE (target_type))
|
||||
{
|
||||
CORE_ADDR regval = extract_address (val, len);
|
||||
if (arm_pc_is_thumb (regval))
|
||||
store_address (val, len, MAKE_THUMB_ADDR (regval));
|
||||
}
|
||||
|
||||
/* Copy the argument to general registers or the stack in
|
||||
register-sized pieces. Large arguments are split between
|
||||
registers and stack. */
|
||||
while (len > 0)
|
||||
{
|
||||
int partial_len = len < REGISTER_SIZE ? len : REGISTER_SIZE;
|
||||
|
||||
if (argreg <= ARM_LAST_ARG_REGNUM)
|
||||
{
|
||||
/* It's an argument being passed in a general register. */
|
||||
regval = extract_address (val, partial_len);
|
||||
write_register (argreg++, regval);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Push the arguments onto the stack. */
|
||||
write_memory ((CORE_ADDR) fp, val, REGISTER_SIZE);
|
||||
fp += REGISTER_SIZE;
|
||||
}
|
||||
|
||||
len -= partial_len;
|
||||
val += partial_len;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return adjusted stack pointer. */
|
||||
return sp;
|
||||
}
|
||||
|
||||
/*
|
||||
Dynamic Linking on ARM GNU/Linux
|
||||
--------------------------------
|
||||
|
||||
Note: PLT = procedure linkage table
|
||||
GOT = global offset table
|
||||
|
||||
As much as possible, ELF dynamic linking defers the resolution of
|
||||
jump/call addresses until the last minute. The technique used is
|
||||
inspired by the i386 ELF design, and is based on the following
|
||||
constraints.
|
||||
|
||||
1) The calling technique should not force a change in the assembly
|
||||
code produced for apps; it MAY cause changes in the way assembly
|
||||
code is produced for position independent code (i.e. shared
|
||||
libraries).
|
||||
|
||||
2) The technique must be such that all executable areas must not be
|
||||
modified; and any modified areas must not be executed.
|
||||
|
||||
To do this, there are three steps involved in a typical jump:
|
||||
|
||||
1) in the code
|
||||
2) through the PLT
|
||||
3) using a pointer from the GOT
|
||||
|
||||
When the executable or library is first loaded, each GOT entry is
|
||||
initialized to point to the code which implements dynamic name
|
||||
resolution and code finding. This is normally a function in the
|
||||
program interpreter (on ARM GNU/Linux this is usually
|
||||
ld-linux.so.2, but it does not have to be). On the first
|
||||
invocation, the function is located and the GOT entry is replaced
|
||||
with the real function address. Subsequent calls go through steps
|
||||
1, 2 and 3 and end up calling the real code.
|
||||
|
||||
1) In the code:
|
||||
|
||||
b function_call
|
||||
bl function_call
|
||||
|
||||
This is typical ARM code using the 26 bit relative branch or branch
|
||||
and link instructions. The target of the instruction
|
||||
(function_call is usually the address of the function to be called.
|
||||
In position independent code, the target of the instruction is
|
||||
actually an entry in the PLT when calling functions in a shared
|
||||
library. Note that this call is identical to a normal function
|
||||
call, only the target differs.
|
||||
|
||||
2) In the PLT:
|
||||
|
||||
The PLT is a synthetic area, created by the linker. It exists in
|
||||
both executables and libraries. It is an array of stubs, one per
|
||||
imported function call. It looks like this:
|
||||
|
||||
PLT[0]:
|
||||
str lr, [sp, #-4]! @push the return address (lr)
|
||||
ldr lr, [pc, #16] @load from 6 words ahead
|
||||
add lr, pc, lr @form an address for GOT[0]
|
||||
ldr pc, [lr, #8]! @jump to the contents of that addr
|
||||
|
||||
The return address (lr) is pushed on the stack and used for
|
||||
calculations. The load on the second line loads the lr with
|
||||
&GOT[3] - . - 20. The addition on the third leaves:
|
||||
|
||||
lr = (&GOT[3] - . - 20) + (. + 8)
|
||||
lr = (&GOT[3] - 12)
|
||||
lr = &GOT[0]
|
||||
|
||||
On the fourth line, the pc and lr are both updated, so that:
|
||||
|
||||
pc = GOT[2]
|
||||
lr = &GOT[0] + 8
|
||||
= &GOT[2]
|
||||
|
||||
NOTE: PLT[0] borrows an offset .word from PLT[1]. This is a little
|
||||
"tight", but allows us to keep all the PLT entries the same size.
|
||||
|
||||
PLT[n+1]:
|
||||
ldr ip, [pc, #4] @load offset from gotoff
|
||||
add ip, pc, ip @add the offset to the pc
|
||||
ldr pc, [ip] @jump to that address
|
||||
gotoff: .word GOT[n+3] - .
|
||||
|
||||
The load on the first line, gets an offset from the fourth word of
|
||||
the PLT entry. The add on the second line makes ip = &GOT[n+3],
|
||||
which contains either a pointer to PLT[0] (the fixup trampoline) or
|
||||
a pointer to the actual code.
|
||||
|
||||
3) In the GOT:
|
||||
|
||||
The GOT contains helper pointers for both code (PLT) fixups and
|
||||
data fixups. The first 3 entries of the GOT are special. The next
|
||||
M entries (where M is the number of entries in the PLT) belong to
|
||||
the PLT fixups. The next D (all remaining) entries belong to
|
||||
various data fixups. The actual size of the GOT is 3 + M + D.
|
||||
|
||||
The GOT is also a synthetic area, created by the linker. It exists
|
||||
in both executables and libraries. When the GOT is first
|
||||
initialized , all the GOT entries relating to PLT fixups are
|
||||
pointing to code back at PLT[0].
|
||||
|
||||
The special entries in the GOT are:
|
||||
|
||||
GOT[0] = linked list pointer used by the dynamic loader
|
||||
GOT[1] = pointer to the reloc table for this module
|
||||
GOT[2] = pointer to the fixup/resolver code
|
||||
|
||||
The first invocation of function call comes through and uses the
|
||||
fixup/resolver code. On the entry to the fixup/resolver code:
|
||||
|
||||
ip = &GOT[n+3]
|
||||
lr = &GOT[2]
|
||||
stack[0] = return address (lr) of the function call
|
||||
[r0, r1, r2, r3] are still the arguments to the function call
|
||||
|
||||
This is enough information for the fixup/resolver code to work
|
||||
with. Before the fixup/resolver code returns, it actually calls
|
||||
the requested function and repairs &GOT[n+3]. */
|
||||
|
||||
/* Find the minimal symbol named NAME, and return both the minsym
|
||||
struct and its objfile. This probably ought to be in minsym.c, but
|
||||
everything there is trying to deal with things like C++ and
|
||||
SOFUN_ADDRESS_MAYBE_TURQUOISE, ... Since this is so simple, it may
|
||||
be considered too special-purpose for general consumption. */
|
||||
|
||||
static struct minimal_symbol *
|
||||
find_minsym_and_objfile (char *name, struct objfile **objfile_p)
|
||||
{
|
||||
struct objfile *objfile;
|
||||
|
||||
ALL_OBJFILES (objfile)
|
||||
{
|
||||
struct minimal_symbol *msym;
|
||||
|
||||
ALL_OBJFILE_MSYMBOLS (objfile, msym)
|
||||
{
|
||||
if (SYMBOL_NAME (msym)
|
||||
&& strcmp (SYMBOL_NAME (msym), name) == 0)
|
||||
{
|
||||
*objfile_p = objfile;
|
||||
return msym;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static CORE_ADDR
|
||||
skip_hurd_resolver (CORE_ADDR pc)
|
||||
{
|
||||
/* The HURD dynamic linker is part of the GNU C library, so many
|
||||
GNU/Linux distributions use it. (All ELF versions, as far as I
|
||||
know.) An unresolved PLT entry points to "_dl_runtime_resolve",
|
||||
which calls "fixup" to patch the PLT, and then passes control to
|
||||
the function.
|
||||
|
||||
We look for the symbol `_dl_runtime_resolve', and find `fixup' in
|
||||
the same objfile. If we are at the entry point of `fixup', then
|
||||
we set a breakpoint at the return address (at the top of the
|
||||
stack), and continue.
|
||||
|
||||
It's kind of gross to do all these checks every time we're
|
||||
called, since they don't change once the executable has gotten
|
||||
started. But this is only a temporary hack --- upcoming versions
|
||||
of GNU/Linux will provide a portable, efficient interface for
|
||||
debugging programs that use shared libraries. */
|
||||
|
||||
struct objfile *objfile;
|
||||
struct minimal_symbol *resolver
|
||||
= find_minsym_and_objfile ("_dl_runtime_resolve", &objfile);
|
||||
|
||||
if (resolver)
|
||||
{
|
||||
struct minimal_symbol *fixup
|
||||
= lookup_minimal_symbol ("fixup", NULL, objfile);
|
||||
|
||||
if (fixup && SYMBOL_VALUE_ADDRESS (fixup) == pc)
|
||||
return (SAVED_PC_AFTER_CALL (get_current_frame ()));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* See the comments for SKIP_SOLIB_RESOLVER at the top of infrun.c.
|
||||
This function:
|
||||
1) decides whether a PLT has sent us into the linker to resolve
|
||||
a function reference, and
|
||||
2) if so, tells us where to set a temporary breakpoint that will
|
||||
trigger when the dynamic linker is done. */
|
||||
|
||||
CORE_ADDR
|
||||
arm_linux_skip_solib_resolver (CORE_ADDR pc)
|
||||
{
|
||||
CORE_ADDR result;
|
||||
|
||||
/* Plug in functions for other kinds of resolvers here. */
|
||||
result = skip_hurd_resolver (pc);
|
||||
|
||||
if (result)
|
||||
return result;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* The constants below were determined by examining the following files
|
||||
in the linux kernel sources:
|
||||
|
||||
arch/arm/kernel/signal.c
|
||||
- see SWI_SYS_SIGRETURN and SWI_SYS_RT_SIGRETURN
|
||||
include/asm-arm/unistd.h
|
||||
- see __NR_sigreturn, __NR_rt_sigreturn, and __NR_SYSCALL_BASE */
|
||||
|
||||
#define ARM_LINUX_SIGRETURN_INSTR 0xef900077
|
||||
#define ARM_LINUX_RT_SIGRETURN_INSTR 0xef9000ad
|
||||
|
||||
/* arm_linux_in_sigtramp determines if PC points at one of the
|
||||
instructions which cause control to return to the Linux kernel upon
|
||||
return from a signal handler. FUNC_NAME is unused. */
|
||||
|
||||
int
|
||||
arm_linux_in_sigtramp (CORE_ADDR pc, char *func_name)
|
||||
{
|
||||
unsigned long inst;
|
||||
|
||||
inst = read_memory_integer (pc, 4);
|
||||
|
||||
return (inst == ARM_LINUX_SIGRETURN_INSTR
|
||||
|| inst == ARM_LINUX_RT_SIGRETURN_INSTR);
|
||||
|
||||
}
|
||||
|
||||
/* arm_linux_sigcontext_register_address returns the address in the
|
||||
sigcontext of register REGNO given a stack pointer value SP and
|
||||
program counter value PC. The value 0 is returned if PC is not
|
||||
pointing at one of the signal return instructions or if REGNO is
|
||||
not saved in the sigcontext struct. */
|
||||
|
||||
CORE_ADDR
|
||||
arm_linux_sigcontext_register_address (CORE_ADDR sp, CORE_ADDR pc, int regno)
|
||||
{
|
||||
unsigned long inst;
|
||||
CORE_ADDR reg_addr = 0;
|
||||
|
||||
inst = read_memory_integer (pc, 4);
|
||||
|
||||
if (inst == ARM_LINUX_SIGRETURN_INSTR
|
||||
|| inst == ARM_LINUX_RT_SIGRETURN_INSTR)
|
||||
{
|
||||
CORE_ADDR sigcontext_addr;
|
||||
|
||||
/* The sigcontext structure is at different places for the two
|
||||
signal return instructions. For ARM_LINUX_SIGRETURN_INSTR,
|
||||
it starts at the SP value. For ARM_LINUX_RT_SIGRETURN_INSTR,
|
||||
it is at SP+8. For the latter instruction, it may also be
|
||||
the case that the address of this structure may be determined
|
||||
by reading the 4 bytes at SP, but I'm not convinced this is
|
||||
reliable.
|
||||
|
||||
In any event, these magic constants (0 and 8) may be
|
||||
determined by examining struct sigframe and struct
|
||||
rt_sigframe in arch/arm/kernel/signal.c in the Linux kernel
|
||||
sources. */
|
||||
|
||||
if (inst == ARM_LINUX_RT_SIGRETURN_INSTR)
|
||||
sigcontext_addr = sp + 8;
|
||||
else /* inst == ARM_LINUX_SIGRETURN_INSTR */
|
||||
sigcontext_addr = sp + 0;
|
||||
|
||||
/* The layout of the sigcontext structure for ARM GNU/Linux is
|
||||
in include/asm-arm/sigcontext.h in the Linux kernel sources.
|
||||
|
||||
There are three 4-byte fields which precede the saved r0
|
||||
field. (This accounts for the 12 in the code below.) The
|
||||
sixteen registers (4 bytes per field) follow in order. The
|
||||
PSR value follows the sixteen registers which accounts for
|
||||
the constant 19 below. */
|
||||
|
||||
if (0 <= regno && regno <= ARM_PC_REGNUM)
|
||||
reg_addr = sigcontext_addr + 12 + (4 * regno);
|
||||
else if (regno == ARM_PS_REGNUM)
|
||||
reg_addr = sigcontext_addr + 19 * 4;
|
||||
}
|
||||
|
||||
return reg_addr;
|
||||
}
|
||||
|
||||
static void
|
||||
arm_linux_init_abi (struct gdbarch_info info,
|
||||
struct gdbarch *gdbarch)
|
||||
{
|
||||
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
||||
|
||||
tdep->lowest_pc = 0x8000;
|
||||
tdep->arm_breakpoint = arm_linux_arm_le_breakpoint;
|
||||
tdep->arm_breakpoint_size = sizeof (arm_linux_arm_le_breakpoint);
|
||||
|
||||
tdep->jb_pc = JB_PC;
|
||||
tdep->jb_elt_size = JB_ELEMENT_SIZE;
|
||||
|
||||
set_gdbarch_call_dummy_words (gdbarch, arm_linux_call_dummy_words);
|
||||
set_gdbarch_sizeof_call_dummy_words (gdbarch,
|
||||
sizeof (arm_linux_call_dummy_words));
|
||||
|
||||
/* The following two overrides shouldn't be needed. */
|
||||
set_gdbarch_extract_return_value (gdbarch, arm_linux_extract_return_value);
|
||||
set_gdbarch_push_arguments (gdbarch, arm_linux_push_arguments);
|
||||
|
||||
/* Shared library handling. */
|
||||
set_gdbarch_in_solib_call_trampoline (gdbarch, in_plt_section);
|
||||
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
|
||||
}
|
||||
|
||||
void
|
||||
_initialize_arm_linux_tdep (void)
|
||||
{
|
||||
arm_gdbarch_register_os_abi (ARM_ABI_LINUX, arm_linux_init_abi);
|
||||
}
|
||||
174
contrib/gdb/gdb/arm-tdep.h
Normal file
174
contrib/gdb/gdb/arm-tdep.h
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
/* Common target dependent code for GDB on ARM systems.
|
||||
Copyright 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Register numbers of various important registers. Note that some of
|
||||
these values are "real" register numbers, and correspond to the
|
||||
general registers of the machine, and some are "phony" register
|
||||
numbers which are too large to be actual register numbers as far as
|
||||
the user is concerned but do serve to get the desired values when
|
||||
passed to read_register. */
|
||||
|
||||
#define ARM_A1_REGNUM 0 /* first integer-like argument */
|
||||
#define ARM_A4_REGNUM 3 /* last integer-like argument */
|
||||
#define ARM_AP_REGNUM 11
|
||||
#define ARM_SP_REGNUM 13 /* Contains address of top of stack */
|
||||
#define ARM_LR_REGNUM 14 /* address to return to from a function call */
|
||||
#define ARM_PC_REGNUM 15 /* Contains program counter */
|
||||
#define ARM_F0_REGNUM 16 /* first floating point register */
|
||||
#define ARM_F3_REGNUM 19 /* last floating point argument register */
|
||||
#define ARM_F7_REGNUM 23 /* last floating point register */
|
||||
#define ARM_FPS_REGNUM 24 /* floating point status register */
|
||||
#define ARM_PS_REGNUM 25 /* Contains processor status */
|
||||
|
||||
#define ARM_FP_REGNUM 11 /* Frame register in ARM code, if used. */
|
||||
#define THUMB_FP_REGNUM 7 /* Frame register in Thumb code, if used. */
|
||||
|
||||
#define ARM_NUM_ARG_REGS 4
|
||||
#define ARM_LAST_ARG_REGNUM ARM_A4_REGNUM
|
||||
#define ARM_NUM_FP_ARG_REGS 4
|
||||
#define ARM_LAST_FP_ARG_REGNUM ARM_F3_REGNUM
|
||||
|
||||
/* Size of integer registers. */
|
||||
#define INT_REGISTER_RAW_SIZE 4
|
||||
#define INT_REGISTER_VIRTUAL_SIZE 4
|
||||
|
||||
/* Say how long FP registers are. Used for documentation purposes and
|
||||
code readability in this header. IEEE extended doubles are 80
|
||||
bits. DWORD aligned they use 96 bits. */
|
||||
#define FP_REGISTER_RAW_SIZE 12
|
||||
|
||||
/* GCC doesn't support long doubles (extended IEEE values). The FP
|
||||
register virtual size is therefore 64 bits. Used for documentation
|
||||
purposes and code readability in this header. */
|
||||
#define FP_REGISTER_VIRTUAL_SIZE 8
|
||||
|
||||
/* Status registers are the same size as general purpose registers.
|
||||
Used for documentation purposes and code readability in this
|
||||
header. */
|
||||
#define STATUS_REGISTER_SIZE 4
|
||||
|
||||
/* Number of machine registers. The only define actually required
|
||||
is NUM_REGS. The other definitions are used for documentation
|
||||
purposes and code readability. */
|
||||
/* For 26 bit ARM code, a fake copy of the PC is placed in register 25 (PS)
|
||||
(and called PS for processor status) so the status bits can be cleared
|
||||
from the PC (register 15). For 32 bit ARM code, a copy of CPSR is placed
|
||||
in PS. */
|
||||
#define NUM_FREGS 8 /* Number of floating point registers. */
|
||||
#define NUM_SREGS 2 /* Number of status registers. */
|
||||
#define NUM_GREGS 16 /* Number of general purpose registers. */
|
||||
|
||||
|
||||
/* Instruction condition field values. */
|
||||
#define INST_EQ 0x0
|
||||
#define INST_NE 0x1
|
||||
#define INST_CS 0x2
|
||||
#define INST_CC 0x3
|
||||
#define INST_MI 0x4
|
||||
#define INST_PL 0x5
|
||||
#define INST_VS 0x6
|
||||
#define INST_VC 0x7
|
||||
#define INST_HI 0x8
|
||||
#define INST_LS 0x9
|
||||
#define INST_GE 0xa
|
||||
#define INST_LT 0xb
|
||||
#define INST_GT 0xc
|
||||
#define INST_LE 0xd
|
||||
#define INST_AL 0xe
|
||||
#define INST_NV 0xf
|
||||
|
||||
#define FLAG_N 0x80000000
|
||||
#define FLAG_Z 0x40000000
|
||||
#define FLAG_C 0x20000000
|
||||
#define FLAG_V 0x10000000
|
||||
|
||||
/* ABI variants that we know about. If you add to this enum, please
|
||||
update the table of names in tm-arm.c. */
|
||||
enum arm_abi
|
||||
{
|
||||
ARM_ABI_UNKNOWN = 0,
|
||||
ARM_ABI_EABI_V1,
|
||||
ARM_ABI_EABI_V2,
|
||||
ARM_ABI_LINUX,
|
||||
ARM_ABI_NETBSD_AOUT,
|
||||
ARM_ABI_NETBSD_ELF,
|
||||
ARM_ABI_APCS,
|
||||
ARM_ABI_FREEBSD,
|
||||
ARM_ABI_WINCE,
|
||||
|
||||
ARM_ABI_INVALID /* Keep this last. */
|
||||
};
|
||||
|
||||
/* Type of floating-point code in use by inferior. There are really 3 models
|
||||
that are traditionally supported (plus the endianness issue), but gcc can
|
||||
only generate 2 of those. The third is APCS_FLOAT, where arguments to
|
||||
functions are passed in floating-point registers.
|
||||
|
||||
In addition to the traditional models, VFP adds two more. */
|
||||
|
||||
enum arm_float_model
|
||||
{
|
||||
ARM_FLOAT_SOFT,
|
||||
ARM_FLOAT_FPA,
|
||||
ARM_FLOAT_SOFT_VFP,
|
||||
ARM_FLOAT_VFP
|
||||
};
|
||||
|
||||
/* Target-dependent structure in gdbarch. */
|
||||
struct gdbarch_tdep
|
||||
{
|
||||
enum arm_abi arm_abi; /* OS/ABI of inferior. */
|
||||
const char *abi_name; /* Name of the above. */
|
||||
|
||||
enum arm_float_model fp_model; /* Floating point calling conventions. */
|
||||
|
||||
CORE_ADDR lowest_pc; /* Lowest address at which instructions
|
||||
will appear. */
|
||||
|
||||
const char *arm_breakpoint; /* Breakpoint pattern for an ARM insn. */
|
||||
int arm_breakpoint_size; /* And its size. */
|
||||
const char *thumb_breakpoint; /* Breakpoint pattern for an ARM insn. */
|
||||
int thumb_breakpoint_size; /* And its size. */
|
||||
|
||||
int jb_pc; /* Offset to PC value in jump buffer.
|
||||
If this is negative, longjmp support
|
||||
will be disabled. */
|
||||
size_t jb_elt_size; /* And the size of each entry in the buf. */
|
||||
};
|
||||
|
||||
#ifndef LOWEST_PC
|
||||
#define LOWEST_PC (gdbarch_tdep (current_gdbarch)->lowest_pc)
|
||||
#endif
|
||||
|
||||
/* Prototypes for internal interfaces needed by more than one MD file. */
|
||||
int arm_pc_is_thumb_dummy (CORE_ADDR);
|
||||
|
||||
int arm_pc_is_thumb (CORE_ADDR);
|
||||
|
||||
CORE_ADDR thumb_get_next_pc (CORE_ADDR);
|
||||
|
||||
CORE_ADDR arm_get_next_pc (CORE_ADDR);
|
||||
|
||||
/* How a OS variant tells the ARM generic code that it can handle an ABI
|
||||
type. */
|
||||
void
|
||||
arm_gdbarch_register_os_abi (enum arm_abi abi,
|
||||
void (*init_abi)(struct gdbarch_info,
|
||||
struct gdbarch *));
|
||||
464
contrib/gdb/gdb/armnbsd-nat.c
Normal file
464
contrib/gdb/gdb/armnbsd-nat.c
Normal file
|
|
@ -0,0 +1,464 @@
|
|||
/* Native-dependent code for BSD Unix running on ARM's, for GDB.
|
||||
Copyright 1988, 1989, 1991, 1992, 1994, 1996, 1999, 2002
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
#ifndef FETCH_INFERIOR_REGISTERS
|
||||
#error Not FETCH_INFERIOR_REGISTERS
|
||||
#endif /* !FETCH_INFERIOR_REGISTERS */
|
||||
|
||||
#include "arm-tdep.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/ptrace.h>
|
||||
#include <machine/reg.h>
|
||||
#include <machine/frame.h>
|
||||
#include "inferior.h"
|
||||
#include "regcache.h"
|
||||
#include "gdbcore.h"
|
||||
|
||||
extern int arm_apcs_32;
|
||||
|
||||
static void
|
||||
supply_gregset (struct reg *gregset)
|
||||
{
|
||||
int regno;
|
||||
CORE_ADDR r_pc;
|
||||
|
||||
/* Integer registers. */
|
||||
for (regno = ARM_A1_REGNUM; regno < ARM_SP_REGNUM; regno++)
|
||||
supply_register (regno, (char *) &gregset->r[regno]);
|
||||
|
||||
supply_register (ARM_SP_REGNUM, (char *) &gregset->r_sp);
|
||||
supply_register (ARM_LR_REGNUM, (char *) &gregset->r_lr);
|
||||
/* This is ok: we're running native... */
|
||||
r_pc = ADDR_BITS_REMOVE (gregset->r_pc);
|
||||
supply_register (ARM_PC_REGNUM, (char *) &r_pc);
|
||||
|
||||
if (arm_apcs_32)
|
||||
supply_register (ARM_PS_REGNUM, (char *) &gregset->r_cpsr);
|
||||
else
|
||||
supply_register (ARM_PS_REGNUM, (char *) &gregset->r_pc);
|
||||
}
|
||||
|
||||
static void
|
||||
supply_fparegset (struct fpreg *fparegset)
|
||||
{
|
||||
int regno;
|
||||
|
||||
for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++)
|
||||
supply_register
|
||||
(regno, (char *) &fparegset->fpr[regno - ARM_F0_REGNUM]);
|
||||
|
||||
supply_register (ARM_FPS_REGNUM, (char *) &fparegset->fpr_fpsr);
|
||||
}
|
||||
|
||||
static void
|
||||
fetch_register (int regno)
|
||||
{
|
||||
struct reg inferior_registers;
|
||||
int ret;
|
||||
|
||||
ret = ptrace (PT_GETREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &inferior_registers, 0);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
warning ("unable to fetch general register");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (regno)
|
||||
{
|
||||
case ARM_SP_REGNUM:
|
||||
supply_register (ARM_SP_REGNUM, (char *) &inferior_registers.r_sp);
|
||||
break;
|
||||
|
||||
case ARM_LR_REGNUM:
|
||||
supply_register (ARM_LR_REGNUM, (char *) &inferior_registers.r_lr);
|
||||
break;
|
||||
|
||||
case ARM_PC_REGNUM:
|
||||
/* This is ok: we're running native... */
|
||||
inferior_registers.r_pc = ADDR_BITS_REMOVE (inferior_registers.r_pc);
|
||||
supply_register (ARM_PC_REGNUM, (char *) &inferior_registers.r_pc);
|
||||
break;
|
||||
|
||||
case ARM_PS_REGNUM:
|
||||
if (arm_apcs_32)
|
||||
supply_register (ARM_PS_REGNUM, (char *) &inferior_registers.r_cpsr);
|
||||
else
|
||||
supply_register (ARM_PS_REGNUM, (char *) &inferior_registers.r_pc);
|
||||
break;
|
||||
|
||||
default:
|
||||
supply_register (regno, (char *) &inferior_registers.r[regno]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
fetch_regs (void)
|
||||
{
|
||||
struct reg inferior_registers;
|
||||
int ret;
|
||||
int regno;
|
||||
|
||||
ret = ptrace (PT_GETREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &inferior_registers, 0);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
warning ("unable to fetch general registers");
|
||||
return;
|
||||
}
|
||||
|
||||
supply_gregset (&inferior_registers);
|
||||
}
|
||||
|
||||
static void
|
||||
fetch_fp_register (int regno)
|
||||
{
|
||||
struct fpreg inferior_fp_registers;
|
||||
int ret;
|
||||
|
||||
ret = ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &inferior_fp_registers, 0);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
warning ("unable to fetch floating-point register");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (regno)
|
||||
{
|
||||
case ARM_FPS_REGNUM:
|
||||
supply_register (ARM_FPS_REGNUM,
|
||||
(char *) &inferior_fp_registers.fpr_fpsr);
|
||||
break;
|
||||
|
||||
default:
|
||||
supply_register
|
||||
(regno, (char *) &inferior_fp_registers.fpr[regno - ARM_F0_REGNUM]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
fetch_fp_regs (void)
|
||||
{
|
||||
struct fpreg inferior_fp_registers;
|
||||
int ret;
|
||||
int regno;
|
||||
|
||||
ret = ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &inferior_fp_registers, 0);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
warning ("unable to fetch general registers");
|
||||
return;
|
||||
}
|
||||
|
||||
supply_fparegset (&inferior_fp_registers);
|
||||
}
|
||||
|
||||
void
|
||||
fetch_inferior_registers (int regno)
|
||||
{
|
||||
if (regno >= 0)
|
||||
{
|
||||
if (regno < ARM_F0_REGNUM || regno > ARM_FPS_REGNUM)
|
||||
fetch_register (regno);
|
||||
else
|
||||
fetch_fp_register (regno);
|
||||
}
|
||||
else
|
||||
{
|
||||
fetch_regs ();
|
||||
fetch_fp_regs ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
store_register (int regno)
|
||||
{
|
||||
struct reg inferior_registers;
|
||||
int ret;
|
||||
|
||||
ret = ptrace (PT_GETREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &inferior_registers, 0);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
warning ("unable to fetch general registers");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (regno)
|
||||
{
|
||||
case ARM_SP_REGNUM:
|
||||
regcache_collect (ARM_SP_REGNUM, (char *) &inferior_registers.r_sp);
|
||||
break;
|
||||
|
||||
case ARM_LR_REGNUM:
|
||||
regcache_collect (ARM_LR_REGNUM, (char *) &inferior_registers.r_lr);
|
||||
break;
|
||||
|
||||
case ARM_PC_REGNUM:
|
||||
if (arm_apcs_32)
|
||||
regcache_collect (ARM_PC_REGNUM, (char *) &inferior_registers.r_pc);
|
||||
else
|
||||
{
|
||||
unsigned pc_val;
|
||||
|
||||
regcache_collect (ARM_PC_REGNUM, (char *) &pc_val);
|
||||
|
||||
pc_val = ADDR_BITS_REMOVE (pc_val);
|
||||
inferior_registers.r_pc
|
||||
^= ADDR_BITS_REMOVE (inferior_registers.r_pc);
|
||||
inferior_registers.r_pc |= pc_val;
|
||||
}
|
||||
break;
|
||||
|
||||
case ARM_PS_REGNUM:
|
||||
if (arm_apcs_32)
|
||||
regcache_collect (ARM_PS_REGNUM, (char *) &inferior_registers.r_cpsr);
|
||||
else
|
||||
{
|
||||
unsigned psr_val;
|
||||
|
||||
regcache_collect (ARM_PS_REGNUM, (char *) &psr_val);
|
||||
|
||||
psr_val ^= ADDR_BITS_REMOVE (psr_val);
|
||||
inferior_registers.r_pc = ADDR_BITS_REMOVE (inferior_registers.r_pc);
|
||||
inferior_registers.r_pc |= psr_val;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
regcache_collect (regno, (char *) &inferior_registers.r[regno]);
|
||||
break;
|
||||
}
|
||||
|
||||
ret = ptrace (PT_SETREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &inferior_registers, 0);
|
||||
|
||||
if (ret < 0)
|
||||
warning ("unable to write register %d to inferior", regno);
|
||||
}
|
||||
|
||||
static void
|
||||
store_regs (void)
|
||||
{
|
||||
struct reg inferior_registers;
|
||||
int ret;
|
||||
int regno;
|
||||
|
||||
|
||||
for (regno = ARM_A1_REGNUM; regno < ARM_SP_REGNUM; regno++)
|
||||
regcache_collect (regno, (char *) &inferior_registers.r[regno]);
|
||||
|
||||
regcache_collect (ARM_SP_REGNUM, (char *) &inferior_registers.r_sp);
|
||||
regcache_collect (ARM_LR_REGNUM, (char *) &inferior_registers.r_lr);
|
||||
|
||||
if (arm_apcs_32)
|
||||
{
|
||||
regcache_collect (ARM_PC_REGNUM, (char *) &inferior_registers.r_pc);
|
||||
regcache_collect (ARM_PS_REGNUM, (char *) &inferior_registers.r_cpsr);
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned pc_val;
|
||||
unsigned psr_val;
|
||||
|
||||
regcache_collect (ARM_PC_REGNUM, (char *) &pc_val);
|
||||
regcache_collect (ARM_PS_REGNUM, (char *) &psr_val);
|
||||
|
||||
pc_val = ADDR_BITS_REMOVE (pc_val);
|
||||
psr_val ^= ADDR_BITS_REMOVE (psr_val);
|
||||
|
||||
inferior_registers.r_pc = pc_val | psr_val;
|
||||
}
|
||||
|
||||
ret = ptrace (PT_SETREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &inferior_registers, 0);
|
||||
|
||||
if (ret < 0)
|
||||
warning ("unable to store general registers");
|
||||
}
|
||||
|
||||
static void
|
||||
store_fp_register (int regno)
|
||||
{
|
||||
struct fpreg inferior_fp_registers;
|
||||
int ret;
|
||||
|
||||
ret = ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &inferior_fp_registers, 0);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
warning ("unable to fetch floating-point registers");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (regno)
|
||||
{
|
||||
case ARM_FPS_REGNUM:
|
||||
regcache_collect (ARM_FPS_REGNUM,
|
||||
(char *) &inferior_fp_registers.fpr_fpsr);
|
||||
break;
|
||||
|
||||
default:
|
||||
regcache_collect
|
||||
(regno, (char *) &inferior_fp_registers.fpr[regno - ARM_F0_REGNUM]);
|
||||
break;
|
||||
}
|
||||
|
||||
ret = ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &inferior_fp_registers, 0);
|
||||
|
||||
if (ret < 0)
|
||||
warning ("unable to write register %d to inferior", regno);
|
||||
}
|
||||
|
||||
static void
|
||||
store_fp_regs (void)
|
||||
{
|
||||
struct fpreg inferior_fp_registers;
|
||||
int ret;
|
||||
int regno;
|
||||
|
||||
|
||||
for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++)
|
||||
regcache_collect
|
||||
(regno, (char *) &inferior_fp_registers.fpr[regno - ARM_F0_REGNUM]);
|
||||
|
||||
regcache_collect (ARM_FPS_REGNUM, (char *) &inferior_fp_registers.fpr_fpsr);
|
||||
|
||||
ret = ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &inferior_fp_registers, 0);
|
||||
|
||||
if (ret < 0)
|
||||
warning ("unable to store floating-point registers");
|
||||
}
|
||||
|
||||
void
|
||||
store_inferior_registers (int regno)
|
||||
{
|
||||
if (regno >= 0)
|
||||
{
|
||||
if (regno < ARM_F0_REGNUM || regno > ARM_FPS_REGNUM)
|
||||
store_register (regno);
|
||||
else
|
||||
store_fp_register (regno);
|
||||
}
|
||||
else
|
||||
{
|
||||
store_regs ();
|
||||
store_fp_regs ();
|
||||
}
|
||||
}
|
||||
|
||||
struct md_core
|
||||
{
|
||||
struct reg intreg;
|
||||
struct fpreg freg;
|
||||
};
|
||||
|
||||
static void
|
||||
fetch_core_registers (char *core_reg_sect, unsigned core_reg_size,
|
||||
int which, CORE_ADDR ignore)
|
||||
{
|
||||
struct md_core *core_reg = (struct md_core *) core_reg_sect;
|
||||
int regno;
|
||||
CORE_ADDR r_pc;
|
||||
|
||||
supply_gregset (&core_reg->intreg);
|
||||
supply_fparegset (&core_reg->freg);
|
||||
}
|
||||
|
||||
static void
|
||||
fetch_elfcore_registers (char *core_reg_sect, unsigned core_reg_size,
|
||||
int which, CORE_ADDR ignore)
|
||||
{
|
||||
struct reg gregset;
|
||||
struct fpreg fparegset;
|
||||
|
||||
switch (which)
|
||||
{
|
||||
case 0: /* Integer registers. */
|
||||
if (core_reg_size != sizeof (struct reg))
|
||||
warning ("wrong size of register set in core file");
|
||||
else
|
||||
{
|
||||
/* The memcpy may be unnecessary, but we can't really be sure
|
||||
of the alignment of the data in the core file. */
|
||||
memcpy (&gregset, core_reg_sect, sizeof (gregset));
|
||||
supply_gregset (&gregset);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (core_reg_size != sizeof (struct fpreg))
|
||||
warning ("wrong size of FPA register set in core file");
|
||||
else
|
||||
{
|
||||
/* The memcpy may be unnecessary, but we can't really be sure
|
||||
of the alignment of the data in the core file. */
|
||||
memcpy (&fparegset, core_reg_sect, sizeof (fparegset));
|
||||
supply_fparegset (&fparegset);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Don't know what kind of register request this is; just ignore it. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static struct core_fns arm_netbsd_core_fns =
|
||||
{
|
||||
bfd_target_unknown_flavour, /* core_flovour. */
|
||||
default_check_format, /* check_format. */
|
||||
default_core_sniffer, /* core_sniffer. */
|
||||
fetch_core_registers, /* core_read_registers. */
|
||||
NULL
|
||||
};
|
||||
|
||||
static struct core_fns arm_netbsd_elfcore_fns =
|
||||
{
|
||||
bfd_target_elf_flavour, /* core_flovour. */
|
||||
default_check_format, /* check_format. */
|
||||
default_core_sniffer, /* core_sniffer. */
|
||||
fetch_elfcore_registers, /* core_read_registers. */
|
||||
NULL
|
||||
};
|
||||
|
||||
void
|
||||
_initialize_arm_netbsd_nat (void)
|
||||
{
|
||||
add_core_fns (&arm_netbsd_core_fns);
|
||||
add_core_fns (&arm_netbsd_elfcore_fns);
|
||||
}
|
||||
85
contrib/gdb/gdb/armnbsd-tdep.c
Normal file
85
contrib/gdb/gdb/armnbsd-tdep.c
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
/* Target-specific functions for ARM running under NetBSD.
|
||||
Copyright 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
#include "arm-tdep.h"
|
||||
|
||||
/* Description of the longjmp buffer. */
|
||||
#define JB_PC 24
|
||||
#define JB_ELEMENT_SIZE INT_REGISTER_RAW_SIZE
|
||||
|
||||
/* For compatibility with previous implemenations of GDB on arm/NetBSD,
|
||||
override the default little-endian breakpoint. */
|
||||
static const char arm_nbsd_arm_le_breakpoint[] = {0x11, 0x00, 0x00, 0xe6};
|
||||
|
||||
static int
|
||||
arm_netbsd_aout_in_solib_call_trampoline (CORE_ADDR pc, char *name)
|
||||
{
|
||||
if (strcmp (name, "_PROCEDURE_LINKAGE_TABLE_") == 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
arm_netbsd_init_abi_common (struct gdbarch_info info,
|
||||
struct gdbarch *gdbarch)
|
||||
{
|
||||
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
||||
|
||||
tdep->lowest_pc = 0x8000;
|
||||
tdep->arm_breakpoint = arm_nbsd_arm_le_breakpoint;
|
||||
tdep->arm_breakpoint_size = sizeof (arm_nbsd_arm_le_breakpoint);
|
||||
|
||||
tdep->jb_pc = JB_PC;
|
||||
tdep->jb_elt_size = JB_ELEMENT_SIZE;
|
||||
}
|
||||
|
||||
static void
|
||||
arm_netbsd_aout_init_abi (struct gdbarch_info info,
|
||||
struct gdbarch *gdbarch)
|
||||
{
|
||||
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
||||
|
||||
arm_netbsd_init_abi_common (info, gdbarch);
|
||||
|
||||
set_gdbarch_in_solib_call_trampoline
|
||||
(gdbarch, arm_netbsd_aout_in_solib_call_trampoline);
|
||||
tdep->fp_model = ARM_FLOAT_SOFT;
|
||||
}
|
||||
|
||||
static void
|
||||
arm_netbsd_elf_init_abi (struct gdbarch_info info,
|
||||
struct gdbarch *gdbarch)
|
||||
{
|
||||
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
||||
|
||||
arm_netbsd_init_abi_common (info, gdbarch);
|
||||
|
||||
tdep->fp_model = ARM_FLOAT_SOFT_VFP;
|
||||
}
|
||||
|
||||
void
|
||||
_initialize_arm_netbsd_tdep (void)
|
||||
{
|
||||
arm_gdbarch_register_os_abi (ARM_ABI_NETBSD_AOUT, arm_netbsd_aout_init_abi);
|
||||
arm_gdbarch_register_os_abi (ARM_ABI_NETBSD_ELF, arm_netbsd_elf_init_abi);
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,28 +1,27 @@
|
|||
/* GDB-specific functions for operating on agent expressions
|
||||
Copyright 1998 Free Software Foundation, Inc.
|
||||
Copyright 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* $Id: ax-gdb.h,v 1.3.20.1 1999/04/01 17:33:04 jimb Exp $ */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef AX_GDB_H
|
||||
#define AX_GDB_H
|
||||
|
||||
|
||||
|
||||
/* Types and enums */
|
||||
|
||||
/* GDB stores expressions in the form of a flattened tree (struct
|
||||
|
|
@ -50,62 +49,64 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||
|
||||
|
||||
/* Different kinds of agent expression static values. */
|
||||
enum axs_lvalue_kind {
|
||||
/* We generated code to compute the subexpression's value.
|
||||
Constants and arithmetic operators yield this. */
|
||||
axs_rvalue,
|
||||
enum axs_lvalue_kind
|
||||
{
|
||||
/* We generated code to compute the subexpression's value.
|
||||
Constants and arithmetic operators yield this. */
|
||||
axs_rvalue,
|
||||
|
||||
/* We generated code to yield the subexpression's value's address on
|
||||
the top of the stack. If the caller needs an rvalue, it should
|
||||
call require_rvalue to produce the rvalue from this address. */
|
||||
axs_lvalue_memory,
|
||||
/* We generated code to yield the subexpression's value's address on
|
||||
the top of the stack. If the caller needs an rvalue, it should
|
||||
call require_rvalue to produce the rvalue from this address. */
|
||||
axs_lvalue_memory,
|
||||
|
||||
/* We didn't generate any code, and the stack is undisturbed,
|
||||
because the subexpression's value lives in a register; u.reg is
|
||||
the register number. If the caller needs an rvalue, it should
|
||||
call require_rvalue to produce the rvalue from this register
|
||||
number. */
|
||||
axs_lvalue_register
|
||||
};
|
||||
/* We didn't generate any code, and the stack is undisturbed,
|
||||
because the subexpression's value lives in a register; u.reg is
|
||||
the register number. If the caller needs an rvalue, it should
|
||||
call require_rvalue to produce the rvalue from this register
|
||||
number. */
|
||||
axs_lvalue_register
|
||||
};
|
||||
|
||||
/* Structure describing what we got from a subexpression. Think of
|
||||
this as parallel to value.h's enum lval_type, except that we're
|
||||
describing a value which will exist when the expression is
|
||||
evaluated in the future, not a value we have in our hand. */
|
||||
struct axs_value {
|
||||
enum axs_lvalue_kind kind; /* see above */
|
||||
struct axs_value
|
||||
{
|
||||
enum axs_lvalue_kind kind; /* see above */
|
||||
|
||||
/* The type of the subexpression. Even if lvalue == axs_lvalue_memory,
|
||||
this is the type of the value itself; the value on the stack is a
|
||||
"pointer to" an object of this type. */
|
||||
struct type *type;
|
||||
|
||||
union {
|
||||
/* if kind == axs_lvalue_register, this is the register number */
|
||||
int reg;
|
||||
} u;
|
||||
};
|
||||
/* The type of the subexpression. Even if lvalue == axs_lvalue_memory,
|
||||
this is the type of the value itself; the value on the stack is a
|
||||
"pointer to" an object of this type. */
|
||||
struct type *type;
|
||||
|
||||
union
|
||||
{
|
||||
/* if kind == axs_lvalue_register, this is the register number */
|
||||
int reg;
|
||||
}
|
||||
u;
|
||||
};
|
||||
|
||||
|
||||
/* Translating GDB expressions into agent expressions. */
|
||||
|
||||
/* Given a GDB expression EXPR, translate it into the agent bytecode,
|
||||
and return it. FLAGS are from enum expr_to_agent_flags. */
|
||||
extern struct agent_expr *expr_to_agent PARAMS ((struct expression *EXPR,
|
||||
struct axs_value *VALUE));
|
||||
extern struct agent_expr *expr_to_agent (struct expression *EXPR,
|
||||
struct axs_value *VALUE);
|
||||
|
||||
/* Given a GDB expression EXPR denoting an lvalue in memory, produce a
|
||||
string of agent bytecode which will leave its address and size on
|
||||
the top of stack. Return the agent expression. */
|
||||
extern struct agent_expr *expr_to_address_and_size
|
||||
PARAMS ((struct expression *EXPR));
|
||||
extern struct agent_expr *expr_to_address_and_size (struct expression *EXPR);
|
||||
|
||||
/* Given a GDB expression EXPR, return bytecode to trace its value.
|
||||
The result will use the `trace' and `trace_quick' bytecodes to
|
||||
record the value of all memory touched by the expression, and leave
|
||||
no values on the stack. The caller can then use the ax_reqs
|
||||
function to discover which registers the expression uses. */
|
||||
extern struct agent_expr *gen_trace_for_expr PARAMS ((CORE_ADDR,
|
||||
struct expression *));
|
||||
extern struct agent_expr *gen_trace_for_expr (CORE_ADDR, struct expression *);
|
||||
|
||||
#endif /* AX_GDB_H */
|
||||
|
|
|
|||
|
|
@ -1,23 +1,22 @@
|
|||
/* Functions for manipulating expressions designed to be executed on the agent
|
||||
Copyright 1998 Free Software Foundation, Inc.
|
||||
Copyright 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* $Id: ax-general.c,v 1.3 1998/12/02 23:22:58 msnyder Exp $ */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Despite what the above comment says about this file being part of
|
||||
GDB, we would like to keep these functions free of GDB
|
||||
|
|
@ -27,19 +26,27 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||
#include "defs.h"
|
||||
#include "ax.h"
|
||||
|
||||
#include "value.h"
|
||||
|
||||
static void grow_expr (struct agent_expr *x, int n);
|
||||
|
||||
static void append_const (struct agent_expr *x, LONGEST val, int n);
|
||||
|
||||
static LONGEST read_const (struct agent_expr *x, int o, int n);
|
||||
|
||||
static void generic_ext (struct agent_expr *x, enum agent_op op, int n);
|
||||
|
||||
/* Functions for building expressions. */
|
||||
|
||||
/* Allocate a new, empty agent expression. */
|
||||
struct agent_expr *
|
||||
new_agent_expr (scope)
|
||||
CORE_ADDR scope;
|
||||
new_agent_expr (CORE_ADDR scope)
|
||||
{
|
||||
struct agent_expr *x = xmalloc (sizeof (*x));
|
||||
x->len = 0;
|
||||
x->len = 0;
|
||||
x->size = 1; /* Change this to a larger value once
|
||||
reallocation code is tested. */
|
||||
x->buf = xmalloc (x->size);
|
||||
x->buf = xmalloc (x->size);
|
||||
x->scope = scope;
|
||||
|
||||
return x;
|
||||
|
|
@ -47,20 +54,29 @@ new_agent_expr (scope)
|
|||
|
||||
/* Free a agent expression. */
|
||||
void
|
||||
free_agent_expr (x)
|
||||
struct agent_expr *x;
|
||||
free_agent_expr (struct agent_expr *x)
|
||||
{
|
||||
free (x->buf);
|
||||
free (x);
|
||||
xfree (x->buf);
|
||||
xfree (x);
|
||||
}
|
||||
|
||||
static void
|
||||
do_free_agent_expr_cleanup (void *x)
|
||||
{
|
||||
free_agent_expr (x);
|
||||
}
|
||||
|
||||
struct cleanup *
|
||||
make_cleanup_free_agent_expr (struct agent_expr *x)
|
||||
{
|
||||
return make_cleanup (do_free_agent_expr_cleanup, x);
|
||||
}
|
||||
|
||||
|
||||
/* Make sure that X has room for at least N more bytes. This doesn't
|
||||
affect the length, just the allocated size. */
|
||||
static void
|
||||
grow_expr (x, n)
|
||||
struct agent_expr *x;
|
||||
int n;
|
||||
grow_expr (struct agent_expr *x, int n)
|
||||
{
|
||||
if (x->len + n > x->size)
|
||||
{
|
||||
|
|
@ -75,10 +91,7 @@ grow_expr (x, n)
|
|||
/* Append the low N bytes of VAL as an N-byte integer to the
|
||||
expression X, in big-endian order. */
|
||||
static void
|
||||
append_const (x, val, n)
|
||||
struct agent_expr *x;
|
||||
LONGEST val;
|
||||
int n;
|
||||
append_const (struct agent_expr *x, LONGEST val, int n)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -95,9 +108,7 @@ append_const (x, val, n)
|
|||
/* Extract an N-byte big-endian unsigned integer from expression X at
|
||||
offset O. */
|
||||
static LONGEST
|
||||
read_const (x, o, n)
|
||||
struct agent_expr *x;
|
||||
int o, n;
|
||||
read_const (struct agent_expr *x, int o, int n)
|
||||
{
|
||||
int i;
|
||||
LONGEST accum = 0;
|
||||
|
|
@ -108,16 +119,14 @@ read_const (x, o, n)
|
|||
|
||||
for (i = 0; i < n; i++)
|
||||
accum = (accum << 8) | x->buf[o + i];
|
||||
|
||||
|
||||
return accum;
|
||||
}
|
||||
|
||||
|
||||
/* Append a simple operator OP to EXPR. */
|
||||
void
|
||||
ax_simple (x, op)
|
||||
struct agent_expr *x;
|
||||
enum agent_op op;
|
||||
ax_simple (struct agent_expr *x, enum agent_op op)
|
||||
{
|
||||
grow_expr (x, 1);
|
||||
x->buf[x->len++] = op;
|
||||
|
|
@ -127,10 +136,7 @@ ax_simple (x, op)
|
|||
/* Append a sign-extension or zero-extension instruction to EXPR, to
|
||||
extend an N-bit value. */
|
||||
static void
|
||||
generic_ext (x, op, n)
|
||||
struct agent_expr *x;
|
||||
enum agent_op op;
|
||||
int n;
|
||||
generic_ext (struct agent_expr *x, enum agent_op op, int n)
|
||||
{
|
||||
/* N must fit in a byte. */
|
||||
if (n < 0 || n > 255)
|
||||
|
|
@ -147,9 +153,7 @@ generic_ext (x, op, n)
|
|||
|
||||
/* Append a sign-extension instruction to EXPR, to extend an N-bit value. */
|
||||
void
|
||||
ax_ext (x, n)
|
||||
struct agent_expr *x;
|
||||
int n;
|
||||
ax_ext (struct agent_expr *x, int n)
|
||||
{
|
||||
generic_ext (x, aop_ext, n);
|
||||
}
|
||||
|
|
@ -157,9 +161,7 @@ ax_ext (x, n)
|
|||
|
||||
/* Append a zero-extension instruction to EXPR, to extend an N-bit value. */
|
||||
void
|
||||
ax_zero_ext (x, n)
|
||||
struct agent_expr *x;
|
||||
int n;
|
||||
ax_zero_ext (struct agent_expr *x, int n)
|
||||
{
|
||||
generic_ext (x, aop_zero_ext, n);
|
||||
}
|
||||
|
|
@ -167,9 +169,7 @@ ax_zero_ext (x, n)
|
|||
|
||||
/* Append a trace_quick instruction to EXPR, to record N bytes. */
|
||||
void
|
||||
ax_trace_quick (x, n)
|
||||
struct agent_expr *x;
|
||||
int n;
|
||||
ax_trace_quick (struct agent_expr *x, int n)
|
||||
{
|
||||
/* N must fit in a byte. */
|
||||
if (n < 0 || n > 255)
|
||||
|
|
@ -187,9 +187,8 @@ ax_trace_quick (x, n)
|
|||
for the target, and return the offset in EXPR of that space, so we
|
||||
can backpatch it once we do know the target offset. Use ax_label
|
||||
to do the backpatching. */
|
||||
int ax_goto (x, op)
|
||||
struct agent_expr *x;
|
||||
enum agent_op op;
|
||||
int
|
||||
ax_goto (struct agent_expr *x, enum agent_op op)
|
||||
{
|
||||
grow_expr (x, 3);
|
||||
x->buf[x->len + 0] = op;
|
||||
|
|
@ -201,19 +200,16 @@ int ax_goto (x, op)
|
|||
|
||||
/* Suppose a given call to ax_goto returns some value PATCH. When you
|
||||
know the offset TARGET that goto should jump to, call
|
||||
ax_label (EXPR, PATCH, TARGET)
|
||||
ax_label (EXPR, PATCH, TARGET)
|
||||
to patch TARGET into the ax_goto instruction. */
|
||||
void
|
||||
ax_label (x, patch, target)
|
||||
struct agent_expr *x;
|
||||
int patch;
|
||||
int target;
|
||||
ax_label (struct agent_expr *x, int patch, int target)
|
||||
{
|
||||
/* Make sure the value is in range. Don't accept 0xffff as an
|
||||
offset; that's our magic sentinel value for unpatched branches. */
|
||||
if (target < 0 || target >= 0xffff)
|
||||
error ("GDB bug: ax-general.c (ax_label): label target out of range");
|
||||
|
||||
|
||||
x->buf[patch] = (target >> 8) & 0xff;
|
||||
x->buf[patch + 1] = target & 0xff;
|
||||
}
|
||||
|
|
@ -221,12 +217,11 @@ ax_label (x, patch, target)
|
|||
|
||||
/* Assemble code to push a constant on the stack. */
|
||||
void
|
||||
ax_const_l (x, l)
|
||||
struct agent_expr *x;
|
||||
LONGEST l;
|
||||
ax_const_l (struct agent_expr *x, LONGEST l)
|
||||
{
|
||||
static enum agent_op ops[]
|
||||
= { aop_const8, aop_const16, aop_const32, aop_const64 };
|
||||
=
|
||||
{aop_const8, aop_const16, aop_const32, aop_const64};
|
||||
int size;
|
||||
int op;
|
||||
|
||||
|
|
@ -252,9 +247,7 @@ ax_const_l (x, l)
|
|||
|
||||
|
||||
void
|
||||
ax_const_d (x, d)
|
||||
struct agent_expr *x;
|
||||
LONGEST d;
|
||||
ax_const_d (struct agent_expr *x, LONGEST d)
|
||||
{
|
||||
/* FIXME: floating-point support not present yet. */
|
||||
error ("GDB bug: ax-general.c (ax_const_d): floating point not supported yet");
|
||||
|
|
@ -263,83 +256,81 @@ ax_const_d (x, d)
|
|||
|
||||
/* Assemble code to push the value of register number REG on the
|
||||
stack. */
|
||||
void ax_reg (x, reg)
|
||||
struct agent_expr *x;
|
||||
int reg;
|
||||
void
|
||||
ax_reg (struct agent_expr *x, int reg)
|
||||
{
|
||||
/* Make sure the register number is in range. */
|
||||
if (reg < 0 || reg > 0xffff)
|
||||
error ("GDB bug: ax-general.c (ax_reg): register number out of range");
|
||||
grow_expr (x, 3);
|
||||
x->buf[x->len ] = aop_reg;
|
||||
x->buf[x->len] = aop_reg;
|
||||
x->buf[x->len + 1] = (reg >> 8) & 0xff;
|
||||
x->buf[x->len + 2] = (reg ) & 0xff;
|
||||
x->buf[x->len + 2] = (reg) & 0xff;
|
||||
x->len += 3;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* Functions for disassembling agent expressions, and otherwise
|
||||
debugging the expression compiler. */
|
||||
|
||||
struct aop_map aop_map[] = {
|
||||
{ 0, 0, 0, 0, 0 },
|
||||
{ "float", 0, 0, 0, 0 }, /* 0x01 */
|
||||
{ "add", 0, 0, 2, 1 }, /* 0x02 */
|
||||
{ "sub", 0, 0, 2, 1 }, /* 0x03 */
|
||||
{ "mul", 0, 0, 2, 1 }, /* 0x04 */
|
||||
{ "div_signed", 0, 0, 2, 1 }, /* 0x05 */
|
||||
{ "div_unsigned", 0, 0, 2, 1 }, /* 0x06 */
|
||||
{ "rem_signed", 0, 0, 2, 1 }, /* 0x07 */
|
||||
{ "rem_unsigned", 0, 0, 2, 1 }, /* 0x08 */
|
||||
{ "lsh", 0, 0, 2, 1 }, /* 0x09 */
|
||||
{ "rsh_signed", 0, 0, 2, 1 }, /* 0x0a */
|
||||
{ "rsh_unsigned", 0, 0, 2, 1 }, /* 0x0b */
|
||||
{ "trace", 0, 0, 2, 0 }, /* 0x0c */
|
||||
{ "trace_quick", 1, 0, 1, 1 }, /* 0x0d */
|
||||
{ "log_not", 0, 0, 1, 1 }, /* 0x0e */
|
||||
{ "bit_and", 0, 0, 2, 1 }, /* 0x0f */
|
||||
{ "bit_or", 0, 0, 2, 1 }, /* 0x10 */
|
||||
{ "bit_xor", 0, 0, 2, 1 }, /* 0x11 */
|
||||
{ "bit_not", 0, 0, 1, 1 }, /* 0x12 */
|
||||
{ "equal", 0, 0, 2, 1 }, /* 0x13 */
|
||||
{ "less_signed", 0, 0, 2, 1 }, /* 0x14 */
|
||||
{ "less_unsigned", 0, 0, 2, 1 }, /* 0x15 */
|
||||
{ "ext", 1, 0, 1, 1 }, /* 0x16 */
|
||||
{ "ref8", 0, 8, 1, 1 }, /* 0x17 */
|
||||
{ "ref16", 0, 16, 1, 1 }, /* 0x18 */
|
||||
{ "ref32", 0, 32, 1, 1 }, /* 0x19 */
|
||||
{ "ref64", 0, 64, 1, 1 }, /* 0x1a */
|
||||
{ "ref_float", 0, 0, 1, 1 }, /* 0x1b */
|
||||
{ "ref_double", 0, 0, 1, 1 }, /* 0x1c */
|
||||
{ "ref_long_double", 0, 0, 1, 1 }, /* 0x1d */
|
||||
{ "l_to_d", 0, 0, 1, 1 }, /* 0x1e */
|
||||
{ "d_to_l", 0, 0, 1, 1 }, /* 0x1f */
|
||||
{ "if_goto", 2, 0, 1, 0 }, /* 0x20 */
|
||||
{ "goto", 2, 0, 0, 0 }, /* 0x21 */
|
||||
{ "const8", 1, 8, 0, 1 }, /* 0x22 */
|
||||
{ "const16", 2, 16, 0, 1 }, /* 0x23 */
|
||||
{ "const32", 4, 32, 0, 1 }, /* 0x24 */
|
||||
{ "const64", 8, 64, 0, 1 }, /* 0x25 */
|
||||
{ "reg", 2, 0, 0, 1 }, /* 0x26 */
|
||||
{ "end", 0, 0, 0, 0 }, /* 0x27 */
|
||||
{ "dup", 0, 0, 1, 2 }, /* 0x28 */
|
||||
{ "pop", 0, 0, 1, 0 }, /* 0x29 */
|
||||
{ "zero_ext", 1, 0, 1, 1 }, /* 0x2a */
|
||||
{ "swap", 0, 0, 2, 2 }, /* 0x2b */
|
||||
{ 0, 0, 0, 0, 0 }, /* 0x2c */
|
||||
{ 0, 0, 0, 0, 0 }, /* 0x2d */
|
||||
{ 0, 0, 0, 0, 0 }, /* 0x2e */
|
||||
{ 0, 0, 0, 0, 0 }, /* 0x2f */
|
||||
{ "trace16", 2, 0, 1, 1 }, /* 0x30 */
|
||||
struct aop_map aop_map[] =
|
||||
{
|
||||
{0, 0, 0, 0, 0},
|
||||
{"float", 0, 0, 0, 0}, /* 0x01 */
|
||||
{"add", 0, 0, 2, 1}, /* 0x02 */
|
||||
{"sub", 0, 0, 2, 1}, /* 0x03 */
|
||||
{"mul", 0, 0, 2, 1}, /* 0x04 */
|
||||
{"div_signed", 0, 0, 2, 1}, /* 0x05 */
|
||||
{"div_unsigned", 0, 0, 2, 1}, /* 0x06 */
|
||||
{"rem_signed", 0, 0, 2, 1}, /* 0x07 */
|
||||
{"rem_unsigned", 0, 0, 2, 1}, /* 0x08 */
|
||||
{"lsh", 0, 0, 2, 1}, /* 0x09 */
|
||||
{"rsh_signed", 0, 0, 2, 1}, /* 0x0a */
|
||||
{"rsh_unsigned", 0, 0, 2, 1}, /* 0x0b */
|
||||
{"trace", 0, 0, 2, 0}, /* 0x0c */
|
||||
{"trace_quick", 1, 0, 1, 1}, /* 0x0d */
|
||||
{"log_not", 0, 0, 1, 1}, /* 0x0e */
|
||||
{"bit_and", 0, 0, 2, 1}, /* 0x0f */
|
||||
{"bit_or", 0, 0, 2, 1}, /* 0x10 */
|
||||
{"bit_xor", 0, 0, 2, 1}, /* 0x11 */
|
||||
{"bit_not", 0, 0, 1, 1}, /* 0x12 */
|
||||
{"equal", 0, 0, 2, 1}, /* 0x13 */
|
||||
{"less_signed", 0, 0, 2, 1}, /* 0x14 */
|
||||
{"less_unsigned", 0, 0, 2, 1}, /* 0x15 */
|
||||
{"ext", 1, 0, 1, 1}, /* 0x16 */
|
||||
{"ref8", 0, 8, 1, 1}, /* 0x17 */
|
||||
{"ref16", 0, 16, 1, 1}, /* 0x18 */
|
||||
{"ref32", 0, 32, 1, 1}, /* 0x19 */
|
||||
{"ref64", 0, 64, 1, 1}, /* 0x1a */
|
||||
{"ref_float", 0, 0, 1, 1}, /* 0x1b */
|
||||
{"ref_double", 0, 0, 1, 1}, /* 0x1c */
|
||||
{"ref_long_double", 0, 0, 1, 1}, /* 0x1d */
|
||||
{"l_to_d", 0, 0, 1, 1}, /* 0x1e */
|
||||
{"d_to_l", 0, 0, 1, 1}, /* 0x1f */
|
||||
{"if_goto", 2, 0, 1, 0}, /* 0x20 */
|
||||
{"goto", 2, 0, 0, 0}, /* 0x21 */
|
||||
{"const8", 1, 8, 0, 1}, /* 0x22 */
|
||||
{"const16", 2, 16, 0, 1}, /* 0x23 */
|
||||
{"const32", 4, 32, 0, 1}, /* 0x24 */
|
||||
{"const64", 8, 64, 0, 1}, /* 0x25 */
|
||||
{"reg", 2, 0, 0, 1}, /* 0x26 */
|
||||
{"end", 0, 0, 0, 0}, /* 0x27 */
|
||||
{"dup", 0, 0, 1, 2}, /* 0x28 */
|
||||
{"pop", 0, 0, 1, 0}, /* 0x29 */
|
||||
{"zero_ext", 1, 0, 1, 1}, /* 0x2a */
|
||||
{"swap", 0, 0, 2, 2}, /* 0x2b */
|
||||
{0, 0, 0, 0, 0}, /* 0x2c */
|
||||
{0, 0, 0, 0, 0}, /* 0x2d */
|
||||
{0, 0, 0, 0, 0}, /* 0x2e */
|
||||
{0, 0, 0, 0, 0}, /* 0x2f */
|
||||
{"trace16", 2, 0, 1, 1}, /* 0x30 */
|
||||
};
|
||||
|
||||
|
||||
/* Disassemble the expression EXPR, writing to F. */
|
||||
void
|
||||
ax_print (f, x)
|
||||
GDB_FILE *f;
|
||||
struct agent_expr *x;
|
||||
ax_print (struct ui_file *f, struct agent_expr *x)
|
||||
{
|
||||
int i;
|
||||
int is_float = 0;
|
||||
|
|
@ -349,13 +340,13 @@ ax_print (f, x)
|
|||
if ((sizeof (aop_map) / sizeof (aop_map[0]))
|
||||
!= aop_last)
|
||||
error ("GDB bug: ax-general.c (ax_print): opcode map out of sync");
|
||||
|
||||
for (i = 0; i < x->len; )
|
||||
|
||||
for (i = 0; i < x->len;)
|
||||
{
|
||||
enum agent_op op = x->buf[i];
|
||||
|
||||
if (op >= (sizeof (aop_map) / sizeof (aop_map[0]))
|
||||
|| ! aop_map[op].name)
|
||||
|| !aop_map[op].name)
|
||||
{
|
||||
fprintf_filtered (f, "%3d <bad opcode %02x>\n", i, op);
|
||||
i++;
|
||||
|
|
@ -372,7 +363,7 @@ ax_print (f, x)
|
|||
if (aop_map[op].op_size > 0)
|
||||
{
|
||||
fputs_filtered (" ", f);
|
||||
|
||||
|
||||
print_longest (f, 'd', 0,
|
||||
read_const (x, i + 1, aop_map[op].op_size));
|
||||
}
|
||||
|
|
@ -387,9 +378,7 @@ ax_print (f, x)
|
|||
/* Given an agent expression AX, fill in an agent_reqs structure REQS
|
||||
describing it. */
|
||||
void
|
||||
ax_reqs (ax, reqs)
|
||||
struct agent_expr *ax;
|
||||
struct agent_reqs *reqs;
|
||||
ax_reqs (struct agent_expr *ax, struct agent_reqs *reqs)
|
||||
{
|
||||
int i;
|
||||
int height;
|
||||
|
|
@ -427,23 +416,23 @@ ax_reqs (ax, reqs)
|
|||
if (ax->buf[i] > (sizeof (aop_map) / sizeof (aop_map[0])))
|
||||
{
|
||||
reqs->flaw = agent_flaw_bad_instruction;
|
||||
free (reg_mask);
|
||||
xfree (reg_mask);
|
||||
return;
|
||||
}
|
||||
|
||||
op = &aop_map[ax->buf[i]];
|
||||
|
||||
if (! op->name)
|
||||
if (!op->name)
|
||||
{
|
||||
reqs->flaw = agent_flaw_bad_instruction;
|
||||
free (reg_mask);
|
||||
xfree (reg_mask);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (i + 1 + op->op_size > ax->len)
|
||||
{
|
||||
reqs->flaw = agent_flaw_incomplete_instruction;
|
||||
free (reg_mask);
|
||||
xfree (reg_mask);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -452,7 +441,7 @@ ax_reqs (ax, reqs)
|
|||
if (targets[i] && (heights[i] != height))
|
||||
{
|
||||
reqs->flaw = agent_flaw_height_mismatch;
|
||||
free (reg_mask);
|
||||
xfree (reg_mask);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -470,8 +459,8 @@ ax_reqs (ax, reqs)
|
|||
reqs->max_data_size = op->data_size;
|
||||
|
||||
/* For jump instructions, check that the target is a valid
|
||||
offset. If it is, record the fact that that location is a
|
||||
jump target, and record the height we expect there. */
|
||||
offset. If it is, record the fact that that location is a
|
||||
jump target, and record the height we expect there. */
|
||||
if (aop_goto == op - aop_map
|
||||
|| aop_if_goto == op - aop_map)
|
||||
{
|
||||
|
|
@ -479,7 +468,7 @@ ax_reqs (ax, reqs)
|
|||
if (target < 0 || target >= ax->len)
|
||||
{
|
||||
reqs->flaw = agent_flaw_bad_jump;
|
||||
free (reg_mask);
|
||||
xfree (reg_mask);
|
||||
return;
|
||||
}
|
||||
/* Have we already found other jumps to the same location? */
|
||||
|
|
@ -488,7 +477,7 @@ ax_reqs (ax, reqs)
|
|||
if (heights[i] != height)
|
||||
{
|
||||
reqs->flaw = agent_flaw_height_mismatch;
|
||||
free (reg_mask);
|
||||
xfree (reg_mask);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -498,16 +487,16 @@ ax_reqs (ax, reqs)
|
|||
heights[target] = height;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* For unconditional jumps with a successor, check that the
|
||||
successor is a target, and pick up its stack height. */
|
||||
if (aop_goto == op - aop_map
|
||||
&& i + 3 < ax->len)
|
||||
{
|
||||
if (! targets[i + 3])
|
||||
if (!targets[i + 3])
|
||||
{
|
||||
reqs->flaw = agent_flaw_hole;
|
||||
free (reg_mask);
|
||||
xfree (reg_mask);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -524,9 +513,9 @@ ax_reqs (ax, reqs)
|
|||
if (byte >= reg_mask_len)
|
||||
{
|
||||
/* It's not appropriate to double here. This isn't a
|
||||
string buffer. */
|
||||
string buffer. */
|
||||
int new_len = byte + 1;
|
||||
reg_mask = xrealloc (reg_mask,
|
||||
reg_mask = xrealloc (reg_mask,
|
||||
new_len * sizeof (reg_mask[0]));
|
||||
memset (reg_mask + reg_mask_len, 0,
|
||||
(new_len - reg_mask_len) * sizeof (reg_mask[0]));
|
||||
|
|
@ -542,7 +531,7 @@ ax_reqs (ax, reqs)
|
|||
if (targets[i] && !boundary[i])
|
||||
{
|
||||
reqs->flaw = agent_flaw_bad_jump;
|
||||
free (reg_mask);
|
||||
xfree (reg_mask);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,27 +1,28 @@
|
|||
/* Definitions for expressions designed to be executed on the agent
|
||||
Copyright 1998 Free Software Foundation, Inc.
|
||||
Copyright 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* $Id: ax.h,v 1.3.20.1 1999/04/01 17:33:04 jimb Exp $ */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef AGENTEXPR_H
|
||||
#define AGENTEXPR_H
|
||||
|
||||
#include "doublest.h" /* For DOUBLEST. */
|
||||
|
||||
/* It's sometimes useful to be able to debug programs that you can't
|
||||
really stop for more than a fraction of a second. To this end, the
|
||||
user can specify a tracepoint (like a breakpoint, but you don't
|
||||
|
|
@ -49,8 +50,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||
is independent of symbolic information. This means the agent can
|
||||
evaluate them on the fly without reference to data only available
|
||||
to the host GDB. */
|
||||
|
||||
|
||||
|
||||
/* Agent expression data structures. */
|
||||
|
||||
/* The type of an element of the agent expression stack.
|
||||
|
|
@ -58,18 +59,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||
the value itself has no typing information. GDB generates all
|
||||
bytecode streams, so we don't have to worry about type errors. */
|
||||
|
||||
union agent_val {
|
||||
LONGEST l;
|
||||
DOUBLEST d;
|
||||
};
|
||||
union agent_val
|
||||
{
|
||||
LONGEST l;
|
||||
DOUBLEST d;
|
||||
};
|
||||
|
||||
/* A buffer containing a agent expression. */
|
||||
struct agent_expr {
|
||||
unsigned char *buf;
|
||||
int len; /* number of characters used */
|
||||
int size; /* allocated size */
|
||||
CORE_ADDR scope;
|
||||
};
|
||||
struct agent_expr
|
||||
{
|
||||
unsigned char *buf;
|
||||
int len; /* number of characters used */
|
||||
int size; /* allocated size */
|
||||
CORE_ADDR scope;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
|
@ -84,78 +87,80 @@ struct agent_expr {
|
|||
agentexpr.h behaves like an opcode map. If you want to see them
|
||||
grouped logically, see doc/agentexpr.texi. */
|
||||
|
||||
enum agent_op {
|
||||
aop_float = 0x01,
|
||||
aop_add = 0x02,
|
||||
aop_sub = 0x03,
|
||||
aop_mul = 0x04,
|
||||
aop_div_signed = 0x05,
|
||||
aop_div_unsigned = 0x06,
|
||||
aop_rem_signed = 0x07,
|
||||
aop_rem_unsigned = 0x08,
|
||||
aop_lsh = 0x09,
|
||||
aop_rsh_signed = 0x0a,
|
||||
aop_rsh_unsigned = 0x0b,
|
||||
aop_trace = 0x0c,
|
||||
aop_trace_quick = 0x0d,
|
||||
aop_log_not = 0x0e,
|
||||
aop_bit_and = 0x0f,
|
||||
aop_bit_or = 0x10,
|
||||
aop_bit_xor = 0x11,
|
||||
aop_bit_not = 0x12,
|
||||
aop_equal = 0x13,
|
||||
aop_less_signed = 0x14,
|
||||
aop_less_unsigned = 0x15,
|
||||
aop_ext = 0x16,
|
||||
aop_ref8 = 0x17,
|
||||
aop_ref16 = 0x18,
|
||||
aop_ref32 = 0x19,
|
||||
aop_ref64 = 0x1a,
|
||||
aop_ref_float = 0x1b,
|
||||
aop_ref_double = 0x1c,
|
||||
aop_ref_long_double = 0x1d,
|
||||
aop_l_to_d = 0x1e,
|
||||
aop_d_to_l = 0x1f,
|
||||
aop_if_goto = 0x20,
|
||||
aop_goto = 0x21,
|
||||
aop_const8 = 0x22,
|
||||
aop_const16 = 0x23,
|
||||
aop_const32 = 0x24,
|
||||
aop_const64 = 0x25,
|
||||
aop_reg = 0x26,
|
||||
aop_end = 0x27,
|
||||
aop_dup = 0x28,
|
||||
aop_pop = 0x29,
|
||||
aop_zero_ext = 0x2a,
|
||||
aop_swap = 0x2b,
|
||||
aop_trace16 = 0x30,
|
||||
aop_last
|
||||
};
|
||||
|
||||
|
||||
enum agent_op
|
||||
{
|
||||
aop_float = 0x01,
|
||||
aop_add = 0x02,
|
||||
aop_sub = 0x03,
|
||||
aop_mul = 0x04,
|
||||
aop_div_signed = 0x05,
|
||||
aop_div_unsigned = 0x06,
|
||||
aop_rem_signed = 0x07,
|
||||
aop_rem_unsigned = 0x08,
|
||||
aop_lsh = 0x09,
|
||||
aop_rsh_signed = 0x0a,
|
||||
aop_rsh_unsigned = 0x0b,
|
||||
aop_trace = 0x0c,
|
||||
aop_trace_quick = 0x0d,
|
||||
aop_log_not = 0x0e,
|
||||
aop_bit_and = 0x0f,
|
||||
aop_bit_or = 0x10,
|
||||
aop_bit_xor = 0x11,
|
||||
aop_bit_not = 0x12,
|
||||
aop_equal = 0x13,
|
||||
aop_less_signed = 0x14,
|
||||
aop_less_unsigned = 0x15,
|
||||
aop_ext = 0x16,
|
||||
aop_ref8 = 0x17,
|
||||
aop_ref16 = 0x18,
|
||||
aop_ref32 = 0x19,
|
||||
aop_ref64 = 0x1a,
|
||||
aop_ref_float = 0x1b,
|
||||
aop_ref_double = 0x1c,
|
||||
aop_ref_long_double = 0x1d,
|
||||
aop_l_to_d = 0x1e,
|
||||
aop_d_to_l = 0x1f,
|
||||
aop_if_goto = 0x20,
|
||||
aop_goto = 0x21,
|
||||
aop_const8 = 0x22,
|
||||
aop_const16 = 0x23,
|
||||
aop_const32 = 0x24,
|
||||
aop_const64 = 0x25,
|
||||
aop_reg = 0x26,
|
||||
aop_end = 0x27,
|
||||
aop_dup = 0x28,
|
||||
aop_pop = 0x29,
|
||||
aop_zero_ext = 0x2a,
|
||||
aop_swap = 0x2b,
|
||||
aop_trace16 = 0x30,
|
||||
aop_last
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* Functions for building expressions. */
|
||||
|
||||
/* Allocate a new, empty agent expression. */
|
||||
extern struct agent_expr *new_agent_expr PARAMS ((CORE_ADDR));
|
||||
extern struct agent_expr *new_agent_expr (CORE_ADDR);
|
||||
|
||||
/* Free a agent expression. */
|
||||
extern void free_agent_expr PARAMS ((struct agent_expr *));
|
||||
extern void free_agent_expr (struct agent_expr *);
|
||||
extern struct cleanup *make_cleanup_free_agent_expr (struct agent_expr *);
|
||||
|
||||
/* Append a simple operator OP to EXPR. */
|
||||
extern void ax_simple PARAMS ((struct agent_expr *EXPR, enum agent_op OP));
|
||||
extern void ax_simple (struct agent_expr *EXPR, enum agent_op OP);
|
||||
|
||||
/* Append the floating-point prefix, for the next bytecode. */
|
||||
#define ax_float(EXPR) (ax_simple ((EXPR), aop_float))
|
||||
|
||||
/* Append a sign-extension instruction to EXPR, to extend an N-bit value. */
|
||||
extern void ax_ext PARAMS ((struct agent_expr *EXPR, int N));
|
||||
extern void ax_ext (struct agent_expr *EXPR, int N);
|
||||
|
||||
/* Append a zero-extension instruction to EXPR, to extend an N-bit value. */
|
||||
extern void ax_zero_ext PARAMS ((struct agent_expr *EXPR, int N));
|
||||
extern void ax_zero_ext (struct agent_expr *EXPR, int N);
|
||||
|
||||
/* Append a trace_quick instruction to EXPR, to record N bytes. */
|
||||
extern void ax_trace_quick PARAMS ((struct agent_expr *EXPR, int N));
|
||||
extern void ax_trace_quick (struct agent_expr *EXPR, int N);
|
||||
|
||||
/* Append a goto op to EXPR. OP is the actual op (must be aop_goto or
|
||||
aop_if_goto). We assume we don't know the target offset yet,
|
||||
|
|
@ -163,123 +168,125 @@ extern void ax_trace_quick PARAMS ((struct agent_expr *EXPR, int N));
|
|||
for the target, and return the offset in EXPR of that space, so we
|
||||
can backpatch it once we do know the target offset. Use ax_label
|
||||
to do the backpatching. */
|
||||
extern int ax_goto PARAMS ((struct agent_expr *EXPR, enum agent_op OP));
|
||||
extern int ax_goto (struct agent_expr *EXPR, enum agent_op OP);
|
||||
|
||||
/* Suppose a given call to ax_goto returns some value PATCH. When you
|
||||
know the offset TARGET that goto should jump to, call
|
||||
ax_label (EXPR, PATCH, TARGET)
|
||||
ax_label (EXPR, PATCH, TARGET)
|
||||
to patch TARGET into the ax_goto instruction. */
|
||||
extern void ax_label PARAMS ((struct agent_expr *EXPR, int patch, int target));
|
||||
extern void ax_label (struct agent_expr *EXPR, int patch, int target);
|
||||
|
||||
/* Assemble code to push a constant on the stack. */
|
||||
extern void ax_const_l PARAMS ((struct agent_expr *EXPR, LONGEST l));
|
||||
extern void ax_const_d PARAMS ((struct agent_expr *EXPR, LONGEST d));
|
||||
extern void ax_const_l (struct agent_expr *EXPR, LONGEST l);
|
||||
extern void ax_const_d (struct agent_expr *EXPR, LONGEST d);
|
||||
|
||||
/* Assemble code to push the value of register number REG on the
|
||||
stack. */
|
||||
extern void ax_reg PARAMS ((struct agent_expr *EXPR, int REG));
|
||||
|
||||
extern void ax_reg (struct agent_expr *EXPR, int REG);
|
||||
|
||||
|
||||
/* Functions for printing out expressions, and otherwise debugging
|
||||
things. */
|
||||
|
||||
/* Disassemble the expression EXPR, writing to F. */
|
||||
extern void ax_print PARAMS ((GDB_FILE *f, struct agent_expr *EXPR));
|
||||
extern void ax_print (struct ui_file *f, struct agent_expr * EXPR);
|
||||
|
||||
/* An entry in the opcode map. */
|
||||
struct aop_map {
|
||||
struct aop_map
|
||||
{
|
||||
|
||||
/* The name of the opcode. Null means that this entry is not a
|
||||
valid opcode --- a hole in the opcode space. */
|
||||
char *name;
|
||||
/* The name of the opcode. Null means that this entry is not a
|
||||
valid opcode --- a hole in the opcode space. */
|
||||
char *name;
|
||||
|
||||
/* All opcodes take no operands from the bytecode stream, or take
|
||||
unsigned integers of various sizes. If this is a positive number
|
||||
n, then the opcode is followed by an n-byte operand, which should
|
||||
be printed as an unsigned integer. If this is zero, then the
|
||||
opcode takes no operands from the bytecode stream.
|
||||
/* All opcodes take no operands from the bytecode stream, or take
|
||||
unsigned integers of various sizes. If this is a positive number
|
||||
n, then the opcode is followed by an n-byte operand, which should
|
||||
be printed as an unsigned integer. If this is zero, then the
|
||||
opcode takes no operands from the bytecode stream.
|
||||
|
||||
If we get more complicated opcodes in the future, don't add other
|
||||
magic values of this; that's a crock. Add an `enum encoding'
|
||||
field to this, or something like that. */
|
||||
int op_size;
|
||||
If we get more complicated opcodes in the future, don't add other
|
||||
magic values of this; that's a crock. Add an `enum encoding'
|
||||
field to this, or something like that. */
|
||||
int op_size;
|
||||
|
||||
/* The size of the data operated upon, in bits, for bytecodes that
|
||||
care about that (ref and const). Zero for all others. */
|
||||
int data_size;
|
||||
/* The size of the data operated upon, in bits, for bytecodes that
|
||||
care about that (ref and const). Zero for all others. */
|
||||
int data_size;
|
||||
|
||||
/* Number of stack elements consumed, and number produced. */
|
||||
int consumed, produced;
|
||||
};
|
||||
/* Number of stack elements consumed, and number produced. */
|
||||
int consumed, produced;
|
||||
};
|
||||
|
||||
/* Map of the bytecodes, indexed by bytecode number. */
|
||||
extern struct aop_map aop_map[];
|
||||
|
||||
/* Different kinds of flaws an agent expression might have, as
|
||||
detected by agent_reqs. */
|
||||
enum agent_flaws {
|
||||
agent_flaw_none = 0, /* code is good */
|
||||
enum agent_flaws
|
||||
{
|
||||
agent_flaw_none = 0, /* code is good */
|
||||
|
||||
/* There is an invalid instruction in the stream. */
|
||||
agent_flaw_bad_instruction,
|
||||
/* There is an invalid instruction in the stream. */
|
||||
agent_flaw_bad_instruction,
|
||||
|
||||
/* There is an incomplete instruction at the end of the expression. */
|
||||
agent_flaw_incomplete_instruction,
|
||||
/* There is an incomplete instruction at the end of the expression. */
|
||||
agent_flaw_incomplete_instruction,
|
||||
|
||||
/* agent_reqs was unable to prove that every jump target is to a
|
||||
valid offset. Valid offsets are within the bounds of the
|
||||
expression, and to a valid instruction boundary. */
|
||||
agent_flaw_bad_jump,
|
||||
/* agent_reqs was unable to prove that every jump target is to a
|
||||
valid offset. Valid offsets are within the bounds of the
|
||||
expression, and to a valid instruction boundary. */
|
||||
agent_flaw_bad_jump,
|
||||
|
||||
/* agent_reqs was unable to prove to its satisfaction that, for each
|
||||
jump target location, the stack will have the same height whether
|
||||
that location is reached via a jump or by straight execution. */
|
||||
agent_flaw_height_mismatch,
|
||||
/* agent_reqs was unable to prove to its satisfaction that, for each
|
||||
jump target location, the stack will have the same height whether
|
||||
that location is reached via a jump or by straight execution. */
|
||||
agent_flaw_height_mismatch,
|
||||
|
||||
/* agent_reqs was unable to prove that every instruction following
|
||||
an unconditional jump was the target of some other jump. */
|
||||
agent_flaw_hole
|
||||
};
|
||||
/* agent_reqs was unable to prove that every instruction following
|
||||
an unconditional jump was the target of some other jump. */
|
||||
agent_flaw_hole
|
||||
};
|
||||
|
||||
/* Structure describing the requirements of a bytecode expression. */
|
||||
struct agent_reqs {
|
||||
struct agent_reqs
|
||||
{
|
||||
|
||||
/* If the following is not equal to agent_flaw_none, the rest of the
|
||||
information in this structure is suspect. */
|
||||
enum agent_flaws flaw;
|
||||
/* If the following is not equal to agent_flaw_none, the rest of the
|
||||
information in this structure is suspect. */
|
||||
enum agent_flaws flaw;
|
||||
|
||||
/* Number of elements left on stack at end; may be negative if expr
|
||||
only consumes elements. */
|
||||
int final_height;
|
||||
/* Number of elements left on stack at end; may be negative if expr
|
||||
only consumes elements. */
|
||||
int final_height;
|
||||
|
||||
/* Maximum and minimum stack height, relative to initial height. */
|
||||
int max_height, min_height;
|
||||
/* Maximum and minimum stack height, relative to initial height. */
|
||||
int max_height, min_height;
|
||||
|
||||
/* Largest `ref' or `const' opcode used, in bits. Zero means the
|
||||
expression has no such instructions. */
|
||||
int max_data_size;
|
||||
/* Largest `ref' or `const' opcode used, in bits. Zero means the
|
||||
expression has no such instructions. */
|
||||
int max_data_size;
|
||||
|
||||
/* Bit vector of registers used. Register R is used iff
|
||||
|
||||
reg_mask[R / 8] & (1 << (R % 8))
|
||||
/* Bit vector of registers used. Register R is used iff
|
||||
|
||||
is non-zero. Note! You may not assume that this bitmask is long
|
||||
enough to hold bits for all the registers of the machine; the
|
||||
agent expression code has no idea how many registers the machine
|
||||
has. However, the bitmask is reg_mask_len bytes long, so the
|
||||
valid register numbers run from 0 to reg_mask_len * 8 - 1.
|
||||
reg_mask[R / 8] & (1 << (R % 8))
|
||||
|
||||
We're assuming eight-bit bytes. So sue me.
|
||||
is non-zero. Note! You may not assume that this bitmask is long
|
||||
enough to hold bits for all the registers of the machine; the
|
||||
agent expression code has no idea how many registers the machine
|
||||
has. However, the bitmask is reg_mask_len bytes long, so the
|
||||
valid register numbers run from 0 to reg_mask_len * 8 - 1.
|
||||
|
||||
The caller should free reg_list when done. */
|
||||
int reg_mask_len;
|
||||
unsigned char *reg_mask;
|
||||
};
|
||||
We're assuming eight-bit bytes. So sue me.
|
||||
|
||||
The caller should free reg_list when done. */
|
||||
int reg_mask_len;
|
||||
unsigned char *reg_mask;
|
||||
};
|
||||
|
||||
|
||||
/* Given an agent expression AX, fill in an agent_reqs structure REQS
|
||||
describing it. */
|
||||
extern void ax_reqs PARAMS ((struct agent_expr *ax,
|
||||
struct agent_reqs *reqs));
|
||||
extern void ax_reqs (struct agent_expr *ax, struct agent_reqs *reqs);
|
||||
|
||||
#endif /* AGENTEXPR_H */
|
||||
|
|
|
|||
|
|
@ -1,219 +1,293 @@
|
|||
/* Implement a cached obstack.
|
||||
Written by Fred Fish (fnf@cygnus.com)
|
||||
Copyright 1995, 1998 Free Software Foundation, Inc.
|
||||
Written by Fred Fish <fnf@cygnus.com>
|
||||
Rewritten by Jim Blandy <jimb@cygnus.com>
|
||||
|
||||
This file is part of GDB.
|
||||
Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This file is part of GDB.
|
||||
|
||||
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.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "obstack.h"
|
||||
#include "bcache.h"
|
||||
#include "gdb_string.h" /* For memcpy declaration */
|
||||
|
||||
/* Prototypes for local functions. */
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static unsigned int hash PARAMS ((void *, int));
|
||||
|
||||
static void *lookup_cache PARAMS ((void *, int, int, struct bcache *));
|
||||
|
||||
/* FIXME: Incredibly simplistic hash generator. Probably way too expensive
|
||||
(consider long strings) and unlikely to have good distribution across hash
|
||||
values for typical input. */
|
||||
|
||||
static unsigned int
|
||||
hash (bytes, count)
|
||||
void *bytes;
|
||||
int count;
|
||||
/* The old hash function was stolen from SDBM. This is what DB 3.0 uses now,
|
||||
* and is better than the old one.
|
||||
*/
|
||||
|
||||
unsigned long
|
||||
hash(const void *addr, int length)
|
||||
{
|
||||
unsigned int len;
|
||||
unsigned long hashval;
|
||||
unsigned int c;
|
||||
const unsigned char *data = bytes;
|
||||
|
||||
hashval = 0;
|
||||
len = 0;
|
||||
while (count-- > 0)
|
||||
{
|
||||
c = *data++;
|
||||
hashval += c + (c << 17);
|
||||
hashval ^= hashval >> 2;
|
||||
++len;
|
||||
}
|
||||
hashval += len + (len << 17);
|
||||
hashval ^= hashval >> 2;
|
||||
return (hashval % BCACHE_HASHSIZE);
|
||||
}
|
||||
|
||||
static void *
|
||||
lookup_cache (bytes, count, hashval, bcachep)
|
||||
void *bytes;
|
||||
int count;
|
||||
int hashval;
|
||||
struct bcache *bcachep;
|
||||
{
|
||||
void *location = NULL;
|
||||
struct hashlink **hashtablep;
|
||||
struct hashlink *linkp;
|
||||
|
||||
hashtablep = bcachep -> indextable[count];
|
||||
if (hashtablep != NULL)
|
||||
{
|
||||
linkp = hashtablep[hashval];
|
||||
while (linkp != NULL)
|
||||
{
|
||||
if (memcmp (BCACHE_DATA (linkp), bytes, count) == 0)
|
||||
{
|
||||
location = BCACHE_DATA (linkp);
|
||||
break;
|
||||
}
|
||||
linkp = linkp -> next;
|
||||
}
|
||||
}
|
||||
return (location);
|
||||
}
|
||||
|
||||
void *
|
||||
bcache (bytes, count, bcachep)
|
||||
void *bytes;
|
||||
int count;
|
||||
struct bcache *bcachep;
|
||||
{
|
||||
int hashval;
|
||||
void *location;
|
||||
struct hashlink *newlink;
|
||||
struct hashlink **linkpp;
|
||||
struct hashlink ***hashtablepp;
|
||||
|
||||
if (count >= BCACHE_MAXLENGTH)
|
||||
{
|
||||
/* Rare enough to just stash unique copies */
|
||||
location = (void *) obstack_alloc (&bcachep->cache, count);
|
||||
bcachep -> cache_bytes += count;
|
||||
memcpy (location, bytes, count);
|
||||
bcachep -> bcache_overflows++;
|
||||
}
|
||||
else
|
||||
{
|
||||
hashval = hash (bytes, count);
|
||||
location = lookup_cache (bytes, count, hashval, bcachep);
|
||||
if (location != NULL)
|
||||
{
|
||||
bcachep -> cache_savings += count;
|
||||
bcachep -> cache_hits++;
|
||||
}
|
||||
else
|
||||
{
|
||||
bcachep -> cache_misses++;
|
||||
hashtablepp = &bcachep -> indextable[count];
|
||||
if (*hashtablepp == NULL)
|
||||
{
|
||||
*hashtablepp = (struct hashlink **)
|
||||
obstack_alloc (&bcachep->cache, BCACHE_HASHSIZE * sizeof (struct hashlink *));
|
||||
bcachep -> cache_bytes += BCACHE_HASHSIZE * sizeof (struct hashlink *);
|
||||
memset (*hashtablepp, 0, BCACHE_HASHSIZE * sizeof (struct hashlink *));
|
||||
}
|
||||
linkpp = &(*hashtablepp)[hashval];
|
||||
newlink = (struct hashlink *)
|
||||
obstack_alloc (&bcachep->cache, BCACHE_DATA_ALIGNMENT + count);
|
||||
bcachep -> cache_bytes += BCACHE_DATA_ALIGNMENT + count;
|
||||
memcpy (BCACHE_DATA (newlink), bytes, count);
|
||||
newlink -> next = *linkpp;
|
||||
*linkpp = newlink;
|
||||
location = BCACHE_DATA (newlink);
|
||||
}
|
||||
}
|
||||
return (location);
|
||||
}
|
||||
|
||||
#if MAINTENANCE_CMDS
|
||||
|
||||
void
|
||||
print_bcache_statistics (bcachep, id)
|
||||
struct bcache *bcachep;
|
||||
char *id;
|
||||
{
|
||||
struct hashlink **hashtablep;
|
||||
struct hashlink *linkp;
|
||||
int tidx, tcount, hidx, hcount, lcount, lmax, temp, lmaxt, lmaxh;
|
||||
|
||||
for (lmax = lcount = tcount = hcount = tidx = 0; tidx < BCACHE_MAXLENGTH; tidx++)
|
||||
{
|
||||
hashtablep = bcachep -> indextable[tidx];
|
||||
if (hashtablep != NULL)
|
||||
{
|
||||
tcount++;
|
||||
for (hidx = 0; hidx < BCACHE_HASHSIZE; hidx++)
|
||||
{
|
||||
linkp = hashtablep[hidx];
|
||||
if (linkp != NULL)
|
||||
const unsigned char *k, *e;
|
||||
unsigned long h;
|
||||
|
||||
k = (const unsigned char *)addr;
|
||||
e = k+length;
|
||||
for (h=0; k< e;++k)
|
||||
{
|
||||
hcount++;
|
||||
for (temp = 0; linkp != NULL; linkp = linkp -> next)
|
||||
{
|
||||
lcount++;
|
||||
temp++;
|
||||
}
|
||||
if (temp > lmax)
|
||||
{
|
||||
lmax = temp;
|
||||
lmaxt = tidx;
|
||||
lmaxh = hidx;
|
||||
}
|
||||
h *=16777619;
|
||||
h ^= *k;
|
||||
}
|
||||
}
|
||||
return (h);
|
||||
}
|
||||
|
||||
/* Growing the bcache's hash table. */
|
||||
|
||||
/* If the average chain length grows beyond this, then we want to
|
||||
resize our hash table. */
|
||||
#define CHAIN_LENGTH_THRESHOLD (5)
|
||||
|
||||
static void
|
||||
expand_hash_table (struct bcache *bcache)
|
||||
{
|
||||
/* A table of good hash table sizes. Whenever we grow, we pick the
|
||||
next larger size from this table. sizes[i] is close to 1 << (i+10),
|
||||
so we roughly double the table size each time. After we fall off
|
||||
the end of this table, we just double. Don't laugh --- there have
|
||||
been executables sighted with a gigabyte of debug info. */
|
||||
static unsigned long sizes[] = {
|
||||
1021, 2053, 4099, 8191, 16381, 32771,
|
||||
65537, 131071, 262144, 524287, 1048573, 2097143,
|
||||
4194301, 8388617, 16777213, 33554467, 67108859, 134217757,
|
||||
268435459, 536870923, 1073741827, 2147483659UL
|
||||
};
|
||||
unsigned int new_num_buckets;
|
||||
struct bstring **new_buckets;
|
||||
unsigned int i;
|
||||
|
||||
/* Find the next size. */
|
||||
new_num_buckets = bcache->num_buckets * 2;
|
||||
for (i = 0; i < (sizeof (sizes) / sizeof (sizes[0])); i++)
|
||||
if (sizes[i] > bcache->num_buckets)
|
||||
{
|
||||
new_num_buckets = sizes[i];
|
||||
break;
|
||||
}
|
||||
|
||||
/* Allocate the new table. */
|
||||
{
|
||||
size_t new_size = new_num_buckets * sizeof (new_buckets[0]);
|
||||
new_buckets = (struct bstring **) xmalloc (new_size);
|
||||
memset (new_buckets, 0, new_size);
|
||||
|
||||
bcache->structure_size -= (bcache->num_buckets
|
||||
* sizeof (bcache->bucket[0]));
|
||||
bcache->structure_size += new_size;
|
||||
}
|
||||
|
||||
/* Rehash all existing strings. */
|
||||
for (i = 0; i < bcache->num_buckets; i++)
|
||||
{
|
||||
struct bstring *s, *next;
|
||||
|
||||
for (s = bcache->bucket[i]; s; s = next)
|
||||
{
|
||||
struct bstring **new_bucket;
|
||||
next = s->next;
|
||||
|
||||
new_bucket = &new_buckets[(hash (&s->d.data, s->length)
|
||||
% new_num_buckets)];
|
||||
s->next = *new_bucket;
|
||||
*new_bucket = s;
|
||||
}
|
||||
}
|
||||
printf_filtered (" Cached '%s' statistics:\n", id);
|
||||
printf_filtered (" Cache hits: %d\n", bcachep -> cache_hits);
|
||||
printf_filtered (" Cache misses: %d\n", bcachep -> cache_misses);
|
||||
printf_filtered (" Cache hit ratio: ");
|
||||
if (bcachep -> cache_hits + bcachep -> cache_misses > 0)
|
||||
{
|
||||
printf_filtered ("%d%%\n", ((bcachep -> cache_hits) * 100) /
|
||||
(bcachep -> cache_hits + bcachep -> cache_misses));
|
||||
}
|
||||
else
|
||||
{
|
||||
printf_filtered ("(not applicable)\n");
|
||||
}
|
||||
printf_filtered (" Space used for caching: %d\n", bcachep -> cache_bytes);
|
||||
printf_filtered (" Space saved by cache hits: %d\n", bcachep -> cache_savings);
|
||||
printf_filtered (" Number of bcache overflows: %d\n", bcachep -> bcache_overflows);
|
||||
printf_filtered (" Number of index buckets used: %d\n", tcount);
|
||||
printf_filtered (" Number of hash table buckets used: %d\n", hcount);
|
||||
printf_filtered (" Number of chained items: %d\n", lcount);
|
||||
printf_filtered (" Average hash table population: ");
|
||||
if (tcount > 0)
|
||||
{
|
||||
printf_filtered ("%d%%\n", (hcount * 100) / (tcount * BCACHE_HASHSIZE));
|
||||
}
|
||||
else
|
||||
{
|
||||
printf_filtered ("(not applicable)\n");
|
||||
}
|
||||
printf_filtered (" Average chain length ");
|
||||
if (hcount > 0)
|
||||
{
|
||||
printf_filtered ("%d\n", lcount / hcount);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf_filtered ("(not applicable)\n");
|
||||
}
|
||||
printf_filtered (" Maximum chain length %d at %d:%d\n", lmax, lmaxt, lmaxh);
|
||||
|
||||
/* Plug in the new table. */
|
||||
if (bcache->bucket)
|
||||
xfree (bcache->bucket);
|
||||
bcache->bucket = new_buckets;
|
||||
bcache->num_buckets = new_num_buckets;
|
||||
}
|
||||
|
||||
#endif /* MAINTENANCE_CMDS */
|
||||
|
||||
/* Looking up things in the bcache. */
|
||||
|
||||
/* The number of bytes needed to allocate a struct bstring whose data
|
||||
is N bytes long. */
|
||||
#define BSTRING_SIZE(n) (offsetof (struct bstring, d.data) + (n))
|
||||
|
||||
/* Find a copy of the LENGTH bytes at ADDR in BCACHE. If BCACHE has
|
||||
never seen those bytes before, add a copy of them to BCACHE. In
|
||||
either case, return a pointer to BCACHE's copy of that string. */
|
||||
void *
|
||||
bcache (const void *addr, int length, struct bcache *bcache)
|
||||
{
|
||||
int hash_index;
|
||||
struct bstring *s;
|
||||
|
||||
/* If our average chain length is too high, expand the hash table. */
|
||||
if (bcache->unique_count >= bcache->num_buckets * CHAIN_LENGTH_THRESHOLD)
|
||||
expand_hash_table (bcache);
|
||||
|
||||
bcache->total_count++;
|
||||
bcache->total_size += length;
|
||||
|
||||
hash_index = hash (addr, length) % bcache->num_buckets;
|
||||
|
||||
/* Search the hash bucket for a string identical to the caller's. */
|
||||
for (s = bcache->bucket[hash_index]; s; s = s->next)
|
||||
if (s->length == length
|
||||
&& ! memcmp (&s->d.data, addr, length))
|
||||
return &s->d.data;
|
||||
|
||||
/* The user's string isn't in the list. Insert it after *ps. */
|
||||
{
|
||||
struct bstring *new
|
||||
= obstack_alloc (&bcache->cache, BSTRING_SIZE (length));
|
||||
memcpy (&new->d.data, addr, length);
|
||||
new->length = length;
|
||||
new->next = bcache->bucket[hash_index];
|
||||
bcache->bucket[hash_index] = new;
|
||||
|
||||
bcache->unique_count++;
|
||||
bcache->unique_size += length;
|
||||
bcache->structure_size += BSTRING_SIZE (length);
|
||||
|
||||
return &new->d.data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Freeing bcaches. */
|
||||
|
||||
/* Free all the storage associated with BCACHE. */
|
||||
void
|
||||
free_bcache (struct bcache *bcache)
|
||||
{
|
||||
obstack_free (&bcache->cache, 0);
|
||||
if (bcache->bucket)
|
||||
xfree (bcache->bucket);
|
||||
|
||||
/* This isn't necessary, but at least the bcache is always in a
|
||||
consistent state. */
|
||||
memset (bcache, 0, sizeof (*bcache));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Printing statistics. */
|
||||
|
||||
static int
|
||||
compare_ints (const void *ap, const void *bp)
|
||||
{
|
||||
/* Because we know we're comparing two ints which are positive,
|
||||
there's no danger of overflow here. */
|
||||
return * (int *) ap - * (int *) bp;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
print_percentage (int portion, int total)
|
||||
{
|
||||
if (total == 0)
|
||||
printf_filtered ("(not applicable)\n");
|
||||
else
|
||||
printf_filtered ("%3d%%\n", portion * 100 / total);
|
||||
}
|
||||
|
||||
|
||||
/* Print statistics on BCACHE's memory usage and efficacity at
|
||||
eliminating duplication. NAME should describe the kind of data
|
||||
BCACHE holds. Statistics are printed using `printf_filtered' and
|
||||
its ilk. */
|
||||
void
|
||||
print_bcache_statistics (struct bcache *c, char *type)
|
||||
{
|
||||
int occupied_buckets;
|
||||
int max_chain_length;
|
||||
int median_chain_length;
|
||||
|
||||
/* Count the number of occupied buckets, and measure chain lengths. */
|
||||
{
|
||||
unsigned int b;
|
||||
int *chain_length
|
||||
= (int *) alloca (c->num_buckets * sizeof (*chain_length));
|
||||
|
||||
occupied_buckets = 0;
|
||||
|
||||
for (b = 0; b < c->num_buckets; b++)
|
||||
{
|
||||
struct bstring *s = c->bucket[b];
|
||||
|
||||
chain_length[b] = 0;
|
||||
|
||||
if (s)
|
||||
{
|
||||
occupied_buckets++;
|
||||
|
||||
while (s)
|
||||
{
|
||||
chain_length[b]++;
|
||||
s = s->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* To compute the median, we need the set of chain lengths sorted. */
|
||||
qsort (chain_length, c->num_buckets, sizeof (chain_length[0]),
|
||||
compare_ints);
|
||||
|
||||
if (c->num_buckets > 0)
|
||||
{
|
||||
max_chain_length = chain_length[c->num_buckets - 1];
|
||||
median_chain_length = chain_length[c->num_buckets / 2];
|
||||
}
|
||||
else
|
||||
{
|
||||
max_chain_length = 0;
|
||||
median_chain_length = 0;
|
||||
}
|
||||
}
|
||||
|
||||
printf_filtered (" Cached '%s' statistics:\n", type);
|
||||
printf_filtered (" Total object count: %ld\n", c->total_count);
|
||||
printf_filtered (" Unique object count: %lu\n", c->unique_count);
|
||||
printf_filtered (" Percentage of duplicates, by count: ");
|
||||
print_percentage (c->total_count - c->unique_count, c->total_count);
|
||||
printf_filtered ("\n");
|
||||
|
||||
printf_filtered (" Total object size: %ld\n", c->total_size);
|
||||
printf_filtered (" Unique object size: %ld\n", c->unique_size);
|
||||
printf_filtered (" Percentage of duplicates, by size: ");
|
||||
print_percentage (c->total_size - c->unique_size, c->total_size);
|
||||
printf_filtered ("\n");
|
||||
|
||||
printf_filtered (" Total memory used by bcache, including overhead: %ld\n",
|
||||
c->structure_size);
|
||||
printf_filtered (" Percentage memory overhead: ");
|
||||
print_percentage (c->structure_size - c->unique_size, c->unique_size);
|
||||
printf_filtered (" Net memory savings: ");
|
||||
print_percentage (c->total_size - c->structure_size, c->total_size);
|
||||
printf_filtered ("\n");
|
||||
|
||||
printf_filtered (" Hash table size: %3d\n", c->num_buckets);
|
||||
printf_filtered (" Hash table population: ");
|
||||
print_percentage (occupied_buckets, c->num_buckets);
|
||||
printf_filtered (" Median hash chain length: %3d\n",
|
||||
median_chain_length);
|
||||
printf_filtered (" Average hash chain length: ");
|
||||
if (c->num_buckets > 0)
|
||||
printf_filtered ("%3lu\n", c->unique_count / c->num_buckets);
|
||||
else
|
||||
printf_filtered ("(not applicable)\n");
|
||||
printf_filtered (" Maximum hash chain length: %3d\n", max_chain_length);
|
||||
printf_filtered ("\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,72 +1,130 @@
|
|||
/* Include file cached obstack implementation.
|
||||
Written by Fred Fish (fnf@cygnus.com)
|
||||
Copyright 1995 Free Software Foundation, Inc.
|
||||
Written by Fred Fish <fnf@cygnus.com>
|
||||
Rewritten by Jim Blandy <jimb@cygnus.com>
|
||||
Copyright 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef BCACHE_H
|
||||
#define BCACHE_H 1
|
||||
|
||||
#define BCACHE_HASHLENGTH 12 /* Number of bits in hash value */
|
||||
#define BCACHE_HASHSIZE (1 << BCACHE_HASHLENGTH)
|
||||
#define BCACHE_MAXLENGTH 128
|
||||
/* A bcache is a data structure for factoring out duplication in
|
||||
read-only structures. You give the bcache some string of bytes S.
|
||||
If the bcache already contains a copy of S, it hands you back a
|
||||
pointer to its copy. Otherwise, it makes a fresh copy of S, and
|
||||
hands you back a pointer to that. In either case, you can throw
|
||||
away your copy of S, and use the bcache's.
|
||||
|
||||
/* Note that the user data is stored in data[]. Since it can be any type,
|
||||
it needs to have the same alignment as the most strict alignment of
|
||||
any type on the host machine. So do it the same way obstack does. */
|
||||
The "strings" in question are arbitrary strings of bytes --- they
|
||||
can contain zero bytes. You pass in the length explicitly when you
|
||||
call the bcache function.
|
||||
|
||||
struct hashlink {
|
||||
struct hashlink *next;
|
||||
union {
|
||||
This means that you can put ordinary C objects in a bcache.
|
||||
However, if you do this, remember that structs can contain `holes'
|
||||
between members, added for alignment. These bytes usually contain
|
||||
garbage. If you try to bcache two objects which are identical from
|
||||
your code's point of view, but have different garbage values in the
|
||||
structure's holes, then the bcache will treat them as separate
|
||||
strings, and you won't get the nice elimination of duplicates you
|
||||
were hoping for. So, remember to memset your structures full of
|
||||
zeros before bcaching them!
|
||||
|
||||
You shouldn't modify the strings you get from a bcache, because:
|
||||
|
||||
- You don't necessarily know who you're sharing space with. If I
|
||||
stick eight bytes of text in a bcache, and then stick an
|
||||
eight-byte structure in the same bcache, there's no guarantee
|
||||
those two objects don't actually comprise the same sequence of
|
||||
bytes. If they happen to, the bcache will use a single byte
|
||||
string for both of them. Then, modifying the structure will
|
||||
change the string. In bizarre ways.
|
||||
|
||||
- Even if you know for some other reason that all that's okay,
|
||||
there's another problem. A bcache stores all its strings in a
|
||||
hash table. If you modify a string's contents, you will probably
|
||||
change its hash value. This means that the modified string is
|
||||
now in the wrong place in the hash table, and future bcache
|
||||
probes will never find it. So by mutating a string, you give up
|
||||
any chance of sharing its space with future duplicates. */
|
||||
|
||||
|
||||
/* The type used to hold a single bcache string. The user data is
|
||||
stored in d.data. Since it can be any type, it needs to have the
|
||||
same alignment as the most strict alignment of any type on the host
|
||||
machine. I don't know of any really correct way to do this in
|
||||
stock ANSI C, so just do it the same way obstack.h does.
|
||||
|
||||
It would be nicer to have this stuff hidden away in bcache.c, but
|
||||
struct objstack contains a struct bcache directly --- not a pointer
|
||||
to one --- and then the memory-mapped stuff makes this a real pain.
|
||||
We don't strictly need to expose struct bstring, but it's better to
|
||||
have it all in one place. */
|
||||
|
||||
struct bstring {
|
||||
struct bstring *next;
|
||||
size_t length;
|
||||
|
||||
union
|
||||
{
|
||||
char data[1];
|
||||
double dummy;
|
||||
} d;
|
||||
}
|
||||
d;
|
||||
};
|
||||
|
||||
/* BCACHE_DATA is used to get the address of the cached data. */
|
||||
|
||||
#define BCACHE_DATA(p) ((p)->d.data)
|
||||
|
||||
/* BCACHE_DATA_ALIGNMENT is used to get the offset of the start of
|
||||
cached data within the hashlink struct. This value, plus the
|
||||
size of the cached data, is the amount of space to allocate for
|
||||
a hashlink struct to hold the next pointer and the data. */
|
||||
|
||||
#define BCACHE_DATA_ALIGNMENT \
|
||||
(((char *) BCACHE_DATA((struct hashlink*) 0) - (char *) 0))
|
||||
|
||||
/* The structure for a bcache itself.
|
||||
To initialize a bcache, just fill it with zeros. */
|
||||
struct bcache {
|
||||
/* All the bstrings are allocated here. */
|
||||
struct obstack cache;
|
||||
struct hashlink **indextable[BCACHE_MAXLENGTH];
|
||||
int cache_hits;
|
||||
int cache_misses;
|
||||
int cache_bytes;
|
||||
int cache_savings;
|
||||
int bcache_overflows;
|
||||
|
||||
/* How many hash buckets we're using. */
|
||||
unsigned int num_buckets;
|
||||
|
||||
/* Hash buckets. This table is allocated using malloc, so when we
|
||||
grow the table we can return the old table to the system. */
|
||||
struct bstring **bucket;
|
||||
|
||||
/* Statistics. */
|
||||
unsigned long unique_count; /* number of unique strings */
|
||||
long total_count; /* total number of strings cached, including dups */
|
||||
long unique_size; /* size of unique strings, in bytes */
|
||||
long total_size; /* total number of bytes cached, including dups */
|
||||
long structure_size; /* total size of bcache, including infrastructure */
|
||||
};
|
||||
|
||||
extern void *
|
||||
bcache PARAMS ((void *bytes, int count, struct bcache *bcachep));
|
||||
|
||||
#if MAINTENANCE_CMDS
|
||||
/* Find a copy of the LENGTH bytes at ADDR in BCACHE. If BCACHE has
|
||||
never seen those bytes before, add a copy of them to BCACHE. In
|
||||
either case, return a pointer to BCACHE's copy of that string. */
|
||||
extern void *bcache (const void *addr, int length, struct bcache *bcache);
|
||||
|
||||
extern void
|
||||
print_bcache_statistics PARAMS ((struct bcache *, char *));
|
||||
|
||||
#endif /* MAINTENANCE_CMDS */
|
||||
/* Free all the storage that BCACHE refers to. The result is a valid,
|
||||
but empty, bcache. This does not free BCACHE itself, since that
|
||||
might be part of some larger object. */
|
||||
extern void free_bcache (struct bcache *bcache);
|
||||
|
||||
/* Print statistics on BCACHE's memory usage and efficacity at
|
||||
eliminating duplication. TYPE should be a string describing the
|
||||
kind of data BCACHE holds. Statistics are printed using
|
||||
`printf_filtered' and its ilk. */
|
||||
extern void print_bcache_statistics (struct bcache *bcache, char *type);
|
||||
/* The hash function */
|
||||
extern unsigned long hash(const void *addr, int length);
|
||||
#endif /* BCACHE_H */
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,21 +1,23 @@
|
|||
/* Support routines for building symbol tables in GDB's internal format.
|
||||
Copyright 1986-1999 Free Software Foundation, Inc.
|
||||
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
|
||||
1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* This module provides subroutines used for creating and adding to
|
||||
the symbol table. These routines are called from various symbol-
|
||||
|
|
@ -33,9 +35,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||
#include "gdbtypes.h"
|
||||
#include "complaints.h"
|
||||
#include "gdb_string.h"
|
||||
|
||||
#include "expression.h" /* For "enum exp_opcode" used by... */
|
||||
#include "language.h" /* For "longest_local_hex_string_custom" */
|
||||
#include "bcache.h"
|
||||
#include "filenames.h" /* For DOSish file names */
|
||||
/* Ask buildsym.h to define the vars it normally declares `extern'. */
|
||||
#define EXTERN /**/
|
||||
#define EXTERN
|
||||
/**/
|
||||
#include "buildsym.h" /* Our own declarations */
|
||||
#undef EXTERN
|
||||
|
||||
|
|
@ -79,10 +85,24 @@ struct complaint innerblock_anon_complaint =
|
|||
{"inner block (0x%lx-0x%lx) not inside outer block (0x%lx-0x%lx)", 0, 0};
|
||||
|
||||
struct complaint blockvector_complaint =
|
||||
{"block at 0x%lx out of order", 0, 0};
|
||||
{"block at %s out of order", 0, 0};
|
||||
|
||||
/* maintain the lists of symbols and blocks */
|
||||
|
||||
/* Add a pending list to free_pendings. */
|
||||
void
|
||||
add_free_pendings (struct pending *list)
|
||||
{
|
||||
register struct pending *link = list;
|
||||
|
||||
if (list)
|
||||
{
|
||||
while (link->next) link = link->next;
|
||||
link->next = free_pendings;
|
||||
free_pendings = list;
|
||||
}
|
||||
}
|
||||
|
||||
/* Add a symbol to one of the lists of symbols. */
|
||||
|
||||
void
|
||||
|
|
@ -146,14 +166,14 @@ find_symbol_in_list (struct pending *list, char *name, int length)
|
|||
|
||||
/* ARGSUSED */
|
||||
void
|
||||
really_free_pendings (int foo)
|
||||
really_free_pendings (PTR dummy)
|
||||
{
|
||||
struct pending *next, *next1;
|
||||
|
||||
for (next = free_pendings; next; next = next1)
|
||||
{
|
||||
next1 = next->next;
|
||||
free ((void *) next);
|
||||
xfree ((void *) next);
|
||||
}
|
||||
free_pendings = NULL;
|
||||
|
||||
|
|
@ -162,14 +182,14 @@ really_free_pendings (int foo)
|
|||
for (next = file_symbols; next != NULL; next = next1)
|
||||
{
|
||||
next1 = next->next;
|
||||
free ((void *) next);
|
||||
xfree ((void *) next);
|
||||
}
|
||||
file_symbols = NULL;
|
||||
|
||||
for (next = global_symbols; next != NULL; next = next1)
|
||||
{
|
||||
next1 = next->next;
|
||||
free ((void *) next);
|
||||
xfree ((void *) next);
|
||||
}
|
||||
global_symbols = NULL;
|
||||
}
|
||||
|
|
@ -187,7 +207,7 @@ free_pending_blocks (void)
|
|||
for (bnext = pending_blocks; bnext; bnext = bnext1)
|
||||
{
|
||||
bnext1 = bnext->next;
|
||||
free ((void *) bnext);
|
||||
xfree ((void *) bnext);
|
||||
}
|
||||
#endif
|
||||
pending_blocks = NULL;
|
||||
|
|
@ -220,7 +240,7 @@ finish_block (struct symbol *symbol, struct pending **listhead,
|
|||
}
|
||||
|
||||
block = (struct block *) obstack_alloc (&objfile->symbol_obstack,
|
||||
(sizeof (struct block) + ((i - 1) * sizeof (struct symbol *))));
|
||||
(sizeof (struct block) + ((i - 1) * sizeof (struct symbol *))));
|
||||
|
||||
/* Copy the symbols into the block. */
|
||||
|
||||
|
|
@ -255,9 +275,8 @@ finish_block (struct symbol *symbol, struct pending **listhead,
|
|||
parameter symbols. */
|
||||
int nparams = 0, iparams;
|
||||
struct symbol *sym;
|
||||
for (i = 0; i < BLOCK_NSYMS (block); i++)
|
||||
ALL_BLOCK_SYMBOLS (block, i, sym)
|
||||
{
|
||||
sym = BLOCK_SYM (block, i);
|
||||
switch (SYMBOL_CLASS (sym))
|
||||
{
|
||||
case LOC_ARG:
|
||||
|
|
@ -303,6 +322,7 @@ finish_block (struct symbol *symbol, struct pending **listhead,
|
|||
case LOC_BASEREG_ARG:
|
||||
case LOC_LOCAL_ARG:
|
||||
TYPE_FIELD_TYPE (ftype, iparams) = SYMBOL_TYPE (sym);
|
||||
TYPE_FIELD_ARTIFICIAL (ftype, iparams) = 0;
|
||||
iparams++;
|
||||
break;
|
||||
case LOC_UNDEF:
|
||||
|
|
@ -382,7 +402,7 @@ finish_block (struct symbol *symbol, struct pending **listhead,
|
|||
else
|
||||
{
|
||||
complain (&innerblock_anon_complaint, BLOCK_START (pblock->block),
|
||||
BLOCK_END (pblock->block), BLOCK_START (block),
|
||||
BLOCK_END (pblock->block), BLOCK_START (block),
|
||||
BLOCK_END (block));
|
||||
}
|
||||
if (BLOCK_START (pblock->block) < BLOCK_START (block))
|
||||
|
|
@ -468,7 +488,7 @@ make_blockvector (struct objfile *objfile)
|
|||
for (next = pending_blocks; next; next = next1)
|
||||
{
|
||||
next1 = next->next;
|
||||
free (next);
|
||||
xfree (next);
|
||||
}
|
||||
#endif
|
||||
pending_blocks = NULL;
|
||||
|
|
@ -485,17 +505,11 @@ make_blockvector (struct objfile *objfile)
|
|||
if (BLOCK_START (BLOCKVECTOR_BLOCK (blockvector, i - 1))
|
||||
> BLOCK_START (BLOCKVECTOR_BLOCK (blockvector, i)))
|
||||
{
|
||||
|
||||
/* FIXME-32x64: loses if CORE_ADDR doesn't fit in a
|
||||
long. Possible solutions include a version of
|
||||
complain which takes a callback, a
|
||||
sprintf_address_numeric to match
|
||||
print_address_numeric, or a way to set up a GDB_FILE
|
||||
which causes sprintf rather than fprintf to be
|
||||
called. */
|
||||
CORE_ADDR start
|
||||
= BLOCK_START (BLOCKVECTOR_BLOCK (blockvector, i));
|
||||
|
||||
complain (&blockvector_complaint,
|
||||
(unsigned long) BLOCK_START (BLOCKVECTOR_BLOCK (blockvector, i)));
|
||||
longest_local_hex_string ((LONGEST) start));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -519,7 +533,7 @@ start_subfile (char *name, char *dirname)
|
|||
|
||||
for (subfile = subfiles; subfile; subfile = subfile->next)
|
||||
{
|
||||
if (STREQ (subfile->name, name))
|
||||
if (FILENAME_CMP (subfile->name, name) == 0)
|
||||
{
|
||||
current_subfile = subfile;
|
||||
return;
|
||||
|
|
@ -531,6 +545,7 @@ start_subfile (char *name, char *dirname)
|
|||
source file. */
|
||||
|
||||
subfile = (struct subfile *) xmalloc (sizeof (struct subfile));
|
||||
memset ((char *) subfile, 0, sizeof (struct subfile));
|
||||
subfile->next = subfiles;
|
||||
subfiles = subfile;
|
||||
current_subfile = subfile;
|
||||
|
|
@ -569,7 +584,7 @@ start_subfile (char *name, char *dirname)
|
|||
program. But to demangle we need to set the language to C++. We
|
||||
can distinguish cfront code by the fact that it has #line
|
||||
directives which specify a file name ending in .C.
|
||||
|
||||
|
||||
So if the filename of this subfile ends in .C, then change the
|
||||
language of any pending subfiles from C to C++. We also accept
|
||||
any other C++ suffixes accepted by deduce_language_from_filename
|
||||
|
|
@ -654,7 +669,7 @@ push_subfile (void)
|
|||
subfile_stack = tem;
|
||||
if (current_subfile == NULL || current_subfile->name == NULL)
|
||||
{
|
||||
abort ();
|
||||
internal_error (__FILE__, __LINE__, "failed internal consistency check");
|
||||
}
|
||||
tem->name = current_subfile->name;
|
||||
}
|
||||
|
|
@ -667,11 +682,11 @@ pop_subfile (void)
|
|||
|
||||
if (link == NULL)
|
||||
{
|
||||
abort ();
|
||||
internal_error (__FILE__, __LINE__, "failed internal consistency check");
|
||||
}
|
||||
name = link->name;
|
||||
subfile_stack = link->next;
|
||||
free ((void *) link);
|
||||
xfree ((void *) link);
|
||||
return (name);
|
||||
}
|
||||
|
||||
|
|
@ -695,7 +710,7 @@ record_line (register struct subfile *subfile, int line, CORE_ADDR pc)
|
|||
subfile->line_vector_length = INITIAL_LINE_VECTOR_LENGTH;
|
||||
subfile->line_vector = (struct linetable *)
|
||||
xmalloc (sizeof (struct linetable)
|
||||
+ subfile->line_vector_length * sizeof (struct linetable_entry));
|
||||
+ subfile->line_vector_length * sizeof (struct linetable_entry));
|
||||
subfile->line_vector->nitems = 0;
|
||||
have_line_numbers = 1;
|
||||
}
|
||||
|
|
@ -712,7 +727,7 @@ record_line (register struct subfile *subfile, int line, CORE_ADDR pc)
|
|||
|
||||
e = subfile->line_vector->item + subfile->line_vector->nitems++;
|
||||
e->line = line;
|
||||
e->pc = pc;
|
||||
e->pc = ADDR_BITS_REMOVE(pc);
|
||||
}
|
||||
|
||||
/* Needed in order to sort line tables from IBM xcoff files. Sigh! */
|
||||
|
|
@ -855,7 +870,7 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section)
|
|||
/* Cleanup any undefined types that have been left hanging around
|
||||
(this needs to be done before the finish_blocks so that
|
||||
file_symbols is still good).
|
||||
|
||||
|
||||
Both cleanup_undefined_types and finish_global_stabs are stabs
|
||||
specific, but harmless for other symbol readers, since on gdb
|
||||
startup or when finished reading stabs, the state is set so these
|
||||
|
|
@ -921,7 +936,7 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section)
|
|||
if (objfile->flags & OBJF_REORDERED)
|
||||
qsort (subfile->line_vector->item,
|
||||
subfile->line_vector->nitems,
|
||||
sizeof (struct linetable_entry), compare_line_numbers);
|
||||
sizeof (struct linetable_entry), compare_line_numbers);
|
||||
}
|
||||
|
||||
/* Now, allocate a symbol table. */
|
||||
|
|
@ -968,8 +983,8 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section)
|
|||
if (subfile->debugformat != NULL)
|
||||
{
|
||||
symtab->debugformat = obsavestring (subfile->debugformat,
|
||||
strlen (subfile->debugformat),
|
||||
&objfile->symbol_obstack);
|
||||
strlen (subfile->debugformat),
|
||||
&objfile->symbol_obstack);
|
||||
}
|
||||
|
||||
/* All symtabs for the main file and the subfiles share a
|
||||
|
|
@ -980,23 +995,23 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section)
|
|||
}
|
||||
if (subfile->name != NULL)
|
||||
{
|
||||
free ((void *) subfile->name);
|
||||
xfree ((void *) subfile->name);
|
||||
}
|
||||
if (subfile->dirname != NULL)
|
||||
{
|
||||
free ((void *) subfile->dirname);
|
||||
xfree ((void *) subfile->dirname);
|
||||
}
|
||||
if (subfile->line_vector != NULL)
|
||||
{
|
||||
free ((void *) subfile->line_vector);
|
||||
xfree ((void *) subfile->line_vector);
|
||||
}
|
||||
if (subfile->debugformat != NULL)
|
||||
{
|
||||
free ((void *) subfile->debugformat);
|
||||
xfree ((void *) subfile->debugformat);
|
||||
}
|
||||
|
||||
nextsub = subfile->next;
|
||||
free ((void *) subfile);
|
||||
xfree ((void *) subfile);
|
||||
}
|
||||
|
||||
/* Set this for the main source file. */
|
||||
|
|
@ -1025,7 +1040,7 @@ push_context (int desc, CORE_ADDR valu)
|
|||
context_stack_size *= 2;
|
||||
context_stack = (struct context_stack *)
|
||||
xrealloc ((char *) context_stack,
|
||||
(context_stack_size * sizeof (struct context_stack)));
|
||||
(context_stack_size * sizeof (struct context_stack)));
|
||||
}
|
||||
|
||||
new = &context_stack[context_stack_depth++];
|
||||
|
|
@ -1042,33 +1057,13 @@ push_context (int desc, CORE_ADDR valu)
|
|||
return new;
|
||||
}
|
||||
|
||||
|
||||
/* Compute a small integer hash code for the given name. */
|
||||
|
||||
int
|
||||
hashname (char *name)
|
||||
{
|
||||
register char *p = name;
|
||||
register int total = p[0];
|
||||
register int c;
|
||||
|
||||
c = p[1];
|
||||
total += c << 2;
|
||||
if (c)
|
||||
{
|
||||
c = p[2];
|
||||
total += c << 4;
|
||||
if (c)
|
||||
{
|
||||
total += p[3] << 6;
|
||||
}
|
||||
}
|
||||
|
||||
/* Ensure result is positive. */
|
||||
if (total < 0)
|
||||
{
|
||||
total += (1000 << 6);
|
||||
}
|
||||
return (total % HASHSIZE);
|
||||
return (hash(name,strlen(name)) % HASHSIZE);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1111,7 +1106,7 @@ merge_symbol_lists (struct pending **srclist, struct pending **targetlist)
|
|||
corresponding to a psymtab. */
|
||||
|
||||
void
|
||||
buildsym_init ()
|
||||
buildsym_init (void)
|
||||
{
|
||||
free_pendings = NULL;
|
||||
file_symbols = NULL;
|
||||
|
|
@ -1124,7 +1119,7 @@ buildsym_init ()
|
|||
file, e.g. a shared library). */
|
||||
|
||||
void
|
||||
buildsym_new_init ()
|
||||
buildsym_new_init (void)
|
||||
{
|
||||
buildsym_init ();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,21 +1,23 @@
|
|||
/* Build symbol tables in GDB's internal format.
|
||||
Copyright 1986-1993, 1996-1999 Free Software Foundation, Inc.
|
||||
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1996,
|
||||
1997, 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#if !defined (BUILDSYM_H)
|
||||
#define BUILDSYM_H 1
|
||||
|
|
@ -230,6 +232,8 @@ EXTERN int type_vector_length;
|
|||
|
||||
#define INITIAL_TYPE_VECTOR_LENGTH 160
|
||||
|
||||
extern void add_free_pendings (struct pending *list);
|
||||
|
||||
extern void add_symbol_to_list (struct symbol *symbol,
|
||||
struct pending **listhead);
|
||||
|
||||
|
|
@ -242,7 +246,7 @@ extern void finish_block (struct symbol *symbol,
|
|||
CORE_ADDR start, CORE_ADDR end,
|
||||
struct objfile *objfile);
|
||||
|
||||
extern void really_free_pendings (int foo);
|
||||
extern void really_free_pendings (PTR dummy);
|
||||
|
||||
extern void start_subfile (char *name, char *dirname);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
/* YACC parser for C expressions, for GDB.
|
||||
Copyright (C) 1986, 1989, 1990, 1991, 1993, 1994, 1996, 1997
|
||||
Copyright 1986, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
|
||||
1998, 1999, 2000
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
|
@ -102,14 +103,11 @@ extern int hp_som_som_object_present;
|
|||
#define YYDEBUG 0 /* Default to no yydebug support */
|
||||
#endif
|
||||
|
||||
int
|
||||
yyparse PARAMS ((void));
|
||||
int yyparse (void);
|
||||
|
||||
static int
|
||||
yylex PARAMS ((void));
|
||||
static int yylex (void);
|
||||
|
||||
void
|
||||
yyerror PARAMS ((char *));
|
||||
void yyerror (char *);
|
||||
|
||||
%}
|
||||
|
||||
|
|
@ -144,8 +142,7 @@ yyerror PARAMS ((char *));
|
|||
|
||||
%{
|
||||
/* YYSTYPE gets defined by %union */
|
||||
static int
|
||||
parse_number PARAMS ((char *, int, int, YYSTYPE *));
|
||||
static int parse_number (char *, int, int, YYSTYPE *);
|
||||
%}
|
||||
|
||||
%type <voidval> exp exp1 type_exp start variable qualified_name lcurly
|
||||
|
|
@ -721,21 +718,26 @@ variable: name_not_typename
|
|||
}
|
||||
;
|
||||
|
||||
space_identifier : '@' NAME
|
||||
{ push_type_address_space (copy_name ($2.stoken));
|
||||
push_type (tp_space_identifier);
|
||||
}
|
||||
;
|
||||
|
||||
ptype : typebase
|
||||
/* "const" and "volatile" are curently ignored. A type qualifier
|
||||
before the type is currently handled in the typebase rule.
|
||||
The reason for recognizing these here (shift/reduce conflicts)
|
||||
might be obsolete now that some pointer to member rules have
|
||||
been deleted. */
|
||||
| typebase CONST_KEYWORD
|
||||
| typebase VOLATILE_KEYWORD
|
||||
| typebase abs_decl
|
||||
{ $$ = follow_types ($1); }
|
||||
| typebase CONST_KEYWORD abs_decl
|
||||
{ $$ = follow_types ($1); }
|
||||
| typebase VOLATILE_KEYWORD abs_decl
|
||||
{ $$ = follow_types ($1); }
|
||||
const_or_volatile: const_or_volatile_noopt
|
||||
|
|
||||
;
|
||||
|
||||
cv_with_space_id : const_or_volatile space_identifier const_or_volatile
|
||||
;
|
||||
|
||||
const_or_volatile_or_space_identifier_noopt: cv_with_space_id
|
||||
| const_or_volatile_noopt
|
||||
;
|
||||
|
||||
const_or_volatile_or_space_identifier:
|
||||
const_or_volatile_or_space_identifier_noopt
|
||||
|
|
||||
;
|
||||
|
||||
abs_decl: '*'
|
||||
|
|
@ -815,6 +817,10 @@ typebase /* Implements (approximately): (type-qualifier)* type-specifier */
|
|||
{ $$ = builtin_type_unsigned_long_long; }
|
||||
| UNSIGNED LONG LONG INT_KEYWORD
|
||||
{ $$ = builtin_type_unsigned_long_long; }
|
||||
| SIGNED_KEYWORD LONG LONG
|
||||
{ $$ = lookup_signed_typename ("long long"); }
|
||||
| SIGNED_KEYWORD LONG LONG INT_KEYWORD
|
||||
{ $$ = lookup_signed_typename ("long long"); }
|
||||
| SHORT INT_KEYWORD
|
||||
{ $$ = builtin_type_short; }
|
||||
| UNSIGNED SHORT INT_KEYWORD
|
||||
|
|
@ -850,11 +856,10 @@ typebase /* Implements (approximately): (type-qualifier)* type-specifier */
|
|||
{ $$ = lookup_template_type(copy_name($2), $4,
|
||||
expression_context_block);
|
||||
}
|
||||
/* "const" and "volatile" are curently ignored. A type qualifier
|
||||
after the type is handled in the ptype rule. I think these could
|
||||
be too. */
|
||||
| CONST_KEYWORD typebase { $$ = $2; }
|
||||
| VOLATILE_KEYWORD typebase { $$ = $2; }
|
||||
| const_or_volatile_or_space_identifier_noopt typebase
|
||||
{ $$ = follow_types ($2); }
|
||||
| typebase const_or_volatile_or_space_identifier_noopt
|
||||
{ $$ = follow_types ($1); }
|
||||
;
|
||||
|
||||
typename: TYPENAME
|
||||
|
|
@ -891,6 +896,25 @@ nonempty_typelist
|
|||
}
|
||||
;
|
||||
|
||||
ptype : typebase
|
||||
| ptype const_or_volatile_or_space_identifier abs_decl const_or_volatile_or_space_identifier
|
||||
{ $$ = follow_types ($1); }
|
||||
;
|
||||
|
||||
const_and_volatile: CONST_KEYWORD VOLATILE_KEYWORD
|
||||
| VOLATILE_KEYWORD CONST_KEYWORD
|
||||
;
|
||||
|
||||
const_or_volatile_noopt: const_and_volatile
|
||||
{ push_type (tp_const);
|
||||
push_type (tp_volatile);
|
||||
}
|
||||
| CONST_KEYWORD
|
||||
{ push_type (tp_const); }
|
||||
| VOLATILE_KEYWORD
|
||||
{ push_type (tp_volatile); }
|
||||
;
|
||||
|
||||
name : NAME { $$ = $1.stoken; }
|
||||
| BLOCKNAME { $$ = $1.stoken; }
|
||||
| TYPENAME { $$ = $1.stoken; }
|
||||
|
|
@ -1437,8 +1461,6 @@ yylex ()
|
|||
|
||||
if (c == '<')
|
||||
{
|
||||
if (hp_som_som_object_present)
|
||||
{
|
||||
/* Scan ahead to get rest of the template specification. Note
|
||||
that we look ahead only when the '<' adjoins non-whitespace
|
||||
characters; for comparison expressions, e.g. "a < b > c",
|
||||
|
|
@ -1448,26 +1470,6 @@ yylex ()
|
|||
if (p)
|
||||
namelen = p - tokstart;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = namelen;
|
||||
int nesting_level = 1;
|
||||
while (tokstart[++i])
|
||||
{
|
||||
if (tokstart[i] == '<')
|
||||
nesting_level++;
|
||||
else if (tokstart[i] == '>')
|
||||
{
|
||||
if (--nesting_level == 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (tokstart[i] == '>')
|
||||
namelen = i;
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
c = tokstart[++namelen];
|
||||
}
|
||||
|
|
@ -1706,7 +1708,7 @@ yylex ()
|
|||
return TYPENAME;
|
||||
}
|
||||
if ((yylval.tsym.type = lookup_primitive_typename (tmp)) != 0)
|
||||
return TYPENAME;
|
||||
return TYPENAME;
|
||||
|
||||
/* Input names that aren't symbols but ARE valid hex numbers,
|
||||
when the input radix permits them, can be names or numbers
|
||||
|
|
|
|||
|
|
@ -1,21 +1,23 @@
|
|||
/* C language support routines for GDB, the GNU debugger.
|
||||
Copyright 1992, 1993, 1994 Free Software Foundation, Inc.
|
||||
Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2002
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "symtab.h"
|
||||
|
|
@ -24,18 +26,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||
#include "parser-defs.h"
|
||||
#include "language.h"
|
||||
#include "c-lang.h"
|
||||
#include "valprint.h"
|
||||
|
||||
static void c_emit_char PARAMS ((int c, GDB_FILE *stream, int quoter));
|
||||
extern void _initialize_c_language (void);
|
||||
static void c_emit_char (int c, struct ui_file * stream, int quoter);
|
||||
|
||||
/* Print the character C on STREAM as part of the contents of a literal
|
||||
string whose delimiter is QUOTER. Note that that format for printing
|
||||
characters and strings is language specific. */
|
||||
|
||||
static void
|
||||
c_emit_char (c, stream, quoter)
|
||||
register int c;
|
||||
GDB_FILE *stream;
|
||||
int quoter;
|
||||
c_emit_char (register int c, struct ui_file *stream, int quoter)
|
||||
{
|
||||
c &= 0xFF; /* Avoid sign bit follies */
|
||||
|
||||
|
|
@ -66,12 +67,18 @@ c_emit_char (c, stream, quoter)
|
|||
case '\r':
|
||||
fputs_filtered ("\\r", stream);
|
||||
break;
|
||||
case '\013':
|
||||
fputs_filtered ("\\v", stream);
|
||||
break;
|
||||
case '\033':
|
||||
fputs_filtered ("\\e", stream);
|
||||
break;
|
||||
case '\007':
|
||||
fputs_filtered ("\\a", stream);
|
||||
break;
|
||||
case '\0':
|
||||
fputs_filtered ("\\0", stream);
|
||||
break;
|
||||
default:
|
||||
fprintf_filtered (stream, "\\%.3o", (unsigned int) c);
|
||||
break;
|
||||
|
|
@ -80,9 +87,7 @@ c_emit_char (c, stream, quoter)
|
|||
}
|
||||
|
||||
void
|
||||
c_printchar (c, stream)
|
||||
int c;
|
||||
GDB_FILE *stream;
|
||||
c_printchar (int c, struct ui_file *stream)
|
||||
{
|
||||
fputc_filtered ('\'', stream);
|
||||
LA_EMIT_CHAR (c, stream, '\'');
|
||||
|
|
@ -96,27 +101,22 @@ c_printchar (c, stream)
|
|||
printing LENGTH characters, or if FORCE_ELLIPSES. */
|
||||
|
||||
void
|
||||
c_printstr (stream, string, length, width, force_ellipses)
|
||||
GDB_FILE *stream;
|
||||
char *string;
|
||||
unsigned int length;
|
||||
int width;
|
||||
int force_ellipses;
|
||||
c_printstr (struct ui_file *stream, char *string, unsigned int length,
|
||||
int width, int force_ellipses)
|
||||
{
|
||||
register unsigned int i;
|
||||
unsigned int things_printed = 0;
|
||||
int in_quotes = 0;
|
||||
int need_comma = 0;
|
||||
extern int inspect_it;
|
||||
extern int repeat_count_threshold;
|
||||
extern int print_max;
|
||||
|
||||
/* If the string was not truncated due to `set print elements', and
|
||||
the last byte of it is a null, we don't print that, in traditional C
|
||||
style. */
|
||||
if (!force_ellipses
|
||||
&& length > 0
|
||||
&& extract_unsigned_integer (string + (length - 1) * width, width) == '\0')
|
||||
&& (extract_unsigned_integer (string + (length - 1) * width, width)
|
||||
== '\0'))
|
||||
length--;
|
||||
|
||||
if (length == 0)
|
||||
|
|
@ -128,7 +128,7 @@ c_printstr (stream, string, length, width, force_ellipses)
|
|||
for (i = 0; i < length && things_printed < print_max; ++i)
|
||||
{
|
||||
/* Position of the character we are examining
|
||||
to see whether it is repeated. */
|
||||
to see whether it is repeated. */
|
||||
unsigned int rep1;
|
||||
/* Number of repetitions we have detected so far. */
|
||||
unsigned int reps;
|
||||
|
|
@ -148,7 +148,7 @@ c_printstr (stream, string, length, width, force_ellipses)
|
|||
reps = 1;
|
||||
while (rep1 < length
|
||||
&& extract_unsigned_integer (string + rep1 * width, width)
|
||||
== current_char)
|
||||
== current_char)
|
||||
{
|
||||
++rep1;
|
||||
++reps;
|
||||
|
|
@ -222,177 +222,170 @@ c_printstr (stream, string, length, width, force_ellipses)
|
|||
debugging information supplied by the compiler. fnf@cygnus.com */
|
||||
|
||||
struct type *
|
||||
c_create_fundamental_type (objfile, typeid)
|
||||
struct objfile *objfile;
|
||||
int typeid;
|
||||
c_create_fundamental_type (struct objfile *objfile, int typeid)
|
||||
{
|
||||
register struct type *type = NULL;
|
||||
|
||||
switch (typeid)
|
||||
{
|
||||
default:
|
||||
/* FIXME: For now, if we are asked to produce a type not in this
|
||||
language, create the equivalent of a C integer type with the
|
||||
name "<?type?>". When all the dust settles from the type
|
||||
reconstruction work, this should probably become an error. */
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_INT_BIT / TARGET_CHAR_BIT,
|
||||
0, "<?type?>", objfile);
|
||||
warning ("internal error: no C/C++ fundamental type %d", typeid);
|
||||
break;
|
||||
case FT_VOID:
|
||||
type = init_type (TYPE_CODE_VOID,
|
||||
TARGET_CHAR_BIT / TARGET_CHAR_BIT,
|
||||
0, "void", objfile);
|
||||
break;
|
||||
case FT_BOOLEAN:
|
||||
type = init_type (TYPE_CODE_BOOL,
|
||||
TARGET_CHAR_BIT / TARGET_CHAR_BIT,
|
||||
0, "bool", objfile);
|
||||
|
||||
break;
|
||||
case FT_CHAR:
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_CHAR_BIT / TARGET_CHAR_BIT,
|
||||
0, "char", objfile);
|
||||
TYPE_FLAGS (type) |= TYPE_FLAG_NOSIGN;
|
||||
break;
|
||||
case FT_SIGNED_CHAR:
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_CHAR_BIT / TARGET_CHAR_BIT,
|
||||
0, "signed char", objfile);
|
||||
break;
|
||||
case FT_UNSIGNED_CHAR:
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_CHAR_BIT / TARGET_CHAR_BIT,
|
||||
TYPE_FLAG_UNSIGNED, "unsigned char", objfile);
|
||||
break;
|
||||
case FT_SHORT:
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_SHORT_BIT / TARGET_CHAR_BIT,
|
||||
0, "short", objfile);
|
||||
break;
|
||||
case FT_SIGNED_SHORT:
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_SHORT_BIT / TARGET_CHAR_BIT,
|
||||
0, "short", objfile); /* FIXME-fnf */
|
||||
break;
|
||||
case FT_UNSIGNED_SHORT:
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_SHORT_BIT / TARGET_CHAR_BIT,
|
||||
TYPE_FLAG_UNSIGNED, "unsigned short", objfile);
|
||||
break;
|
||||
case FT_INTEGER:
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_INT_BIT / TARGET_CHAR_BIT,
|
||||
0, "int", objfile);
|
||||
break;
|
||||
case FT_SIGNED_INTEGER:
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_INT_BIT / TARGET_CHAR_BIT,
|
||||
0, "int", objfile); /* FIXME -fnf */
|
||||
break;
|
||||
case FT_UNSIGNED_INTEGER:
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_INT_BIT / TARGET_CHAR_BIT,
|
||||
TYPE_FLAG_UNSIGNED, "unsigned int", objfile);
|
||||
break;
|
||||
case FT_LONG:
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_LONG_BIT / TARGET_CHAR_BIT,
|
||||
0, "long", objfile);
|
||||
break;
|
||||
case FT_SIGNED_LONG:
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_LONG_BIT / TARGET_CHAR_BIT,
|
||||
0, "long", objfile); /* FIXME -fnf */
|
||||
break;
|
||||
case FT_UNSIGNED_LONG:
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_LONG_BIT / TARGET_CHAR_BIT,
|
||||
TYPE_FLAG_UNSIGNED, "unsigned long", objfile);
|
||||
break;
|
||||
case FT_LONG_LONG:
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
|
||||
0, "long long", objfile);
|
||||
break;
|
||||
case FT_SIGNED_LONG_LONG:
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
|
||||
0, "signed long long", objfile);
|
||||
break;
|
||||
case FT_UNSIGNED_LONG_LONG:
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
|
||||
TYPE_FLAG_UNSIGNED, "unsigned long long", objfile);
|
||||
break;
|
||||
case FT_FLOAT:
|
||||
type = init_type (TYPE_CODE_FLT,
|
||||
TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
|
||||
0, "float", objfile);
|
||||
break;
|
||||
case FT_DBL_PREC_FLOAT:
|
||||
type = init_type (TYPE_CODE_FLT,
|
||||
TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
|
||||
0, "double", objfile);
|
||||
break;
|
||||
case FT_EXT_PREC_FLOAT:
|
||||
type = init_type (TYPE_CODE_FLT,
|
||||
TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
|
||||
0, "long double", objfile);
|
||||
break;
|
||||
case FT_TEMPLATE_ARG:
|
||||
type = init_type (TYPE_CODE_TEMPLATE_ARG,
|
||||
0,
|
||||
0, "<template arg>", objfile);
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
/* FIXME: For now, if we are asked to produce a type not in this
|
||||
language, create the equivalent of a C integer type with the
|
||||
name "<?type?>". When all the dust settles from the type
|
||||
reconstruction work, this should probably become an error. */
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_INT_BIT / TARGET_CHAR_BIT,
|
||||
0, "<?type?>", objfile);
|
||||
warning ("internal error: no C/C++ fundamental type %d", typeid);
|
||||
break;
|
||||
case FT_VOID:
|
||||
type = init_type (TYPE_CODE_VOID,
|
||||
TARGET_CHAR_BIT / TARGET_CHAR_BIT,
|
||||
0, "void", objfile);
|
||||
break;
|
||||
case FT_BOOLEAN:
|
||||
type = init_type (TYPE_CODE_BOOL,
|
||||
TARGET_CHAR_BIT / TARGET_CHAR_BIT,
|
||||
0, "bool", objfile);
|
||||
break;
|
||||
case FT_CHAR:
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_CHAR_BIT / TARGET_CHAR_BIT,
|
||||
TYPE_FLAG_NOSIGN, "char", objfile);
|
||||
break;
|
||||
case FT_SIGNED_CHAR:
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_CHAR_BIT / TARGET_CHAR_BIT,
|
||||
0, "signed char", objfile);
|
||||
break;
|
||||
case FT_UNSIGNED_CHAR:
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_CHAR_BIT / TARGET_CHAR_BIT,
|
||||
TYPE_FLAG_UNSIGNED, "unsigned char", objfile);
|
||||
break;
|
||||
case FT_SHORT:
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_SHORT_BIT / TARGET_CHAR_BIT,
|
||||
0, "short", objfile);
|
||||
break;
|
||||
case FT_SIGNED_SHORT:
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_SHORT_BIT / TARGET_CHAR_BIT,
|
||||
0, "short", objfile); /* FIXME-fnf */
|
||||
break;
|
||||
case FT_UNSIGNED_SHORT:
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_SHORT_BIT / TARGET_CHAR_BIT,
|
||||
TYPE_FLAG_UNSIGNED, "unsigned short", objfile);
|
||||
break;
|
||||
case FT_INTEGER:
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_INT_BIT / TARGET_CHAR_BIT,
|
||||
0, "int", objfile);
|
||||
break;
|
||||
case FT_SIGNED_INTEGER:
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_INT_BIT / TARGET_CHAR_BIT,
|
||||
0, "int", objfile); /* FIXME -fnf */
|
||||
break;
|
||||
case FT_UNSIGNED_INTEGER:
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_INT_BIT / TARGET_CHAR_BIT,
|
||||
TYPE_FLAG_UNSIGNED, "unsigned int", objfile);
|
||||
break;
|
||||
case FT_LONG:
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_LONG_BIT / TARGET_CHAR_BIT,
|
||||
0, "long", objfile);
|
||||
break;
|
||||
case FT_SIGNED_LONG:
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_LONG_BIT / TARGET_CHAR_BIT,
|
||||
0, "long", objfile); /* FIXME -fnf */
|
||||
break;
|
||||
case FT_UNSIGNED_LONG:
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_LONG_BIT / TARGET_CHAR_BIT,
|
||||
TYPE_FLAG_UNSIGNED, "unsigned long", objfile);
|
||||
break;
|
||||
case FT_LONG_LONG:
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
|
||||
0, "long long", objfile);
|
||||
break;
|
||||
case FT_SIGNED_LONG_LONG:
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
|
||||
0, "signed long long", objfile);
|
||||
break;
|
||||
case FT_UNSIGNED_LONG_LONG:
|
||||
type = init_type (TYPE_CODE_INT,
|
||||
TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
|
||||
TYPE_FLAG_UNSIGNED, "unsigned long long", objfile);
|
||||
break;
|
||||
case FT_FLOAT:
|
||||
type = init_type (TYPE_CODE_FLT,
|
||||
TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
|
||||
0, "float", objfile);
|
||||
break;
|
||||
case FT_DBL_PREC_FLOAT:
|
||||
type = init_type (TYPE_CODE_FLT,
|
||||
TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
|
||||
0, "double", objfile);
|
||||
break;
|
||||
case FT_EXT_PREC_FLOAT:
|
||||
type = init_type (TYPE_CODE_FLT,
|
||||
TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
|
||||
0, "long double", objfile);
|
||||
break;
|
||||
case FT_TEMPLATE_ARG:
|
||||
type = init_type (TYPE_CODE_TEMPLATE_ARG,
|
||||
0,
|
||||
0, "<template arg>", objfile);
|
||||
break;
|
||||
}
|
||||
return (type);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Table mapping opcodes into strings for printing operators
|
||||
and precedences of the operators. */
|
||||
|
||||
const struct op_print c_op_print_tab[] =
|
||||
{
|
||||
{",", BINOP_COMMA, PREC_COMMA, 0},
|
||||
{"=", BINOP_ASSIGN, PREC_ASSIGN, 1},
|
||||
{"||", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
|
||||
{"&&", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
|
||||
{"|", BINOP_BITWISE_IOR, PREC_BITWISE_IOR, 0},
|
||||
{"^", BINOP_BITWISE_XOR, PREC_BITWISE_XOR, 0},
|
||||
{"&", BINOP_BITWISE_AND, PREC_BITWISE_AND, 0},
|
||||
{"==", BINOP_EQUAL, PREC_EQUAL, 0},
|
||||
{"!=", BINOP_NOTEQUAL, PREC_EQUAL, 0},
|
||||
{"<=", BINOP_LEQ, PREC_ORDER, 0},
|
||||
{">=", BINOP_GEQ, PREC_ORDER, 0},
|
||||
{">", BINOP_GTR, PREC_ORDER, 0},
|
||||
{"<", BINOP_LESS, PREC_ORDER, 0},
|
||||
{">>", BINOP_RSH, PREC_SHIFT, 0},
|
||||
{"<<", BINOP_LSH, PREC_SHIFT, 0},
|
||||
{"+", BINOP_ADD, PREC_ADD, 0},
|
||||
{"-", BINOP_SUB, PREC_ADD, 0},
|
||||
{"*", BINOP_MUL, PREC_MUL, 0},
|
||||
{"/", BINOP_DIV, PREC_MUL, 0},
|
||||
{"%", BINOP_REM, PREC_MUL, 0},
|
||||
{"@", BINOP_REPEAT, PREC_REPEAT, 0},
|
||||
{"-", UNOP_NEG, PREC_PREFIX, 0},
|
||||
{"!", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
|
||||
{"~", UNOP_COMPLEMENT, PREC_PREFIX, 0},
|
||||
{"*", UNOP_IND, PREC_PREFIX, 0},
|
||||
{"&", UNOP_ADDR, PREC_PREFIX, 0},
|
||||
{"sizeof ", UNOP_SIZEOF, PREC_PREFIX, 0},
|
||||
{"++", UNOP_PREINCREMENT, PREC_PREFIX, 0},
|
||||
{"--", UNOP_PREDECREMENT, PREC_PREFIX, 0},
|
||||
/* C++ */
|
||||
{"::", BINOP_SCOPE, PREC_PREFIX, 0},
|
||||
{NULL, 0, 0, 0}
|
||||
{
|
||||
{",", BINOP_COMMA, PREC_COMMA, 0},
|
||||
{"=", BINOP_ASSIGN, PREC_ASSIGN, 1},
|
||||
{"||", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
|
||||
{"&&", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
|
||||
{"|", BINOP_BITWISE_IOR, PREC_BITWISE_IOR, 0},
|
||||
{"^", BINOP_BITWISE_XOR, PREC_BITWISE_XOR, 0},
|
||||
{"&", BINOP_BITWISE_AND, PREC_BITWISE_AND, 0},
|
||||
{"==", BINOP_EQUAL, PREC_EQUAL, 0},
|
||||
{"!=", BINOP_NOTEQUAL, PREC_EQUAL, 0},
|
||||
{"<=", BINOP_LEQ, PREC_ORDER, 0},
|
||||
{">=", BINOP_GEQ, PREC_ORDER, 0},
|
||||
{">", BINOP_GTR, PREC_ORDER, 0},
|
||||
{"<", BINOP_LESS, PREC_ORDER, 0},
|
||||
{">>", BINOP_RSH, PREC_SHIFT, 0},
|
||||
{"<<", BINOP_LSH, PREC_SHIFT, 0},
|
||||
{"+", BINOP_ADD, PREC_ADD, 0},
|
||||
{"-", BINOP_SUB, PREC_ADD, 0},
|
||||
{"*", BINOP_MUL, PREC_MUL, 0},
|
||||
{"/", BINOP_DIV, PREC_MUL, 0},
|
||||
{"%", BINOP_REM, PREC_MUL, 0},
|
||||
{"@", BINOP_REPEAT, PREC_REPEAT, 0},
|
||||
{"-", UNOP_NEG, PREC_PREFIX, 0},
|
||||
{"!", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
|
||||
{"~", UNOP_COMPLEMENT, PREC_PREFIX, 0},
|
||||
{"*", UNOP_IND, PREC_PREFIX, 0},
|
||||
{"&", UNOP_ADDR, PREC_PREFIX, 0},
|
||||
{"sizeof ", UNOP_SIZEOF, PREC_PREFIX, 0},
|
||||
{"++", UNOP_PREINCREMENT, PREC_PREFIX, 0},
|
||||
{"--", UNOP_PREDECREMENT, PREC_PREFIX, 0},
|
||||
{NULL, 0, 0, 0}
|
||||
};
|
||||
|
||||
struct type ** CONST_PTR (c_builtin_types[]) =
|
||||
struct type **const (c_builtin_types[]) =
|
||||
{
|
||||
&builtin_type_int,
|
||||
&builtin_type_long,
|
||||
|
|
@ -414,12 +407,14 @@ struct type ** CONST_PTR (c_builtin_types[]) =
|
|||
0
|
||||
};
|
||||
|
||||
const struct language_defn c_language_defn = {
|
||||
const struct language_defn c_language_defn =
|
||||
{
|
||||
"c", /* Language name */
|
||||
language_c,
|
||||
c_builtin_types,
|
||||
range_check_off,
|
||||
type_check_off,
|
||||
case_sensitive_on,
|
||||
c_parse,
|
||||
c_error,
|
||||
evaluate_subexp_standard,
|
||||
|
|
@ -430,18 +425,18 @@ const struct language_defn c_language_defn = {
|
|||
c_print_type, /* Print a type using appropriate syntax */
|
||||
c_val_print, /* Print a value using appropriate syntax */
|
||||
c_value_print, /* Print a top-level value */
|
||||
{"", "", "", ""}, /* Binary format info */
|
||||
{"0%lo", "0", "o", ""}, /* Octal format info */
|
||||
{"%ld", "", "d", ""}, /* Decimal format info */
|
||||
{"0x%lx", "0x", "x", ""}, /* Hex format info */
|
||||
{"", "", "", ""}, /* Binary format info */
|
||||
{"0%lo", "0", "o", ""}, /* Octal format info */
|
||||
{"%ld", "", "d", ""}, /* Decimal format info */
|
||||
{"0x%lx", "0x", "x", ""}, /* Hex format info */
|
||||
c_op_print_tab, /* expression operators for printing */
|
||||
1, /* c-style arrays */
|
||||
0, /* String lower bound */
|
||||
&builtin_type_char, /* Type of string elements */
|
||||
&builtin_type_char, /* Type of string elements */
|
||||
LANG_MAGIC
|
||||
};
|
||||
|
||||
struct type ** const (cplus_builtin_types[]) =
|
||||
struct type **const (cplus_builtin_types[]) =
|
||||
{
|
||||
&builtin_type_int,
|
||||
&builtin_type_long,
|
||||
|
|
@ -464,12 +459,14 @@ struct type ** const (cplus_builtin_types[]) =
|
|||
0
|
||||
};
|
||||
|
||||
const struct language_defn cplus_language_defn = {
|
||||
"c++", /* Language name */
|
||||
const struct language_defn cplus_language_defn =
|
||||
{
|
||||
"c++", /* Language name */
|
||||
language_cplus,
|
||||
cplus_builtin_types,
|
||||
range_check_off,
|
||||
type_check_off,
|
||||
case_sensitive_on,
|
||||
c_parse,
|
||||
c_error,
|
||||
evaluate_subexp_standard,
|
||||
|
|
@ -480,23 +477,25 @@ const struct language_defn cplus_language_defn = {
|
|||
c_print_type, /* Print a type using appropriate syntax */
|
||||
c_val_print, /* Print a value using appropriate syntax */
|
||||
c_value_print, /* Print a top-level value */
|
||||
{"", "", "", ""}, /* Binary format info */
|
||||
{"0%lo", "0", "o", ""}, /* Octal format info */
|
||||
{"%ld", "", "d", ""}, /* Decimal format info */
|
||||
{"0x%lx", "0x", "x", ""}, /* Hex format info */
|
||||
{"", "", "", ""}, /* Binary format info */
|
||||
{"0%lo", "0", "o", ""}, /* Octal format info */
|
||||
{"%ld", "", "d", ""}, /* Decimal format info */
|
||||
{"0x%lx", "0x", "x", ""}, /* Hex format info */
|
||||
c_op_print_tab, /* expression operators for printing */
|
||||
1, /* c-style arrays */
|
||||
0, /* String lower bound */
|
||||
&builtin_type_char, /* Type of string elements */
|
||||
&builtin_type_char, /* Type of string elements */
|
||||
LANG_MAGIC
|
||||
};
|
||||
|
||||
const struct language_defn asm_language_defn = {
|
||||
const struct language_defn asm_language_defn =
|
||||
{
|
||||
"asm", /* Language name */
|
||||
language_asm,
|
||||
c_builtin_types,
|
||||
range_check_off,
|
||||
type_check_off,
|
||||
case_sensitive_on,
|
||||
c_parse,
|
||||
c_error,
|
||||
evaluate_subexp_standard,
|
||||
|
|
@ -507,19 +506,19 @@ const struct language_defn asm_language_defn = {
|
|||
c_print_type, /* Print a type using appropriate syntax */
|
||||
c_val_print, /* Print a value using appropriate syntax */
|
||||
c_value_print, /* Print a top-level value */
|
||||
{"", "", "", ""}, /* Binary format info */
|
||||
{"0%lo", "0", "o", ""}, /* Octal format info */
|
||||
{"%ld", "", "d", ""}, /* Decimal format info */
|
||||
{"0x%lx", "0x", "x", ""}, /* Hex format info */
|
||||
{"", "", "", ""}, /* Binary format info */
|
||||
{"0%lo", "0", "o", ""}, /* Octal format info */
|
||||
{"%ld", "", "d", ""}, /* Decimal format info */
|
||||
{"0x%lx", "0x", "x", ""}, /* Hex format info */
|
||||
c_op_print_tab, /* expression operators for printing */
|
||||
1, /* c-style arrays */
|
||||
0, /* String lower bound */
|
||||
&builtin_type_char, /* Type of string elements */
|
||||
&builtin_type_char, /* Type of string elements */
|
||||
LANG_MAGIC
|
||||
};
|
||||
|
||||
void
|
||||
_initialize_c_language ()
|
||||
_initialize_c_language (void)
|
||||
{
|
||||
add_language (&c_language_defn);
|
||||
add_language (&cplus_language_defn);
|
||||
|
|
|
|||
|
|
@ -1,21 +1,23 @@
|
|||
/* C language support definitions for GDB, the GNU debugger.
|
||||
Copyright 1992, 1996 Free Software Foundation, Inc.
|
||||
Copyright 1992, 1994, 1995, 1996, 1997, 1998, 2000, 2002
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
|
||||
#if !defined (C_LANG_H)
|
||||
|
|
@ -24,41 +26,39 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||
#include "value.h"
|
||||
|
||||
|
||||
extern int
|
||||
c_parse PARAMS ((void)); /* Defined in c-exp.y */
|
||||
extern int c_parse (void); /* Defined in c-exp.y */
|
||||
|
||||
extern void
|
||||
c_error PARAMS ((char *)); /* Defined in c-exp.y */
|
||||
extern void c_error (char *); /* Defined in c-exp.y */
|
||||
|
||||
extern void /* Defined in c-typeprint.c */
|
||||
c_print_type PARAMS ((struct type *, char *, GDB_FILE *, int, int));
|
||||
/* Defined in c-typeprint.c */
|
||||
extern void c_print_type (struct type *, char *, struct ui_file *, int,
|
||||
int);
|
||||
|
||||
extern int
|
||||
c_val_print PARAMS ((struct type *, char *, int, CORE_ADDR, GDB_FILE *, int, int,
|
||||
int, enum val_prettyprint));
|
||||
extern int c_val_print (struct type *, char *, int, CORE_ADDR,
|
||||
struct ui_file *, int, int, int,
|
||||
enum val_prettyprint);
|
||||
|
||||
extern int
|
||||
c_value_print PARAMS ((struct value *, GDB_FILE *, int, enum val_prettyprint));
|
||||
extern int c_value_print (struct value *, struct ui_file *, int,
|
||||
enum val_prettyprint);
|
||||
|
||||
/* These are in c-lang.c: */
|
||||
|
||||
extern void c_printchar PARAMS ((int, GDB_FILE*));
|
||||
extern void c_printchar (int, struct ui_file *);
|
||||
|
||||
extern void c_printstr PARAMS ((GDB_FILE *stream, char *string,
|
||||
unsigned int length, int width,
|
||||
int force_ellipses));
|
||||
extern void c_printstr (struct ui_file * stream, char *string,
|
||||
unsigned int length, int width,
|
||||
int force_ellipses);
|
||||
|
||||
extern struct type * c_create_fundamental_type PARAMS ((struct objfile*, int));
|
||||
extern struct type *c_create_fundamental_type (struct objfile *, int);
|
||||
|
||||
extern struct type ** CONST_PTR (c_builtin_types[]);
|
||||
extern struct type **const (c_builtin_types[]);
|
||||
|
||||
/* These are in c-typeprint.c: */
|
||||
|
||||
extern void
|
||||
c_type_print_base PARAMS ((struct type *, GDB_FILE *, int, int));
|
||||
extern void c_type_print_base (struct type *, struct ui_file *, int, int);
|
||||
|
||||
extern void
|
||||
c_type_print_varspec_prefix PARAMS ((struct type *, GDB_FILE *, int, int));
|
||||
extern void c_type_print_varspec_prefix (struct type *, struct ui_file *,
|
||||
int, int);
|
||||
|
||||
/* These are in cp-valprint.c */
|
||||
|
||||
|
|
@ -66,22 +66,19 @@ extern int vtblprint; /* Controls printing of vtbl's */
|
|||
|
||||
extern int static_field_print;
|
||||
|
||||
extern void
|
||||
cp_print_class_member PARAMS ((char *, struct type *, GDB_FILE *, char *));
|
||||
extern void cp_print_class_member (char *, struct type *, struct ui_file *,
|
||||
char *);
|
||||
|
||||
extern void
|
||||
cp_print_class_method PARAMS ((char *, struct type *, GDB_FILE *));
|
||||
extern void cp_print_class_method (char *, struct type *, struct ui_file *);
|
||||
|
||||
extern void
|
||||
cp_print_value_fields PARAMS ((struct type *, struct type *, char *, int, CORE_ADDR,
|
||||
GDB_FILE *, int, int, enum val_prettyprint,
|
||||
struct type**, int));
|
||||
extern void cp_print_value_fields (struct type *, struct type *, char *,
|
||||
int, CORE_ADDR, struct ui_file *, int,
|
||||
int, enum val_prettyprint,
|
||||
struct type **, int);
|
||||
|
||||
extern int
|
||||
cp_is_vtbl_ptr_type PARAMS ((struct type *));
|
||||
extern int cp_is_vtbl_ptr_type (struct type *);
|
||||
|
||||
extern int
|
||||
cp_is_vtbl_member PARAMS ((struct type *));
|
||||
extern int cp_is_vtbl_member (struct type *);
|
||||
|
||||
|
||||
#endif /* !defined (C_LANG_H) */
|
||||
#endif /* !defined (C_LANG_H) */
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,34 +1,56 @@
|
|||
/* Support for printing C values for GDB, the GNU debugger.
|
||||
Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
||||
Free Software Foundation, Inc.
|
||||
Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
|
||||
1998, 1999, 2000, 2001
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "symtab.h"
|
||||
#include "gdbtypes.h"
|
||||
#include "expression.h"
|
||||
#include "value.h"
|
||||
#include "demangle.h"
|
||||
#include "valprint.h"
|
||||
#include "language.h"
|
||||
#include "c-lang.h"
|
||||
|
||||
#include "cp-abi.h"
|
||||
|
||||
|
||||
/* Print function pointer with inferior address ADDRESS onto stdio
|
||||
stream STREAM. */
|
||||
|
||||
static void
|
||||
print_function_pointer_address (CORE_ADDR address, struct ui_file *stream)
|
||||
{
|
||||
CORE_ADDR func_addr = CONVERT_FROM_FUNC_PTR_ADDR (address);
|
||||
|
||||
/* If the function pointer is represented by a description, print the
|
||||
address of the description. */
|
||||
if (addressprint && func_addr != address)
|
||||
{
|
||||
fputs_filtered ("@", stream);
|
||||
print_address_numeric (address, 1, stream);
|
||||
fputs_filtered (": ", stream);
|
||||
}
|
||||
print_address_demangle (func_addr, stream, demangle);
|
||||
}
|
||||
|
||||
|
||||
/* Print data of type TYPE located at VALADDR (within GDB), which came from
|
||||
the inferior at address ADDRESS, onto stdio stream STREAM according to
|
||||
FORMAT (a letter or 0 for natural format). The data at VALADDR is in
|
||||
|
|
@ -43,19 +65,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||
The PRETTY parameter controls prettyprinting. */
|
||||
|
||||
int
|
||||
c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref, recurse,
|
||||
pretty)
|
||||
struct type *type;
|
||||
char *valaddr;
|
||||
int embedded_offset;
|
||||
CORE_ADDR address;
|
||||
GDB_FILE *stream;
|
||||
int format;
|
||||
int deref_ref;
|
||||
int recurse;
|
||||
enum val_prettyprint pretty;
|
||||
c_val_print (struct type *type, char *valaddr, int embedded_offset,
|
||||
CORE_ADDR address, struct ui_file *stream, int format,
|
||||
int deref_ref, int recurse, enum val_prettyprint pretty)
|
||||
{
|
||||
register unsigned int i = 0; /* Number of characters printed */
|
||||
register unsigned int i = 0; /* Number of characters printed */
|
||||
unsigned len;
|
||||
struct type *elttype;
|
||||
unsigned eltlen;
|
||||
|
|
@ -83,11 +97,11 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
|
|||
&& (format == 0 || format == 's'))
|
||||
{
|
||||
/* If requested, look for the first null char and only print
|
||||
elements up to it. */
|
||||
elements up to it. */
|
||||
if (stop_print_at_null)
|
||||
{
|
||||
int temp_len;
|
||||
|
||||
unsigned int temp_len;
|
||||
|
||||
/* Look for a NULL char. */
|
||||
for (temp_len = 0;
|
||||
(valaddr + embedded_offset)[temp_len]
|
||||
|
|
@ -95,7 +109,7 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
|
|||
temp_len++);
|
||||
len = temp_len;
|
||||
}
|
||||
|
||||
|
||||
LA_PRINT_STRING (stream, valaddr + embedded_offset, len, eltlen, 0);
|
||||
i = len;
|
||||
}
|
||||
|
|
@ -103,7 +117,7 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
|
|||
{
|
||||
fprintf_filtered (stream, "{");
|
||||
/* If this is a virtual function table, print the 0th
|
||||
entry specially, and the rest of the members normally. */
|
||||
entry specially, and the rest of the members normally. */
|
||||
if (cp_is_vtbl_ptr_type (elttype))
|
||||
{
|
||||
i = 1;
|
||||
|
|
@ -114,7 +128,7 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
|
|||
i = 0;
|
||||
}
|
||||
val_print_array_elements (type, valaddr + embedded_offset, address, stream,
|
||||
format, deref_ref, recurse, pretty, i);
|
||||
format, deref_ref, recurse, pretty, i);
|
||||
fprintf_filtered (stream, "}");
|
||||
}
|
||||
break;
|
||||
|
|
@ -129,13 +143,14 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
|
|||
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
|
||||
break;
|
||||
}
|
||||
if (vtblprint && cp_is_vtbl_ptr_type(type))
|
||||
if (vtblprint && cp_is_vtbl_ptr_type (type))
|
||||
{
|
||||
/* Print the unmangled name if desired. */
|
||||
/* Print the unmangled name if desired. */
|
||||
/* Print vtable entry - we only get here if we ARE using
|
||||
-fvtable_thunks. (Otherwise, look under TYPE_CODE_STRUCT.) */
|
||||
print_address_demangle(extract_address (valaddr + embedded_offset, TYPE_LENGTH (type)),
|
||||
stream, demangle);
|
||||
CORE_ADDR addr
|
||||
= extract_typed_address (valaddr + embedded_offset, type);
|
||||
print_function_pointer_address (addr, stream);
|
||||
break;
|
||||
}
|
||||
elttype = check_typedef (TYPE_TARGET_TYPE (type));
|
||||
|
|
@ -153,12 +168,11 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
|
|||
{
|
||||
addr = unpack_pointer (type, valaddr + embedded_offset);
|
||||
print_unpacked_pointer:
|
||||
elttype = check_typedef (TYPE_TARGET_TYPE (type));
|
||||
|
||||
if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
|
||||
{
|
||||
/* Try to print what function it points to. */
|
||||
print_address_demangle (addr, stream, demangle);
|
||||
print_function_pointer_address (addr, stream);
|
||||
/* Return value is irrelevant except for string pointers. */
|
||||
return (0);
|
||||
}
|
||||
|
|
@ -179,13 +193,13 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
|
|||
{
|
||||
i = val_print_string (addr, -1, TYPE_LENGTH (elttype), stream);
|
||||
}
|
||||
else if (cp_is_vtbl_member(type))
|
||||
{
|
||||
else if (cp_is_vtbl_member (type))
|
||||
{
|
||||
/* print vtbl's nicely */
|
||||
CORE_ADDR vt_address = unpack_pointer (type, valaddr + embedded_offset);
|
||||
|
||||
struct minimal_symbol *msymbol =
|
||||
lookup_minimal_symbol_by_pc (vt_address);
|
||||
lookup_minimal_symbol_by_pc (vt_address);
|
||||
if ((msymbol != NULL) &&
|
||||
(vt_address == SYMBOL_VALUE_ADDRESS (msymbol)))
|
||||
{
|
||||
|
|
@ -194,25 +208,25 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
|
|||
fputs_filtered (">", stream);
|
||||
}
|
||||
if (vt_address && vtblprint)
|
||||
{
|
||||
value_ptr vt_val;
|
||||
struct symbol *wsym = (struct symbol *)NULL;
|
||||
struct type *wtype;
|
||||
{
|
||||
struct value *vt_val;
|
||||
struct symbol *wsym = (struct symbol *) NULL;
|
||||
struct type *wtype;
|
||||
struct symtab *s;
|
||||
struct block *block = (struct block *)NULL;
|
||||
struct block *block = (struct block *) NULL;
|
||||
int is_this_fld;
|
||||
|
||||
if (msymbol != NULL)
|
||||
wsym = lookup_symbol (SYMBOL_NAME(msymbol), block,
|
||||
VAR_NAMESPACE, &is_this_fld, &s);
|
||||
|
||||
wsym = lookup_symbol (SYMBOL_NAME (msymbol), block,
|
||||
VAR_NAMESPACE, &is_this_fld, &s);
|
||||
|
||||
if (wsym)
|
||||
{
|
||||
wtype = SYMBOL_TYPE(wsym);
|
||||
wtype = SYMBOL_TYPE (wsym);
|
||||
}
|
||||
else
|
||||
{
|
||||
wtype = TYPE_TARGET_TYPE(type);
|
||||
wtype = TYPE_TARGET_TYPE (type);
|
||||
}
|
||||
vt_val = value_at (wtype, vt_address, NULL);
|
||||
val_print (VALUE_TYPE (vt_val), VALUE_CONTENTS (vt_val), 0,
|
||||
|
|
@ -223,8 +237,8 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
|
|||
fprintf_filtered (stream, "\n");
|
||||
print_spaces_filtered (2 + 2 * recurse, stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Return number of characters printed, including the terminating
|
||||
'\0' if we reached the end. val_print_string takes care including
|
||||
|
|
@ -240,41 +254,41 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
|
|||
case TYPE_CODE_REF:
|
||||
elttype = check_typedef (TYPE_TARGET_TYPE (type));
|
||||
if (TYPE_CODE (elttype) == TYPE_CODE_MEMBER)
|
||||
{
|
||||
{
|
||||
cp_print_class_member (valaddr + embedded_offset,
|
||||
TYPE_DOMAIN_TYPE (elttype),
|
||||
stream, "");
|
||||
break;
|
||||
}
|
||||
if (addressprint)
|
||||
{
|
||||
{
|
||||
CORE_ADDR addr
|
||||
= extract_typed_address (valaddr + embedded_offset, type);
|
||||
fprintf_filtered (stream, "@");
|
||||
print_address_numeric
|
||||
(extract_address (valaddr + embedded_offset,
|
||||
TARGET_PTR_BIT / HOST_CHAR_BIT), 1, stream);
|
||||
print_address_numeric (addr, 1, stream);
|
||||
if (deref_ref)
|
||||
fputs_filtered (": ", stream);
|
||||
}
|
||||
}
|
||||
/* De-reference the reference. */
|
||||
if (deref_ref)
|
||||
{
|
||||
if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
|
||||
{
|
||||
value_ptr deref_val =
|
||||
value_at
|
||||
(TYPE_TARGET_TYPE (type),
|
||||
unpack_pointer (lookup_pointer_type (builtin_type_void),
|
||||
valaddr + embedded_offset),
|
||||
NULL);
|
||||
struct value *deref_val =
|
||||
value_at
|
||||
(TYPE_TARGET_TYPE (type),
|
||||
unpack_pointer (lookup_pointer_type (builtin_type_void),
|
||||
valaddr + embedded_offset),
|
||||
NULL);
|
||||
val_print (VALUE_TYPE (deref_val),
|
||||
VALUE_CONTENTS (deref_val),
|
||||
0,
|
||||
VALUE_ADDRESS (deref_val),
|
||||
stream,
|
||||
format,
|
||||
deref_ref,
|
||||
recurse,
|
||||
pretty);
|
||||
VALUE_CONTENTS (deref_val),
|
||||
0,
|
||||
VALUE_ADDRESS (deref_val),
|
||||
stream,
|
||||
format,
|
||||
deref_ref,
|
||||
recurse,
|
||||
pretty);
|
||||
}
|
||||
else
|
||||
fputs_filtered ("???", stream);
|
||||
|
|
@ -289,16 +303,19 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
|
|||
}
|
||||
/* Fall through. */
|
||||
case TYPE_CODE_STRUCT:
|
||||
if (vtblprint && cp_is_vtbl_ptr_type(type))
|
||||
/*FIXME: Abstract this away */
|
||||
if (vtblprint && cp_is_vtbl_ptr_type (type))
|
||||
{
|
||||
/* Print the unmangled name if desired. */
|
||||
/* Print the unmangled name if desired. */
|
||||
/* Print vtable entry - we only get here if NOT using
|
||||
-fvtable_thunks. (Otherwise, look under TYPE_CODE_PTR.) */
|
||||
print_address_demangle (extract_address (
|
||||
valaddr + embedded_offset +
|
||||
TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8,
|
||||
TYPE_LENGTH (TYPE_FIELD_TYPE (type, VTBL_FNADDR_OFFSET))),
|
||||
stream, demangle);
|
||||
int offset = (embedded_offset +
|
||||
TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8);
|
||||
struct type *field_type = TYPE_FIELD_TYPE (type, VTBL_FNADDR_OFFSET);
|
||||
CORE_ADDR addr
|
||||
= extract_typed_address (valaddr + offset, field_type);
|
||||
|
||||
print_function_pointer_address (addr, stream);
|
||||
}
|
||||
else
|
||||
cp_print_value_fields (type, type, valaddr, embedded_offset, address, stream, format,
|
||||
|
|
@ -338,7 +355,7 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
|
|||
break;
|
||||
}
|
||||
/* FIXME, we should consider, at least for ANSI C language, eliminating
|
||||
the distinction made between FUNCs and POINTERs to FUNCs. */
|
||||
the distinction made between FUNCs and POINTERs to FUNCs. */
|
||||
fprintf_filtered (stream, "{");
|
||||
type_print (type, "", stream, -1);
|
||||
fprintf_filtered (stream, "} ");
|
||||
|
|
@ -364,12 +381,12 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
|
|||
|
||||
case TYPE_CODE_RANGE:
|
||||
/* FIXME: create_range_type does not set the unsigned bit in a
|
||||
range type (I think it probably should copy it from the target
|
||||
type), so we won't print values which are too large to
|
||||
fit in a signed integer correctly. */
|
||||
range type (I think it probably should copy it from the target
|
||||
type), so we won't print values which are too large to
|
||||
fit in a signed integer correctly. */
|
||||
/* FIXME: Doesn't handle ranges of enums correctly. (Can't just
|
||||
print with the target type, though, because the size of our type
|
||||
and the target type might differ). */
|
||||
print with the target type, though, because the size of our type
|
||||
and the target type might differ). */
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case TYPE_CODE_INT:
|
||||
|
|
@ -402,10 +419,13 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
|
|||
}
|
||||
else
|
||||
{
|
||||
fprintf_filtered (stream, TYPE_UNSIGNED (type) ? "%u" : "%d",
|
||||
unpack_long (type, valaddr + embedded_offset));
|
||||
val = unpack_long (type, valaddr + embedded_offset);
|
||||
if (TYPE_UNSIGNED (type))
|
||||
fprintf_filtered (stream, "%u", (unsigned int) val);
|
||||
else
|
||||
fprintf_filtered (stream, "%d", (int) val);
|
||||
fputs_filtered (" ", stream);
|
||||
LA_PRINT_CHAR ((unsigned char) unpack_long (type, valaddr + embedded_offset), stream);
|
||||
LA_PRINT_CHAR ((unsigned char) val, stream);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -421,8 +441,12 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
|
|||
break;
|
||||
|
||||
case TYPE_CODE_METHOD:
|
||||
cp_print_class_method (valaddr + embedded_offset, lookup_pointer_type (type), stream);
|
||||
break;
|
||||
{
|
||||
struct value *v = value_at (type, address, NULL);
|
||||
cp_print_class_method (VALUE_CONTENTS (value_addr (v)),
|
||||
lookup_pointer_type (type), stream);
|
||||
break;
|
||||
}
|
||||
|
||||
case TYPE_CODE_VOID:
|
||||
fprintf_filtered (stream, "void");
|
||||
|
|
@ -434,11 +458,33 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
|
|||
|
||||
case TYPE_CODE_UNDEF:
|
||||
/* This happens (without TYPE_FLAG_STUB set) on systems which don't use
|
||||
dbx xrefs (NO_DBX_XREFS in gcc) if a file has a "struct foo *bar"
|
||||
and no complete type for struct foo in that file. */
|
||||
dbx xrefs (NO_DBX_XREFS in gcc) if a file has a "struct foo *bar"
|
||||
and no complete type for struct foo in that file. */
|
||||
fprintf_filtered (stream, "<incomplete type>");
|
||||
break;
|
||||
|
||||
case TYPE_CODE_COMPLEX:
|
||||
if (format)
|
||||
print_scalar_formatted (valaddr + embedded_offset,
|
||||
TYPE_TARGET_TYPE (type),
|
||||
format, 0, stream);
|
||||
else
|
||||
print_floating (valaddr + embedded_offset, TYPE_TARGET_TYPE (type),
|
||||
stream);
|
||||
fprintf_filtered (stream, " + ");
|
||||
if (format)
|
||||
print_scalar_formatted (valaddr + embedded_offset
|
||||
+ TYPE_LENGTH (TYPE_TARGET_TYPE (type)),
|
||||
TYPE_TARGET_TYPE (type),
|
||||
format, 0, stream);
|
||||
else
|
||||
print_floating (valaddr + embedded_offset
|
||||
+ TYPE_LENGTH (TYPE_TARGET_TYPE (type)),
|
||||
TYPE_TARGET_TYPE (type),
|
||||
stream);
|
||||
fprintf_filtered (stream, " * I");
|
||||
break;
|
||||
|
||||
default:
|
||||
error ("Invalid C/C++ type code %d in symbol table.", TYPE_CODE (type));
|
||||
}
|
||||
|
|
@ -447,16 +493,13 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
|
|||
}
|
||||
|
||||
int
|
||||
c_value_print (val, stream, format, pretty)
|
||||
value_ptr val;
|
||||
GDB_FILE *stream;
|
||||
int format;
|
||||
enum val_prettyprint pretty;
|
||||
c_value_print (struct value *val, struct ui_file *stream, int format,
|
||||
enum val_prettyprint pretty)
|
||||
{
|
||||
struct type *type = VALUE_TYPE (val);
|
||||
struct type * real_type;
|
||||
struct type *real_type;
|
||||
int full, top, using_enc;
|
||||
|
||||
|
||||
/* If it is a pointer, indicate what it points to.
|
||||
|
||||
Print type also if it is a reference.
|
||||
|
|
@ -467,7 +510,7 @@ c_value_print (val, stream, format, pretty)
|
|||
TYPE_CODE (type) == TYPE_CODE_REF)
|
||||
{
|
||||
/* Hack: remove (char *) for char strings. Their
|
||||
type is indicated by the quoted string anyway. */
|
||||
type is indicated by the quoted string anyway. */
|
||||
if (TYPE_CODE (type) == TYPE_CODE_PTR &&
|
||||
TYPE_NAME (type) == NULL &&
|
||||
TYPE_NAME (TYPE_TARGET_TYPE (type)) != NULL &&
|
||||
|
|
@ -476,28 +519,46 @@ c_value_print (val, stream, format, pretty)
|
|||
/* Print nothing */
|
||||
}
|
||||
else if (objectprint && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CLASS))
|
||||
{
|
||||
/* Pointer to class, check real type of object */
|
||||
{
|
||||
|
||||
if (TYPE_CODE(type) == TYPE_CODE_REF)
|
||||
{
|
||||
/* Copy value, change to pointer, so we don't get an
|
||||
* error about a non-pointer type in value_rtti_target_type
|
||||
*/
|
||||
struct value *temparg;
|
||||
temparg=value_copy(val);
|
||||
VALUE_TYPE (temparg) = lookup_pointer_type(TYPE_TARGET_TYPE(type));
|
||||
val=temparg;
|
||||
}
|
||||
/* Pointer to class, check real type of object */
|
||||
fprintf_filtered (stream, "(");
|
||||
type = value_rtti_target_type (val, &full, &top, &using_enc);
|
||||
if (type)
|
||||
{
|
||||
/* RTTI entry found */
|
||||
type = lookup_pointer_type (type);
|
||||
type_print (type, "", stream, -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No RTTI fields, do whatever we can */
|
||||
type = VALUE_ENCLOSING_TYPE (val);
|
||||
type_print (type, "", stream, -1);
|
||||
fprintf_filtered (stream, " ?");
|
||||
real_type = value_rtti_target_type (val, &full, &top, &using_enc);
|
||||
if (real_type)
|
||||
{
|
||||
/* RTTI entry found */
|
||||
if (TYPE_CODE (type) == TYPE_CODE_PTR)
|
||||
{
|
||||
/* create a pointer type pointing to the real type */
|
||||
type = lookup_pointer_type (real_type);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* create a reference type referencing the real type */
|
||||
type = lookup_reference_type (real_type);
|
||||
}
|
||||
/* JYG: Need to adjust pointer value. */
|
||||
val->aligner.contents[0] -= top;
|
||||
|
||||
/* Note: When we look up RTTI entries, we don't get any
|
||||
information on const or volatile attributes */
|
||||
}
|
||||
type_print (type, "", stream, -1);
|
||||
fprintf_filtered (stream, ") ");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* normal case */
|
||||
/* normal case */
|
||||
fprintf_filtered (stream, "(");
|
||||
type_print (type, "", stream, -1);
|
||||
fprintf_filtered (stream, ") ");
|
||||
|
|
@ -507,29 +568,31 @@ c_value_print (val, stream, format, pretty)
|
|||
{
|
||||
/* Attempt to determine real type of object */
|
||||
real_type = value_rtti_type (val, &full, &top, &using_enc);
|
||||
if (real_type)
|
||||
{
|
||||
/* We have RTTI information, so use it */
|
||||
val = value_full_object (val, real_type, full, top, using_enc);
|
||||
fprintf_filtered (stream, "(%s%s) ",
|
||||
TYPE_NAME (real_type),
|
||||
full ? "" : " [incomplete object]");
|
||||
/* Print out object: enclosing type is same as real_type if full */
|
||||
return val_print (VALUE_ENCLOSING_TYPE (val), VALUE_CONTENTS_ALL (val), 0,
|
||||
VALUE_ADDRESS (val), stream, format, 1, 0, pretty);
|
||||
}
|
||||
if (real_type)
|
||||
{
|
||||
/* We have RTTI information, so use it */
|
||||
val = value_full_object (val, real_type, full, top, using_enc);
|
||||
fprintf_filtered (stream, "(%s%s) ",
|
||||
TYPE_NAME (real_type),
|
||||
full ? "" : " [incomplete object]");
|
||||
/* Print out object: enclosing type is same as real_type if full */
|
||||
return val_print (VALUE_ENCLOSING_TYPE (val), VALUE_CONTENTS_ALL (val), 0,
|
||||
VALUE_ADDRESS (val), stream, format, 1, 0, pretty);
|
||||
/* Note: When we look up RTTI entries, we don't get any information on
|
||||
const or volatile attributes */
|
||||
}
|
||||
else if (type != VALUE_ENCLOSING_TYPE (val))
|
||||
{
|
||||
/* No RTTI information, so let's do our best */
|
||||
fprintf_filtered (stream, "(%s ?) ",
|
||||
TYPE_NAME (VALUE_ENCLOSING_TYPE (val)));
|
||||
return val_print (VALUE_ENCLOSING_TYPE (val), VALUE_CONTENTS_ALL (val), 0,
|
||||
VALUE_ADDRESS (val), stream, format, 1, 0, pretty);
|
||||
}
|
||||
{
|
||||
/* No RTTI information, so let's do our best */
|
||||
fprintf_filtered (stream, "(%s ?) ",
|
||||
TYPE_NAME (VALUE_ENCLOSING_TYPE (val)));
|
||||
return val_print (VALUE_ENCLOSING_TYPE (val), VALUE_CONTENTS_ALL (val), 0,
|
||||
VALUE_ADDRESS (val), stream, format, 1, 0, pretty);
|
||||
}
|
||||
/* Otherwise, we end up at the return outside this "if" */
|
||||
}
|
||||
|
||||
return val_print (type, VALUE_CONTENTS_ALL (val), VALUE_EMBEDDED_OFFSET (val),
|
||||
|
||||
return val_print (type, VALUE_CONTENTS_ALL (val), VALUE_EMBEDDED_OFFSET (val),
|
||||
VALUE_ADDRESS (val),
|
||||
stream, format, 1, 0, pretty);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,35 @@
|
|||
/* ***DEPRECATED*** The gdblib files must not be calling/using things in any
|
||||
of the possible command languages. If necessary, a hook (that may be
|
||||
present or not) must be used and set to the appropriate routine by any
|
||||
command language that cares about it. If you are having to include this
|
||||
file you are possibly doing things the old way. This file will disapear.
|
||||
2000-12-01 fnasser@redhat.com */
|
||||
|
||||
/* Prototypes for GDB commands that are called internally by other functions.
|
||||
Copyright 1992 Free Software Foundation, Inc.
|
||||
Copyright 1992, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
extern void
|
||||
initialize_all_files PARAMS ((void));
|
||||
#ifndef CALL_CMDS_H
|
||||
#define CALL_CMDS_H
|
||||
|
||||
extern void
|
||||
exec_file_command PARAMS ((char *, int));
|
||||
extern void initialize_all_files (void);
|
||||
|
||||
extern void
|
||||
core_file_command PARAMS ((char *, int));
|
||||
extern void core_file_command (char *, int);
|
||||
|
||||
extern void
|
||||
break_command PARAMS ((char *, int));
|
||||
extern void break_command (char *, int);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,21 +1,23 @@
|
|||
/* Chill language support routines for GDB, the GNU debugger.
|
||||
Copyright 1992, 1995, 1996 Free Software Foundation, Inc.
|
||||
Copyright 1992, 1993, 1994, 1995, 1996, 2000, 2001, 2002
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "symtab.h"
|
||||
|
|
@ -25,35 +27,33 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||
#include "parser-defs.h"
|
||||
#include "language.h"
|
||||
#include "ch-lang.h"
|
||||
#include "valprint.h"
|
||||
|
||||
static value_ptr
|
||||
evaluate_subexp_chill PARAMS ((struct type *, struct expression *, int *, enum noside));
|
||||
extern void _initialize_chill_language (void);
|
||||
|
||||
static value_ptr
|
||||
value_chill_max_min PARAMS ((enum exp_opcode, value_ptr));
|
||||
static struct value *evaluate_subexp_chill (struct type *, struct expression *,
|
||||
int *, enum noside);
|
||||
|
||||
static value_ptr
|
||||
value_chill_card PARAMS ((value_ptr));
|
||||
static struct value *value_chill_max_min (enum exp_opcode, struct value *);
|
||||
|
||||
static value_ptr
|
||||
value_chill_length PARAMS ((value_ptr));
|
||||
static struct value *value_chill_card (struct value *);
|
||||
|
||||
static struct type *
|
||||
chill_create_fundamental_type PARAMS ((struct objfile *, int));
|
||||
static struct value *value_chill_length (struct value *);
|
||||
|
||||
static void
|
||||
chill_printstr PARAMS ((GDB_FILE *stream, char *string, unsigned int length, int width, int force_ellipses));
|
||||
static struct type *chill_create_fundamental_type (struct objfile *, int);
|
||||
|
||||
static void
|
||||
chill_printchar PARAMS ((int, GDB_FILE *));
|
||||
static void chill_printstr (struct ui_file * stream, char *string,
|
||||
unsigned int length, int width,
|
||||
int force_ellipses);
|
||||
|
||||
static void chill_printchar (int, struct ui_file *);
|
||||
|
||||
/* For now, Chill uses a simple mangling algorithm whereby you simply
|
||||
discard everything after the occurance of two successive CPLUS_MARKER
|
||||
characters to derive the demangled form. */
|
||||
|
||||
char *
|
||||
chill_demangle (mangled)
|
||||
const char *mangled;
|
||||
chill_demangle (const char *mangled)
|
||||
{
|
||||
const char *joiner = NULL;
|
||||
char *demangled;
|
||||
|
|
@ -80,9 +80,7 @@ chill_demangle (mangled)
|
|||
}
|
||||
|
||||
static void
|
||||
chill_printchar (c, stream)
|
||||
register int c;
|
||||
GDB_FILE *stream;
|
||||
chill_printchar (register int c, struct ui_file *stream)
|
||||
{
|
||||
c &= 0xFF; /* Avoid sign bit follies */
|
||||
|
||||
|
|
@ -108,15 +106,11 @@ chill_printchar (c, stream)
|
|||
an explicit null byte. So we always assume an implied null byte
|
||||
until gdb is able to maintain non-null terminated strings as well
|
||||
as null terminated strings (FIXME).
|
||||
*/
|
||||
*/
|
||||
|
||||
static void
|
||||
chill_printstr (stream, string, length, width, force_ellipses)
|
||||
GDB_FILE *stream;
|
||||
char *string;
|
||||
unsigned int length;
|
||||
int width;
|
||||
int force_ellipses;
|
||||
chill_printstr (struct ui_file *stream, char *string, unsigned int length,
|
||||
int width, int force_ellipses)
|
||||
{
|
||||
register unsigned int i;
|
||||
unsigned int things_printed = 0;
|
||||
|
|
@ -124,8 +118,6 @@ chill_printstr (stream, string, length, width, force_ellipses)
|
|||
int in_control_form = 0;
|
||||
int need_slashslash = 0;
|
||||
unsigned int c;
|
||||
extern int repeat_count_threshold;
|
||||
extern int print_max;
|
||||
|
||||
if (length == 0)
|
||||
{
|
||||
|
|
@ -136,7 +128,7 @@ chill_printstr (stream, string, length, width, force_ellipses)
|
|||
for (i = 0; i < length && things_printed < print_max; ++i)
|
||||
{
|
||||
/* Position of the character we are examining
|
||||
to see whether it is repeated. */
|
||||
to see whether it is repeated. */
|
||||
unsigned int rep1;
|
||||
/* Number of repetitions we have detected so far. */
|
||||
unsigned int reps;
|
||||
|
|
@ -175,7 +167,7 @@ chill_printstr (stream, string, length, width, force_ellipses)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (! in_literal_form && ! in_control_form)
|
||||
if (!in_literal_form && !in_control_form)
|
||||
fputs_filtered ("\"", stream);
|
||||
if (PRINT_LITERAL_FORM (c))
|
||||
{
|
||||
|
|
@ -229,98 +221,97 @@ chill_printstr (stream, string, length, width, force_ellipses)
|
|||
}
|
||||
|
||||
static struct type *
|
||||
chill_create_fundamental_type (objfile, typeid)
|
||||
struct objfile *objfile;
|
||||
int typeid;
|
||||
chill_create_fundamental_type (struct objfile *objfile, int typeid)
|
||||
{
|
||||
register struct type *type = NULL;
|
||||
|
||||
switch (typeid)
|
||||
{
|
||||
default:
|
||||
/* FIXME: For now, if we are asked to produce a type not in this
|
||||
language, create the equivalent of a C integer type with the
|
||||
name "<?type?>". When all the dust settles from the type
|
||||
reconstruction work, this should probably become an error. */
|
||||
type = init_type (TYPE_CODE_INT, 2, 0, "<?type?>", objfile);
|
||||
warning ("internal error: no chill fundamental type %d", typeid);
|
||||
break;
|
||||
case FT_VOID:
|
||||
/* FIXME: Currently the GNU Chill compiler emits some DWARF entries for
|
||||
typedefs, unrelated to anything directly in the code being compiled,
|
||||
that have some FT_VOID types. Just fake it for now. */
|
||||
type = init_type (TYPE_CODE_VOID, 0, 0, "<?VOID?>", objfile);
|
||||
break;
|
||||
case FT_BOOLEAN:
|
||||
type = init_type (TYPE_CODE_BOOL, 1, TYPE_FLAG_UNSIGNED, "BOOL", objfile);
|
||||
break;
|
||||
case FT_CHAR:
|
||||
type = init_type (TYPE_CODE_CHAR, 1, TYPE_FLAG_UNSIGNED, "CHAR", objfile);
|
||||
break;
|
||||
case FT_SIGNED_CHAR:
|
||||
type = init_type (TYPE_CODE_INT, 1, 0, "BYTE", objfile);
|
||||
break;
|
||||
case FT_UNSIGNED_CHAR:
|
||||
type = init_type (TYPE_CODE_INT, 1, TYPE_FLAG_UNSIGNED, "UBYTE", objfile);
|
||||
break;
|
||||
case FT_SHORT: /* Chill ints are 2 bytes */
|
||||
type = init_type (TYPE_CODE_INT, 2, 0, "INT", objfile);
|
||||
break;
|
||||
case FT_UNSIGNED_SHORT: /* Chill ints are 2 bytes */
|
||||
type = init_type (TYPE_CODE_INT, 2, TYPE_FLAG_UNSIGNED, "UINT", objfile);
|
||||
break;
|
||||
case FT_INTEGER: /* FIXME? */
|
||||
case FT_SIGNED_INTEGER: /* FIXME? */
|
||||
case FT_LONG: /* Chill longs are 4 bytes */
|
||||
case FT_SIGNED_LONG: /* Chill longs are 4 bytes */
|
||||
type = init_type (TYPE_CODE_INT, 4, 0, "LONG", objfile);
|
||||
break;
|
||||
case FT_UNSIGNED_INTEGER: /* FIXME? */
|
||||
case FT_UNSIGNED_LONG: /* Chill longs are 4 bytes */
|
||||
type = init_type (TYPE_CODE_INT, 4, TYPE_FLAG_UNSIGNED, "ULONG", objfile);
|
||||
break;
|
||||
case FT_FLOAT:
|
||||
type = init_type (TYPE_CODE_FLT, 4, 0, "REAL", objfile);
|
||||
break;
|
||||
case FT_DBL_PREC_FLOAT:
|
||||
type = init_type (TYPE_CODE_FLT, 8, 0, "LONG_REAL", objfile);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
/* FIXME: For now, if we are asked to produce a type not in this
|
||||
language, create the equivalent of a C integer type with the
|
||||
name "<?type?>". When all the dust settles from the type
|
||||
reconstruction work, this should probably become an error. */
|
||||
type = init_type (TYPE_CODE_INT, 2, 0, "<?type?>", objfile);
|
||||
warning ("internal error: no chill fundamental type %d", typeid);
|
||||
break;
|
||||
case FT_VOID:
|
||||
/* FIXME: Currently the GNU Chill compiler emits some DWARF entries for
|
||||
typedefs, unrelated to anything directly in the code being compiled,
|
||||
that have some FT_VOID types. Just fake it for now. */
|
||||
type = init_type (TYPE_CODE_VOID, 0, 0, "<?VOID?>", objfile);
|
||||
break;
|
||||
case FT_BOOLEAN:
|
||||
type = init_type (TYPE_CODE_BOOL, 1, TYPE_FLAG_UNSIGNED, "BOOL", objfile);
|
||||
break;
|
||||
case FT_CHAR:
|
||||
type = init_type (TYPE_CODE_CHAR, 1, TYPE_FLAG_UNSIGNED, "CHAR", objfile);
|
||||
break;
|
||||
case FT_SIGNED_CHAR:
|
||||
type = init_type (TYPE_CODE_INT, 1, 0, "BYTE", objfile);
|
||||
break;
|
||||
case FT_UNSIGNED_CHAR:
|
||||
type = init_type (TYPE_CODE_INT, 1, TYPE_FLAG_UNSIGNED, "UBYTE", objfile);
|
||||
break;
|
||||
case FT_SHORT: /* Chill ints are 2 bytes */
|
||||
type = init_type (TYPE_CODE_INT, 2, 0, "INT", objfile);
|
||||
break;
|
||||
case FT_UNSIGNED_SHORT: /* Chill ints are 2 bytes */
|
||||
type = init_type (TYPE_CODE_INT, 2, TYPE_FLAG_UNSIGNED, "UINT", objfile);
|
||||
break;
|
||||
case FT_INTEGER: /* FIXME? */
|
||||
case FT_SIGNED_INTEGER: /* FIXME? */
|
||||
case FT_LONG: /* Chill longs are 4 bytes */
|
||||
case FT_SIGNED_LONG: /* Chill longs are 4 bytes */
|
||||
type = init_type (TYPE_CODE_INT, 4, 0, "LONG", objfile);
|
||||
break;
|
||||
case FT_UNSIGNED_INTEGER: /* FIXME? */
|
||||
case FT_UNSIGNED_LONG: /* Chill longs are 4 bytes */
|
||||
type = init_type (TYPE_CODE_INT, 4, TYPE_FLAG_UNSIGNED, "ULONG", objfile);
|
||||
break;
|
||||
case FT_FLOAT:
|
||||
type = init_type (TYPE_CODE_FLT, 4, 0, "REAL", objfile);
|
||||
break;
|
||||
case FT_DBL_PREC_FLOAT:
|
||||
type = init_type (TYPE_CODE_FLT, 8, 0, "LONG_REAL", objfile);
|
||||
break;
|
||||
}
|
||||
return (type);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Table of operators and their precedences for printing expressions. */
|
||||
|
||||
static const struct op_print chill_op_print_tab[] = {
|
||||
{"AND", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
|
||||
{"OR", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
|
||||
{"NOT", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
|
||||
{"MOD", BINOP_MOD, PREC_MUL, 0},
|
||||
{"REM", BINOP_REM, PREC_MUL, 0},
|
||||
{"SIZE",UNOP_SIZEOF, PREC_BUILTIN_FUNCTION, 0},
|
||||
{"LOWER",UNOP_LOWER, PREC_BUILTIN_FUNCTION, 0},
|
||||
{"UPPER",UNOP_UPPER, PREC_BUILTIN_FUNCTION, 0},
|
||||
{"CARD",UNOP_CARD, PREC_BUILTIN_FUNCTION, 0},
|
||||
{"MAX",UNOP_CHMAX, PREC_BUILTIN_FUNCTION, 0},
|
||||
{"MIN",UNOP_CHMIN, PREC_BUILTIN_FUNCTION, 0},
|
||||
{":=", BINOP_ASSIGN, PREC_ASSIGN, 1},
|
||||
{"=", BINOP_EQUAL, PREC_EQUAL, 0},
|
||||
{"/=", BINOP_NOTEQUAL, PREC_EQUAL, 0},
|
||||
{"<=", BINOP_LEQ, PREC_ORDER, 0},
|
||||
{">=", BINOP_GEQ, PREC_ORDER, 0},
|
||||
{">", BINOP_GTR, PREC_ORDER, 0},
|
||||
{"<", BINOP_LESS, PREC_ORDER, 0},
|
||||
{"+", BINOP_ADD, PREC_ADD, 0},
|
||||
{"-", BINOP_SUB, PREC_ADD, 0},
|
||||
{"*", BINOP_MUL, PREC_MUL, 0},
|
||||
{"/", BINOP_DIV, PREC_MUL, 0},
|
||||
{"//", BINOP_CONCAT, PREC_PREFIX, 0}, /* FIXME: precedence? */
|
||||
{"-", UNOP_NEG, PREC_PREFIX, 0},
|
||||
{"->", UNOP_IND, PREC_SUFFIX, 1},
|
||||
{"->", UNOP_ADDR, PREC_PREFIX, 0},
|
||||
{":", BINOP_RANGE, PREC_ASSIGN, 0},
|
||||
{NULL, 0, 0, 0}
|
||||
static const struct op_print chill_op_print_tab[] =
|
||||
{
|
||||
{"AND", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
|
||||
{"OR", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
|
||||
{"NOT", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
|
||||
{"MOD", BINOP_MOD, PREC_MUL, 0},
|
||||
{"REM", BINOP_REM, PREC_MUL, 0},
|
||||
{"SIZE", UNOP_SIZEOF, PREC_BUILTIN_FUNCTION, 0},
|
||||
{"LOWER", UNOP_LOWER, PREC_BUILTIN_FUNCTION, 0},
|
||||
{"UPPER", UNOP_UPPER, PREC_BUILTIN_FUNCTION, 0},
|
||||
{"CARD", UNOP_CARD, PREC_BUILTIN_FUNCTION, 0},
|
||||
{"MAX", UNOP_CHMAX, PREC_BUILTIN_FUNCTION, 0},
|
||||
{"MIN", UNOP_CHMIN, PREC_BUILTIN_FUNCTION, 0},
|
||||
{":=", BINOP_ASSIGN, PREC_ASSIGN, 1},
|
||||
{"=", BINOP_EQUAL, PREC_EQUAL, 0},
|
||||
{"/=", BINOP_NOTEQUAL, PREC_EQUAL, 0},
|
||||
{"<=", BINOP_LEQ, PREC_ORDER, 0},
|
||||
{">=", BINOP_GEQ, PREC_ORDER, 0},
|
||||
{">", BINOP_GTR, PREC_ORDER, 0},
|
||||
{"<", BINOP_LESS, PREC_ORDER, 0},
|
||||
{"+", BINOP_ADD, PREC_ADD, 0},
|
||||
{"-", BINOP_SUB, PREC_ADD, 0},
|
||||
{"*", BINOP_MUL, PREC_MUL, 0},
|
||||
{"/", BINOP_DIV, PREC_MUL, 0},
|
||||
{"//", BINOP_CONCAT, PREC_PREFIX, 0}, /* FIXME: precedence? */
|
||||
{"-", UNOP_NEG, PREC_PREFIX, 0},
|
||||
{"->", UNOP_IND, PREC_SUFFIX, 1},
|
||||
{"->", UNOP_ADDR, PREC_PREFIX, 0},
|
||||
{":", BINOP_RANGE, PREC_ASSIGN, 0},
|
||||
{NULL, 0, 0, 0}
|
||||
};
|
||||
|
||||
/* The built-in types of Chill. */
|
||||
|
|
@ -331,14 +322,14 @@ struct type *builtin_type_chill_long;
|
|||
struct type *builtin_type_chill_ulong;
|
||||
struct type *builtin_type_chill_real;
|
||||
|
||||
struct type ** CONST_PTR (chill_builtin_types[]) =
|
||||
struct type **const (chill_builtin_types[]) =
|
||||
{
|
||||
&builtin_type_chill_bool,
|
||||
&builtin_type_chill_char,
|
||||
&builtin_type_chill_long,
|
||||
&builtin_type_chill_ulong,
|
||||
&builtin_type_chill_real,
|
||||
0
|
||||
&builtin_type_chill_char,
|
||||
&builtin_type_chill_long,
|
||||
&builtin_type_chill_ulong,
|
||||
&builtin_type_chill_real,
|
||||
0
|
||||
};
|
||||
|
||||
/* Calculate LOWER or UPPER of TYPE.
|
||||
|
|
@ -346,10 +337,8 @@ struct type ** CONST_PTR (chill_builtin_types[]) =
|
|||
*RESULT_TYPE is the appropriate type for the result. */
|
||||
|
||||
LONGEST
|
||||
type_lower_upper (op, type, result_type)
|
||||
enum exp_opcode op; /* Either UNOP_LOWER or UNOP_UPPER */
|
||||
struct type *type;
|
||||
struct type **result_type;
|
||||
type_lower_upper (enum exp_opcode op, /* Either UNOP_LOWER or UNOP_UPPER */
|
||||
struct type *type, struct type **result_type)
|
||||
{
|
||||
LONGEST low, high;
|
||||
*result_type = type;
|
||||
|
|
@ -364,7 +353,7 @@ type_lower_upper (op, type, result_type)
|
|||
case TYPE_CODE_ARRAY:
|
||||
case TYPE_CODE_BITSTRING:
|
||||
case TYPE_CODE_STRING:
|
||||
type = TYPE_FIELD_TYPE (type, 0); /* Get index type */
|
||||
type = TYPE_FIELD_TYPE (type, 0); /* Get index type */
|
||||
|
||||
/* ... fall through ... */
|
||||
case TYPE_CODE_RANGE:
|
||||
|
|
@ -399,9 +388,8 @@ type_lower_upper (op, type, result_type)
|
|||
error ("unknown mode for LOWER/UPPER builtin");
|
||||
}
|
||||
|
||||
static value_ptr
|
||||
value_chill_length (val)
|
||||
value_ptr val;
|
||||
static struct value *
|
||||
value_chill_length (struct value *val)
|
||||
{
|
||||
LONGEST tmp;
|
||||
struct type *type = VALUE_TYPE (val);
|
||||
|
|
@ -428,9 +416,8 @@ value_chill_length (val)
|
|||
return value_from_longest (builtin_type_int, tmp);
|
||||
}
|
||||
|
||||
static value_ptr
|
||||
value_chill_card (val)
|
||||
value_ptr val;
|
||||
static struct value *
|
||||
value_chill_card (struct value *val)
|
||||
{
|
||||
LONGEST tmp = 0;
|
||||
struct type *type = VALUE_TYPE (val);
|
||||
|
|
@ -453,10 +440,8 @@ value_chill_card (val)
|
|||
return value_from_longest (builtin_type_int, tmp);
|
||||
}
|
||||
|
||||
static value_ptr
|
||||
value_chill_max_min (op, val)
|
||||
enum exp_opcode op;
|
||||
value_ptr val;
|
||||
static struct value *
|
||||
value_chill_max_min (enum exp_opcode op, struct value *val)
|
||||
{
|
||||
LONGEST tmp = 0;
|
||||
struct type *type = VALUE_TYPE (val);
|
||||
|
|
@ -503,23 +488,21 @@ value_chill_max_min (op, val)
|
|||
error ("bad argument to %s builtin", op == UNOP_CHMAX ? "MAX" : "MIN");
|
||||
|
||||
return value_from_longest (TYPE_CODE (elttype) == TYPE_CODE_RANGE
|
||||
? TYPE_TARGET_TYPE (elttype)
|
||||
: elttype,
|
||||
? TYPE_TARGET_TYPE (elttype)
|
||||
: elttype,
|
||||
tmp);
|
||||
}
|
||||
|
||||
static value_ptr
|
||||
evaluate_subexp_chill (expect_type, exp, pos, noside)
|
||||
struct type *expect_type;
|
||||
register struct expression *exp;
|
||||
register int *pos;
|
||||
enum noside noside;
|
||||
static struct value *
|
||||
evaluate_subexp_chill (struct type *expect_type,
|
||||
register struct expression *exp, register int *pos,
|
||||
enum noside noside)
|
||||
{
|
||||
int pc = *pos;
|
||||
struct type *type;
|
||||
int tem, nargs;
|
||||
value_ptr arg1;
|
||||
value_ptr *argvec;
|
||||
struct value *arg1;
|
||||
struct value **argvec;
|
||||
enum exp_opcode op = exp->elts[*pos].opcode;
|
||||
switch (op)
|
||||
{
|
||||
|
|
@ -534,7 +517,8 @@ evaluate_subexp_chill (expect_type, exp, pos, noside)
|
|||
if (nargs == 1 && TYPE_CODE (type) == TYPE_CODE_INT)
|
||||
{
|
||||
/* Looks like string repetition. */
|
||||
value_ptr string = evaluate_subexp_with_coercion (exp, pos, noside);
|
||||
struct value *string = evaluate_subexp_with_coercion (exp, pos,
|
||||
noside);
|
||||
return value_concat (arg1, string);
|
||||
}
|
||||
|
||||
|
|
@ -552,18 +536,19 @@ evaluate_subexp_chill (expect_type, exp, pos, noside)
|
|||
|
||||
/* Allocate arg vector, including space for the function to be
|
||||
called in argvec[0] and a terminating NULL */
|
||||
argvec = (value_ptr *) alloca (sizeof (value_ptr) * (nargs + 2));
|
||||
argvec = (struct value **) alloca (sizeof (struct value *)
|
||||
* (nargs + 2));
|
||||
argvec[0] = arg1;
|
||||
tem = 1;
|
||||
for (; tem <= nargs && tem <= TYPE_NFIELDS (type); tem++)
|
||||
{
|
||||
argvec[tem]
|
||||
= evaluate_subexp_chill (TYPE_FIELD_TYPE (type, tem-1),
|
||||
= evaluate_subexp_chill (TYPE_FIELD_TYPE (type, tem - 1),
|
||||
exp, pos, noside);
|
||||
}
|
||||
for (; tem <= nargs; tem++)
|
||||
argvec[tem] = evaluate_subexp_with_coercion (exp, pos, noside);
|
||||
argvec[tem] = 0; /* signal end of arglist */
|
||||
argvec[tem] = 0; /* signal end of arglist */
|
||||
|
||||
return call_function_by_hand (argvec[0], nargs, argvec + 1);
|
||||
default:
|
||||
|
|
@ -572,7 +557,8 @@ evaluate_subexp_chill (expect_type, exp, pos, noside)
|
|||
|
||||
while (nargs-- > 0)
|
||||
{
|
||||
value_ptr index = evaluate_subexp_with_coercion (exp, pos, noside);
|
||||
struct value *index = evaluate_subexp_with_coercion (exp, pos,
|
||||
noside);
|
||||
arg1 = value_subscript (arg1, index);
|
||||
}
|
||||
return (arg1);
|
||||
|
|
@ -614,41 +600,43 @@ evaluate_subexp_chill (expect_type, exp, pos, noside)
|
|||
}
|
||||
|
||||
return evaluate_subexp_standard (expect_type, exp, pos, noside);
|
||||
nosideret:
|
||||
nosideret:
|
||||
return value_from_longest (builtin_type_long, (LONGEST) 1);
|
||||
}
|
||||
|
||||
const struct language_defn chill_language_defn = {
|
||||
const struct language_defn chill_language_defn =
|
||||
{
|
||||
"chill",
|
||||
language_chill,
|
||||
chill_builtin_types,
|
||||
range_check_on,
|
||||
type_check_on,
|
||||
case_sensitive_on,
|
||||
chill_parse, /* parser */
|
||||
chill_error, /* parser error function */
|
||||
evaluate_subexp_chill,
|
||||
chill_printchar, /* print a character constant */
|
||||
chill_printstr, /* function to print a string constant */
|
||||
NULL, /* Function to print a single char */
|
||||
chill_create_fundamental_type,/* Create fundamental type in this language */
|
||||
chill_create_fundamental_type, /* Create fundamental type in this language */
|
||||
chill_print_type, /* Print a type using appropriate syntax */
|
||||
chill_val_print, /* Print a value using appropriate syntax */
|
||||
chill_value_print, /* Print a top-levl value */
|
||||
{"", "B'", "", ""}, /* Binary format info */
|
||||
{"O'%lo", "O'", "o", ""}, /* Octal format info */
|
||||
{"D'%ld", "D'", "d", ""}, /* Decimal format info */
|
||||
{"H'%lx", "H'", "x", ""}, /* Hex format info */
|
||||
{"", "B'", "", ""}, /* Binary format info */
|
||||
{"O'%lo", "O'", "o", ""}, /* Octal format info */
|
||||
{"D'%ld", "D'", "d", ""}, /* Decimal format info */
|
||||
{"H'%lx", "H'", "x", ""}, /* Hex format info */
|
||||
chill_op_print_tab, /* expression operators for printing */
|
||||
0, /* arrays are first-class (not c-style) */
|
||||
0, /* String lower bound */
|
||||
&builtin_type_chill_char, /* Type of string elements */
|
||||
&builtin_type_chill_char, /* Type of string elements */
|
||||
LANG_MAGIC
|
||||
};
|
||||
|
||||
/* Initialization for Chill */
|
||||
|
||||
void
|
||||
_initialize_chill_language ()
|
||||
_initialize_chill_language (void)
|
||||
{
|
||||
builtin_type_chill_bool =
|
||||
init_type (TYPE_CODE_BOOL, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
|
||||
|
|
|
|||
|
|
@ -1,42 +1,41 @@
|
|||
/* Chill language support definitions for GDB, the GNU debugger.
|
||||
Copyright 1992 Free Software Foundation, Inc.
|
||||
Copyright 1992, 1994, 1996, 1998, 1999, 2000
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef __STDC__ /* Forward decls for prototypes */
|
||||
/* Forward decls for prototypes */
|
||||
struct value;
|
||||
#endif
|
||||
|
||||
extern int
|
||||
chill_parse PARAMS ((void)); /* Defined in ch-exp.y */
|
||||
extern int chill_parse (void); /* Defined in ch-exp.y */
|
||||
|
||||
extern void
|
||||
chill_error PARAMS ((char *)); /* Defined in ch-exp.y */
|
||||
extern void chill_error (char *); /* Defined in ch-exp.y */
|
||||
|
||||
extern void /* Defined in ch-typeprint.c */
|
||||
chill_print_type PARAMS ((struct type *, char *, GDB_FILE *, int, int));
|
||||
/* Defined in ch-typeprint.c */
|
||||
extern void chill_print_type (struct type *, char *, struct ui_file *, int,
|
||||
int);
|
||||
|
||||
extern int
|
||||
chill_val_print PARAMS ((struct type *, char *, int, CORE_ADDR, GDB_FILE *, int, int,
|
||||
int, enum val_prettyprint));
|
||||
extern int chill_val_print (struct type *, char *, int, CORE_ADDR,
|
||||
struct ui_file *, int, int, int,
|
||||
enum val_prettyprint);
|
||||
|
||||
extern int
|
||||
chill_value_print PARAMS ((struct value *, GDB_FILE *,
|
||||
int, enum val_prettyprint));
|
||||
extern int chill_value_print (struct value *, struct ui_file *,
|
||||
int, enum val_prettyprint);
|
||||
|
||||
extern LONGEST
|
||||
type_lower_upper PARAMS ((enum exp_opcode, struct type *, struct type **));
|
||||
type_lower_upper (enum exp_opcode, struct type *, struct type **);
|
||||
|
|
|
|||
|
|
@ -1,21 +1,23 @@
|
|||
/* Support for printing Chill types for GDB, the GNU debugger.
|
||||
Copyright 1986, 1988, 1989, 1991 Free Software Foundation, Inc.
|
||||
Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 2000
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "obstack.h"
|
||||
|
|
@ -26,26 +28,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||
#include "value.h"
|
||||
#include "gdbcore.h"
|
||||
#include "target.h"
|
||||
#include "command.h"
|
||||
#include "gdbcmd.h"
|
||||
#include "language.h"
|
||||
#include "demangle.h"
|
||||
#include "ch-lang.h"
|
||||
#include "typeprint.h"
|
||||
|
||||
#include "gdb_string.h"
|
||||
#include <errno.h>
|
||||
|
||||
static void
|
||||
chill_type_print_base PARAMS ((struct type *, GDB_FILE *, int, int));
|
||||
static void chill_type_print_base (struct type *, struct ui_file *, int, int);
|
||||
|
||||
void
|
||||
chill_print_type (type, varstring, stream, show, level)
|
||||
struct type *type;
|
||||
char *varstring;
|
||||
GDB_FILE *stream;
|
||||
int show;
|
||||
int level;
|
||||
chill_print_type (struct type *type, char *varstring, struct ui_file *stream,
|
||||
int show, int level)
|
||||
{
|
||||
if (varstring != NULL && *varstring != '\0')
|
||||
{
|
||||
|
|
@ -68,11 +62,8 @@ chill_print_type (type, varstring, stream, show, level)
|
|||
We increase it for some recursive calls. */
|
||||
|
||||
static void
|
||||
chill_type_print_base (type, stream, show, level)
|
||||
struct type *type;
|
||||
GDB_FILE *stream;
|
||||
int show;
|
||||
int level;
|
||||
chill_type_print_base (struct type *type, struct ui_file *stream, int show,
|
||||
int level)
|
||||
{
|
||||
register int len;
|
||||
register int i;
|
||||
|
|
@ -104,243 +95,246 @@ chill_type_print_base (type, stream, show, level)
|
|||
|
||||
switch (TYPE_CODE (type))
|
||||
{
|
||||
case TYPE_CODE_TYPEDEF:
|
||||
chill_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level);
|
||||
break;
|
||||
case TYPE_CODE_PTR:
|
||||
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_VOID)
|
||||
{
|
||||
fprintf_filtered (stream,
|
||||
TYPE_NAME (type) ? TYPE_NAME (type) : "PTR");
|
||||
break;
|
||||
}
|
||||
fprintf_filtered (stream, "REF ");
|
||||
chill_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level);
|
||||
break;
|
||||
case TYPE_CODE_TYPEDEF:
|
||||
chill_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level);
|
||||
break;
|
||||
case TYPE_CODE_PTR:
|
||||
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_VOID)
|
||||
{
|
||||
fprintf_filtered (stream,
|
||||
TYPE_NAME (type) ? TYPE_NAME (type) : "PTR");
|
||||
break;
|
||||
}
|
||||
fprintf_filtered (stream, "REF ");
|
||||
chill_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level);
|
||||
break;
|
||||
|
||||
case TYPE_CODE_BOOL:
|
||||
/* FIXME: we should probably just print the TYPE_NAME, in case
|
||||
anyone ever fixes the compiler to give us the real names
|
||||
in the presence of the chill equivalent of typedef (assuming
|
||||
there is one). */
|
||||
fprintf_filtered (stream,
|
||||
TYPE_NAME (type) ? TYPE_NAME (type) : "BOOL");
|
||||
break;
|
||||
case TYPE_CODE_BOOL:
|
||||
/* FIXME: we should probably just print the TYPE_NAME, in case
|
||||
anyone ever fixes the compiler to give us the real names
|
||||
in the presence of the chill equivalent of typedef (assuming
|
||||
there is one). */
|
||||
fprintf_filtered (stream,
|
||||
TYPE_NAME (type) ? TYPE_NAME (type) : "BOOL");
|
||||
break;
|
||||
|
||||
case TYPE_CODE_ARRAY:
|
||||
fputs_filtered ("ARRAY (", stream);
|
||||
range_type = TYPE_FIELD_TYPE (type, 0);
|
||||
if (TYPE_CODE (range_type) != TYPE_CODE_RANGE)
|
||||
chill_print_type (range_type, "", stream, 0, level);
|
||||
case TYPE_CODE_ARRAY:
|
||||
fputs_filtered ("ARRAY (", stream);
|
||||
range_type = TYPE_FIELD_TYPE (type, 0);
|
||||
if (TYPE_CODE (range_type) != TYPE_CODE_RANGE)
|
||||
chill_print_type (range_type, "", stream, 0, level);
|
||||
else
|
||||
{
|
||||
index_type = TYPE_TARGET_TYPE (range_type);
|
||||
low_bound = TYPE_FIELD_BITPOS (range_type, 0);
|
||||
high_bound = TYPE_FIELD_BITPOS (range_type, 1);
|
||||
print_type_scalar (index_type, low_bound, stream);
|
||||
fputs_filtered (":", stream);
|
||||
print_type_scalar (index_type, high_bound, stream);
|
||||
}
|
||||
fputs_filtered (") ", stream);
|
||||
chill_print_type (TYPE_TARGET_TYPE (type), "", stream, 0, level);
|
||||
break;
|
||||
|
||||
case TYPE_CODE_BITSTRING:
|
||||
fprintf_filtered (stream, "BOOLS (%d)",
|
||||
TYPE_FIELD_BITPOS (TYPE_FIELD_TYPE (type, 0), 1) + 1);
|
||||
break;
|
||||
|
||||
case TYPE_CODE_SET:
|
||||
fputs_filtered ("POWERSET ", stream);
|
||||
chill_print_type (TYPE_INDEX_TYPE (type), "", stream,
|
||||
show - 1, level);
|
||||
break;
|
||||
|
||||
case TYPE_CODE_STRING:
|
||||
range_type = TYPE_FIELD_TYPE (type, 0);
|
||||
index_type = TYPE_TARGET_TYPE (range_type);
|
||||
high_bound = TYPE_FIELD_BITPOS (range_type, 1);
|
||||
fputs_filtered ("CHARS (", stream);
|
||||
print_type_scalar (index_type, high_bound + 1, stream);
|
||||
fputs_filtered (")", stream);
|
||||
break;
|
||||
|
||||
case TYPE_CODE_MEMBER:
|
||||
fprintf_filtered (stream, "MEMBER ");
|
||||
chill_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level);
|
||||
break;
|
||||
case TYPE_CODE_REF:
|
||||
fprintf_filtered (stream, "/*LOC*/ ");
|
||||
chill_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
|
||||
break;
|
||||
case TYPE_CODE_FUNC:
|
||||
fprintf_filtered (stream, "PROC (");
|
||||
len = TYPE_NFIELDS (type);
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
struct type *param_type = TYPE_FIELD_TYPE (type, i);
|
||||
if (i > 0)
|
||||
{
|
||||
fputs_filtered (", ", stream);
|
||||
wrap_here (" ");
|
||||
}
|
||||
if (TYPE_CODE (param_type) == TYPE_CODE_REF)
|
||||
{
|
||||
chill_type_print_base (TYPE_TARGET_TYPE (param_type),
|
||||
stream, 0, level);
|
||||
fputs_filtered (" LOC", stream);
|
||||
}
|
||||
else
|
||||
chill_type_print_base (param_type, stream, show, level);
|
||||
}
|
||||
fprintf_filtered (stream, ")");
|
||||
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID)
|
||||
{
|
||||
fputs_filtered (" RETURNS (", stream);
|
||||
chill_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level);
|
||||
fputs_filtered (")", stream);
|
||||
}
|
||||
break;
|
||||
|
||||
case TYPE_CODE_STRUCT:
|
||||
if (chill_varying_type (type))
|
||||
{
|
||||
chill_type_print_base (TYPE_FIELD_TYPE (type, 1),
|
||||
stream, 0, level);
|
||||
fputs_filtered (" VARYING", stream);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf_filtered (stream, "STRUCT ");
|
||||
|
||||
fprintf_filtered (stream, "(\n");
|
||||
if ((TYPE_NFIELDS (type) == 0) && (TYPE_NFN_FIELDS (type) == 0))
|
||||
{
|
||||
if (TYPE_STUB (type))
|
||||
{
|
||||
fprintfi_filtered (level + 4, stream, "<incomplete type>\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintfi_filtered (level + 4, stream, "<no data fields>\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
len = TYPE_NFIELDS (type);
|
||||
for (i = TYPE_N_BASECLASSES (type); i < len; i++)
|
||||
{
|
||||
struct type *field_type = TYPE_FIELD_TYPE (type, i);
|
||||
QUIT;
|
||||
print_spaces_filtered (level + 4, stream);
|
||||
if (TYPE_CODE (field_type) == TYPE_CODE_UNION)
|
||||
{
|
||||
int j; /* variant number */
|
||||
fputs_filtered ("CASE OF\n", stream);
|
||||
for (j = 0; j < TYPE_NFIELDS (field_type); j++)
|
||||
{
|
||||
int k; /* variant field index */
|
||||
struct type *variant_type
|
||||
= TYPE_FIELD_TYPE (field_type, j);
|
||||
int var_len = TYPE_NFIELDS (variant_type);
|
||||
print_spaces_filtered (level + 4, stream);
|
||||
if (strcmp (TYPE_FIELD_NAME (field_type, j),
|
||||
"else") == 0)
|
||||
fputs_filtered ("ELSE\n", stream);
|
||||
else
|
||||
fputs_filtered (":\n", stream);
|
||||
if (TYPE_CODE (variant_type) != TYPE_CODE_STRUCT)
|
||||
error ("variant record confusion");
|
||||
for (k = 0; k < var_len; k++)
|
||||
{
|
||||
print_spaces_filtered (level + 8, stream);
|
||||
chill_print_type (TYPE_FIELD_TYPE (variant_type, k),
|
||||
TYPE_FIELD_NAME (variant_type, k),
|
||||
stream, show - 1, level + 8);
|
||||
if (k < (var_len - 1))
|
||||
fputs_filtered (",", stream);
|
||||
fputs_filtered ("\n", stream);
|
||||
}
|
||||
}
|
||||
print_spaces_filtered (level + 4, stream);
|
||||
fputs_filtered ("ESAC", stream);
|
||||
}
|
||||
else
|
||||
chill_print_type (field_type,
|
||||
TYPE_FIELD_NAME (type, i),
|
||||
stream, show - 1, level + 4);
|
||||
if (i < (len - 1))
|
||||
{
|
||||
fputs_filtered (",", stream);
|
||||
}
|
||||
fputs_filtered ("\n", stream);
|
||||
}
|
||||
}
|
||||
fprintfi_filtered (level, stream, ")");
|
||||
}
|
||||
break;
|
||||
|
||||
case TYPE_CODE_RANGE:
|
||||
{
|
||||
struct type *target = TYPE_TARGET_TYPE (type);
|
||||
if (target && TYPE_NAME (target))
|
||||
fputs_filtered (TYPE_NAME (target), stream);
|
||||
else
|
||||
{
|
||||
index_type = TYPE_TARGET_TYPE (range_type);
|
||||
low_bound = TYPE_FIELD_BITPOS (range_type, 0);
|
||||
high_bound = TYPE_FIELD_BITPOS (range_type, 1);
|
||||
print_type_scalar (index_type, low_bound, stream);
|
||||
fputs_filtered (":", stream);
|
||||
print_type_scalar (index_type, high_bound, stream);
|
||||
}
|
||||
fputs_filtered (") ", stream);
|
||||
chill_print_type (TYPE_TARGET_TYPE (type), "", stream, 0, level);
|
||||
break;
|
||||
|
||||
case TYPE_CODE_BITSTRING:
|
||||
fprintf_filtered (stream, "BOOLS (%d)",
|
||||
TYPE_FIELD_BITPOS (TYPE_FIELD_TYPE(type,0), 1) + 1);
|
||||
break;
|
||||
|
||||
case TYPE_CODE_SET:
|
||||
fputs_filtered ("POWERSET ", stream);
|
||||
chill_print_type (TYPE_INDEX_TYPE (type), "", stream,
|
||||
show - 1, level);
|
||||
break;
|
||||
|
||||
case TYPE_CODE_STRING:
|
||||
range_type = TYPE_FIELD_TYPE (type, 0);
|
||||
index_type = TYPE_TARGET_TYPE (range_type);
|
||||
high_bound = TYPE_FIELD_BITPOS (range_type, 1);
|
||||
fputs_filtered ("CHARS (", stream);
|
||||
print_type_scalar (index_type, high_bound + 1, stream);
|
||||
fputs_filtered ("RANGE", stream);
|
||||
if (target == NULL)
|
||||
target = builtin_type_long;
|
||||
fputs_filtered (" (", stream);
|
||||
print_type_scalar (target, TYPE_LOW_BOUND (type), stream);
|
||||
fputs_filtered (":", stream);
|
||||
print_type_scalar (target, TYPE_HIGH_BOUND (type), stream);
|
||||
fputs_filtered (")", stream);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case TYPE_CODE_MEMBER:
|
||||
fprintf_filtered (stream, "MEMBER ");
|
||||
chill_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level);
|
||||
break;
|
||||
case TYPE_CODE_REF:
|
||||
fprintf_filtered (stream, "/*LOC*/ ");
|
||||
chill_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
|
||||
break;
|
||||
case TYPE_CODE_FUNC:
|
||||
fprintf_filtered (stream, "PROC (");
|
||||
case TYPE_CODE_ENUM:
|
||||
{
|
||||
register int lastval = 0;
|
||||
fprintf_filtered (stream, "SET (");
|
||||
len = TYPE_NFIELDS (type);
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
struct type *param_type = TYPE_FIELD_TYPE (type, i);
|
||||
if (i > 0)
|
||||
QUIT;
|
||||
if (i)
|
||||
fprintf_filtered (stream, ", ");
|
||||
wrap_here (" ");
|
||||
fputs_filtered (TYPE_FIELD_NAME (type, i), stream);
|
||||
if (lastval != TYPE_FIELD_BITPOS (type, i))
|
||||
{
|
||||
fputs_filtered (", ", stream);
|
||||
wrap_here (" ");
|
||||
fprintf_filtered (stream, " = %d", TYPE_FIELD_BITPOS (type, i));
|
||||
lastval = TYPE_FIELD_BITPOS (type, i);
|
||||
}
|
||||
if (TYPE_CODE (param_type) == TYPE_CODE_REF)
|
||||
{
|
||||
chill_type_print_base (TYPE_TARGET_TYPE (param_type),
|
||||
stream, 0, level);
|
||||
fputs_filtered (" LOC", stream);
|
||||
}
|
||||
else
|
||||
chill_type_print_base (param_type, stream, show, level);
|
||||
lastval++;
|
||||
}
|
||||
fprintf_filtered (stream, ")");
|
||||
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID)
|
||||
{
|
||||
fputs_filtered (" RETURNS (", stream);
|
||||
chill_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level);
|
||||
fputs_filtered (")", stream);
|
||||
}
|
||||
break;
|
||||
|
||||
case TYPE_CODE_STRUCT:
|
||||
if (chill_varying_type (type))
|
||||
{
|
||||
chill_type_print_base (TYPE_FIELD_TYPE (type, 1),
|
||||
stream, 0, level);
|
||||
fputs_filtered (" VARYING", stream);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf_filtered (stream, "STRUCT ");
|
||||
|
||||
fprintf_filtered (stream, "(\n");
|
||||
if ((TYPE_NFIELDS (type) == 0) && (TYPE_NFN_FIELDS (type) == 0))
|
||||
{
|
||||
if (TYPE_FLAGS (type) & TYPE_FLAG_STUB)
|
||||
{
|
||||
fprintfi_filtered (level + 4, stream, "<incomplete type>\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintfi_filtered (level + 4, stream, "<no data fields>\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
len = TYPE_NFIELDS (type);
|
||||
for (i = TYPE_N_BASECLASSES (type); i < len; i++)
|
||||
{
|
||||
struct type *field_type = TYPE_FIELD_TYPE (type, i);
|
||||
QUIT;
|
||||
print_spaces_filtered (level + 4, stream);
|
||||
if (TYPE_CODE (field_type) == TYPE_CODE_UNION)
|
||||
{ int j; /* variant number */
|
||||
fputs_filtered ("CASE OF\n", stream);
|
||||
for (j = 0; j < TYPE_NFIELDS (field_type); j++)
|
||||
{ int k; /* variant field index */
|
||||
struct type *variant_type
|
||||
= TYPE_FIELD_TYPE (field_type, j);
|
||||
int var_len = TYPE_NFIELDS (variant_type);
|
||||
print_spaces_filtered (level + 4, stream);
|
||||
if (strcmp (TYPE_FIELD_NAME (field_type, j),
|
||||
"else") == 0)
|
||||
fputs_filtered ("ELSE\n", stream);
|
||||
else
|
||||
fputs_filtered (":\n", stream);
|
||||
if (TYPE_CODE (variant_type) != TYPE_CODE_STRUCT)
|
||||
error ("variant record confusion");
|
||||
for (k = 0; k < var_len; k++)
|
||||
{
|
||||
print_spaces_filtered (level + 8, stream);
|
||||
chill_print_type (TYPE_FIELD_TYPE (variant_type, k),
|
||||
TYPE_FIELD_NAME (variant_type, k),
|
||||
stream, show - 1, level + 8);
|
||||
if (k < (var_len - 1))
|
||||
fputs_filtered (",", stream);
|
||||
fputs_filtered ("\n", stream);
|
||||
}
|
||||
}
|
||||
print_spaces_filtered (level + 4, stream);
|
||||
fputs_filtered ("ESAC", stream);
|
||||
}
|
||||
else
|
||||
chill_print_type (field_type,
|
||||
TYPE_FIELD_NAME (type, i),
|
||||
stream, show - 1, level + 4);
|
||||
if (i < (len - 1))
|
||||
{
|
||||
fputs_filtered (",", stream);
|
||||
}
|
||||
fputs_filtered ("\n", stream);
|
||||
}
|
||||
}
|
||||
fprintfi_filtered (level, stream, ")");
|
||||
}
|
||||
break;
|
||||
|
||||
case TYPE_CODE_RANGE:
|
||||
{
|
||||
struct type *target = TYPE_TARGET_TYPE (type);
|
||||
if (target && TYPE_NAME (target))
|
||||
fputs_filtered (TYPE_NAME (target), stream);
|
||||
else
|
||||
fputs_filtered ("RANGE", stream);
|
||||
if (target == NULL)
|
||||
target = builtin_type_long;
|
||||
fputs_filtered (" (", stream);
|
||||
print_type_scalar (target, TYPE_LOW_BOUND (type), stream);
|
||||
fputs_filtered (":", stream);
|
||||
print_type_scalar (target, TYPE_HIGH_BOUND (type), stream);
|
||||
fputs_filtered (")", stream);
|
||||
}
|
||||
break;
|
||||
|
||||
case TYPE_CODE_ENUM:
|
||||
{
|
||||
register int lastval = 0;
|
||||
fprintf_filtered (stream, "SET (");
|
||||
len = TYPE_NFIELDS (type);
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
QUIT;
|
||||
if (i) fprintf_filtered (stream, ", ");
|
||||
wrap_here (" ");
|
||||
fputs_filtered (TYPE_FIELD_NAME (type, i), stream);
|
||||
if (lastval != TYPE_FIELD_BITPOS (type, i))
|
||||
{
|
||||
fprintf_filtered (stream, " = %d", TYPE_FIELD_BITPOS (type, i));
|
||||
lastval = TYPE_FIELD_BITPOS (type, i);
|
||||
}
|
||||
lastval++;
|
||||
}
|
||||
fprintf_filtered (stream, ")");
|
||||
}
|
||||
break;
|
||||
|
||||
case TYPE_CODE_VOID:
|
||||
case TYPE_CODE_UNDEF:
|
||||
case TYPE_CODE_ERROR:
|
||||
case TYPE_CODE_UNION:
|
||||
case TYPE_CODE_METHOD:
|
||||
error ("missing language support in chill_type_print_base");
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
/* Handle types not explicitly handled by the other cases,
|
||||
such as fundamental types. For these, just print whatever
|
||||
the type name is, as recorded in the type itself. If there
|
||||
is no type name, then complain. */
|
||||
|
||||
if (TYPE_NAME (type) != NULL)
|
||||
{
|
||||
fputs_filtered (TYPE_NAME (type), stream);
|
||||
}
|
||||
else
|
||||
{
|
||||
error ("Unrecognized type code (%d) in symbol table.",
|
||||
TYPE_CODE (type));
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case TYPE_CODE_VOID:
|
||||
case TYPE_CODE_UNDEF:
|
||||
case TYPE_CODE_ERROR:
|
||||
case TYPE_CODE_UNION:
|
||||
case TYPE_CODE_METHOD:
|
||||
error ("missing language support in chill_type_print_base");
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
/* Handle types not explicitly handled by the other cases,
|
||||
such as fundamental types. For these, just print whatever
|
||||
the type name is, as recorded in the type itself. If there
|
||||
is no type name, then complain. */
|
||||
|
||||
if (TYPE_NAME (type) != NULL)
|
||||
{
|
||||
fputs_filtered (TYPE_NAME (type), stream);
|
||||
}
|
||||
else
|
||||
{
|
||||
error ("Unrecognized type code (%d) in symbol table.",
|
||||
TYPE_CODE (type));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,22 +1,24 @@
|
|||
/* Support for printing Chill values for GDB, the GNU debugger.
|
||||
Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994
|
||||
Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
|
||||
1998, 2000, 2001
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "obstack.h"
|
||||
|
|
@ -27,23 +29,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||
#include "value.h"
|
||||
#include "language.h"
|
||||
#include "demangle.h"
|
||||
#include "c-lang.h" /* For c_val_print */
|
||||
#include "c-lang.h" /* For c_val_print */
|
||||
#include "typeprint.h"
|
||||
#include "ch-lang.h"
|
||||
#include "annotate.h"
|
||||
|
||||
static void
|
||||
chill_print_value_fields PARAMS ((struct type *, char *, GDB_FILE *, int, int,
|
||||
enum val_prettyprint, struct type **));
|
||||
static void chill_print_value_fields (struct type *, char *,
|
||||
struct ui_file *, int, int,
|
||||
enum val_prettyprint, struct type **);
|
||||
|
||||
static void
|
||||
chill_print_type_scalar PARAMS ((struct type *, LONGEST, GDB_FILE *));
|
||||
|
||||
static void
|
||||
chill_val_print_array_elements PARAMS ((struct type *, char *, CORE_ADDR, GDB_FILE *,
|
||||
int, int, int, enum val_prettyprint));
|
||||
static void chill_print_type_scalar (struct type *, LONGEST,
|
||||
struct ui_file *);
|
||||
|
||||
static void chill_val_print_array_elements (struct type *, char *,
|
||||
CORE_ADDR, struct ui_file *,
|
||||
int, int, int,
|
||||
enum val_prettyprint);
|
||||
|
||||
|
||||
/* Print integral scalar data VAL, of type TYPE, onto stdio stream STREAM.
|
||||
Used to print data from type structures in a specified type. For example,
|
||||
array bounds may be characters or booleans in some languages, and this
|
||||
|
|
@ -51,10 +54,7 @@ chill_val_print_array_elements PARAMS ((struct type *, char *, CORE_ADDR, GDB_FI
|
|||
decimal integer values. */
|
||||
|
||||
static void
|
||||
chill_print_type_scalar (type, val, stream)
|
||||
struct type *type;
|
||||
LONGEST val;
|
||||
GDB_FILE *stream;
|
||||
chill_print_type_scalar (struct type *type, LONGEST val, struct ui_file *stream)
|
||||
{
|
||||
switch (TYPE_CODE (type))
|
||||
{
|
||||
|
|
@ -97,16 +97,10 @@ chill_print_type_scalar (type, val, stream)
|
|||
element indexes (in Chill syntax). */
|
||||
|
||||
static void
|
||||
chill_val_print_array_elements (type, valaddr, address, stream,
|
||||
format, deref_ref, recurse, pretty)
|
||||
struct type *type;
|
||||
char *valaddr;
|
||||
CORE_ADDR address;
|
||||
GDB_FILE *stream;
|
||||
int format;
|
||||
int deref_ref;
|
||||
int recurse;
|
||||
enum val_prettyprint pretty;
|
||||
chill_val_print_array_elements (struct type *type, char *valaddr,
|
||||
CORE_ADDR address, struct ui_file *stream,
|
||||
int format, int deref_ref, int recurse,
|
||||
enum val_prettyprint pretty)
|
||||
{
|
||||
unsigned int i = 0;
|
||||
unsigned int things_printed = 0;
|
||||
|
|
@ -120,8 +114,8 @@ chill_val_print_array_elements (type, valaddr, address, stream,
|
|||
unsigned int rep1;
|
||||
/* Number of repetitions we have detected so far. */
|
||||
unsigned int reps;
|
||||
LONGEST low_bound = TYPE_FIELD_BITPOS (range_type, 0);
|
||||
|
||||
LONGEST low_bound = TYPE_FIELD_BITPOS (range_type, 0);
|
||||
|
||||
elttype = check_typedef (TYPE_TARGET_TYPE (type));
|
||||
eltlen = TYPE_LENGTH (elttype);
|
||||
len = TYPE_LENGTH (type) / eltlen;
|
||||
|
|
@ -146,7 +140,7 @@ chill_val_print_array_elements (type, valaddr, address, stream,
|
|||
|
||||
rep1 = i + 1;
|
||||
reps = 1;
|
||||
while ((rep1 < len) &&
|
||||
while ((rep1 < len) &&
|
||||
!memcmp (valaddr + i * eltlen, valaddr + rep1 * eltlen, eltlen))
|
||||
{
|
||||
++reps;
|
||||
|
|
@ -197,17 +191,9 @@ chill_val_print_array_elements (type, valaddr, address, stream,
|
|||
The PRETTY parameter controls prettyprinting. */
|
||||
|
||||
int
|
||||
chill_val_print (type, valaddr, embedded_offset, address,
|
||||
stream, format, deref_ref, recurse, pretty)
|
||||
struct type *type;
|
||||
char *valaddr;
|
||||
int embedded_offset;
|
||||
CORE_ADDR address;
|
||||
GDB_FILE *stream;
|
||||
int format;
|
||||
int deref_ref;
|
||||
int recurse;
|
||||
enum val_prettyprint pretty;
|
||||
chill_val_print (struct type *type, char *valaddr, int embedded_offset,
|
||||
CORE_ADDR address, struct ui_file *stream, int format,
|
||||
int deref_ref, int recurse, enum val_prettyprint pretty)
|
||||
{
|
||||
LONGEST val;
|
||||
unsigned int i = 0; /* Number of characters printed. */
|
||||
|
|
@ -227,7 +213,7 @@ chill_val_print (type, valaddr, embedded_offset, address,
|
|||
}
|
||||
fprintf_filtered (stream, "[");
|
||||
chill_val_print_array_elements (type, valaddr, address, stream,
|
||||
format, deref_ref, recurse, pretty);
|
||||
format, deref_ref, recurse, pretty);
|
||||
fprintf_filtered (stream, "]");
|
||||
}
|
||||
else
|
||||
|
|
@ -288,8 +274,8 @@ chill_val_print (type, valaddr, embedded_offset, address,
|
|||
|
||||
case TYPE_CODE_UNDEF:
|
||||
/* This happens (without TYPE_FLAG_STUB set) on systems which don't use
|
||||
dbx xrefs (NO_DBX_XREFS in gcc) if a file has a "struct foo *bar"
|
||||
and no complete type for struct foo in that file. */
|
||||
dbx xrefs (NO_DBX_XREFS in gcc) if a file has a "struct foo *bar"
|
||||
and no complete type for struct foo in that file. */
|
||||
fprintf_filtered (stream, "<incomplete type>");
|
||||
break;
|
||||
|
||||
|
|
@ -308,7 +294,7 @@ chill_val_print (type, valaddr, embedded_offset, address,
|
|||
fputs_filtered ("NULL", stream);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
|
||||
{
|
||||
/* Try to print what function it points to. */
|
||||
|
|
@ -320,20 +306,20 @@ chill_val_print (type, valaddr, embedded_offset, address,
|
|||
{
|
||||
print_address_numeric (addr, 1, stream);
|
||||
}
|
||||
|
||||
|
||||
/* For a pointer to char or unsigned char, also print the string
|
||||
pointed to, unless pointer is null. */
|
||||
pointed to, unless pointer is null. */
|
||||
if (TYPE_LENGTH (elttype) == 1
|
||||
&& TYPE_CODE (elttype) == TYPE_CODE_CHAR
|
||||
&& (format == 0 || format == 's')
|
||||
&& addr != 0
|
||||
&& /* If print_max is UINT_MAX, the alloca below will fail.
|
||||
In that case don't try to print the string. */
|
||||
&& /* If print_max is UINT_MAX, the alloca below will fail.
|
||||
In that case don't try to print the string. */
|
||||
print_max < UINT_MAX)
|
||||
i = val_print_string (addr, -1, TYPE_LENGTH (elttype), stream);
|
||||
|
||||
/* Return number of characters printed, plus one for the
|
||||
terminating null if we have "reached the end". */
|
||||
terminating null if we have "reached the end". */
|
||||
return (i + (print_max && i != print_max));
|
||||
break;
|
||||
|
||||
|
|
@ -341,7 +327,7 @@ chill_val_print (type, valaddr, embedded_offset, address,
|
|||
i = TYPE_LENGTH (type);
|
||||
LA_PRINT_STRING (stream, valaddr, i, 1, 0);
|
||||
/* Return number of characters printed, plus one for the terminating
|
||||
null if we have "reached the end". */
|
||||
null if we have "reached the end". */
|
||||
return (i + (print_max && i != print_max));
|
||||
break;
|
||||
|
||||
|
|
@ -349,7 +335,7 @@ chill_val_print (type, valaddr, embedded_offset, address,
|
|||
case TYPE_CODE_SET:
|
||||
elttype = TYPE_INDEX_TYPE (type);
|
||||
CHECK_TYPEDEF (elttype);
|
||||
if (TYPE_FLAGS (elttype) & TYPE_FLAG_STUB)
|
||||
if (TYPE_STUB (elttype))
|
||||
{
|
||||
fprintf_filtered (stream, "<incomplete type>");
|
||||
gdb_flush (stream);
|
||||
|
|
@ -393,11 +379,11 @@ chill_val_print (type, valaddr, embedded_offset, address,
|
|||
need_comma = 1;
|
||||
|
||||
/* Look for a continuous range of true elements. */
|
||||
if (i+1 <= high_bound && value_bit_index (type, valaddr, ++i))
|
||||
if (i + 1 <= high_bound && value_bit_index (type, valaddr, ++i))
|
||||
{
|
||||
int j = i; /* j is the upper bound so far of the range */
|
||||
int j = i; /* j is the upper bound so far of the range */
|
||||
fputs_filtered (":", stream);
|
||||
while (i+1 <= high_bound
|
||||
while (i + 1 <= high_bound
|
||||
&& value_bit_index (type, valaddr, ++i))
|
||||
j = i;
|
||||
chill_print_type_scalar (range, (LONGEST) j, stream);
|
||||
|
|
@ -418,14 +404,14 @@ chill_val_print (type, valaddr, embedded_offset, address,
|
|||
struct type *inner = check_typedef (TYPE_FIELD_TYPE (type, 1));
|
||||
long length = unpack_long (TYPE_FIELD_TYPE (type, 0), valaddr);
|
||||
char *data_addr = valaddr + TYPE_FIELD_BITPOS (type, 1) / 8;
|
||||
|
||||
|
||||
switch (TYPE_CODE (inner))
|
||||
{
|
||||
case TYPE_CODE_STRING:
|
||||
if (length > TYPE_LENGTH (type) - 2)
|
||||
{
|
||||
fprintf_filtered (stream,
|
||||
"<dynamic length %ld > static length %d> *invalid*",
|
||||
"<dynamic length %ld > static length %d> *invalid*",
|
||||
length, TYPE_LENGTH (type));
|
||||
|
||||
/* Don't print the string; doing so might produce a
|
||||
|
|
@ -444,7 +430,7 @@ chill_val_print (type, valaddr, embedded_offset, address,
|
|||
|
||||
case TYPE_CODE_REF:
|
||||
if (addressprint)
|
||||
{
|
||||
{
|
||||
fprintf_filtered (stream, "LOC(");
|
||||
print_address_numeric
|
||||
(extract_address (valaddr, TARGET_PTR_BIT / HOST_CHAR_BIT),
|
||||
|
|
@ -453,21 +439,21 @@ chill_val_print (type, valaddr, embedded_offset, address,
|
|||
fprintf_filtered (stream, ")");
|
||||
if (deref_ref)
|
||||
fputs_filtered (": ", stream);
|
||||
}
|
||||
}
|
||||
/* De-reference the reference. */
|
||||
if (deref_ref)
|
||||
{
|
||||
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_UNDEF)
|
||||
{
|
||||
value_ptr deref_val =
|
||||
value_at
|
||||
(TYPE_TARGET_TYPE (type),
|
||||
unpack_pointer (lookup_pointer_type (builtin_type_void),
|
||||
valaddr),
|
||||
NULL);
|
||||
struct value *deref_val =
|
||||
value_at
|
||||
(TYPE_TARGET_TYPE (type),
|
||||
unpack_pointer (lookup_pointer_type (builtin_type_void),
|
||||
valaddr),
|
||||
NULL);
|
||||
val_print (VALUE_TYPE (deref_val),
|
||||
VALUE_CONTENTS (deref_val),
|
||||
0,
|
||||
0,
|
||||
VALUE_ADDRESS (deref_val), stream, format,
|
||||
deref_ref, recurse + 1, pretty);
|
||||
}
|
||||
|
|
@ -494,7 +480,7 @@ chill_val_print (type, valaddr, embedded_offset, address,
|
|||
case TYPE_CODE_ERROR:
|
||||
default:
|
||||
/* Let's defer printing to the C printer, rather than
|
||||
print an error message. FIXME! */
|
||||
print an error message. FIXME! */
|
||||
c_val_print (type, valaddr, 0, address, stream, format,
|
||||
deref_ref, recurse, pretty);
|
||||
}
|
||||
|
|
@ -512,15 +498,9 @@ chill_val_print (type, valaddr, embedded_offset, address,
|
|||
should not print, or zero if called from top level. */
|
||||
|
||||
static void
|
||||
chill_print_value_fields (type, valaddr, stream, format, recurse, pretty,
|
||||
dont_print)
|
||||
struct type *type;
|
||||
char *valaddr;
|
||||
GDB_FILE *stream;
|
||||
int format;
|
||||
int recurse;
|
||||
enum val_prettyprint pretty;
|
||||
struct type **dont_print;
|
||||
chill_print_value_fields (struct type *type, char *valaddr,
|
||||
struct ui_file *stream, int format, int recurse,
|
||||
enum val_prettyprint pretty, struct type **dont_print)
|
||||
{
|
||||
int i, len;
|
||||
int fields_seen = 0;
|
||||
|
|
@ -547,7 +527,7 @@ chill_print_value_fields (type, valaddr, stream, format, recurse, pretty,
|
|||
fprintf_filtered (stream, "\n");
|
||||
print_spaces_filtered (2 + 2 * recurse, stream);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
wrap_here (n_spaces (2 + 2 * recurse));
|
||||
}
|
||||
|
|
@ -557,19 +537,19 @@ chill_print_value_fields (type, valaddr, stream, format, recurse, pretty,
|
|||
fputs_filtered (": ", stream);
|
||||
if (TYPE_FIELD_PACKED (type, i))
|
||||
{
|
||||
value_ptr v;
|
||||
struct value *v;
|
||||
|
||||
/* Bitfields require special handling, especially due to byte
|
||||
order problems. */
|
||||
order problems. */
|
||||
v = value_from_longest (TYPE_FIELD_TYPE (type, i),
|
||||
unpack_field_as_long (type, valaddr, i));
|
||||
unpack_field_as_long (type, valaddr, i));
|
||||
|
||||
chill_val_print (TYPE_FIELD_TYPE (type, i), VALUE_CONTENTS (v), 0, 0,
|
||||
stream, format, 0, recurse + 1, pretty);
|
||||
}
|
||||
else
|
||||
{
|
||||
chill_val_print (TYPE_FIELD_TYPE (type, i),
|
||||
chill_val_print (TYPE_FIELD_TYPE (type, i),
|
||||
valaddr + TYPE_FIELD_BITPOS (type, i) / 8, 0,
|
||||
0, stream, format, 0, recurse + 1, pretty);
|
||||
}
|
||||
|
|
@ -584,14 +564,11 @@ chill_print_value_fields (type, valaddr, stream, format, recurse, pretty,
|
|||
}
|
||||
|
||||
int
|
||||
chill_value_print (val, stream, format, pretty)
|
||||
value_ptr val;
|
||||
GDB_FILE *stream;
|
||||
int format;
|
||||
enum val_prettyprint pretty;
|
||||
chill_value_print (struct value *val, struct ui_file *stream, int format,
|
||||
enum val_prettyprint pretty)
|
||||
{
|
||||
struct type *type = VALUE_TYPE (val);
|
||||
struct type *real_type = check_typedef (type);
|
||||
struct type *real_type = check_typedef (type);
|
||||
|
||||
/* If it is a pointer, indicate what it points to.
|
||||
|
||||
|
|
@ -626,5 +603,3 @@ chill_value_print (val, stream, format, pretty)
|
|||
return (val_print (type, VALUE_CONTENTS (val), 0,
|
||||
VALUE_ADDRESS (val), stream, format, 1, 0, pretty));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
377
contrib/gdb/gdb/cli-out.c
Normal file
377
contrib/gdb/gdb/cli-out.c
Normal file
|
|
@ -0,0 +1,377 @@
|
|||
/* Output generating routines for GDB CLI.
|
||||
Copyright 1999, 2000 Free Software Foundation, Inc.
|
||||
Contributed by Cygnus Solutions.
|
||||
Written by Fernando Nasser for Cygnus.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "ui-out.h"
|
||||
#include "cli-out.h"
|
||||
#include "gdb_string.h"
|
||||
#include "gdb_assert.h"
|
||||
|
||||
/* Convenience macro for allocting typesafe memory. */
|
||||
|
||||
#ifndef XMALLOC
|
||||
#define XMALLOC(TYPE) (TYPE*) xmalloc (sizeof (TYPE))
|
||||
#endif
|
||||
|
||||
struct ui_out_data
|
||||
{
|
||||
struct ui_file *stream;
|
||||
int suppress_output;
|
||||
};
|
||||
|
||||
/* These are the CLI output functions */
|
||||
|
||||
static void cli_table_begin (struct ui_out *uiout, int nbrofcols,
|
||||
int nr_rows, const char *tblid);
|
||||
static void cli_table_body (struct ui_out *uiout);
|
||||
static void cli_table_end (struct ui_out *uiout);
|
||||
static void cli_table_header (struct ui_out *uiout, int width,
|
||||
enum ui_align alig, const char *col_name,
|
||||
const char *colhdr);
|
||||
static void cli_begin (struct ui_out *uiout, enum ui_out_type type,
|
||||
int level, const char *lstid);
|
||||
static void cli_end (struct ui_out *uiout, enum ui_out_type type, int level);
|
||||
static void cli_field_int (struct ui_out *uiout, int fldno, int width,
|
||||
enum ui_align alig, const char *fldname, int value);
|
||||
static void cli_field_skip (struct ui_out *uiout, int fldno, int width,
|
||||
enum ui_align alig, const char *fldname);
|
||||
static void cli_field_string (struct ui_out *uiout, int fldno, int width,
|
||||
enum ui_align alig, const char *fldname,
|
||||
const char *string);
|
||||
static void cli_field_fmt (struct ui_out *uiout, int fldno,
|
||||
int width, enum ui_align align,
|
||||
const char *fldname, const char *format,
|
||||
va_list args);
|
||||
static void cli_spaces (struct ui_out *uiout, int numspaces);
|
||||
static void cli_text (struct ui_out *uiout, const char *string);
|
||||
static void cli_message (struct ui_out *uiout, int verbosity,
|
||||
const char *format, va_list args);
|
||||
static void cli_wrap_hint (struct ui_out *uiout, char *identstring);
|
||||
static void cli_flush (struct ui_out *uiout);
|
||||
|
||||
/* This is the CLI ui-out implementation functions vector */
|
||||
|
||||
/* FIXME: This can be initialized dynamically after default is set to
|
||||
handle initial output in main.c */
|
||||
|
||||
static struct ui_out_impl cli_ui_out_impl =
|
||||
{
|
||||
cli_table_begin,
|
||||
cli_table_body,
|
||||
cli_table_end,
|
||||
cli_table_header,
|
||||
cli_begin,
|
||||
cli_end,
|
||||
cli_field_int,
|
||||
cli_field_skip,
|
||||
cli_field_string,
|
||||
cli_field_fmt,
|
||||
cli_spaces,
|
||||
cli_text,
|
||||
cli_message,
|
||||
cli_wrap_hint,
|
||||
cli_flush,
|
||||
0, /* Does not need MI hacks (i.e. needs CLI hacks). */
|
||||
};
|
||||
|
||||
/* Prototypes for local functions */
|
||||
|
||||
extern void _initialize_cli_out (void);
|
||||
|
||||
static void field_separator (void);
|
||||
|
||||
static void out_field_fmt (struct ui_out *uiout, int fldno,
|
||||
const char *fldname,
|
||||
const char *format,...);
|
||||
|
||||
/* local variables */
|
||||
|
||||
/* (none yet) */
|
||||
|
||||
/* Mark beginning of a table */
|
||||
|
||||
void
|
||||
cli_table_begin (struct ui_out *uiout, int nbrofcols,
|
||||
int nr_rows,
|
||||
const char *tblid)
|
||||
{
|
||||
struct ui_out_data *data = ui_out_data (uiout);
|
||||
if (nr_rows == 0)
|
||||
data->suppress_output = 1;
|
||||
else
|
||||
/* Only the table suppresses the output and, fortunatly, a table
|
||||
is not a recursive data structure. */
|
||||
gdb_assert (data->suppress_output == 0);
|
||||
}
|
||||
|
||||
/* Mark beginning of a table body */
|
||||
|
||||
void
|
||||
cli_table_body (struct ui_out *uiout)
|
||||
{
|
||||
struct ui_out_data *data = ui_out_data (uiout);
|
||||
if (data->suppress_output)
|
||||
return;
|
||||
/* first, close the table header line */
|
||||
cli_text (uiout, "\n");
|
||||
}
|
||||
|
||||
/* Mark end of a table */
|
||||
|
||||
void
|
||||
cli_table_end (struct ui_out *uiout)
|
||||
{
|
||||
struct ui_out_data *data = ui_out_data (uiout);
|
||||
data->suppress_output = 0;
|
||||
}
|
||||
|
||||
/* Specify table header */
|
||||
|
||||
void
|
||||
cli_table_header (struct ui_out *uiout, int width, enum ui_align alignment,
|
||||
const char *col_name,
|
||||
const char *colhdr)
|
||||
{
|
||||
struct ui_out_data *data = ui_out_data (uiout);
|
||||
if (data->suppress_output)
|
||||
return;
|
||||
cli_field_string (uiout, 0, width, alignment, 0, colhdr);
|
||||
}
|
||||
|
||||
/* Mark beginning of a list */
|
||||
|
||||
void
|
||||
cli_begin (struct ui_out *uiout,
|
||||
enum ui_out_type type,
|
||||
int level,
|
||||
const char *id)
|
||||
{
|
||||
struct ui_out_data *data = ui_out_data (uiout);
|
||||
if (data->suppress_output)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Mark end of a list */
|
||||
|
||||
void
|
||||
cli_end (struct ui_out *uiout,
|
||||
enum ui_out_type type,
|
||||
int level)
|
||||
{
|
||||
struct ui_out_data *data = ui_out_data (uiout);
|
||||
if (data->suppress_output)
|
||||
return;
|
||||
}
|
||||
|
||||
/* output an int field */
|
||||
|
||||
void
|
||||
cli_field_int (struct ui_out *uiout, int fldno, int width,
|
||||
enum ui_align alignment,
|
||||
const char *fldname, int value)
|
||||
{
|
||||
char buffer[20]; /* FIXME: how many chars long a %d can become? */
|
||||
|
||||
struct ui_out_data *data = ui_out_data (uiout);
|
||||
if (data->suppress_output)
|
||||
return;
|
||||
sprintf (buffer, "%d", value);
|
||||
cli_field_string (uiout, fldno, width, alignment, fldname, buffer);
|
||||
}
|
||||
|
||||
/* used to ommit a field */
|
||||
|
||||
void
|
||||
cli_field_skip (struct ui_out *uiout, int fldno, int width,
|
||||
enum ui_align alignment,
|
||||
const char *fldname)
|
||||
{
|
||||
struct ui_out_data *data = ui_out_data (uiout);
|
||||
if (data->suppress_output)
|
||||
return;
|
||||
cli_field_string (uiout, fldno, width, alignment, fldname, "");
|
||||
}
|
||||
|
||||
/* other specific cli_field_* end up here so alignment and field
|
||||
separators are both handled by cli_field_string */
|
||||
|
||||
void
|
||||
cli_field_string (struct ui_out *uiout,
|
||||
int fldno,
|
||||
int width,
|
||||
enum ui_align align,
|
||||
const char *fldname,
|
||||
const char *string)
|
||||
{
|
||||
int before = 0;
|
||||
int after = 0;
|
||||
|
||||
struct ui_out_data *data = ui_out_data (uiout);
|
||||
if (data->suppress_output)
|
||||
return;
|
||||
|
||||
if ((align != ui_noalign) && string)
|
||||
{
|
||||
before = width - strlen (string);
|
||||
if (before <= 0)
|
||||
before = 0;
|
||||
else
|
||||
{
|
||||
if (align == ui_right)
|
||||
after = 0;
|
||||
else if (align == ui_left)
|
||||
{
|
||||
after = before;
|
||||
before = 0;
|
||||
}
|
||||
else
|
||||
/* ui_center */
|
||||
{
|
||||
after = before / 2;
|
||||
before -= after;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (before)
|
||||
ui_out_spaces (uiout, before);
|
||||
if (string)
|
||||
out_field_fmt (uiout, fldno, fldname, "%s", string);
|
||||
if (after)
|
||||
ui_out_spaces (uiout, after);
|
||||
|
||||
if (align != ui_noalign)
|
||||
field_separator ();
|
||||
}
|
||||
|
||||
/* This is the only field function that does not align */
|
||||
|
||||
void
|
||||
cli_field_fmt (struct ui_out *uiout, int fldno,
|
||||
int width, enum ui_align align,
|
||||
const char *fldname,
|
||||
const char *format,
|
||||
va_list args)
|
||||
{
|
||||
struct ui_out_data *data = ui_out_data (uiout);
|
||||
if (data->suppress_output)
|
||||
return;
|
||||
|
||||
vfprintf_filtered (data->stream, format, args);
|
||||
|
||||
if (align != ui_noalign)
|
||||
field_separator ();
|
||||
}
|
||||
|
||||
void
|
||||
cli_spaces (struct ui_out *uiout, int numspaces)
|
||||
{
|
||||
struct ui_out_data *data = ui_out_data (uiout);
|
||||
if (data->suppress_output)
|
||||
return;
|
||||
print_spaces_filtered (numspaces, data->stream);
|
||||
}
|
||||
|
||||
void
|
||||
cli_text (struct ui_out *uiout, const char *string)
|
||||
{
|
||||
struct ui_out_data *data = ui_out_data (uiout);
|
||||
if (data->suppress_output)
|
||||
return;
|
||||
fputs_filtered (string, data->stream);
|
||||
}
|
||||
|
||||
void
|
||||
cli_message (struct ui_out *uiout, int verbosity,
|
||||
const char *format, va_list args)
|
||||
{
|
||||
struct ui_out_data *data = ui_out_data (uiout);
|
||||
if (data->suppress_output)
|
||||
return;
|
||||
if (ui_out_get_verblvl (uiout) >= verbosity)
|
||||
vfprintf_unfiltered (data->stream, format, args);
|
||||
}
|
||||
|
||||
void
|
||||
cli_wrap_hint (struct ui_out *uiout, char *identstring)
|
||||
{
|
||||
struct ui_out_data *data = ui_out_data (uiout);
|
||||
if (data->suppress_output)
|
||||
return;
|
||||
wrap_here (identstring);
|
||||
}
|
||||
|
||||
void
|
||||
cli_flush (struct ui_out *uiout)
|
||||
{
|
||||
struct ui_out_data *data = ui_out_data (uiout);
|
||||
gdb_flush (data->stream);
|
||||
}
|
||||
|
||||
/* local functions */
|
||||
|
||||
/* Like cli_field_fmt, but takes a variable number of args
|
||||
and makes a va_list and does not insert a separator */
|
||||
|
||||
/* VARARGS */
|
||||
static void
|
||||
out_field_fmt (struct ui_out *uiout, int fldno,
|
||||
const char *fldname,
|
||||
const char *format,...)
|
||||
{
|
||||
struct ui_out_data *data = ui_out_data (uiout);
|
||||
va_list args;
|
||||
|
||||
va_start (args, format);
|
||||
vfprintf_filtered (data->stream, format, args);
|
||||
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
/* access to ui_out format private members */
|
||||
|
||||
static void
|
||||
field_separator (void)
|
||||
{
|
||||
struct ui_out_data *data = ui_out_data (uiout);
|
||||
fputc_filtered (' ', data->stream);
|
||||
}
|
||||
|
||||
/* initalize private members at startup */
|
||||
|
||||
struct ui_out *
|
||||
cli_out_new (struct ui_file *stream)
|
||||
{
|
||||
int flags = ui_source_list;
|
||||
|
||||
struct ui_out_data *data = XMALLOC (struct ui_out_data);
|
||||
data->stream = stream;
|
||||
data->suppress_output = 0;
|
||||
return ui_out_new (&cli_ui_out_impl, data, flags);
|
||||
}
|
||||
|
||||
/* standard gdb initialization hook */
|
||||
void
|
||||
_initialize_cli_out (void)
|
||||
{
|
||||
/* nothing needs to be done */
|
||||
}
|
||||
27
contrib/gdb/gdb/cli-out.h
Normal file
27
contrib/gdb/gdb/cli-out.h
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/* Output generating routines for GDB CLI.
|
||||
Copyright 1999, 2000 Free Software Foundation, Inc.
|
||||
Contributed by Cygnus Solutions.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef CLI_OUT_H
|
||||
#define CLI_OUT_H
|
||||
|
||||
extern struct ui_out *cli_out_new (struct ui_file *stream);
|
||||
|
||||
#endif
|
||||
826
contrib/gdb/gdb/cli/cli-cmds.c
Normal file
826
contrib/gdb/gdb/cli/cli-cmds.c
Normal file
|
|
@ -0,0 +1,826 @@
|
|||
/* GDB CLI commands.
|
||||
|
||||
Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "completer.h"
|
||||
#include "target.h" /* For baud_rate, remote_debug and remote_timeout */
|
||||
#include "gdb_wait.h" /* For shell escape implementation */
|
||||
#include "gdb_regex.h" /* Used by apropos_command */
|
||||
#include "filenames.h" /* for DOSish file names */
|
||||
|
||||
#include "ui-out.h"
|
||||
|
||||
#include "top.h"
|
||||
#include "cli/cli-decode.h"
|
||||
#include "cli/cli-script.h"
|
||||
#include "cli/cli-setshow.h"
|
||||
#include "cli/cli-cmds.h"
|
||||
|
||||
#ifndef GDBINIT_FILENAME
|
||||
#define GDBINIT_FILENAME ".gdbinit"
|
||||
#endif
|
||||
|
||||
/* From gdb/top.c */
|
||||
|
||||
extern void dont_repeat (void);
|
||||
|
||||
extern void set_verbose (char *, int, struct cmd_list_element *);
|
||||
|
||||
extern void show_history (char *, int);
|
||||
|
||||
extern void set_history (char *, int);
|
||||
|
||||
extern void show_commands (char *, int);
|
||||
|
||||
/* Prototypes for local functions */
|
||||
|
||||
static void complete_command (char *, int);
|
||||
|
||||
static void echo_command (char *, int);
|
||||
|
||||
static void pwd_command (char *, int);
|
||||
|
||||
static void show_version (char *, int);
|
||||
|
||||
static void validate_comname (char *);
|
||||
|
||||
static void help_command (char *, int);
|
||||
|
||||
static void show_command (char *, int);
|
||||
|
||||
static void info_command (char *, int);
|
||||
|
||||
static void show_debug (char *, int);
|
||||
|
||||
static void set_debug (char *, int);
|
||||
|
||||
static void show_user (char *, int);
|
||||
|
||||
static void make_command (char *, int);
|
||||
|
||||
static void shell_escape (char *, int);
|
||||
|
||||
void apropos_command (char *, int);
|
||||
|
||||
/* Define all cmd_list_elements. */
|
||||
|
||||
/* Chain containing all defined commands. */
|
||||
|
||||
struct cmd_list_element *cmdlist;
|
||||
|
||||
/* Chain containing all defined info subcommands. */
|
||||
|
||||
struct cmd_list_element *infolist;
|
||||
|
||||
/* Chain containing all defined enable subcommands. */
|
||||
|
||||
struct cmd_list_element *enablelist;
|
||||
|
||||
/* Chain containing all defined disable subcommands. */
|
||||
|
||||
struct cmd_list_element *disablelist;
|
||||
|
||||
/* Chain containing all defined toggle subcommands. */
|
||||
|
||||
struct cmd_list_element *togglelist;
|
||||
|
||||
/* Chain containing all defined stop subcommands. */
|
||||
|
||||
struct cmd_list_element *stoplist;
|
||||
|
||||
/* Chain containing all defined delete subcommands. */
|
||||
|
||||
struct cmd_list_element *deletelist;
|
||||
|
||||
/* Chain containing all defined "enable breakpoint" subcommands. */
|
||||
|
||||
struct cmd_list_element *enablebreaklist;
|
||||
|
||||
/* Chain containing all defined set subcommands */
|
||||
|
||||
struct cmd_list_element *setlist;
|
||||
|
||||
/* Chain containing all defined unset subcommands */
|
||||
|
||||
struct cmd_list_element *unsetlist;
|
||||
|
||||
/* Chain containing all defined show subcommands. */
|
||||
|
||||
struct cmd_list_element *showlist;
|
||||
|
||||
/* Chain containing all defined \"set history\". */
|
||||
|
||||
struct cmd_list_element *sethistlist;
|
||||
|
||||
/* Chain containing all defined \"show history\". */
|
||||
|
||||
struct cmd_list_element *showhistlist;
|
||||
|
||||
/* Chain containing all defined \"unset history\". */
|
||||
|
||||
struct cmd_list_element *unsethistlist;
|
||||
|
||||
/* Chain containing all defined maintenance subcommands. */
|
||||
|
||||
struct cmd_list_element *maintenancelist;
|
||||
|
||||
/* Chain containing all defined "maintenance info" subcommands. */
|
||||
|
||||
struct cmd_list_element *maintenanceinfolist;
|
||||
|
||||
/* Chain containing all defined "maintenance print" subcommands. */
|
||||
|
||||
struct cmd_list_element *maintenanceprintlist;
|
||||
|
||||
struct cmd_list_element *setprintlist;
|
||||
|
||||
struct cmd_list_element *showprintlist;
|
||||
|
||||
struct cmd_list_element *setdebuglist;
|
||||
|
||||
struct cmd_list_element *showdebuglist;
|
||||
|
||||
struct cmd_list_element *setchecklist;
|
||||
|
||||
struct cmd_list_element *showchecklist;
|
||||
|
||||
/* Utility used everywhere when at least one argument is needed and
|
||||
none is supplied. */
|
||||
|
||||
void
|
||||
error_no_arg (char *why)
|
||||
{
|
||||
error ("Argument required (%s).", why);
|
||||
}
|
||||
|
||||
/* The "info" command is defined as a prefix, with allow_unknown = 0.
|
||||
Therefore, its own definition is called only for "info" with no args. */
|
||||
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
info_command (char *arg, int from_tty)
|
||||
{
|
||||
printf_unfiltered ("\"info\" must be followed by the name of an info command.\n");
|
||||
help_list (infolist, "info ", -1, gdb_stdout);
|
||||
}
|
||||
|
||||
/* The "show" command with no arguments shows all the settings. */
|
||||
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
show_command (char *arg, int from_tty)
|
||||
{
|
||||
cmd_show_list (showlist, from_tty, "");
|
||||
}
|
||||
|
||||
/* Provide documentation on command or list given by COMMAND. FROM_TTY
|
||||
is ignored. */
|
||||
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
help_command (char *command, int from_tty)
|
||||
{
|
||||
help_cmd (command, gdb_stdout);
|
||||
}
|
||||
|
||||
/* String compare function for qsort. */
|
||||
static int
|
||||
compare_strings (const void *arg1, const void *arg2)
|
||||
{
|
||||
const char **s1 = (const char **) arg1;
|
||||
const char **s2 = (const char **) arg2;
|
||||
return strcmp (*s1, *s2);
|
||||
}
|
||||
|
||||
/* The "complete" command is used by Emacs to implement completion. */
|
||||
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
complete_command (char *arg, int from_tty)
|
||||
{
|
||||
int i;
|
||||
int argpoint;
|
||||
char **completions;
|
||||
|
||||
dont_repeat ();
|
||||
|
||||
if (arg == NULL)
|
||||
arg = "";
|
||||
argpoint = strlen (arg);
|
||||
|
||||
completions = complete_line (arg, arg, argpoint);
|
||||
|
||||
if (completions)
|
||||
{
|
||||
int item, size;
|
||||
|
||||
for (size = 0; completions[size]; ++size)
|
||||
;
|
||||
qsort (completions, size, sizeof (char *), compare_strings);
|
||||
|
||||
/* We do extra processing here since we only want to print each
|
||||
unique item once. */
|
||||
item = 0;
|
||||
while (item < size)
|
||||
{
|
||||
int next_item;
|
||||
printf_unfiltered ("%s\n", completions[item]);
|
||||
next_item = item + 1;
|
||||
while (next_item < size
|
||||
&& ! strcmp (completions[item], completions[next_item]))
|
||||
{
|
||||
xfree (completions[next_item]);
|
||||
++next_item;
|
||||
}
|
||||
|
||||
xfree (completions[item]);
|
||||
item = next_item;
|
||||
}
|
||||
|
||||
xfree (completions);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
is_complete_command (struct cmd_list_element *c)
|
||||
{
|
||||
return cmd_cfunc_eq (c, complete_command);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
show_version (char *args, int from_tty)
|
||||
{
|
||||
immediate_quit++;
|
||||
print_gdb_version (gdb_stdout);
|
||||
printf_filtered ("\n");
|
||||
immediate_quit--;
|
||||
}
|
||||
|
||||
/* Handle the quit command. */
|
||||
|
||||
void
|
||||
quit_command (char *args, int from_tty)
|
||||
{
|
||||
if (!quit_confirm ())
|
||||
error ("Not confirmed.");
|
||||
quit_force (args, from_tty);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
pwd_command (char *args, int from_tty)
|
||||
{
|
||||
if (args)
|
||||
error ("The \"pwd\" command does not take an argument: %s", args);
|
||||
getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
|
||||
|
||||
if (!STREQ (gdb_dirbuf, current_directory))
|
||||
printf_unfiltered ("Working directory %s\n (canonically %s).\n",
|
||||
current_directory, gdb_dirbuf);
|
||||
else
|
||||
printf_unfiltered ("Working directory %s.\n", current_directory);
|
||||
}
|
||||
|
||||
void
|
||||
cd_command (char *dir, int from_tty)
|
||||
{
|
||||
int len;
|
||||
/* Found something other than leading repetitions of "/..". */
|
||||
int found_real_path;
|
||||
char *p;
|
||||
|
||||
/* If the new directory is absolute, repeat is a no-op; if relative,
|
||||
repeat might be useful but is more likely to be a mistake. */
|
||||
dont_repeat ();
|
||||
|
||||
if (dir == 0)
|
||||
error_no_arg ("new working directory");
|
||||
|
||||
dir = tilde_expand (dir);
|
||||
make_cleanup (xfree, dir);
|
||||
|
||||
if (chdir (dir) < 0)
|
||||
perror_with_name (dir);
|
||||
|
||||
#ifdef HAVE_DOS_BASED_FILE_SYSTEM
|
||||
/* There's too much mess with DOSish names like "d:", "d:.",
|
||||
"d:./foo" etc. Instead of having lots of special #ifdef'ed code,
|
||||
simply get the canonicalized name of the current directory. */
|
||||
dir = getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
|
||||
#endif
|
||||
|
||||
len = strlen (dir);
|
||||
if (IS_DIR_SEPARATOR (dir[len - 1]))
|
||||
{
|
||||
/* Remove the trailing slash unless this is a root directory
|
||||
(including a drive letter on non-Unix systems). */
|
||||
if (!(len == 1) /* "/" */
|
||||
#ifdef HAVE_DOS_BASED_FILE_SYSTEM
|
||||
&& !(len == 3 && dir[1] == ':') /* "d:/" */
|
||||
#endif
|
||||
)
|
||||
len--;
|
||||
}
|
||||
|
||||
dir = savestring (dir, len);
|
||||
if (IS_ABSOLUTE_PATH (dir))
|
||||
current_directory = dir;
|
||||
else
|
||||
{
|
||||
if (IS_DIR_SEPARATOR (current_directory[strlen (current_directory) - 1]))
|
||||
current_directory = concat (current_directory, dir, NULL);
|
||||
else
|
||||
current_directory = concat (current_directory, SLASH_STRING, dir, NULL);
|
||||
xfree (dir);
|
||||
}
|
||||
|
||||
/* Now simplify any occurrences of `.' and `..' in the pathname. */
|
||||
|
||||
found_real_path = 0;
|
||||
for (p = current_directory; *p;)
|
||||
{
|
||||
if (IS_DIR_SEPARATOR (p[0]) && p[1] == '.'
|
||||
&& (p[2] == 0 || IS_DIR_SEPARATOR (p[2])))
|
||||
strcpy (p, p + 2);
|
||||
else if (IS_DIR_SEPARATOR (p[0]) && p[1] == '.' && p[2] == '.'
|
||||
&& (p[3] == 0 || IS_DIR_SEPARATOR (p[3])))
|
||||
{
|
||||
if (found_real_path)
|
||||
{
|
||||
/* Search backwards for the directory just before the "/.."
|
||||
and obliterate it and the "/..". */
|
||||
char *q = p;
|
||||
while (q != current_directory && !IS_DIR_SEPARATOR (q[-1]))
|
||||
--q;
|
||||
|
||||
if (q == current_directory)
|
||||
/* current_directory is
|
||||
a relative pathname ("can't happen"--leave it alone). */
|
||||
++p;
|
||||
else
|
||||
{
|
||||
strcpy (q - 1, p + 3);
|
||||
p = q - 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
/* We are dealing with leading repetitions of "/..", for example
|
||||
"/../..", which is the Mach super-root. */
|
||||
p += 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
found_real_path = 1;
|
||||
++p;
|
||||
}
|
||||
}
|
||||
|
||||
forget_cached_source_info ();
|
||||
|
||||
if (from_tty)
|
||||
pwd_command ((char *) 0, 1);
|
||||
}
|
||||
|
||||
void
|
||||
source_command (char *args, int from_tty)
|
||||
{
|
||||
FILE *stream;
|
||||
struct cleanup *old_cleanups;
|
||||
char *file = args;
|
||||
|
||||
if (file == NULL)
|
||||
{
|
||||
error ("source command requires pathname of file to source.");
|
||||
}
|
||||
|
||||
file = tilde_expand (file);
|
||||
old_cleanups = make_cleanup (xfree, file);
|
||||
|
||||
stream = fopen (file, FOPEN_RT);
|
||||
if (!stream)
|
||||
{
|
||||
if (from_tty)
|
||||
perror_with_name (file);
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
script_from_file (stream, file);
|
||||
|
||||
do_cleanups (old_cleanups);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
echo_command (char *text, int from_tty)
|
||||
{
|
||||
char *p = text;
|
||||
register int c;
|
||||
|
||||
if (text)
|
||||
while ((c = *p++) != '\0')
|
||||
{
|
||||
if (c == '\\')
|
||||
{
|
||||
/* \ at end of argument is used after spaces
|
||||
so they won't be lost. */
|
||||
if (*p == 0)
|
||||
return;
|
||||
|
||||
c = parse_escape (&p);
|
||||
if (c >= 0)
|
||||
printf_filtered ("%c", c);
|
||||
}
|
||||
else
|
||||
printf_filtered ("%c", c);
|
||||
}
|
||||
|
||||
/* Force this output to appear now. */
|
||||
wrap_here ("");
|
||||
gdb_flush (gdb_stdout);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
shell_escape (char *arg, int from_tty)
|
||||
{
|
||||
#ifdef CANT_FORK
|
||||
/* If ARG is NULL, they want an inferior shell, but `system' just
|
||||
reports if the shell is available when passed a NULL arg. */
|
||||
int rc = system (arg ? arg : "");
|
||||
|
||||
if (!arg)
|
||||
arg = "inferior shell";
|
||||
|
||||
if (rc == -1)
|
||||
{
|
||||
fprintf_unfiltered (gdb_stderr, "Cannot execute %s: %s\n", arg,
|
||||
safe_strerror (errno));
|
||||
gdb_flush (gdb_stderr);
|
||||
}
|
||||
else if (rc)
|
||||
{
|
||||
fprintf_unfiltered (gdb_stderr, "%s exited with status %d\n", arg, rc);
|
||||
gdb_flush (gdb_stderr);
|
||||
}
|
||||
#ifdef GLOBAL_CURDIR
|
||||
/* Make sure to return to the directory GDB thinks it is, in case the
|
||||
shell command we just ran changed it. */
|
||||
chdir (current_directory);
|
||||
#endif
|
||||
#else /* Can fork. */
|
||||
int rc, status, pid;
|
||||
char *p, *user_shell;
|
||||
|
||||
if ((user_shell = (char *) getenv ("SHELL")) == NULL)
|
||||
user_shell = "/bin/sh";
|
||||
|
||||
/* Get the name of the shell for arg0 */
|
||||
if ((p = strrchr (user_shell, '/')) == NULL)
|
||||
p = user_shell;
|
||||
else
|
||||
p++; /* Get past '/' */
|
||||
|
||||
if ((pid = fork ()) == 0)
|
||||
{
|
||||
if (!arg)
|
||||
execl (user_shell, p, 0);
|
||||
else
|
||||
execl (user_shell, p, "-c", arg, 0);
|
||||
|
||||
fprintf_unfiltered (gdb_stderr, "Cannot execute %s: %s\n", user_shell,
|
||||
safe_strerror (errno));
|
||||
gdb_flush (gdb_stderr);
|
||||
_exit (0177);
|
||||
}
|
||||
|
||||
if (pid != -1)
|
||||
while ((rc = wait (&status)) != pid && rc != -1)
|
||||
;
|
||||
else
|
||||
error ("Fork failed");
|
||||
#endif /* Can fork. */
|
||||
}
|
||||
|
||||
static void
|
||||
make_command (char *arg, int from_tty)
|
||||
{
|
||||
char *p;
|
||||
|
||||
if (arg == 0)
|
||||
p = "make";
|
||||
else
|
||||
{
|
||||
p = xmalloc (sizeof ("make ") + strlen (arg));
|
||||
strcpy (p, "make ");
|
||||
strcpy (p + sizeof ("make ") - 1, arg);
|
||||
}
|
||||
|
||||
shell_escape (p, from_tty);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
show_user (char *args, int from_tty)
|
||||
{
|
||||
struct cmd_list_element *c;
|
||||
extern struct cmd_list_element *cmdlist;
|
||||
|
||||
if (args)
|
||||
{
|
||||
c = lookup_cmd (&args, cmdlist, "", 0, 1);
|
||||
if (c->class != class_user)
|
||||
error ("Not a user command.");
|
||||
show_user_1 (c, gdb_stdout);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (c = cmdlist; c; c = c->next)
|
||||
{
|
||||
if (c->class == class_user)
|
||||
show_user_1 (c, gdb_stdout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Search through names of commands and documentations for a certain
|
||||
regular expression.
|
||||
*/
|
||||
void
|
||||
apropos_command (char *searchstr, int from_tty)
|
||||
{
|
||||
extern struct cmd_list_element *cmdlist; /*This is the main command list*/
|
||||
regex_t pattern;
|
||||
char *pattern_fastmap;
|
||||
char errorbuffer[512];
|
||||
pattern_fastmap = xcalloc (256, sizeof (char));
|
||||
if (searchstr == NULL)
|
||||
error("REGEXP string is empty");
|
||||
|
||||
if (regcomp(&pattern,searchstr,REG_ICASE) == 0)
|
||||
{
|
||||
pattern.fastmap=pattern_fastmap;
|
||||
re_compile_fastmap(&pattern);
|
||||
apropos_cmd (gdb_stdout,cmdlist,&pattern,"");
|
||||
}
|
||||
else
|
||||
{
|
||||
regerror(regcomp(&pattern,searchstr,REG_ICASE),NULL,errorbuffer,512);
|
||||
error("Error in regular expression:%s",errorbuffer);
|
||||
}
|
||||
xfree (pattern_fastmap);
|
||||
}
|
||||
|
||||
static void
|
||||
set_debug (char *arg, int from_tty)
|
||||
{
|
||||
printf_unfiltered ("\"set debug\" must be followed by the name of a print subcommand.\n");
|
||||
help_list (setdebuglist, "set debug ", -1, gdb_stdout);
|
||||
}
|
||||
|
||||
static void
|
||||
show_debug (char *args, int from_tty)
|
||||
{
|
||||
cmd_show_list (showdebuglist, from_tty, "");
|
||||
}
|
||||
|
||||
void
|
||||
init_cmd_lists (void)
|
||||
{
|
||||
cmdlist = NULL;
|
||||
infolist = NULL;
|
||||
enablelist = NULL;
|
||||
disablelist = NULL;
|
||||
togglelist = NULL;
|
||||
stoplist = NULL;
|
||||
deletelist = NULL;
|
||||
enablebreaklist = NULL;
|
||||
setlist = NULL;
|
||||
unsetlist = NULL;
|
||||
showlist = NULL;
|
||||
sethistlist = NULL;
|
||||
showhistlist = NULL;
|
||||
unsethistlist = NULL;
|
||||
maintenancelist = NULL;
|
||||
maintenanceinfolist = NULL;
|
||||
maintenanceprintlist = NULL;
|
||||
setprintlist = NULL;
|
||||
showprintlist = NULL;
|
||||
setchecklist = NULL;
|
||||
showchecklist = NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
init_cli_cmds (void)
|
||||
{
|
||||
struct cmd_list_element *c;
|
||||
|
||||
/* Define the classes of commands.
|
||||
They will appear in the help list in the reverse of this order. */
|
||||
|
||||
add_cmd ("internals", class_maintenance, NULL,
|
||||
"Maintenance commands.\n\
|
||||
Some gdb commands are provided just for use by gdb maintainers.\n\
|
||||
These commands are subject to frequent change, and may not be as\n\
|
||||
well documented as user commands.",
|
||||
&cmdlist);
|
||||
add_cmd ("obscure", class_obscure, NULL, "Obscure features.", &cmdlist);
|
||||
add_cmd ("aliases", class_alias, NULL, "Aliases of other commands.", &cmdlist);
|
||||
add_cmd ("user-defined", class_user, NULL, "User-defined commands.\n\
|
||||
The commands in this class are those defined by the user.\n\
|
||||
Use the \"define\" command to define a command.", &cmdlist);
|
||||
add_cmd ("support", class_support, NULL, "Support facilities.", &cmdlist);
|
||||
if (!dbx_commands)
|
||||
add_cmd ("status", class_info, NULL, "Status inquiries.", &cmdlist);
|
||||
add_cmd ("files", class_files, NULL, "Specifying and examining files.", &cmdlist);
|
||||
add_cmd ("breakpoints", class_breakpoint, NULL, "Making program stop at certain points.", &cmdlist);
|
||||
add_cmd ("data", class_vars, NULL, "Examining data.", &cmdlist);
|
||||
add_cmd ("stack", class_stack, NULL, "Examining the stack.\n\
|
||||
The stack is made up of stack frames. Gdb assigns numbers to stack frames\n\
|
||||
counting from zero for the innermost (currently executing) frame.\n\n\
|
||||
At any time gdb identifies one frame as the \"selected\" frame.\n\
|
||||
Variable lookups are done with respect to the selected frame.\n\
|
||||
When the program being debugged stops, gdb selects the innermost frame.\n\
|
||||
The commands below can be used to select other frames by number or address.",
|
||||
&cmdlist);
|
||||
add_cmd ("running", class_run, NULL, "Running the program.", &cmdlist);
|
||||
|
||||
/* Define general commands. */
|
||||
|
||||
add_com ("pwd", class_files, pwd_command,
|
||||
"Print working directory. This is used for your program as well.");
|
||||
c = add_cmd ("cd", class_files, cd_command,
|
||||
"Set working directory to DIR for debugger and program being debugged.\n\
|
||||
The change does not take effect for the program being debugged\n\
|
||||
until the next time it is started.", &cmdlist);
|
||||
c->completer = filename_completer;
|
||||
|
||||
add_com ("echo", class_support, echo_command,
|
||||
"Print a constant string. Give string as argument.\n\
|
||||
C escape sequences may be used in the argument.\n\
|
||||
No newline is added at the end of the argument;\n\
|
||||
use \"\\n\" if you want a newline to be printed.\n\
|
||||
Since leading and trailing whitespace are ignored in command arguments,\n\
|
||||
if you want to print some you must use \"\\\" before leading whitespace\n\
|
||||
to be printed or after trailing whitespace.");
|
||||
add_com ("document", class_support, document_command,
|
||||
"Document a user-defined command.\n\
|
||||
Give command name as argument. Give documentation on following lines.\n\
|
||||
End with a line of just \"end\".");
|
||||
add_com ("define", class_support, define_command,
|
||||
"Define a new command name. Command name is argument.\n\
|
||||
Definition appears on following lines, one command per line.\n\
|
||||
End with a line of just \"end\".\n\
|
||||
Use the \"document\" command to give documentation for the new command.\n\
|
||||
Commands defined in this way may have up to ten arguments.");
|
||||
|
||||
c = add_cmd ("source", class_support, source_command,
|
||||
"Read commands from a file named FILE.\n\
|
||||
Note that the file \"" GDBINIT_FILENAME "\" is read automatically in this way\n\
|
||||
when gdb is started.", &cmdlist);
|
||||
c->completer = filename_completer;
|
||||
|
||||
add_com ("quit", class_support, quit_command, "Exit gdb.");
|
||||
c = add_com ("help", class_support, help_command, "Print list of commands.");
|
||||
c->completer = command_completer;
|
||||
add_com_alias ("q", "quit", class_support, 1);
|
||||
add_com_alias ("h", "help", class_support, 1);
|
||||
|
||||
c = add_set_cmd ("verbose", class_support, var_boolean, (char *) &info_verbose,
|
||||
"Set ",
|
||||
&setlist),
|
||||
add_show_from_set (c, &showlist);
|
||||
set_cmd_sfunc (c, set_verbose);
|
||||
set_verbose (NULL, 0, c);
|
||||
|
||||
add_prefix_cmd ("history", class_support, set_history,
|
||||
"Generic command for setting command history parameters.",
|
||||
&sethistlist, "set history ", 0, &setlist);
|
||||
add_prefix_cmd ("history", class_support, show_history,
|
||||
"Generic command for showing command history parameters.",
|
||||
&showhistlist, "show history ", 0, &showlist);
|
||||
|
||||
add_show_from_set
|
||||
(add_set_cmd ("expansion", no_class, var_boolean, (char *) &history_expansion_p,
|
||||
"Set history expansion on command input.\n\
|
||||
Without an argument, history expansion is enabled.", &sethistlist),
|
||||
&showhistlist);
|
||||
|
||||
add_prefix_cmd ("info", class_info, info_command,
|
||||
"Generic command for showing things about the program being debugged.",
|
||||
&infolist, "info ", 0, &cmdlist);
|
||||
add_com_alias ("i", "info", class_info, 1);
|
||||
|
||||
add_com ("complete", class_obscure, complete_command,
|
||||
"List the completions for the rest of the line as a command.");
|
||||
|
||||
add_prefix_cmd ("show", class_info, show_command,
|
||||
"Generic command for showing things about the debugger.",
|
||||
&showlist, "show ", 0, &cmdlist);
|
||||
/* Another way to get at the same thing. */
|
||||
add_info ("set", show_command, "Show all GDB settings.");
|
||||
|
||||
add_cmd ("commands", no_class, show_commands,
|
||||
"Show the history of commands you typed.\n\
|
||||
You can supply a command number to start with, or a `+' to start after\n\
|
||||
the previous command number shown.",
|
||||
&showlist);
|
||||
|
||||
add_cmd ("version", no_class, show_version,
|
||||
"Show what version of GDB this is.", &showlist);
|
||||
|
||||
add_com ("while", class_support, while_command,
|
||||
"Execute nested commands WHILE the conditional expression is non zero.\n\
|
||||
The conditional expression must follow the word `while' and must in turn be\n\
|
||||
followed by a new line. The nested commands must be entered one per line,\n\
|
||||
and should be terminated by the word `end'.");
|
||||
|
||||
add_com ("if", class_support, if_command,
|
||||
"Execute nested commands once IF the conditional expression is non zero.\n\
|
||||
The conditional expression must follow the word `if' and must in turn be\n\
|
||||
followed by a new line. The nested commands must be entered one per line,\n\
|
||||
and should be terminated by the word 'else' or `end'. If an else clause\n\
|
||||
is used, the same rules apply to its nested commands as to the first ones.");
|
||||
|
||||
/* If target is open when baud changes, it doesn't take effect until the
|
||||
next open (I think, not sure). */
|
||||
add_show_from_set (add_set_cmd ("remotebaud", no_class,
|
||||
var_zinteger, (char *) &baud_rate,
|
||||
"Set baud rate for remote serial I/O.\n\
|
||||
This value is used to set the speed of the serial port when debugging\n\
|
||||
using remote targets.", &setlist),
|
||||
&showlist);
|
||||
|
||||
c = add_set_cmd ("remotedebug", no_class, var_zinteger,
|
||||
(char *) &remote_debug,
|
||||
"Set debugging of remote protocol.\n\
|
||||
When enabled, each packet sent or received with the remote target\n\
|
||||
is displayed.", &setlist);
|
||||
deprecate_cmd (c, "set debug remote");
|
||||
deprecate_cmd (add_show_from_set (c, &showlist), "show debug remote");
|
||||
|
||||
add_show_from_set (add_set_cmd ("remote", no_class, var_zinteger,
|
||||
(char *) &remote_debug,
|
||||
"Set debugging of remote protocol.\n\
|
||||
When enabled, each packet sent or received with the remote target\n\
|
||||
is displayed.", &setdebuglist),
|
||||
&showdebuglist);
|
||||
|
||||
add_show_from_set (
|
||||
add_set_cmd ("remotetimeout", no_class, var_integer, (char *) &remote_timeout,
|
||||
"Set timeout limit to wait for target to respond.\n\
|
||||
This value is used to set the time limit for gdb to wait for a response\n\
|
||||
from the target.", &setlist),
|
||||
&showlist);
|
||||
|
||||
add_prefix_cmd ("debug", no_class, set_debug,
|
||||
"Generic command for setting gdb debugging flags",
|
||||
&setdebuglist, "set debug ", 0, &setlist);
|
||||
|
||||
add_prefix_cmd ("debug", no_class, show_debug,
|
||||
"Generic command for showing gdb debugging flags",
|
||||
&showdebuglist, "show debug ", 0, &showlist);
|
||||
|
||||
c = add_com ("shell", class_support, shell_escape,
|
||||
"Execute the rest of the line as a shell command. \n\
|
||||
With no arguments, run an inferior shell.");
|
||||
c->completer = filename_completer;
|
||||
|
||||
/* NOTE: cagney/2000-03-20: Being able to enter ``(gdb) !ls'' would
|
||||
be a really useful feature. Unfortunately, the below wont do
|
||||
this. Instead it adds support for the form ``(gdb) ! ls''
|
||||
(i.e. the space is required). If the ``!'' command below is
|
||||
added the complains about no ``!'' command would be replaced by
|
||||
complains about how the ``!'' command is broken :-) */
|
||||
if (xdb_commands)
|
||||
add_com_alias ("!", "shell", class_support, 0);
|
||||
|
||||
c = add_com ("make", class_support, make_command,
|
||||
"Run the ``make'' program using the rest of the line as arguments.");
|
||||
c->completer = filename_completer;
|
||||
add_cmd ("user", no_class, show_user,
|
||||
"Show definitions of user defined commands.\n\
|
||||
Argument is the name of the user defined command.\n\
|
||||
With no argument, show definitions of all user defined commands.", &showlist);
|
||||
add_com ("apropos", class_support, apropos_command, "Search for commands matching a REGEXP");
|
||||
}
|
||||
125
contrib/gdb/gdb/cli/cli-cmds.h
Normal file
125
contrib/gdb/gdb/cli/cli-cmds.h
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
/* Header file for GDB CLI command implementation library.
|
||||
Copyright 2000 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#if !defined (CLI_CMDS_H)
|
||||
#define CLI_CMDS_H 1
|
||||
|
||||
/* Chain containing all defined commands. */
|
||||
|
||||
extern struct cmd_list_element *cmdlist;
|
||||
|
||||
/* Chain containing all defined info subcommands. */
|
||||
|
||||
extern struct cmd_list_element *infolist;
|
||||
|
||||
/* Chain containing all defined enable subcommands. */
|
||||
|
||||
extern struct cmd_list_element *enablelist;
|
||||
|
||||
/* Chain containing all defined disable subcommands. */
|
||||
|
||||
extern struct cmd_list_element *disablelist;
|
||||
|
||||
/* Chain containing all defined delete subcommands. */
|
||||
|
||||
extern struct cmd_list_element *deletelist;
|
||||
|
||||
/* Chain containing all defined toggle subcommands. */
|
||||
|
||||
extern struct cmd_list_element *togglelist;
|
||||
|
||||
/* Chain containing all defined stop subcommands. */
|
||||
|
||||
extern struct cmd_list_element *stoplist;
|
||||
|
||||
/* Chain containing all defined "enable breakpoint" subcommands. */
|
||||
|
||||
extern struct cmd_list_element *enablebreaklist;
|
||||
|
||||
/* Chain containing all defined set subcommands */
|
||||
|
||||
extern struct cmd_list_element *setlist;
|
||||
|
||||
/* Chain containing all defined unset subcommands */
|
||||
|
||||
extern struct cmd_list_element *unsetlist;
|
||||
|
||||
/* Chain containing all defined show subcommands. */
|
||||
|
||||
extern struct cmd_list_element *showlist;
|
||||
|
||||
/* Chain containing all defined \"set history\". */
|
||||
|
||||
extern struct cmd_list_element *sethistlist;
|
||||
|
||||
/* Chain containing all defined \"show history\". */
|
||||
|
||||
extern struct cmd_list_element *showhistlist;
|
||||
|
||||
/* Chain containing all defined \"unset history\". */
|
||||
|
||||
extern struct cmd_list_element *unsethistlist;
|
||||
|
||||
/* Chain containing all defined maintenance subcommands. */
|
||||
|
||||
extern struct cmd_list_element *maintenancelist;
|
||||
|
||||
/* Chain containing all defined "maintenance info" subcommands. */
|
||||
|
||||
extern struct cmd_list_element *maintenanceinfolist;
|
||||
|
||||
/* Chain containing all defined "maintenance print" subcommands. */
|
||||
|
||||
extern struct cmd_list_element *maintenanceprintlist;
|
||||
|
||||
extern struct cmd_list_element *setprintlist;
|
||||
|
||||
extern struct cmd_list_element *showprintlist;
|
||||
|
||||
extern struct cmd_list_element *setdebuglist;
|
||||
|
||||
extern struct cmd_list_element *showdebuglist;
|
||||
|
||||
extern struct cmd_list_element *setchecklist;
|
||||
|
||||
extern struct cmd_list_element *showchecklist;
|
||||
|
||||
/* Exported to gdb/top.c */
|
||||
|
||||
void init_cmd_lists (void);
|
||||
|
||||
void init_cli_cmds (void);
|
||||
|
||||
int is_complete_command (struct cmd_list_element *cmd);
|
||||
|
||||
/* Exported to gdb/main.c */
|
||||
|
||||
extern void cd_command (char *, int);
|
||||
|
||||
/* Exported to gdb/top.c and gdb/main.c */
|
||||
|
||||
extern void quit_command (char *, int);
|
||||
|
||||
extern void source_command (char *, int);
|
||||
|
||||
/* Used everywhere whenever at least one parameter is required and
|
||||
none is specified. */
|
||||
|
||||
extern NORETURN void error_no_arg (char *) ATTR_NORETURN;
|
||||
|
||||
#endif /* !defined (CLI_CMDS_H) */
|
||||
1409
contrib/gdb/gdb/cli/cli-decode.c
Normal file
1409
contrib/gdb/gdb/cli/cli-decode.c
Normal file
File diff suppressed because it is too large
Load diff
385
contrib/gdb/gdb/cli/cli-decode.h
Normal file
385
contrib/gdb/gdb/cli/cli-decode.h
Normal file
|
|
@ -0,0 +1,385 @@
|
|||
/* Header file for GDB command decoding library.
|
||||
Copyright 2000 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#if !defined (CLI_DECODE_H)
|
||||
#define CLI_DECODE_H 1
|
||||
|
||||
#include "gdb_regex.h" /* Needed by apropos_cmd. */
|
||||
|
||||
/* Command classes are top-level categories into which commands are broken
|
||||
down for "help" purposes.
|
||||
Notes on classes: class_alias is for alias commands which are not
|
||||
abbreviations of the original command. class-pseudo is for
|
||||
commands which are not really commands nor help topics ("stop"). */
|
||||
|
||||
enum command_class
|
||||
{
|
||||
/* Special args to help_list */
|
||||
class_deprecated, all_classes = -2, all_commands = -1,
|
||||
/* Classes of commands */
|
||||
no_class = -1, class_run = 0, class_vars, class_stack,
|
||||
class_files, class_support, class_info, class_breakpoint, class_trace,
|
||||
class_alias, class_obscure, class_user, class_maintenance,
|
||||
class_pseudo, class_tui, class_xdb
|
||||
};
|
||||
|
||||
/* Not a set/show command. Note that some commands which begin with
|
||||
"set" or "show" might be in this category, if their syntax does
|
||||
not fall into one of the following categories. */
|
||||
typedef enum cmd_types
|
||||
{
|
||||
not_set_cmd,
|
||||
set_cmd,
|
||||
show_cmd
|
||||
}
|
||||
cmd_types;
|
||||
|
||||
/* Reasonable values for an AUTO_BOOLEAN variable. */
|
||||
enum cmd_auto_boolean
|
||||
{
|
||||
CMD_AUTO_BOOLEAN_TRUE,
|
||||
CMD_AUTO_BOOLEAN_FALSE,
|
||||
CMD_AUTO_BOOLEAN_AUTO
|
||||
};
|
||||
|
||||
/* Types of "set" or "show" command. */
|
||||
typedef enum var_types
|
||||
{
|
||||
/* "on" or "off". *VAR is an integer which is nonzero for on,
|
||||
zero for off. */
|
||||
var_boolean,
|
||||
|
||||
/* "on" / "true" / "enable" or "off" / "false" / "disable" or
|
||||
"auto. *VAR is an ``enum cmd_auto_boolean''. NOTE: In general
|
||||
a custom show command will need to be implemented - one that
|
||||
for "auto" prints both the "auto" and the current auto-selected
|
||||
value. */
|
||||
var_auto_boolean,
|
||||
|
||||
/* Unsigned Integer. *VAR is an unsigned int. The user can type 0
|
||||
to mean "unlimited", which is stored in *VAR as UINT_MAX. */
|
||||
var_uinteger,
|
||||
|
||||
/* Like var_uinteger but signed. *VAR is an int. The user can type 0
|
||||
to mean "unlimited", which is stored in *VAR as INT_MAX. */
|
||||
var_integer,
|
||||
|
||||
/* String which the user enters with escapes (e.g. the user types \n and
|
||||
it is a real newline in the stored string).
|
||||
*VAR is a malloc'd string, or NULL if the string is empty. */
|
||||
var_string,
|
||||
/* String which stores what the user types verbatim.
|
||||
*VAR is a malloc'd string, or NULL if the string is empty. */
|
||||
var_string_noescape,
|
||||
/* String which stores a filename.
|
||||
*VAR is a malloc'd string, or NULL if the string is empty. */
|
||||
var_filename,
|
||||
/* ZeroableInteger. *VAR is an int. Like Unsigned Integer except
|
||||
that zero really means zero. */
|
||||
var_zinteger,
|
||||
/* Enumerated type. Can only have one of the specified values. *VAR is a
|
||||
char pointer to the name of the element that we find. */
|
||||
var_enum
|
||||
}
|
||||
var_types;
|
||||
|
||||
/* This structure records one command'd definition. */
|
||||
|
||||
|
||||
/* This flag is used by the code executing commands to warn the user
|
||||
the first time a deprecated command is used, see the 'flags' field in
|
||||
the following struct.
|
||||
*/
|
||||
#define CMD_DEPRECATED 0x1
|
||||
#define DEPRECATED_WARN_USER 0x2
|
||||
#define MALLOCED_REPLACEMENT 0x4
|
||||
|
||||
struct cmd_list_element
|
||||
{
|
||||
/* Points to next command in this list. */
|
||||
struct cmd_list_element *next;
|
||||
|
||||
/* Name of this command. */
|
||||
char *name;
|
||||
|
||||
/* Command class; class values are chosen by application program. */
|
||||
enum command_class class;
|
||||
|
||||
/* Function definition of this command. NULL for command class
|
||||
names and for help topics that are not really commands. NOTE:
|
||||
cagney/2002-02-02: This function signature is evolving. For
|
||||
the moment suggest sticking with either set_cmd_cfunc() or
|
||||
set_cmd_sfunc(). */
|
||||
void (*func) (struct cmd_list_element *c, char *args, int from_tty);
|
||||
/* The command's real callback. At present func() bounces through
|
||||
to one of the below. */
|
||||
union
|
||||
{
|
||||
/* If type is not_set_cmd, call it like this: */
|
||||
void (*cfunc) (char *args, int from_tty);
|
||||
|
||||
/* If type is set_cmd or show_cmd, first set the variables, and
|
||||
then call this. */
|
||||
void (*sfunc) (char *args, int from_tty, struct cmd_list_element * c);
|
||||
}
|
||||
function;
|
||||
|
||||
/* Documentation of this command (or help topic).
|
||||
First line is brief documentation; remaining lines form, with it,
|
||||
the full documentation. First line should end with a period.
|
||||
Entire string should also end with a period, not a newline. */
|
||||
char *doc;
|
||||
|
||||
/* flags : a bitfield
|
||||
|
||||
bit 0: (LSB) CMD_DEPRECATED, when 1 indicated that this command
|
||||
is deprecated. It may be removed from gdb's command set in the
|
||||
future.
|
||||
|
||||
bit 1: DEPRECATED_WARN_USER, the user needs to be warned that
|
||||
this is a deprecated command. The user should only be warned
|
||||
the first time a command is used.
|
||||
|
||||
bit 2: MALLOCED_REPLACEMENT, when functions are deprecated at
|
||||
compile time (this is the way it should, in general, be done)
|
||||
the memory containing the replacement string is statically
|
||||
allocated. In some cases it makes sense to deprecate commands
|
||||
at runtime (the testsuite is one example). In this case the
|
||||
memory for replacement is malloc'ed. When a command is
|
||||
undeprecated or re-deprecated at runtime we don't want to risk
|
||||
calling free on statically allocated memory, so we check this
|
||||
flag.
|
||||
*/
|
||||
int flags;
|
||||
|
||||
/* if this command is deprecated, this is the replacement name */
|
||||
char *replacement;
|
||||
|
||||
/* If this command represents a show command, then this function
|
||||
is called before the variable's value is examined. */
|
||||
void (*pre_show_hook) (struct cmd_list_element *c);
|
||||
|
||||
/* Hook for another command to be executed before this command. */
|
||||
struct cmd_list_element *hook_pre;
|
||||
|
||||
/* Hook for another command to be executed after this command. */
|
||||
struct cmd_list_element *hook_post;
|
||||
|
||||
/* Flag that specifies if this command is already running it's hook. */
|
||||
/* Prevents the possibility of hook recursion. */
|
||||
int hook_in;
|
||||
|
||||
/* Nonzero identifies a prefix command. For them, the address
|
||||
of the variable containing the list of subcommands. */
|
||||
struct cmd_list_element **prefixlist;
|
||||
|
||||
/* For prefix commands only:
|
||||
String containing prefix commands to get here: this one
|
||||
plus any others needed to get to it. Should end in a space.
|
||||
It is used before the word "command" in describing the
|
||||
commands reached through this prefix. */
|
||||
char *prefixname;
|
||||
|
||||
/* For prefix commands only:
|
||||
nonzero means do not get an error if subcommand is not
|
||||
recognized; call the prefix's own function in that case. */
|
||||
char allow_unknown;
|
||||
|
||||
/* Nonzero says this is an abbreviation, and should not
|
||||
be mentioned in lists of commands.
|
||||
This allows "br<tab>" to complete to "break", which it
|
||||
otherwise wouldn't. */
|
||||
char abbrev_flag;
|
||||
|
||||
/* Completion routine for this command. TEXT is the text beyond
|
||||
what was matched for the command itself (leading whitespace is
|
||||
skipped). It stops where we are supposed to stop completing
|
||||
(rl_point) and is '\0' terminated.
|
||||
|
||||
Return value is a malloc'd vector of pointers to possible completions
|
||||
terminated with NULL. If there are no completions, returning a pointer
|
||||
to a NULL would work but returning NULL itself is also valid.
|
||||
WORD points in the same buffer as TEXT, and completions should be
|
||||
returned relative to this position. For example, suppose TEXT is "foo"
|
||||
and we want to complete to "foobar". If WORD is "oo", return
|
||||
"oobar"; if WORD is "baz/foo", return "baz/foobar". */
|
||||
char **(*completer) (char *text, char *word);
|
||||
|
||||
/* Type of "set" or "show" command (or SET_NOT_SET if not "set"
|
||||
or "show"). */
|
||||
cmd_types type;
|
||||
|
||||
/* Pointer to variable affected by "set" and "show". Doesn't matter
|
||||
if type is not_set. */
|
||||
void *var;
|
||||
|
||||
/* What kind of variable is *VAR? */
|
||||
var_types var_type;
|
||||
|
||||
/* Pointer to NULL terminated list of enumerated values (like argv). */
|
||||
const char **enums;
|
||||
|
||||
/* Pointer to command strings of user-defined commands */
|
||||
struct command_line *user_commands;
|
||||
|
||||
/* Pointer to command that is hooked by this one, (by hook_pre)
|
||||
so the hook can be removed when this one is deleted. */
|
||||
struct cmd_list_element *hookee_pre;
|
||||
|
||||
/* Pointer to command that is hooked by this one, (by hook_post)
|
||||
so the hook can be removed when this one is deleted. */
|
||||
struct cmd_list_element *hookee_post;
|
||||
|
||||
/* Pointer to command that is aliased by this one, so the
|
||||
aliased command can be located in case it has been hooked. */
|
||||
struct cmd_list_element *cmd_pointer;
|
||||
};
|
||||
|
||||
/* API to the manipulation of command lists. */
|
||||
|
||||
extern struct cmd_list_element *add_cmd (char *, enum command_class,
|
||||
void (*fun) (char *, int), char *,
|
||||
struct cmd_list_element **);
|
||||
|
||||
extern struct cmd_list_element *add_alias_cmd (char *, char *,
|
||||
enum command_class, int,
|
||||
struct cmd_list_element **);
|
||||
|
||||
extern struct cmd_list_element *add_prefix_cmd (char *, enum command_class,
|
||||
void (*fun) (char *, int),
|
||||
char *,
|
||||
struct cmd_list_element **,
|
||||
char *, int,
|
||||
struct cmd_list_element **);
|
||||
|
||||
extern struct cmd_list_element *add_abbrev_prefix_cmd (char *,
|
||||
enum command_class,
|
||||
void (*fun) (char *,
|
||||
int),
|
||||
char *,
|
||||
struct cmd_list_element
|
||||
**, char *, int,
|
||||
struct cmd_list_element
|
||||
**);
|
||||
|
||||
/* Set the commands corresponding callback. */
|
||||
|
||||
extern void set_cmd_cfunc (struct cmd_list_element *cmd,
|
||||
void (*cfunc) (char *args, int from_tty));
|
||||
|
||||
extern void set_cmd_sfunc (struct cmd_list_element *cmd,
|
||||
void (*sfunc) (char *args, int from_tty,
|
||||
struct cmd_list_element * c));
|
||||
|
||||
/* HACK: cagney/2002-02-23: Code, mostly in tracepoints.c, grubs
|
||||
around in cmd objects to test the value of the commands sfunc(). */
|
||||
extern int cmd_cfunc_eq (struct cmd_list_element *cmd,
|
||||
void (*cfunc) (char *args, int from_tty));
|
||||
|
||||
extern struct cmd_list_element *lookup_cmd (char **,
|
||||
struct cmd_list_element *, char *,
|
||||
int, int);
|
||||
|
||||
extern struct cmd_list_element *lookup_cmd_1 (char **,
|
||||
struct cmd_list_element *,
|
||||
struct cmd_list_element **,
|
||||
int);
|
||||
|
||||
extern struct cmd_list_element *
|
||||
deprecate_cmd (struct cmd_list_element *, char * );
|
||||
|
||||
extern void
|
||||
deprecated_cmd_warning (char **);
|
||||
|
||||
extern int
|
||||
lookup_cmd_composition (char *text,
|
||||
struct cmd_list_element **alias,
|
||||
struct cmd_list_element **prefix_cmd,
|
||||
struct cmd_list_element **cmd);
|
||||
|
||||
extern struct cmd_list_element *add_com (char *, enum command_class,
|
||||
void (*fun) (char *, int), char *);
|
||||
|
||||
extern struct cmd_list_element *add_com_alias (char *, char *,
|
||||
enum command_class, int);
|
||||
|
||||
extern struct cmd_list_element *add_info (char *, void (*fun) (char *, int),
|
||||
char *);
|
||||
|
||||
extern struct cmd_list_element *add_info_alias (char *, char *, int);
|
||||
|
||||
extern char **complete_on_cmdlist (struct cmd_list_element *, char *, char *);
|
||||
|
||||
extern char **complete_on_enum (const char *enumlist[], char *, char *);
|
||||
|
||||
extern void delete_cmd (char *, struct cmd_list_element **);
|
||||
|
||||
extern void help_cmd_list (struct cmd_list_element *, enum command_class,
|
||||
char *, int, struct ui_file *);
|
||||
|
||||
extern struct cmd_list_element *add_set_cmd (char *name, enum
|
||||
command_class class,
|
||||
var_types var_type, void *var,
|
||||
char *doc,
|
||||
struct cmd_list_element **list);
|
||||
|
||||
extern struct cmd_list_element *add_set_enum_cmd (char *name,
|
||||
enum command_class class,
|
||||
const char *enumlist[],
|
||||
const char **var,
|
||||
char *doc,
|
||||
struct cmd_list_element **list);
|
||||
|
||||
extern struct cmd_list_element *add_set_auto_boolean_cmd (char *name,
|
||||
enum command_class class,
|
||||
enum cmd_auto_boolean *var,
|
||||
char *doc,
|
||||
struct cmd_list_element **list);
|
||||
|
||||
extern struct cmd_list_element *add_set_boolean_cmd (char *name,
|
||||
enum command_class class,
|
||||
int *var,
|
||||
char *doc,
|
||||
struct cmd_list_element **list);
|
||||
|
||||
extern struct cmd_list_element *add_show_from_set (struct cmd_list_element *,
|
||||
struct cmd_list_element
|
||||
**);
|
||||
|
||||
/* Functions that implement commands about CLI commands. */
|
||||
|
||||
extern void help_cmd (char *, struct ui_file *);
|
||||
|
||||
extern void help_list (struct cmd_list_element *, char *,
|
||||
enum command_class, struct ui_file *);
|
||||
|
||||
extern void apropos_cmd (struct ui_file *, struct cmd_list_element *,
|
||||
struct re_pattern_buffer *, char *);
|
||||
|
||||
/* Used to mark commands that don't do anything. If we just leave the
|
||||
function field NULL, the command is interpreted as a help topic, or
|
||||
as a class of commands. */
|
||||
|
||||
extern void not_just_help_class_command (char *arg, int from_tty);
|
||||
|
||||
/* Exported to cli/cli-setshow.c */
|
||||
|
||||
extern void print_doc_line (struct ui_file *, char *);
|
||||
|
||||
|
||||
#endif /* !defined (CLI_DECODE_H) */
|
||||
1228
contrib/gdb/gdb/cli/cli-script.c
Normal file
1228
contrib/gdb/gdb/cli/cli-script.c
Normal file
File diff suppressed because it is too large
Load diff
48
contrib/gdb/gdb/cli/cli-script.h
Normal file
48
contrib/gdb/gdb/cli/cli-script.h
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/* Header file for GDB CLI command implementation library.
|
||||
Copyright 2000, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#if !defined (CLI_SCRIPT_H)
|
||||
#define CLI_SCRIPT_H 1
|
||||
|
||||
/* Exported to cli/cli-cmds.c */
|
||||
|
||||
extern void script_from_file (FILE *stream, char *file);
|
||||
|
||||
extern void document_command (char *, int);
|
||||
|
||||
extern void define_command (char *, int);
|
||||
|
||||
extern void while_command (char *arg, int from_tty);
|
||||
|
||||
extern void if_command (char *arg, int from_tty);
|
||||
|
||||
extern void show_user_1 (struct cmd_list_element *c, struct ui_file *stream);
|
||||
|
||||
/* Exported to gdb/breakpoint.c */
|
||||
|
||||
extern enum command_control_type
|
||||
execute_control_command (struct command_line *cmd);
|
||||
|
||||
extern void print_command_lines (struct ui_out *,
|
||||
struct command_line *, unsigned int);
|
||||
|
||||
/* Exported to gdb/infrun.c */
|
||||
|
||||
extern void execute_user_command (struct cmd_list_element *c, char *args);
|
||||
|
||||
#endif /* !defined (CLI_SCRIPT_H) */
|
||||
382
contrib/gdb/gdb/cli/cli-setshow.c
Normal file
382
contrib/gdb/gdb/cli/cli-setshow.c
Normal file
|
|
@ -0,0 +1,382 @@
|
|||
/* Handle set and show GDB commands.
|
||||
|
||||
Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "value.h"
|
||||
#include <ctype.h>
|
||||
#if 0
|
||||
#include "gdb_string.h"
|
||||
#endif
|
||||
|
||||
#include "ui-out.h"
|
||||
|
||||
#include "cli/cli-decode.h"
|
||||
#include "cli/cli-cmds.h"
|
||||
#include "cli/cli-setshow.h"
|
||||
|
||||
/* Prototypes for local functions */
|
||||
|
||||
static int parse_binary_operation (char *);
|
||||
|
||||
static enum cmd_auto_boolean parse_auto_binary_operation (const char *arg);
|
||||
|
||||
static enum cmd_auto_boolean
|
||||
parse_auto_binary_operation (const char *arg)
|
||||
{
|
||||
if (arg != NULL && *arg != '\0')
|
||||
{
|
||||
int length = strlen (arg);
|
||||
while (isspace (arg[length - 1]) && length > 0)
|
||||
length--;
|
||||
if (strncmp (arg, "on", length) == 0
|
||||
|| strncmp (arg, "1", length) == 0
|
||||
|| strncmp (arg, "yes", length) == 0
|
||||
|| strncmp (arg, "enable", length) == 0)
|
||||
return CMD_AUTO_BOOLEAN_TRUE;
|
||||
else if (strncmp (arg, "off", length) == 0
|
||||
|| strncmp (arg, "0", length) == 0
|
||||
|| strncmp (arg, "no", length) == 0
|
||||
|| strncmp (arg, "disable", length) == 0)
|
||||
return CMD_AUTO_BOOLEAN_FALSE;
|
||||
else if (strncmp (arg, "auto", length) == 0
|
||||
|| (strncmp (arg, "-1", length) == 0 && length > 1))
|
||||
return CMD_AUTO_BOOLEAN_AUTO;
|
||||
}
|
||||
error ("\"on\", \"off\" or \"auto\" expected.");
|
||||
return CMD_AUTO_BOOLEAN_AUTO; /* pacify GCC */
|
||||
}
|
||||
|
||||
static int
|
||||
parse_binary_operation (char *arg)
|
||||
{
|
||||
int length;
|
||||
|
||||
if (!arg || !*arg)
|
||||
return 1;
|
||||
|
||||
length = strlen (arg);
|
||||
|
||||
while (arg[length - 1] == ' ' || arg[length - 1] == '\t')
|
||||
length--;
|
||||
|
||||
if (strncmp (arg, "on", length) == 0
|
||||
|| strncmp (arg, "1", length) == 0
|
||||
|| strncmp (arg, "yes", length) == 0
|
||||
|| strncmp (arg, "enable", length) == 0)
|
||||
return 1;
|
||||
else if (strncmp (arg, "off", length) == 0
|
||||
|| strncmp (arg, "0", length) == 0
|
||||
|| strncmp (arg, "no", length) == 0
|
||||
|| strncmp (arg, "disable", length) == 0)
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
error ("\"on\" or \"off\" expected.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Do a "set" or "show" command. ARG is NULL if no argument, or the text
|
||||
of the argument, and FROM_TTY is nonzero if this command is being entered
|
||||
directly by the user (i.e. these are just like any other
|
||||
command). C is the command list element for the command. */
|
||||
|
||||
void
|
||||
do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
|
||||
{
|
||||
if (c->type == set_cmd)
|
||||
{
|
||||
switch (c->var_type)
|
||||
{
|
||||
case var_string:
|
||||
{
|
||||
char *new;
|
||||
char *p;
|
||||
char *q;
|
||||
int ch;
|
||||
|
||||
if (arg == NULL)
|
||||
arg = "";
|
||||
new = (char *) xmalloc (strlen (arg) + 2);
|
||||
p = arg;
|
||||
q = new;
|
||||
while ((ch = *p++) != '\000')
|
||||
{
|
||||
if (ch == '\\')
|
||||
{
|
||||
/* \ at end of argument is used after spaces
|
||||
so they won't be lost. */
|
||||
/* This is obsolete now that we no longer strip
|
||||
trailing whitespace and actually, the backslash
|
||||
didn't get here in my test, readline or
|
||||
something did something funky with a backslash
|
||||
right before a newline. */
|
||||
if (*p == 0)
|
||||
break;
|
||||
ch = parse_escape (&p);
|
||||
if (ch == 0)
|
||||
break; /* C loses */
|
||||
else if (ch > 0)
|
||||
*q++ = ch;
|
||||
}
|
||||
else
|
||||
*q++ = ch;
|
||||
}
|
||||
#if 0
|
||||
if (*(p - 1) != '\\')
|
||||
*q++ = ' ';
|
||||
#endif
|
||||
*q++ = '\0';
|
||||
new = (char *) xrealloc (new, q - new);
|
||||
if (*(char **) c->var != NULL)
|
||||
xfree (*(char **) c->var);
|
||||
*(char **) c->var = new;
|
||||
}
|
||||
break;
|
||||
case var_string_noescape:
|
||||
if (arg == NULL)
|
||||
arg = "";
|
||||
if (*(char **) c->var != NULL)
|
||||
xfree (*(char **) c->var);
|
||||
*(char **) c->var = savestring (arg, strlen (arg));
|
||||
break;
|
||||
case var_filename:
|
||||
if (arg == NULL)
|
||||
error_no_arg ("filename to set it to.");
|
||||
if (*(char **) c->var != NULL)
|
||||
xfree (*(char **) c->var);
|
||||
*(char **) c->var = tilde_expand (arg);
|
||||
break;
|
||||
case var_boolean:
|
||||
*(int *) c->var = parse_binary_operation (arg);
|
||||
break;
|
||||
case var_auto_boolean:
|
||||
*(enum cmd_auto_boolean *) c->var = parse_auto_binary_operation (arg);
|
||||
break;
|
||||
case var_uinteger:
|
||||
if (arg == NULL)
|
||||
error_no_arg ("integer to set it to.");
|
||||
*(unsigned int *) c->var = parse_and_eval_long (arg);
|
||||
if (*(unsigned int *) c->var == 0)
|
||||
*(unsigned int *) c->var = UINT_MAX;
|
||||
break;
|
||||
case var_integer:
|
||||
{
|
||||
unsigned int val;
|
||||
if (arg == NULL)
|
||||
error_no_arg ("integer to set it to.");
|
||||
val = parse_and_eval_long (arg);
|
||||
if (val == 0)
|
||||
*(int *) c->var = INT_MAX;
|
||||
else if (val >= INT_MAX)
|
||||
error ("integer %u out of range", val);
|
||||
else
|
||||
*(int *) c->var = val;
|
||||
break;
|
||||
}
|
||||
case var_zinteger:
|
||||
if (arg == NULL)
|
||||
error_no_arg ("integer to set it to.");
|
||||
*(int *) c->var = parse_and_eval_long (arg);
|
||||
break;
|
||||
case var_enum:
|
||||
{
|
||||
int i;
|
||||
int len;
|
||||
int nmatches;
|
||||
const char *match = NULL;
|
||||
char *p;
|
||||
|
||||
/* if no argument was supplied, print an informative error message */
|
||||
if (arg == NULL)
|
||||
{
|
||||
char msg[1024];
|
||||
strcpy (msg, "Requires an argument. Valid arguments are ");
|
||||
for (i = 0; c->enums[i]; i++)
|
||||
{
|
||||
if (i != 0)
|
||||
strcat (msg, ", ");
|
||||
strcat (msg, c->enums[i]);
|
||||
}
|
||||
strcat (msg, ".");
|
||||
error (msg);
|
||||
}
|
||||
|
||||
p = strchr (arg, ' ');
|
||||
|
||||
if (p)
|
||||
len = p - arg;
|
||||
else
|
||||
len = strlen (arg);
|
||||
|
||||
nmatches = 0;
|
||||
for (i = 0; c->enums[i]; i++)
|
||||
if (strncmp (arg, c->enums[i], len) == 0)
|
||||
{
|
||||
if (c->enums[i][len] == '\0')
|
||||
{
|
||||
match = c->enums[i];
|
||||
nmatches = 1;
|
||||
break; /* exact match. */
|
||||
}
|
||||
else
|
||||
{
|
||||
match = c->enums[i];
|
||||
nmatches++;
|
||||
}
|
||||
}
|
||||
|
||||
if (nmatches <= 0)
|
||||
error ("Undefined item: \"%s\".", arg);
|
||||
|
||||
if (nmatches > 1)
|
||||
error ("Ambiguous item \"%s\".", arg);
|
||||
|
||||
*(const char **) c->var = match;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
error ("gdb internal error: bad var_type in do_setshow_command");
|
||||
}
|
||||
}
|
||||
else if (c->type == show_cmd)
|
||||
{
|
||||
struct cleanup *old_chain;
|
||||
struct ui_stream *stb;
|
||||
int quote;
|
||||
|
||||
stb = ui_out_stream_new (uiout);
|
||||
old_chain = make_cleanup_ui_out_stream_delete (stb);
|
||||
|
||||
/* Possibly call the pre hook. */
|
||||
if (c->pre_show_hook)
|
||||
(c->pre_show_hook) (c);
|
||||
|
||||
/* Print doc minus "show" at start. */
|
||||
print_doc_line (gdb_stdout, c->doc + 5);
|
||||
|
||||
ui_out_text (uiout, " is ");
|
||||
ui_out_wrap_hint (uiout, " ");
|
||||
quote = 0;
|
||||
switch (c->var_type)
|
||||
{
|
||||
case var_string:
|
||||
{
|
||||
unsigned char *p;
|
||||
|
||||
if (*(unsigned char **) c->var)
|
||||
fputstr_filtered (*(unsigned char **) c->var, '"', stb->stream);
|
||||
quote = 1;
|
||||
}
|
||||
break;
|
||||
case var_string_noescape:
|
||||
case var_filename:
|
||||
case var_enum:
|
||||
if (*(char **) c->var)
|
||||
fputs_filtered (*(char **) c->var, stb->stream);
|
||||
quote = 1;
|
||||
break;
|
||||
case var_boolean:
|
||||
fputs_filtered (*(int *) c->var ? "on" : "off", stb->stream);
|
||||
break;
|
||||
case var_auto_boolean:
|
||||
switch (*(enum cmd_auto_boolean*) c->var)
|
||||
{
|
||||
case CMD_AUTO_BOOLEAN_TRUE:
|
||||
fputs_filtered ("on", stb->stream);
|
||||
break;
|
||||
case CMD_AUTO_BOOLEAN_FALSE:
|
||||
fputs_filtered ("off", stb->stream);
|
||||
break;
|
||||
case CMD_AUTO_BOOLEAN_AUTO:
|
||||
fputs_filtered ("auto", stb->stream);
|
||||
break;
|
||||
default:
|
||||
internal_error (__FILE__, __LINE__,
|
||||
"do_setshow_command: invalid var_auto_boolean");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case var_uinteger:
|
||||
if (*(unsigned int *) c->var == UINT_MAX)
|
||||
{
|
||||
fputs_filtered ("unlimited", stb->stream);
|
||||
break;
|
||||
}
|
||||
/* else fall through */
|
||||
case var_zinteger:
|
||||
fprintf_filtered (stb->stream, "%u", *(unsigned int *) c->var);
|
||||
break;
|
||||
case var_integer:
|
||||
if (*(int *) c->var == INT_MAX)
|
||||
{
|
||||
fputs_filtered ("unlimited", stb->stream);
|
||||
}
|
||||
else
|
||||
fprintf_filtered (stb->stream, "%d", *(int *) c->var);
|
||||
break;
|
||||
|
||||
default:
|
||||
error ("gdb internal error: bad var_type in do_setshow_command");
|
||||
}
|
||||
if (quote)
|
||||
ui_out_text (uiout, "\"");
|
||||
ui_out_field_stream (uiout, "value", stb);
|
||||
if (quote)
|
||||
ui_out_text (uiout, "\"");
|
||||
ui_out_text (uiout, ".\n");
|
||||
do_cleanups (old_chain);
|
||||
}
|
||||
else
|
||||
error ("gdb internal error: bad cmd_type in do_setshow_command");
|
||||
c->func (c, NULL, from_tty);
|
||||
if (c->type == set_cmd && set_hook)
|
||||
set_hook (c);
|
||||
}
|
||||
|
||||
/* Show all the settings in a list of show commands. */
|
||||
|
||||
void
|
||||
cmd_show_list (struct cmd_list_element *list, int from_tty, char *prefix)
|
||||
{
|
||||
ui_out_tuple_begin (uiout, "showlist");
|
||||
for (; list != NULL; list = list->next)
|
||||
{
|
||||
/* If we find a prefix, run its list, prefixing our output by its
|
||||
prefix (with "show " skipped). */
|
||||
if (list->prefixlist && !list->abbrev_flag)
|
||||
{
|
||||
ui_out_tuple_begin (uiout, "optionlist");
|
||||
ui_out_field_string (uiout, "prefix", list->prefixname + 5);
|
||||
cmd_show_list (*list->prefixlist, from_tty, list->prefixname + 5);
|
||||
ui_out_tuple_end (uiout);
|
||||
}
|
||||
if (list->type == show_cmd)
|
||||
{
|
||||
ui_out_tuple_begin (uiout, "option");
|
||||
ui_out_text (uiout, prefix);
|
||||
ui_out_field_string (uiout, "name", list->name);
|
||||
ui_out_text (uiout, ": ");
|
||||
do_setshow_command ((char *) NULL, from_tty, list);
|
||||
ui_out_tuple_end (uiout);
|
||||
}
|
||||
}
|
||||
ui_out_tuple_end (uiout);
|
||||
}
|
||||
|
||||
36
contrib/gdb/gdb/cli/cli-setshow.h
Normal file
36
contrib/gdb/gdb/cli/cli-setshow.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/* Header file for GDB CLI set and show commands implementation.
|
||||
Copyright 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#if !defined (CLI_SETSHOW_H)
|
||||
#define CLI_SETSHOW_H 1
|
||||
|
||||
/* Exported to cli/cli-cmds.c and gdb/top.c */
|
||||
|
||||
/* Do a "set" or "show" command. ARG is NULL if no argument, or the text
|
||||
of the argument, and FROM_TTY is nonzero if this command is being entered
|
||||
directly by the user (i.e. these are just like any other
|
||||
command). C is the command list element for the command. */
|
||||
extern void do_setshow_command (char *arg, int from_tty,
|
||||
struct cmd_list_element *c);
|
||||
|
||||
/* Exported to cli/cli-cmds.c and gdb/top.c, language.c and valprint.c */
|
||||
|
||||
extern void cmd_show_list (struct cmd_list_element *list, int from_tty,
|
||||
char *prefix);
|
||||
|
||||
#endif /* !defined (CLI_SETSHOW_H) */
|
||||
21
contrib/gdb/gdb/cli/cli-utils.c
Normal file
21
contrib/gdb/gdb/cli/cli-utils.c
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/* GDB CLI utility library.
|
||||
Copyright 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "cli/cli-utils.h"
|
||||
|
||||
22
contrib/gdb/gdb/cli/cli-utils.h
Normal file
22
contrib/gdb/gdb/cli/cli-utils.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/* Header file for GDB CLI utility library.
|
||||
Copyright 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#if !defined (CLI_UTILS_H)
|
||||
# define CLI_UTILS_H 1
|
||||
|
||||
#endif /* !defined (CLI_UTILS_H) */
|
||||
|
|
@ -1,65 +1,120 @@
|
|||
/* ***DEPRECATED*** The gdblib files must not be calling/using things in any
|
||||
of the possible command languages. If necessary, a hook (that may be
|
||||
present or not) must be used and set to the appropriate routine by any
|
||||
command language that cares about it. If you are having to include this
|
||||
file you are possibly doing things the old way. This file will disapear.
|
||||
2000-12-01 fnasser@redhat.com */
|
||||
|
||||
/* Header file for command-reading library command.c.
|
||||
Copyright (C) 1986, 1989, 1990 Free Software Foundation, Inc.
|
||||
Copyright 1986, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#if !defined (COMMAND_H)
|
||||
#define COMMAND_H 1
|
||||
|
||||
/* Command classes are top-level categories into which commands are broken
|
||||
down for "help" purposes.
|
||||
Notes on classes: class_alias is for alias commands which are not
|
||||
abbreviations of the original command. class-pseudo is for
|
||||
commands which are not really commands nor help topics ("stop"). */
|
||||
|
||||
enum command_class
|
||||
{
|
||||
/* Special args to help_list */
|
||||
class_deprecated, all_classes = -2, all_commands = -1,
|
||||
/* Classes of commands */
|
||||
no_class = -1, class_run = 0, class_vars, class_stack,
|
||||
class_files, class_support, class_info, class_breakpoint, class_trace,
|
||||
class_alias, class_obscure, class_user, class_maintenance,
|
||||
class_pseudo, class_tui, class_xdb
|
||||
};
|
||||
|
||||
/* Not a set/show command. Note that some commands which begin with
|
||||
"set" or "show" might be in this category, if their syntax does
|
||||
not fall into one of the following categories. */
|
||||
typedef enum cmd_types {
|
||||
not_set_cmd,
|
||||
set_cmd,
|
||||
show_cmd
|
||||
} cmd_types;
|
||||
typedef enum cmd_types
|
||||
{
|
||||
not_set_cmd,
|
||||
set_cmd,
|
||||
show_cmd
|
||||
}
|
||||
cmd_types;
|
||||
|
||||
/* Reasonable values for an AUTO_BOOLEAN variable. */
|
||||
enum cmd_auto_boolean
|
||||
{
|
||||
CMD_AUTO_BOOLEAN_TRUE,
|
||||
CMD_AUTO_BOOLEAN_FALSE,
|
||||
CMD_AUTO_BOOLEAN_AUTO
|
||||
};
|
||||
|
||||
/* Types of "set" or "show" command. */
|
||||
typedef enum var_types {
|
||||
/* "on" or "off". *VAR is an integer which is nonzero for on,
|
||||
zero for off. */
|
||||
var_boolean,
|
||||
/* Unsigned Integer. *VAR is an unsigned int. The user can type 0
|
||||
to mean "unlimited", which is stored in *VAR as UINT_MAX. */
|
||||
var_uinteger,
|
||||
typedef enum var_types
|
||||
{
|
||||
/* "on" or "off". *VAR is an integer which is nonzero for on,
|
||||
zero for off. */
|
||||
var_boolean,
|
||||
|
||||
/* Like var_uinteger but signed. *VAR is an int. The user can type 0
|
||||
to mean "unlimited", which is stored in *VAR as INT_MAX. */
|
||||
var_integer,
|
||||
/* "on" / "true" / "enable" or "off" / "false" / "disable" or
|
||||
"auto. *VAR is an ``enum cmd_auto_boolean''. NOTE: In general
|
||||
a custom show command will need to be implemented - one that
|
||||
for "auto" prints both the "auto" and the current auto-selected
|
||||
value. */
|
||||
var_auto_boolean,
|
||||
|
||||
/* String which the user enters with escapes (e.g. the user types \n and
|
||||
it is a real newline in the stored string).
|
||||
*VAR is a malloc'd string, or NULL if the string is empty. */
|
||||
var_string,
|
||||
/* String which stores what the user types verbatim.
|
||||
*VAR is a malloc'd string, or NULL if the string is empty. */
|
||||
var_string_noescape,
|
||||
/* String which stores a filename.
|
||||
*VAR is a malloc'd string, or NULL if the string is empty. */
|
||||
var_filename,
|
||||
/* ZeroableInteger. *VAR is an int. Like Unsigned Integer except
|
||||
that zero really means zero. */
|
||||
var_zinteger,
|
||||
/* Enumerated type. Can only have one of the specified values. *VAR is a
|
||||
char pointer to the name of the element that we find. */
|
||||
var_enum
|
||||
} var_types;
|
||||
/* Unsigned Integer. *VAR is an unsigned int. The user can type 0
|
||||
to mean "unlimited", which is stored in *VAR as UINT_MAX. */
|
||||
var_uinteger,
|
||||
|
||||
/* Like var_uinteger but signed. *VAR is an int. The user can type 0
|
||||
to mean "unlimited", which is stored in *VAR as INT_MAX. */
|
||||
var_integer,
|
||||
|
||||
/* String which the user enters with escapes (e.g. the user types \n and
|
||||
it is a real newline in the stored string).
|
||||
*VAR is a malloc'd string, or NULL if the string is empty. */
|
||||
var_string,
|
||||
/* String which stores what the user types verbatim.
|
||||
*VAR is a malloc'd string, or NULL if the string is empty. */
|
||||
var_string_noescape,
|
||||
/* String which stores a filename.
|
||||
*VAR is a malloc'd string, or NULL if the string is empty. */
|
||||
var_filename,
|
||||
/* ZeroableInteger. *VAR is an int. Like Unsigned Integer except
|
||||
that zero really means zero. */
|
||||
var_zinteger,
|
||||
/* Enumerated type. Can only have one of the specified values. *VAR is a
|
||||
char pointer to the name of the element that we find. */
|
||||
var_enum
|
||||
}
|
||||
var_types;
|
||||
|
||||
/* This structure records one command'd definition. */
|
||||
|
||||
|
||||
/* This flag is used by the code executing commands to warn the user
|
||||
the first time a deprecated command is used, see the 'flags' field in
|
||||
the following struct.
|
||||
*/
|
||||
#define CMD_DEPRECATED 0x1
|
||||
#define DEPRECATED_WARN_USER 0x2
|
||||
#define MALLOCED_REPLACEMENT 0x4
|
||||
|
||||
struct cmd_list_element
|
||||
{
|
||||
/* Points to next command in this list. */
|
||||
|
|
@ -71,20 +126,24 @@ struct cmd_list_element
|
|||
/* Command class; class values are chosen by application program. */
|
||||
enum command_class class;
|
||||
|
||||
/* Function definition of this command.
|
||||
NO_FUNCTION for command class names and for help topics that
|
||||
are not really commands. */
|
||||
/* Function definition of this command. NULL for command class
|
||||
names and for help topics that are not really commands. NOTE:
|
||||
cagney/2002-02-02: This function signature is evolving. For
|
||||
the moment suggest sticking with either set_cmd_cfunc() or
|
||||
set_cmd_sfunc(). */
|
||||
void (*func) (struct cmd_list_element *c, char *args, int from_tty);
|
||||
/* The command's real callback. At present func() bounces through
|
||||
to one of the below. */
|
||||
union
|
||||
{
|
||||
/* If type is not_set_cmd, call it like this: */
|
||||
void (*cfunc) PARAMS ((char *args, int from_tty));
|
||||
void (*cfunc) (char *args, int from_tty);
|
||||
|
||||
/* If type is cmd_set or show_cmd, first set the variables, and
|
||||
/* If type is set_cmd or show_cmd, first set the variables, and
|
||||
then call this. */
|
||||
void (*sfunc) PARAMS ((char *args, int from_tty,
|
||||
struct cmd_list_element *c));
|
||||
} function;
|
||||
# define NO_FUNCTION ((void (*) PARAMS((char *args, int from_tty))) 0)
|
||||
void (*sfunc) (char *args, int from_tty, struct cmd_list_element * c);
|
||||
}
|
||||
function;
|
||||
|
||||
/* Documentation of this command (or help topic).
|
||||
First line is brief documentation; remaining lines form, with it,
|
||||
|
|
@ -92,8 +151,44 @@ struct cmd_list_element
|
|||
Entire string should also end with a period, not a newline. */
|
||||
char *doc;
|
||||
|
||||
/* flags : a bitfield
|
||||
|
||||
bit 0: (LSB) CMD_DEPRECATED, when 1 indicated that this command
|
||||
is deprecated. It may be removed from gdb's command set in the
|
||||
future.
|
||||
|
||||
bit 1: DEPRECATED_WARN_USER, the user needs to be warned that
|
||||
this is a deprecated command. The user should only be warned
|
||||
the first time a command is used.
|
||||
|
||||
bit 2: MALLOCED_REPLACEMENT, when functions are deprecated at
|
||||
compile time (this is the way it should, in general, be done)
|
||||
the memory containing the replacement string is statically
|
||||
allocated. In some cases it makes sense to deprecate commands
|
||||
at runtime (the testsuite is one example). In this case the
|
||||
memory for replacement is malloc'ed. When a command is
|
||||
undeprecated or re-deprecated at runtime we don't want to risk
|
||||
calling free on statically allocated memory, so we check this
|
||||
flag.
|
||||
*/
|
||||
int flags;
|
||||
|
||||
/* if this command is deprecated, this is the replacement name */
|
||||
char *replacement;
|
||||
|
||||
/* If this command represents a show command, then this function
|
||||
is called before the variable's value is examined. */
|
||||
void (*pre_show_hook) (struct cmd_list_element *c);
|
||||
|
||||
/* Hook for another command to be executed before this command. */
|
||||
struct cmd_list_element *hook;
|
||||
struct cmd_list_element *hook_pre;
|
||||
|
||||
/* Hook for another command to be executed after this command. */
|
||||
struct cmd_list_element *hook_post;
|
||||
|
||||
/* Flag that specifies if this command is already running it's hook. */
|
||||
/* Prevents the possibility of hook recursion. */
|
||||
int hook_in;
|
||||
|
||||
/* Nonzero identifies a prefix command. For them, the address
|
||||
of the variable containing the list of subcommands. */
|
||||
|
|
@ -129,7 +224,7 @@ struct cmd_list_element
|
|||
returned relative to this position. For example, suppose TEXT is "foo"
|
||||
and we want to complete to "foobar". If WORD is "oo", return
|
||||
"oobar"; if WORD is "baz/foo", return "baz/foobar". */
|
||||
char ** (*completer) PARAMS ((char *text, char *word));
|
||||
char **(*completer) (char *text, char *word);
|
||||
|
||||
/* Type of "set" or "show" command (or SET_NOT_SET if not "set"
|
||||
or "show"). */
|
||||
|
|
@ -137,123 +232,158 @@ struct cmd_list_element
|
|||
|
||||
/* Pointer to variable affected by "set" and "show". Doesn't matter
|
||||
if type is not_set. */
|
||||
char *var;
|
||||
void *var;
|
||||
|
||||
/* What kind of variable is *VAR? */
|
||||
var_types var_type;
|
||||
|
||||
/* Pointer to NULL terminated list of enumerated values (like argv). */
|
||||
char **enums;
|
||||
const char **enums;
|
||||
|
||||
/* Pointer to command strings of user-defined commands */
|
||||
struct command_line *user_commands;
|
||||
|
||||
/* Pointer to command that is hooked by this one,
|
||||
/* Pointer to command that is hooked by this one, (by hook_pre)
|
||||
so the hook can be removed when this one is deleted. */
|
||||
struct cmd_list_element *hookee;
|
||||
struct cmd_list_element *hookee_pre;
|
||||
|
||||
/* Pointer to command that is hooked by this one, (by hook_post)
|
||||
so the hook can be removed when this one is deleted. */
|
||||
struct cmd_list_element *hookee_post;
|
||||
|
||||
/* Pointer to command that is aliased by this one, so the
|
||||
aliased command can be located in case it has been hooked. */
|
||||
struct cmd_list_element *cmd_pointer;
|
||||
};
|
||||
|
||||
/* Forward-declarations of the entry-points of command.c. */
|
||||
/* Forward-declarations of the entry-points of cli/cli-decode.c. */
|
||||
|
||||
extern struct cmd_list_element *add_cmd (char *, enum command_class,
|
||||
void (*fun) (char *, int), char *,
|
||||
struct cmd_list_element **);
|
||||
|
||||
extern struct cmd_list_element *add_alias_cmd (char *, char *,
|
||||
enum command_class, int,
|
||||
struct cmd_list_element **);
|
||||
|
||||
extern struct cmd_list_element *add_prefix_cmd (char *, enum command_class,
|
||||
void (*fun) (char *, int),
|
||||
char *,
|
||||
struct cmd_list_element **,
|
||||
char *, int,
|
||||
struct cmd_list_element **);
|
||||
|
||||
extern struct cmd_list_element *add_abbrev_prefix_cmd (char *,
|
||||
enum command_class,
|
||||
void (*fun) (char *,
|
||||
int),
|
||||
char *,
|
||||
struct cmd_list_element
|
||||
**, char *, int,
|
||||
struct cmd_list_element
|
||||
**);
|
||||
|
||||
/* Set the commands corresponding callback. */
|
||||
|
||||
extern void set_cmd_cfunc (struct cmd_list_element *cmd,
|
||||
void (*cfunc) (char *args, int from_tty));
|
||||
|
||||
extern void set_cmd_sfunc (struct cmd_list_element *cmd,
|
||||
void (*sfunc) (char *args, int from_tty,
|
||||
struct cmd_list_element * c));
|
||||
|
||||
/* HACK: cagney/2002-02-23: Code, mostly in tracepoints.c, grubs
|
||||
around in cmd objects to test the value of the commands sfunc(). */
|
||||
extern int cmd_cfunc_eq (struct cmd_list_element *cmd,
|
||||
void (*cfunc) (char *args, int from_tty));
|
||||
|
||||
extern struct cmd_list_element *lookup_cmd (char **,
|
||||
struct cmd_list_element *, char *,
|
||||
int, int);
|
||||
|
||||
extern struct cmd_list_element *lookup_cmd_1 (char **,
|
||||
struct cmd_list_element *,
|
||||
struct cmd_list_element **,
|
||||
int);
|
||||
|
||||
extern struct cmd_list_element *
|
||||
add_cmd PARAMS ((char *, enum command_class, void (*fun) (char *, int),
|
||||
char *, struct cmd_list_element **));
|
||||
|
||||
extern struct cmd_list_element *
|
||||
add_alias_cmd PARAMS ((char *, char *, enum command_class, int,
|
||||
struct cmd_list_element **));
|
||||
|
||||
extern struct cmd_list_element *
|
||||
add_prefix_cmd PARAMS ((char *, enum command_class, void (*fun) (char *, int),
|
||||
char *, struct cmd_list_element **, char *, int,
|
||||
struct cmd_list_element **));
|
||||
|
||||
extern struct cmd_list_element *
|
||||
add_abbrev_prefix_cmd PARAMS ((char *, enum command_class,
|
||||
void (*fun) (char *, int), char *,
|
||||
struct cmd_list_element **, char *, int,
|
||||
struct cmd_list_element **));
|
||||
|
||||
extern struct cmd_list_element *
|
||||
lookup_cmd PARAMS ((char **, struct cmd_list_element *, char *, int, int));
|
||||
|
||||
extern struct cmd_list_element *
|
||||
lookup_cmd_1 PARAMS ((char **, struct cmd_list_element *,
|
||||
struct cmd_list_element **, int));
|
||||
deprecate_cmd (struct cmd_list_element *, char * );
|
||||
|
||||
extern void
|
||||
add_com PARAMS ((char *, enum command_class, void (*fun)(char *, int),
|
||||
char *));
|
||||
deprecated_cmd_warning (char **);
|
||||
|
||||
extern void
|
||||
add_com_alias PARAMS ((char *, char *, enum command_class, int));
|
||||
extern int
|
||||
lookup_cmd_composition (char *text,
|
||||
struct cmd_list_element **alias,
|
||||
struct cmd_list_element **prefix_cmd,
|
||||
struct cmd_list_element **cmd);
|
||||
|
||||
extern void
|
||||
add_info PARAMS ((char *, void (*fun) (char *, int), char *));
|
||||
extern struct cmd_list_element *add_com (char *, enum command_class,
|
||||
void (*fun) (char *, int), char *);
|
||||
|
||||
extern void
|
||||
add_info_alias PARAMS ((char *, char *, int));
|
||||
extern struct cmd_list_element *add_com_alias (char *, char *,
|
||||
enum command_class, int);
|
||||
|
||||
extern char **
|
||||
complete_on_cmdlist PARAMS ((struct cmd_list_element *, char *, char *));
|
||||
extern struct cmd_list_element *add_info (char *, void (*fun) (char *, int),
|
||||
char *);
|
||||
|
||||
extern char **
|
||||
complete_on_enum PARAMS ((char **enumlist, char *, char *));
|
||||
extern struct cmd_list_element *add_info_alias (char *, char *, int);
|
||||
|
||||
extern void
|
||||
delete_cmd PARAMS ((char *, struct cmd_list_element **));
|
||||
extern char **complete_on_cmdlist (struct cmd_list_element *, char *, char *);
|
||||
|
||||
extern void
|
||||
help_cmd PARAMS ((char *, GDB_FILE *));
|
||||
extern char **complete_on_enum (const char *enumlist[], char *, char *);
|
||||
|
||||
extern void
|
||||
help_list PARAMS ((struct cmd_list_element *, char *, enum command_class,
|
||||
GDB_FILE *));
|
||||
extern void delete_cmd (char *, struct cmd_list_element **);
|
||||
|
||||
extern void
|
||||
help_cmd_list PARAMS ((struct cmd_list_element *, enum command_class, char *,
|
||||
int, GDB_FILE *));
|
||||
extern void help_cmd (char *, struct ui_file *);
|
||||
|
||||
extern struct cmd_list_element *
|
||||
add_set_cmd PARAMS ((char *, enum command_class, var_types, char *, char *,
|
||||
struct cmd_list_element **));
|
||||
extern void help_list (struct cmd_list_element *, char *,
|
||||
enum command_class, struct ui_file *);
|
||||
|
||||
extern struct cmd_list_element *
|
||||
add_set_enum_cmd PARAMS ((char *name, enum command_class, char *list[],
|
||||
char *var, char *doc, struct cmd_list_element **c));
|
||||
extern void help_cmd_list (struct cmd_list_element *, enum command_class,
|
||||
char *, int, struct ui_file *);
|
||||
|
||||
extern struct cmd_list_element *
|
||||
add_show_from_set PARAMS ((struct cmd_list_element *,
|
||||
struct cmd_list_element **));
|
||||
extern struct cmd_list_element *add_set_cmd (char *name, enum
|
||||
command_class class,
|
||||
var_types var_type, void *var,
|
||||
char *doc,
|
||||
struct cmd_list_element **list);
|
||||
|
||||
/* Do a "set" or "show" command. ARG is NULL if no argument, or the text
|
||||
of the argument, and FROM_TTY is nonzero if this command is being entered
|
||||
directly by the user (i.e. these are just like any other
|
||||
command). C is the command list element for the command. */
|
||||
extern struct cmd_list_element *add_set_enum_cmd (char *name,
|
||||
enum command_class class,
|
||||
const char *enumlist[],
|
||||
const char **var,
|
||||
char *doc,
|
||||
struct cmd_list_element **list);
|
||||
|
||||
extern void
|
||||
do_setshow_command PARAMS ((char *, int, struct cmd_list_element *));
|
||||
extern struct cmd_list_element *add_set_auto_boolean_cmd (char *name,
|
||||
enum command_class class,
|
||||
enum cmd_auto_boolean *var,
|
||||
char *doc,
|
||||
struct cmd_list_element **list);
|
||||
|
||||
extern struct cmd_list_element *add_set_boolean_cmd (char *name,
|
||||
enum command_class class,
|
||||
int *var,
|
||||
char *doc,
|
||||
struct cmd_list_element **list);
|
||||
|
||||
extern struct cmd_list_element *add_show_from_set (struct cmd_list_element *,
|
||||
struct cmd_list_element
|
||||
**);
|
||||
|
||||
/* Do a "show" command for each thing on a command list. */
|
||||
|
||||
extern void
|
||||
cmd_show_list PARAMS ((struct cmd_list_element *, int, char *));
|
||||
extern void cmd_show_list (struct cmd_list_element *, int, char *);
|
||||
|
||||
extern void
|
||||
error_no_arg PARAMS ((char *));
|
||||
extern NORETURN void error_no_arg (char *) ATTR_NORETURN;
|
||||
|
||||
extern void
|
||||
dont_repeat PARAMS ((void));
|
||||
extern void dont_repeat (void);
|
||||
|
||||
/* Used to mark commands that don't do anything. If we just leave the
|
||||
function field NULL, the command is interpreted as a help topic, or
|
||||
as a class of commands. */
|
||||
|
||||
extern void
|
||||
not_just_help_class_command PARAMS ((char *, int));
|
||||
extern void not_just_help_class_command (char *, int);
|
||||
|
||||
#endif /* !defined (COMMAND_H) */
|
||||
|
|
|
|||
|
|
@ -1,33 +1,38 @@
|
|||
/* Support for complaint handling during symbol reading in GDB.
|
||||
Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
|
||||
Copyright 1990, 1991, 1992, 1993, 1995, 1998, 1999, 2000
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "complaints.h"
|
||||
#include "gdbcmd.h"
|
||||
|
||||
extern void _initialize_complaints (void);
|
||||
|
||||
/* Structure to manage complaints about symbol file contents. */
|
||||
|
||||
struct complaint complaint_root[1] = {
|
||||
struct complaint complaint_root[1] =
|
||||
{
|
||||
{
|
||||
(char *) NULL, /* Complaint message */
|
||||
0, /* Complaint counter */
|
||||
complaint_root /* Next complaint. */
|
||||
(char *) NULL, /* Complaint message */
|
||||
0, /* Complaint counter */
|
||||
complaint_root /* Next complaint. */
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -42,46 +47,30 @@ static unsigned int stop_whining = 0;
|
|||
case 0: self explanatory message.
|
||||
case 1: First message of a series that must start off with explanation.
|
||||
case 2: Subsequent message, when user already knows we are reading
|
||||
symbols and we can just state our piece. */
|
||||
symbols and we can just state our piece. */
|
||||
|
||||
static int complaint_series = 0;
|
||||
|
||||
/* External variables and functions referenced. */
|
||||
|
||||
extern int info_verbose;
|
||||
|
||||
|
||||
|
||||
/* Functions to handle complaints during symbol reading. */
|
||||
|
||||
/* Print a complaint about the input symbols, and link the complaint block
|
||||
into a chain for later handling. */
|
||||
|
||||
/* VARARGS */
|
||||
void
|
||||
#ifdef ANSI_PROTOTYPES
|
||||
complain (struct complaint *complaint, ...)
|
||||
#else
|
||||
complain (va_alist)
|
||||
va_dcl
|
||||
#endif
|
||||
complain (struct complaint *complaint,...)
|
||||
{
|
||||
va_list args;
|
||||
#ifdef ANSI_PROTOTYPES
|
||||
va_start (args, complaint);
|
||||
#else
|
||||
struct complaint *complaint;
|
||||
|
||||
va_start (args);
|
||||
complaint = va_arg (args, struct complaint *);
|
||||
#endif
|
||||
|
||||
complaint -> counter++;
|
||||
if (complaint -> next == NULL)
|
||||
complaint->counter++;
|
||||
if (complaint->next == NULL)
|
||||
{
|
||||
complaint -> next = complaint_root -> next;
|
||||
complaint_root -> next = complaint;
|
||||
complaint->next = complaint_root->next;
|
||||
complaint_root->next = complaint;
|
||||
}
|
||||
if (complaint -> counter > stop_whining)
|
||||
if (complaint->counter > stop_whining)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -91,36 +80,51 @@ complain (va_alist)
|
|||
{
|
||||
|
||||
/* Isolated messages, must be self-explanatory. */
|
||||
case 0:
|
||||
begin_line ();
|
||||
puts_filtered ("During symbol reading, ");
|
||||
wrap_here ("");
|
||||
vprintf_filtered (complaint -> message, args);
|
||||
puts_filtered (".\n");
|
||||
break;
|
||||
case 0:
|
||||
if (warning_hook)
|
||||
(*warning_hook) (complaint->message, args);
|
||||
else
|
||||
{
|
||||
begin_line ();
|
||||
fputs_filtered ("During symbol reading, ", gdb_stderr);
|
||||
wrap_here ("");
|
||||
vfprintf_filtered (gdb_stderr, complaint->message, args);
|
||||
fputs_filtered (".\n", gdb_stderr);
|
||||
}
|
||||
break;
|
||||
|
||||
/* First of a series, without `set verbose'. */
|
||||
case 1:
|
||||
begin_line ();
|
||||
puts_filtered ("During symbol reading...");
|
||||
vprintf_filtered (complaint -> message, args);
|
||||
puts_filtered ("...");
|
||||
wrap_here ("");
|
||||
complaint_series++;
|
||||
break;
|
||||
case 1:
|
||||
if (warning_hook)
|
||||
(*warning_hook) (complaint->message, args);
|
||||
else
|
||||
{
|
||||
begin_line ();
|
||||
fputs_filtered ("During symbol reading...", gdb_stderr);
|
||||
vfprintf_filtered (gdb_stderr, complaint->message, args);
|
||||
fputs_filtered ("...", gdb_stderr);
|
||||
wrap_here ("");
|
||||
complaint_series++;
|
||||
}
|
||||
break;
|
||||
|
||||
/* Subsequent messages of a series, or messages under `set verbose'.
|
||||
(We'll already have produced a "Reading in symbols for XXX..."
|
||||
message and will clean up at the end with a newline.) */
|
||||
default:
|
||||
vprintf_filtered (complaint -> message, args);
|
||||
puts_filtered ("...");
|
||||
wrap_here ("");
|
||||
(We'll already have produced a "Reading in symbols for XXX..."
|
||||
message and will clean up at the end with a newline.) */
|
||||
default:
|
||||
if (warning_hook)
|
||||
(*warning_hook) (complaint->message, args);
|
||||
else
|
||||
{
|
||||
vfprintf_filtered (gdb_stderr, complaint->message, args);
|
||||
fputs_filtered ("...", gdb_stderr);
|
||||
wrap_here ("");
|
||||
}
|
||||
}
|
||||
/* If GDB dumps core, we'd like to see the complaints first. Presumably
|
||||
GDB will not be sending so many complaints that this becomes a
|
||||
performance hog. */
|
||||
gdb_flush (gdb_stdout);
|
||||
gdb_flush (gdb_stderr);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
|
|
@ -133,18 +137,16 @@ complain (va_alist)
|
|||
context for the user to figure it out. */
|
||||
|
||||
void
|
||||
clear_complaints (sym_reading, noisy)
|
||||
int sym_reading;
|
||||
int noisy;
|
||||
clear_complaints (int sym_reading, int noisy)
|
||||
{
|
||||
struct complaint *p;
|
||||
|
||||
for (p = complaint_root -> next; p != complaint_root; p = p -> next)
|
||||
for (p = complaint_root->next; p != complaint_root; p = p->next)
|
||||
{
|
||||
p -> counter = 0;
|
||||
p->counter = 0;
|
||||
}
|
||||
|
||||
if (!sym_reading && !noisy && complaint_series > 1)
|
||||
if (!sym_reading && !noisy && complaint_series > 1 && !warning_hook)
|
||||
{
|
||||
/* Terminate previous series, since caller won't. */
|
||||
puts_filtered ("\n");
|
||||
|
|
@ -154,7 +156,7 @@ clear_complaints (sym_reading, noisy)
|
|||
}
|
||||
|
||||
void
|
||||
_initialize_complaints ()
|
||||
_initialize_complaints (void)
|
||||
{
|
||||
add_show_from_set
|
||||
(add_set_cmd ("complaints", class_support, var_zinteger,
|
||||
|
|
|
|||
|
|
@ -1,21 +1,23 @@
|
|||
/* Definitions for complaint handling during symbol reading in GDB.
|
||||
Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
|
||||
Copyright 1990, 1991, 1992, 1995, 1998, 2000
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
|
||||
#if !defined (COMPLAINTS_H)
|
||||
|
|
@ -30,11 +32,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||
if verbose, we report how many of each problem we had. */
|
||||
|
||||
struct complaint
|
||||
{
|
||||
char *message;
|
||||
unsigned counter;
|
||||
struct complaint *next;
|
||||
};
|
||||
{
|
||||
char *message;
|
||||
unsigned counter;
|
||||
struct complaint *next;
|
||||
};
|
||||
|
||||
/* Root of the chain of complaints that have at some point been issued.
|
||||
This is used to reset the counters, and/or report the total counts. */
|
||||
|
|
@ -43,11 +45,9 @@ extern struct complaint complaint_root[1];
|
|||
|
||||
/* Functions that handle complaints. (in complaints.c) */
|
||||
|
||||
extern void
|
||||
complain PARAMS ((struct complaint *, ...));
|
||||
extern void complain (struct complaint *, ...);
|
||||
|
||||
extern void
|
||||
clear_complaints PARAMS ((int, int));
|
||||
extern void clear_complaints (int, int);
|
||||
|
||||
|
||||
#endif /* !defined (COMPLAINTS_H) */
|
||||
#endif /* !defined (COMPLAINTS_H) */
|
||||
|
|
|
|||
713
contrib/gdb/gdb/completer.c
Normal file
713
contrib/gdb/gdb/completer.c
Normal file
|
|
@ -0,0 +1,713 @@
|
|||
/* Line completion stuff for GDB, the GNU debugger.
|
||||
Copyright 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "symtab.h"
|
||||
#include "gdbtypes.h"
|
||||
#include "expression.h"
|
||||
#include "filenames.h" /* for DOSish file names */
|
||||
|
||||
/* FIXME: This is needed because of lookup_cmd_1().
|
||||
We should be calling a hook instead so we eliminate the CLI dependency. */
|
||||
#include "gdbcmd.h"
|
||||
|
||||
/* Needed for rl_completer_word_break_characters() and for
|
||||
filename_completion_function. */
|
||||
#include <readline/readline.h>
|
||||
|
||||
/* readline defines this. */
|
||||
#undef savestring
|
||||
|
||||
#include "completer.h"
|
||||
|
||||
/* Prototypes for local functions */
|
||||
char *line_completion_function (char *text, int matches, char *line_buffer,
|
||||
int point);
|
||||
|
||||
/* readline uses the word breaks for two things:
|
||||
(1) In figuring out where to point the TEXT parameter to the
|
||||
rl_completion_entry_function. Since we don't use TEXT for much,
|
||||
it doesn't matter a lot what the word breaks are for this purpose, but
|
||||
it does affect how much stuff M-? lists.
|
||||
(2) If one of the matches contains a word break character, readline
|
||||
will quote it. That's why we switch between
|
||||
gdb_completer_word_break_characters and
|
||||
gdb_completer_command_word_break_characters. I'm not sure when
|
||||
we need this behavior (perhaps for funky characters in C++ symbols?). */
|
||||
|
||||
/* Variables which are necessary for fancy command line editing. */
|
||||
static char *gdb_completer_word_break_characters =
|
||||
" \t\n!@#$%^&*()+=|~`}{[]\"';:?/>.<,-";
|
||||
|
||||
/* When completing on command names, we remove '-' from the list of
|
||||
word break characters, since we use it in command names. If the
|
||||
readline library sees one in any of the current completion strings,
|
||||
it thinks that the string needs to be quoted and automatically supplies
|
||||
a leading quote. */
|
||||
static char *gdb_completer_command_word_break_characters =
|
||||
" \t\n!@#$%^&*()+=|~`}{[]\"';:?/>.<,";
|
||||
|
||||
/* When completing on file names, we remove from the list of word
|
||||
break characters any characters that are commonly used in file
|
||||
names, such as '-', '+', '~', etc. Otherwise, readline displays
|
||||
incorrect completion candidates. */
|
||||
#ifdef HAVE_DOS_BASED_FILE_SYSTEM
|
||||
/* MS-DOS and MS-Windows use colon as part of the drive spec, and most
|
||||
programs support @foo style response files. */
|
||||
static char *gdb_completer_file_name_break_characters = " \t\n*|\"';?><@";
|
||||
#else
|
||||
static char *gdb_completer_file_name_break_characters = " \t\n*|\"';:?><";
|
||||
#endif
|
||||
|
||||
/* These are used when completing on locations, which can mix file
|
||||
names and symbol names separated by a colon. */
|
||||
static char *gdb_completer_loc_break_characters = " \t\n*|\"';:?><,";
|
||||
|
||||
/* Characters that can be used to quote completion strings. Note that we
|
||||
can't include '"' because the gdb C parser treats such quoted sequences
|
||||
as strings. */
|
||||
static char *gdb_completer_quote_characters = "'";
|
||||
|
||||
/* Accessor for some completer data that may interest other files. */
|
||||
|
||||
char *
|
||||
get_gdb_completer_word_break_characters (void)
|
||||
{
|
||||
return gdb_completer_word_break_characters;
|
||||
}
|
||||
|
||||
char *
|
||||
get_gdb_completer_quote_characters (void)
|
||||
{
|
||||
return gdb_completer_quote_characters;
|
||||
}
|
||||
|
||||
/* Line completion interface function for readline. */
|
||||
|
||||
char *
|
||||
readline_line_completion_function (char *text, int matches)
|
||||
{
|
||||
return line_completion_function (text, matches, rl_line_buffer, rl_point);
|
||||
}
|
||||
|
||||
/* This can be used for functions which don't want to complete on symbols
|
||||
but don't want to complete on anything else either. */
|
||||
char **
|
||||
noop_completer (char *text, char *prefix)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Complete on filenames. */
|
||||
char **
|
||||
filename_completer (char *text, char *word)
|
||||
{
|
||||
int subsequent_name;
|
||||
char **return_val;
|
||||
int return_val_used;
|
||||
int return_val_alloced;
|
||||
|
||||
return_val_used = 0;
|
||||
/* Small for testing. */
|
||||
return_val_alloced = 1;
|
||||
return_val = (char **) xmalloc (return_val_alloced * sizeof (char *));
|
||||
|
||||
subsequent_name = 0;
|
||||
while (1)
|
||||
{
|
||||
char *p;
|
||||
p = filename_completion_function (text, subsequent_name);
|
||||
if (return_val_used >= return_val_alloced)
|
||||
{
|
||||
return_val_alloced *= 2;
|
||||
return_val =
|
||||
(char **) xrealloc (return_val,
|
||||
return_val_alloced * sizeof (char *));
|
||||
}
|
||||
if (p == NULL)
|
||||
{
|
||||
return_val[return_val_used++] = p;
|
||||
break;
|
||||
}
|
||||
/* We need to set subsequent_name to a non-zero value before the
|
||||
continue line below, because otherwise, if the first file seen
|
||||
by GDB is a backup file whose name ends in a `~', we will loop
|
||||
indefinitely. */
|
||||
subsequent_name = 1;
|
||||
/* Like emacs, don't complete on old versions. Especially useful
|
||||
in the "source" command. */
|
||||
if (p[strlen (p) - 1] == '~')
|
||||
continue;
|
||||
|
||||
{
|
||||
char *q;
|
||||
if (word == text)
|
||||
/* Return exactly p. */
|
||||
return_val[return_val_used++] = p;
|
||||
else if (word > text)
|
||||
{
|
||||
/* Return some portion of p. */
|
||||
q = xmalloc (strlen (p) + 5);
|
||||
strcpy (q, p + (word - text));
|
||||
return_val[return_val_used++] = q;
|
||||
xfree (p);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Return some of TEXT plus p. */
|
||||
q = xmalloc (strlen (p) + (text - word) + 5);
|
||||
strncpy (q, word, text - word);
|
||||
q[text - word] = '\0';
|
||||
strcat (q, p);
|
||||
return_val[return_val_used++] = q;
|
||||
xfree (p);
|
||||
}
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
/* There is no way to do this just long enough to affect quote inserting
|
||||
without also affecting the next completion. This should be fixed in
|
||||
readline. FIXME. */
|
||||
/* Insure that readline does the right thing
|
||||
with respect to inserting quotes. */
|
||||
rl_completer_word_break_characters = "";
|
||||
#endif
|
||||
return return_val;
|
||||
}
|
||||
|
||||
/* Complete on locations, which might be of two possible forms:
|
||||
|
||||
file:line
|
||||
or
|
||||
symbol+offset
|
||||
|
||||
This is intended to be used in commands that set breakpoints etc. */
|
||||
char **
|
||||
location_completer (char *text, char *word)
|
||||
{
|
||||
int n_syms = 0, n_files = 0;
|
||||
char ** fn_list = NULL;
|
||||
char ** list = NULL;
|
||||
char *p;
|
||||
int quote_found = 0;
|
||||
int quoted = *text == '\'' || *text == '"';
|
||||
int quote_char = '\0';
|
||||
char *colon = NULL;
|
||||
char *file_to_match = NULL;
|
||||
char *symbol_start = text;
|
||||
char *orig_text = text;
|
||||
size_t text_len;
|
||||
|
||||
/* Do we have an unquoted colon, as in "break foo.c::bar"? */
|
||||
for (p = text; *p != '\0'; ++p)
|
||||
{
|
||||
if (*p == '\\' && p[1] == '\'')
|
||||
p++;
|
||||
else if (*p == '\'' || *p == '"')
|
||||
{
|
||||
quote_found = *p;
|
||||
quote_char = *p++;
|
||||
while (*p != '\0' && *p != quote_found)
|
||||
{
|
||||
if (*p == '\\' && p[1] == quote_found)
|
||||
p++;
|
||||
p++;
|
||||
}
|
||||
|
||||
if (*p == quote_found)
|
||||
quote_found = 0;
|
||||
else
|
||||
break; /* hit the end of text */
|
||||
}
|
||||
#if HAVE_DOS_BASED_FILE_SYSTEM
|
||||
/* If we have a DOS-style absolute file name at the beginning of
|
||||
TEXT, and the colon after the drive letter is the only colon
|
||||
we found, pretend the colon is not there. */
|
||||
else if (p < text + 3 && *p == ':' && p == text + 1 + quoted)
|
||||
;
|
||||
#endif
|
||||
else if (*p == ':' && !colon)
|
||||
{
|
||||
colon = p;
|
||||
symbol_start = p + 1;
|
||||
}
|
||||
else if (strchr (gdb_completer_word_break_characters, *p))
|
||||
symbol_start = p + 1;
|
||||
}
|
||||
|
||||
if (quoted)
|
||||
text++;
|
||||
text_len = strlen (text);
|
||||
|
||||
/* Where is the file name? */
|
||||
if (colon)
|
||||
{
|
||||
char *s;
|
||||
|
||||
file_to_match = (char *) xmalloc (colon - text + 1);
|
||||
strncpy (file_to_match, text, colon - text + 1);
|
||||
/* Remove trailing colons and quotes from the file name. */
|
||||
for (s = file_to_match + (colon - text);
|
||||
s > file_to_match;
|
||||
s--)
|
||||
if (*s == ':' || *s == quote_char)
|
||||
*s = '\0';
|
||||
}
|
||||
/* If the text includes a colon, they want completion only on a
|
||||
symbol name after the colon. Otherwise, we need to complete on
|
||||
symbols as well as on files. */
|
||||
if (colon)
|
||||
{
|
||||
list = make_file_symbol_completion_list (symbol_start, word,
|
||||
file_to_match);
|
||||
xfree (file_to_match);
|
||||
}
|
||||
else
|
||||
{
|
||||
list = make_symbol_completion_list (symbol_start, word);
|
||||
/* If text includes characters which cannot appear in a file
|
||||
name, they cannot be asking for completion on files. */
|
||||
if (strcspn (text, gdb_completer_file_name_break_characters) == text_len)
|
||||
fn_list = make_source_files_completion_list (text, text);
|
||||
}
|
||||
|
||||
/* How many completions do we have in both lists? */
|
||||
if (fn_list)
|
||||
for ( ; fn_list[n_files]; n_files++)
|
||||
;
|
||||
if (list)
|
||||
for ( ; list[n_syms]; n_syms++)
|
||||
;
|
||||
|
||||
/* Make list[] large enough to hold both lists, then catenate
|
||||
fn_list[] onto the end of list[]. */
|
||||
if (n_syms && n_files)
|
||||
{
|
||||
list = xrealloc (list, (n_syms + n_files + 1) * sizeof (char *));
|
||||
memcpy (list + n_syms, fn_list, (n_files + 1) * sizeof (char *));
|
||||
xfree (fn_list);
|
||||
}
|
||||
else if (n_files)
|
||||
{
|
||||
/* If we only have file names as possible completion, we should
|
||||
bring them in sync with what rl_complete expects. The
|
||||
problem is that if the user types "break /foo/b TAB", and the
|
||||
possible completions are "/foo/bar" and "/foo/baz"
|
||||
rl_complete expects us to return "bar" and "baz", without the
|
||||
leading directories, as possible completions, because `word'
|
||||
starts at the "b". But we ignore the value of `word' when we
|
||||
call make_source_files_completion_list above (because that
|
||||
would not DTRT when the completion results in both symbols
|
||||
and file names), so make_source_files_completion_list returns
|
||||
the full "/foo/bar" and "/foo/baz" strings. This produces
|
||||
wrong results when, e.g., there's only one possible
|
||||
completion, because rl_complete will prepend "/foo/" to each
|
||||
candidate completion. The loop below removes that leading
|
||||
part. */
|
||||
for (n_files = 0; fn_list[n_files]; n_files++)
|
||||
{
|
||||
memmove (fn_list[n_files], fn_list[n_files] + (word - text),
|
||||
strlen (fn_list[n_files]) + 1 - (word - text));
|
||||
}
|
||||
/* Return just the file-name list as the result. */
|
||||
list = fn_list;
|
||||
}
|
||||
else if (!n_syms)
|
||||
{
|
||||
/* No completions at all. As the final resort, try completing
|
||||
on the entire text as a symbol. */
|
||||
list = make_symbol_completion_list (orig_text, word);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/* Complete on command names. Used by "help". */
|
||||
char **
|
||||
command_completer (char *text, char *word)
|
||||
{
|
||||
return complete_on_cmdlist (cmdlist, text, word);
|
||||
}
|
||||
|
||||
|
||||
/* Here are some useful test cases for completion. FIXME: These should
|
||||
be put in the test suite. They should be tested with both M-? and TAB.
|
||||
|
||||
"show output-" "radix"
|
||||
"show output" "-radix"
|
||||
"p" ambiguous (commands starting with p--path, print, printf, etc.)
|
||||
"p " ambiguous (all symbols)
|
||||
"info t foo" no completions
|
||||
"info t " no completions
|
||||
"info t" ambiguous ("info target", "info terminal", etc.)
|
||||
"info ajksdlfk" no completions
|
||||
"info ajksdlfk " no completions
|
||||
"info" " "
|
||||
"info " ambiguous (all info commands)
|
||||
"p \"a" no completions (string constant)
|
||||
"p 'a" ambiguous (all symbols starting with a)
|
||||
"p b-a" ambiguous (all symbols starting with a)
|
||||
"p b-" ambiguous (all symbols)
|
||||
"file Make" "file" (word break hard to screw up here)
|
||||
"file ../gdb.stabs/we" "ird" (needs to not break word at slash)
|
||||
*/
|
||||
|
||||
/* Generate completions all at once. Returns a NULL-terminated array
|
||||
of strings. Both the array and each element are allocated with
|
||||
xmalloc. It can also return NULL if there are no completions.
|
||||
|
||||
TEXT is the caller's idea of the "word" we are looking at.
|
||||
|
||||
LINE_BUFFER is available to be looked at; it contains the entire text
|
||||
of the line. POINT is the offset in that line of the cursor. You
|
||||
should pretend that the line ends at POINT. */
|
||||
|
||||
char **
|
||||
complete_line (char *text, char *line_buffer, int point)
|
||||
{
|
||||
char **list = NULL;
|
||||
char *tmp_command, *p;
|
||||
/* Pointer within tmp_command which corresponds to text. */
|
||||
char *word;
|
||||
struct cmd_list_element *c, *result_list;
|
||||
|
||||
/* Choose the default set of word break characters to break completions.
|
||||
If we later find out that we are doing completions on command strings
|
||||
(as opposed to strings supplied by the individual command completer
|
||||
functions, which can be any string) then we will switch to the
|
||||
special word break set for command strings, which leaves out the
|
||||
'-' character used in some commands. */
|
||||
|
||||
rl_completer_word_break_characters =
|
||||
gdb_completer_word_break_characters;
|
||||
|
||||
/* Decide whether to complete on a list of gdb commands or on symbols. */
|
||||
tmp_command = (char *) alloca (point + 1);
|
||||
p = tmp_command;
|
||||
|
||||
strncpy (tmp_command, line_buffer, point);
|
||||
tmp_command[point] = '\0';
|
||||
/* Since text always contains some number of characters leading up
|
||||
to point, we can find the equivalent position in tmp_command
|
||||
by subtracting that many characters from the end of tmp_command. */
|
||||
word = tmp_command + point - strlen (text);
|
||||
|
||||
if (point == 0)
|
||||
{
|
||||
/* An empty line we want to consider ambiguous; that is, it
|
||||
could be any command. */
|
||||
c = (struct cmd_list_element *) -1;
|
||||
result_list = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
c = lookup_cmd_1 (&p, cmdlist, &result_list, 1);
|
||||
}
|
||||
|
||||
/* Move p up to the next interesting thing. */
|
||||
while (*p == ' ' || *p == '\t')
|
||||
{
|
||||
p++;
|
||||
}
|
||||
|
||||
if (!c)
|
||||
{
|
||||
/* It is an unrecognized command. So there are no
|
||||
possible completions. */
|
||||
list = NULL;
|
||||
}
|
||||
else if (c == (struct cmd_list_element *) -1)
|
||||
{
|
||||
char *q;
|
||||
|
||||
/* lookup_cmd_1 advances p up to the first ambiguous thing, but
|
||||
doesn't advance over that thing itself. Do so now. */
|
||||
q = p;
|
||||
while (*q && (isalnum (*q) || *q == '-' || *q == '_'))
|
||||
++q;
|
||||
if (q != tmp_command + point)
|
||||
{
|
||||
/* There is something beyond the ambiguous
|
||||
command, so there are no possible completions. For
|
||||
example, "info t " or "info t foo" does not complete
|
||||
to anything, because "info t" can be "info target" or
|
||||
"info terminal". */
|
||||
list = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We're trying to complete on the command which was ambiguous.
|
||||
This we can deal with. */
|
||||
if (result_list)
|
||||
{
|
||||
list = complete_on_cmdlist (*result_list->prefixlist, p,
|
||||
word);
|
||||
}
|
||||
else
|
||||
{
|
||||
list = complete_on_cmdlist (cmdlist, p, word);
|
||||
}
|
||||
/* Insure that readline does the right thing with respect to
|
||||
inserting quotes. */
|
||||
rl_completer_word_break_characters =
|
||||
gdb_completer_command_word_break_characters;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We've recognized a full command. */
|
||||
|
||||
if (p == tmp_command + point)
|
||||
{
|
||||
/* There is no non-whitespace in the line beyond the command. */
|
||||
|
||||
if (p[-1] == ' ' || p[-1] == '\t')
|
||||
{
|
||||
/* The command is followed by whitespace; we need to complete
|
||||
on whatever comes after command. */
|
||||
if (c->prefixlist)
|
||||
{
|
||||
/* It is a prefix command; what comes after it is
|
||||
a subcommand (e.g. "info "). */
|
||||
list = complete_on_cmdlist (*c->prefixlist, p, word);
|
||||
|
||||
/* Insure that readline does the right thing
|
||||
with respect to inserting quotes. */
|
||||
rl_completer_word_break_characters =
|
||||
gdb_completer_command_word_break_characters;
|
||||
}
|
||||
else if (c->enums)
|
||||
{
|
||||
list = complete_on_enum (c->enums, p, word);
|
||||
rl_completer_word_break_characters =
|
||||
gdb_completer_command_word_break_characters;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* It is a normal command; what comes after it is
|
||||
completed by the command's completer function. */
|
||||
if (c->completer == filename_completer)
|
||||
{
|
||||
/* Many commands which want to complete on
|
||||
file names accept several file names, as
|
||||
in "run foo bar >>baz". So we don't want
|
||||
to complete the entire text after the
|
||||
command, just the last word. To this
|
||||
end, we need to find the beginning of the
|
||||
file name by starting at `word' and going
|
||||
backwards. */
|
||||
for (p = word;
|
||||
p > tmp_command
|
||||
&& strchr (gdb_completer_file_name_break_characters, p[-1]) == NULL;
|
||||
p--)
|
||||
;
|
||||
rl_completer_word_break_characters =
|
||||
gdb_completer_file_name_break_characters;
|
||||
}
|
||||
else if (c->completer == location_completer)
|
||||
{
|
||||
/* Commands which complete on locations want to
|
||||
see the entire argument. */
|
||||
for (p = word;
|
||||
p > tmp_command
|
||||
&& p[-1] != ' ' && p[-1] != '\t';
|
||||
p--)
|
||||
;
|
||||
}
|
||||
list = (*c->completer) (p, word);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The command is not followed by whitespace; we need to
|
||||
complete on the command itself. e.g. "p" which is a
|
||||
command itself but also can complete to "print", "ptype"
|
||||
etc. */
|
||||
char *q;
|
||||
|
||||
/* Find the command we are completing on. */
|
||||
q = p;
|
||||
while (q > tmp_command)
|
||||
{
|
||||
if (isalnum (q[-1]) || q[-1] == '-' || q[-1] == '_')
|
||||
--q;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
list = complete_on_cmdlist (result_list, q, word);
|
||||
|
||||
/* Insure that readline does the right thing
|
||||
with respect to inserting quotes. */
|
||||
rl_completer_word_break_characters =
|
||||
gdb_completer_command_word_break_characters;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* There is non-whitespace beyond the command. */
|
||||
|
||||
if (c->prefixlist && !c->allow_unknown)
|
||||
{
|
||||
/* It is an unrecognized subcommand of a prefix command,
|
||||
e.g. "info adsfkdj". */
|
||||
list = NULL;
|
||||
}
|
||||
else if (c->enums)
|
||||
{
|
||||
list = complete_on_enum (c->enums, p, word);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* It is a normal command. */
|
||||
if (c->completer == filename_completer)
|
||||
{
|
||||
/* See the commentary above about the specifics
|
||||
of file-name completion. */
|
||||
for (p = word;
|
||||
p > tmp_command
|
||||
&& strchr (gdb_completer_file_name_break_characters, p[-1]) == NULL;
|
||||
p--)
|
||||
;
|
||||
rl_completer_word_break_characters =
|
||||
gdb_completer_file_name_break_characters;
|
||||
}
|
||||
else if (c->completer == location_completer)
|
||||
{
|
||||
for (p = word;
|
||||
p > tmp_command
|
||||
&& p[-1] != ' ' && p[-1] != '\t';
|
||||
p--)
|
||||
;
|
||||
}
|
||||
list = (*c->completer) (p, word);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/* Generate completions one by one for the completer. Each time we are
|
||||
called return another potential completion to the caller.
|
||||
line_completion just completes on commands or passes the buck to the
|
||||
command's completer function, the stuff specific to symbol completion
|
||||
is in make_symbol_completion_list.
|
||||
|
||||
TEXT is the caller's idea of the "word" we are looking at.
|
||||
|
||||
MATCHES is the number of matches that have currently been collected from
|
||||
calling this completion function. When zero, then we need to initialize,
|
||||
otherwise the initialization has already taken place and we can just
|
||||
return the next potential completion string.
|
||||
|
||||
LINE_BUFFER is available to be looked at; it contains the entire text
|
||||
of the line. POINT is the offset in that line of the cursor. You
|
||||
should pretend that the line ends at POINT.
|
||||
|
||||
Returns NULL if there are no more completions, else a pointer to a string
|
||||
which is a possible completion, it is the caller's responsibility to
|
||||
free the string. */
|
||||
|
||||
char *
|
||||
line_completion_function (char *text, int matches, char *line_buffer, int point)
|
||||
{
|
||||
static char **list = (char **) NULL; /* Cache of completions */
|
||||
static int index; /* Next cached completion */
|
||||
char *output = NULL;
|
||||
|
||||
if (matches == 0)
|
||||
{
|
||||
/* The caller is beginning to accumulate a new set of completions, so
|
||||
we need to find all of them now, and cache them for returning one at
|
||||
a time on future calls. */
|
||||
|
||||
if (list)
|
||||
{
|
||||
/* Free the storage used by LIST, but not by the strings inside.
|
||||
This is because rl_complete_internal () frees the strings. */
|
||||
xfree (list);
|
||||
}
|
||||
index = 0;
|
||||
list = complete_line (text, line_buffer, point);
|
||||
}
|
||||
|
||||
/* If we found a list of potential completions during initialization then
|
||||
dole them out one at a time. The vector of completions is NULL
|
||||
terminated, so after returning the last one, return NULL (and continue
|
||||
to do so) each time we are called after that, until a new list is
|
||||
available. */
|
||||
|
||||
if (list)
|
||||
{
|
||||
output = list[index];
|
||||
if (output)
|
||||
{
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Can't do this because readline hasn't yet checked the word breaks
|
||||
for figuring out whether to insert a quote. */
|
||||
if (output == NULL)
|
||||
/* Make sure the word break characters are set back to normal for the
|
||||
next time that readline tries to complete something. */
|
||||
rl_completer_word_break_characters =
|
||||
gdb_completer_word_break_characters;
|
||||
#endif
|
||||
|
||||
return (output);
|
||||
}
|
||||
/* Skip over a possibly quoted word (as defined by the quote characters
|
||||
and word break characters the completer uses). Returns pointer to the
|
||||
location after the "word". */
|
||||
|
||||
char *
|
||||
skip_quoted (char *str)
|
||||
{
|
||||
char quote_char = '\0';
|
||||
char *scan;
|
||||
|
||||
for (scan = str; *scan != '\0'; scan++)
|
||||
{
|
||||
if (quote_char != '\0')
|
||||
{
|
||||
/* Ignore everything until the matching close quote char */
|
||||
if (*scan == quote_char)
|
||||
{
|
||||
/* Found matching close quote. */
|
||||
scan++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (strchr (gdb_completer_quote_characters, *scan))
|
||||
{
|
||||
/* Found start of a quoted string. */
|
||||
quote_char = *scan;
|
||||
}
|
||||
else if (strchr (gdb_completer_word_break_characters, *scan))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return (scan);
|
||||
}
|
||||
|
||||
44
contrib/gdb/gdb/completer.h
Normal file
44
contrib/gdb/gdb/completer.h
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/* Header for GDB line completion.
|
||||
Copyright 2000 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#if !defined (COMPLETER_H)
|
||||
#define COMPLETER_H 1
|
||||
|
||||
extern char **complete_line (char *text, char *line_buffer, int point);
|
||||
|
||||
extern char *line_completion_function (char *, int, char *, int);
|
||||
|
||||
extern char *readline_line_completion_function (char *text, int matches);
|
||||
|
||||
extern char **noop_completer (char *, char *);
|
||||
|
||||
extern char **filename_completer (char *, char *);
|
||||
|
||||
extern char **location_completer (char *, char *);
|
||||
|
||||
extern char **command_completer (char *, char *);
|
||||
|
||||
extern char *get_gdb_completer_word_break_characters (void);
|
||||
|
||||
extern char *get_gdb_completer_quote_characters (void);
|
||||
|
||||
/* Exported to linespec.c */
|
||||
|
||||
extern char *skip_quoted (char *str);
|
||||
|
||||
#endif /* defined (COMPLETER_H) */
|
||||
|
|
@ -1,17 +1,5 @@
|
|||
/* config.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* Whether malloc must be declared even if <stdlib.h> is included. */
|
||||
#undef NEED_DECLARATION_MALLOC
|
||||
|
||||
/* Whether realloc must be declared even if <stdlib.h> is included. */
|
||||
#undef NEED_DECLARATION_REALLOC
|
||||
|
||||
/* Whether free must be declared even if <stdlib.h> is included. */
|
||||
#undef NEED_DECLARATION_FREE
|
||||
|
||||
/* Whether strerror must be declared even if <string.h> is included. */
|
||||
#undef NEED_DECLARATION_STRERROR
|
||||
|
||||
/* Define if on AIX 3.
|
||||
System headers sometimes define this.
|
||||
We just want to avoid a redefinition error message. */
|
||||
|
|
@ -41,18 +29,24 @@
|
|||
/* Define if you have a working `mmap' system call. */
|
||||
#undef HAVE_MMAP
|
||||
|
||||
/* Define if you have <vfork.h>. */
|
||||
#undef HAVE_VFORK_H
|
||||
|
||||
/* Define as __inline if that's what the C compiler calls it. */
|
||||
#undef inline
|
||||
|
||||
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||
#undef off_t
|
||||
|
||||
/* Define if you need to in order for stat and other things to work. */
|
||||
#undef _POSIX_SOURCE
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#undef pid_t
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
/* Define if the `setpgrp' function takes no argument. */
|
||||
#undef SETPGRP_VOID
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||
#undef size_t
|
||||
|
||||
|
|
@ -71,13 +65,44 @@
|
|||
/* Define if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define vfork as fork if vfork does not work. */
|
||||
#undef vfork
|
||||
|
||||
/* Define if compiling on Solaris 7. */
|
||||
#undef _MSE_INT_H
|
||||
|
||||
/* Define if your struct reg has r_fs. */
|
||||
#undef HAVE_STRUCT_REG_R_FS
|
||||
|
||||
/* Define if your struct reg has r_gs. */
|
||||
#undef HAVE_STRUCT_REG_R_GS
|
||||
|
||||
/* Define if <link.h> exists and defines struct link_map which has
|
||||
members with an ``l_'' prefix. (For Solaris, SVR4, and
|
||||
SVR4-like systems.) */
|
||||
#undef HAVE_STRUCT_LINK_MAP_WITH_L_MEMBERS
|
||||
|
||||
/* Define if <link.h> exists and defines struct link_map which has
|
||||
members with an ``lm_'' prefix. (For SunOS.) */
|
||||
#undef HAVE_STRUCT_LINK_MAP_WITH_LM_MEMBERS
|
||||
|
||||
/* Define if <link.h> exists and defines a struct so_map which has
|
||||
members with an ``som_'' prefix. (Found on older *BSD systems.) */
|
||||
#undef HAVE_STRUCT_SO_MAP_WITH_SOM_MEMBERS
|
||||
|
||||
/* Define if <sys/link.h> has struct link_map32 */
|
||||
#undef HAVE_STRUCT_LINK_MAP32
|
||||
|
||||
/* Define if the prfpregset_t type is broken. */
|
||||
#undef PRFPREGSET_T_BROKEN
|
||||
|
||||
/* Define if you want to use new multi-fd /proc interface
|
||||
(replaces HAVE_MULTIPLE_PROC_FDS as well as other macros). */
|
||||
#undef NEW_PROC_API
|
||||
|
||||
/* Define if ioctl argument PIOCSET is available. */
|
||||
#undef HAVE_PROCFS_PIOCSET
|
||||
|
||||
/* /proc PID entries are directories containing the files
|
||||
ctl as map status */
|
||||
#undef HAVE_MULTIPLE_PROC_FDS
|
||||
|
||||
/* Define if the `long long' type works. */
|
||||
#undef CC_HAS_LONG_LONG
|
||||
|
||||
|
|
@ -109,18 +134,55 @@
|
|||
to explicitly deallocate that memory when gdb calls exit. */
|
||||
#undef MMCHECK_FORCE
|
||||
|
||||
/* Define if you want to use the full-screen terminal user interface. */
|
||||
#undef TUI
|
||||
|
||||
/* Define if <proc_service.h> on solaris uses int instead of
|
||||
size_t, and assorted other type changes. */
|
||||
#undef PROC_SERVICE_IS_OLD
|
||||
|
||||
/* If you want to specify a default CPU variant, define this to be its
|
||||
name, as a C string. */
|
||||
#undef TARGET_CPU_DEFAULT
|
||||
|
||||
/* Define if the simulator is being linked in. */
|
||||
#undef WITH_SIM
|
||||
|
||||
/* Set to true if the save_state_t structure is present */
|
||||
#define HAVE_STRUCT_SAVE_STATE_T 0
|
||||
#undef HAVE_STRUCT_SAVE_STATE_T
|
||||
|
||||
/* Set to true if the save_state_t structure has the ss_wide member */
|
||||
#define HAVE_STRUCT_MEMBER_SS_WIDE 0
|
||||
#undef HAVE_STRUCT_MEMBER_SS_WIDE
|
||||
|
||||
/* Define if <sys/ptrace.h> defines the PTRACE_GETREGS request. */
|
||||
#undef HAVE_PTRACE_GETREGS
|
||||
|
||||
/* Define if <sys/ptrace.h> defines the PTRACE_GETFPXREGS request. */
|
||||
#undef HAVE_PTRACE_GETFPXREGS
|
||||
|
||||
/* Define if <sys/ptrace.h> defines the PT_GETDBREGS request. */
|
||||
#undef HAVE_PT_GETDBREGS
|
||||
|
||||
/* Define if <sys/ptrace.h> defines the PT_GETXMMREGS request. */
|
||||
#undef HAVE_PT_GETXMMREGS
|
||||
|
||||
/* Define if gnu-regex.c included with GDB should be used. */
|
||||
#undef USE_INCLUDED_REGEX
|
||||
|
||||
/* BFD's default architecture. */
|
||||
#undef DEFAULT_BFD_ARCH
|
||||
|
||||
/* BFD's default target vector. */
|
||||
#undef DEFAULT_BFD_VEC
|
||||
|
||||
/* Multi-arch enabled. */
|
||||
#undef GDB_MULTI_ARCH
|
||||
|
||||
/* hostfile */
|
||||
#undef GDB_XM_FILE
|
||||
|
||||
/* targetfile */
|
||||
#undef GDB_TM_FILE
|
||||
|
||||
/* nativefile */
|
||||
#undef GDB_NM_FILE
|
||||
|
||||
/* Define if you have the __argz_count function. */
|
||||
#undef HAVE___ARGZ_COUNT
|
||||
|
|
@ -140,6 +202,9 @@
|
|||
/* Define if you have the bzero function. */
|
||||
#undef HAVE_BZERO
|
||||
|
||||
/* Define if you have the canonicalize_file_name function. */
|
||||
#undef HAVE_CANONICALIZE_FILE_NAME
|
||||
|
||||
/* Define if you have the dcgettext function. */
|
||||
#undef HAVE_DCGETTEXT
|
||||
|
||||
|
|
@ -155,9 +220,15 @@
|
|||
/* Define if you have the munmap function. */
|
||||
#undef HAVE_MUNMAP
|
||||
|
||||
/* Define if you have the poll function. */
|
||||
#undef HAVE_POLL
|
||||
|
||||
/* Define if you have the putenv function. */
|
||||
#undef HAVE_PUTENV
|
||||
|
||||
/* Define if you have the realpath function. */
|
||||
#undef HAVE_REALPATH
|
||||
|
||||
/* Define if you have the sbrk function. */
|
||||
#undef HAVE_SBRK
|
||||
|
||||
|
|
@ -170,9 +241,21 @@
|
|||
/* Define if you have the setpgid function. */
|
||||
#undef HAVE_SETPGID
|
||||
|
||||
/* Define if you have the setpgrp function. */
|
||||
#undef HAVE_SETPGRP
|
||||
|
||||
/* Define if you have the sigaction function. */
|
||||
#undef HAVE_SIGACTION
|
||||
|
||||
/* Define if you have the sigprocmask function. */
|
||||
#undef HAVE_SIGPROCMASK
|
||||
|
||||
/* Define if you have the sigsetmask function. */
|
||||
#undef HAVE_SIGSETMASK
|
||||
|
||||
/* Define if you have the socketpair function. */
|
||||
#undef HAVE_SOCKETPAIR
|
||||
|
||||
/* Define if you have the stpcpy function. */
|
||||
#undef HAVE_STPCPY
|
||||
|
||||
|
|
@ -194,8 +277,8 @@
|
|||
/* Define if you have the <curses.h> header file. */
|
||||
#undef HAVE_CURSES_H
|
||||
|
||||
/* Define if you have the <endian.h> header file. */
|
||||
#undef HAVE_ENDIAN_H
|
||||
/* Define if you have the <dirent.h> header file. */
|
||||
#undef HAVE_DIRENT_H
|
||||
|
||||
/* Define if you have the <limits.h> header file. */
|
||||
#undef HAVE_LIMITS_H
|
||||
|
|
@ -212,12 +295,27 @@
|
|||
/* Define if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define if you have the <ncurses.h> header file. */
|
||||
#undef HAVE_NCURSES_H
|
||||
|
||||
/* Define if you have the <ndir.h> header file. */
|
||||
#undef HAVE_NDIR_H
|
||||
|
||||
/* Define if you have the <nl_types.h> header file. */
|
||||
#undef HAVE_NL_TYPES_H
|
||||
|
||||
/* Define if you have the <nlist.h> header file. */
|
||||
#undef HAVE_NLIST_H
|
||||
|
||||
/* Define if you have the <objlist.h> header file. */
|
||||
#undef HAVE_OBJLIST_H
|
||||
|
||||
/* Define if you have the <poll.h> header file. */
|
||||
#undef HAVE_POLL_H
|
||||
|
||||
/* Define if you have the <proc_service.h> header file. */
|
||||
#undef HAVE_PROC_SERVICE_H
|
||||
|
||||
/* Define if you have the <ptrace.h> header file. */
|
||||
#undef HAVE_PTRACE_H
|
||||
|
||||
|
|
@ -227,6 +325,9 @@
|
|||
/* Define if you have the <stddef.h> header file. */
|
||||
#undef HAVE_STDDEF_H
|
||||
|
||||
/* Define if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
|
|
@ -236,9 +337,30 @@
|
|||
/* Define if you have the <sys/debugreg.h> header file. */
|
||||
#undef HAVE_SYS_DEBUGREG_H
|
||||
|
||||
/* Define if you have the <sys/dir.h> header file. */
|
||||
#undef HAVE_SYS_DIR_H
|
||||
|
||||
/* Define if you have the <sys/fault.h> header file. */
|
||||
#undef HAVE_SYS_FAULT_H
|
||||
|
||||
/* Define if you have the <sys/file.h> header file. */
|
||||
#undef HAVE_SYS_FILE_H
|
||||
|
||||
/* Define if you have the <sys/filio.h> header file. */
|
||||
#undef HAVE_SYS_FILIO_H
|
||||
|
||||
/* Define if you have the <sys/ioctl.h> header file. */
|
||||
#undef HAVE_SYS_IOCTL_H
|
||||
|
||||
/* Define if you have the <sys/ndir.h> header file. */
|
||||
#undef HAVE_SYS_NDIR_H
|
||||
|
||||
/* Define if you have the <sys/param.h> header file. */
|
||||
#undef HAVE_SYS_PARAM_H
|
||||
|
||||
/* Define if you have the <sys/poll.h> header file. */
|
||||
#undef HAVE_SYS_POLL_H
|
||||
|
||||
/* Define if you have the <sys/procfs.h> header file. */
|
||||
#undef HAVE_SYS_PROCFS_H
|
||||
|
||||
|
|
@ -248,6 +370,15 @@
|
|||
/* Define if you have the <sys/reg.h> header file. */
|
||||
#undef HAVE_SYS_REG_H
|
||||
|
||||
/* Define if you have the <sys/select.h> header file. */
|
||||
#undef HAVE_SYS_SELECT_H
|
||||
|
||||
/* Define if you have the <sys/syscall.h> header file. */
|
||||
#undef HAVE_SYS_SYSCALL_H
|
||||
|
||||
/* Define if you have the <sys/user.h> header file. */
|
||||
#undef HAVE_SYS_USER_H
|
||||
|
||||
/* Define if you have the <sys/wait.h> header file. */
|
||||
#undef HAVE_SYS_WAIT_H
|
||||
|
||||
|
|
@ -260,6 +391,12 @@
|
|||
/* Define if you have the <termios.h> header file. */
|
||||
#undef HAVE_TERMIOS_H
|
||||
|
||||
/* Define if you have the <thread_db.h> header file. */
|
||||
#undef HAVE_THREAD_DB_H
|
||||
|
||||
/* Define if you have the <time.h> header file. */
|
||||
#undef HAVE_TIME_H
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
|
|
@ -281,6 +418,9 @@
|
|||
/* Define if you have the m library (-lm). */
|
||||
#undef HAVE_LIBM
|
||||
|
||||
/* Define if you have the socket library (-lsocket). */
|
||||
#undef HAVE_LIBSOCKET
|
||||
|
||||
/* Define if you have the w library (-lw). */
|
||||
#undef HAVE_LIBW
|
||||
|
||||
|
|
@ -296,6 +436,9 @@
|
|||
/* Define as 1 if you have gettext and don't want to use GNU gettext. */
|
||||
#undef HAVE_GETTEXT
|
||||
|
||||
/* Define if sigsetjmp is available. */
|
||||
#undef HAVE_SIGSETJMP
|
||||
|
||||
/* Define if malloc is not declared in system header files. */
|
||||
#undef NEED_DECLARATION_MALLOC
|
||||
|
||||
|
|
@ -311,6 +454,9 @@
|
|||
/* Define if strdup is not declared in system header files. */
|
||||
#undef NEED_DECLARATION_STRDUP
|
||||
|
||||
/* Define if strstr is not declared in system header files. */
|
||||
#undef NEED_DECLARATION_STRSTR
|
||||
|
||||
/* Define if <sys/procfs.h> has pstatus_t. */
|
||||
#undef HAVE_PSTATUS_T
|
||||
|
||||
|
|
@ -323,3 +469,33 @@
|
|||
/* Define if <sys/procfs.h> has fpregset_t. */
|
||||
#undef HAVE_FPREGSET_T
|
||||
|
||||
/* Define if <sys/procfs.h> has prgregset_t. */
|
||||
#undef HAVE_PRGREGSET_T
|
||||
|
||||
/* Define if <sys/procfs.h> has prfpregset_t. */
|
||||
#undef HAVE_PRFPREGSET_T
|
||||
|
||||
/* Define if <sys/procfs.h> has prgregset32_t. */
|
||||
#undef HAVE_PRGREGSET32_T
|
||||
|
||||
/* Define if <sys/procfs.h> has prfpregset32_t. */
|
||||
#undef HAVE_PRFPREGSET32_T
|
||||
|
||||
/* Define if <sys/procfs.h> has lwpid_t. */
|
||||
#undef HAVE_LWPID_T
|
||||
|
||||
/* Define if <sys/procfs.h> has psaddr_t. */
|
||||
#undef HAVE_PSADDR_T
|
||||
|
||||
/* Define if <sys/procfs.h> has prsysent_t. */
|
||||
#undef HAVE_PRSYSENT_T
|
||||
|
||||
/* Define if <sys/procfs.h> has pr_sigset_t. */
|
||||
#undef HAVE_PR_SIGSET_T
|
||||
|
||||
/* Define if <sys/procfs.h> has pr_sigaction64_t. */
|
||||
#undef HAVE_PR_SIGACTION64_T
|
||||
|
||||
/* Define if <sys/procfs.h> has pr_siginfo64_t. */
|
||||
#undef HAVE_PR_SIGINFO64_T
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
# Host: Little-endian Alpha running Linux
|
||||
XDEPFILES= ser-tcp.o
|
||||
XM_FILE= xm-alphalinux.h
|
||||
NAT_FILE= nm-linux.h
|
||||
NATDEPFILES= infptrace.o inftarg.o corelow.o core-regset.o alpha-nat.o \
|
||||
fork-child.o solib.o
|
||||
NATDEPFILES= infptrace.o inftarg.o corelow.o alpha-nat.o linux-proc.o \
|
||||
fork-child.o proc-service.o thread-db.o lin-lwp.o gcore.o
|
||||
|
||||
LOADLIBES = -ldl -rdynamic
|
||||
|
||||
MMALLOC =
|
||||
MMALLOC_CFLAGS = -DNO_MMALLOC
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
# Target: Little-endian Alpha
|
||||
TDEPFILES= alpha-tdep.o
|
||||
TDEPFILES= alpha-tdep.o solib.o solib-svr4.o solib-legacy.o
|
||||
TM_FILE= tm-alphalinux.h
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# Host: Little-endian Alpha running OSF/1-1.x
|
||||
XDEPFILES=
|
||||
XM_FILE= xm-alphaosf.h
|
||||
NAT_FILE= nm-osf.h
|
||||
NATDEPFILES= infptrace.o inftarg.o corelow.o alpha-nat.o fork-child.o osfsolib.o
|
||||
NATDEPFILES= infptrace.o inftarg.o corelow.o alpha-nat.o fork-child.o \
|
||||
solib-osf.o solib.o
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
# Host: Little-endian Alpha running OSF/1-2.x using procfs
|
||||
XDEPFILES=
|
||||
XM_FILE= xm-alphaosf.h
|
||||
NAT_FILE= nm-osf2.h
|
||||
NATDEPFILES= infptrace.o inftarg.o corelow.o alpha-nat.o fork-child.o osfsolib.o procfs.o
|
||||
NATDEPFILES= infptrace.o inftarg.o corelow.o alpha-nat.o fork-child.o \
|
||||
solib-osf.o solib.o procfs.o proc-api.o proc-events.o proc-flags.o \
|
||||
proc-why.o
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
# Host: Little-endian Alpha running OSF/1-3.x and higher using procfs
|
||||
XDEPFILES=
|
||||
XM_FILE= xm-alphaosf.h
|
||||
NAT_FILE= nm-osf3.h
|
||||
NATDEPFILES= infptrace.o inftarg.o corelow.o alpha-nat.o fork-child.o osfsolib.o procfs.o
|
||||
NATDEPFILES= infptrace.o inftarg.o corelow.o alpha-nat.o fork-child.o \
|
||||
solib-osf.o solib.o procfs.o proc-api.o proc-events.o proc-flags.o \
|
||||
proc-why.o
|
||||
|
|
|
|||
5
contrib/gdb/gdb/config/alpha/fbsd.mh
Normal file
5
contrib/gdb/gdb/config/alpha/fbsd.mh
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# Host: FreeBSD/Alpha
|
||||
NATDEPFILES= fork-child.o infptrace.o inftarg.o \
|
||||
solib.o solib-svr4.o solib-legacy.o \
|
||||
corelow.o core-regset.o alphabsd-nat.o
|
||||
NAT_FILE= nm-fbsd.h
|
||||
3
contrib/gdb/gdb/config/alpha/fbsd.mt
Normal file
3
contrib/gdb/gdb/config/alpha/fbsd.mt
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Target: FreeBSD/Alpha
|
||||
TDEPFILES= alpha-tdep.o alphafbsd-tdep.o
|
||||
TM_FILE= tm-fbsd.h
|
||||
45
contrib/gdb/gdb/config/alpha/nm-fbsd.h
Normal file
45
contrib/gdb/gdb/config/alpha/nm-fbsd.h
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/* Native-dependent definitions for FreeBSD/Alpha.
|
||||
Copyright 1986, 1987, 1989, 1992, 1996, 2000
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef NM_FBSD_H
|
||||
#define NM_FBSD_H
|
||||
|
||||
/* Type of the third argument to the `ptrace' system call. */
|
||||
#define PTRACE_ARG3_TYPE caddr_t
|
||||
|
||||
/* Override copies of {fetch,store}_inferior_registers in `infptrace.c'. */
|
||||
#define FETCH_INFERIOR_REGISTERS
|
||||
|
||||
/* We can attach and detach. */
|
||||
#define ATTACH_DETACH
|
||||
|
||||
/* The Alpha does not step over a breakpoint. */
|
||||
#define CANNOT_STEP_BREAKPOINT
|
||||
|
||||
|
||||
/* Shared library support. */
|
||||
|
||||
#define SVR4_SHARED_LIBS
|
||||
|
||||
#include "solib.h" /* Support for shared libraries. */
|
||||
#include "elf/common.h" /* Additional ELF shared library info. */
|
||||
|
||||
#endif /* NM_FBSD_H */
|
||||
|
|
@ -1,21 +1,29 @@
|
|||
/* Native definitions for alpha running Linux.
|
||||
Copyright (C) 1993, 1994 Free Software Foundation, Inc.
|
||||
/* Native definitions for alpha running GNU/Linux.
|
||||
|
||||
This file is part of GDB.
|
||||
Copyright 1993, 1994, 1996, 1998, 2000, 2001, 2002 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This file is part of GDB.
|
||||
|
||||
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.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef NM_LINUX_H
|
||||
#define NM_LINUX_H
|
||||
|
||||
#include "nm-linux.h"
|
||||
|
||||
/* Figure out where the longjmp will land. We expect that we have just entered
|
||||
longjmp and haven't yet setup the stack frame, so the args are still in the
|
||||
|
|
@ -24,16 +32,14 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
This routine returns true on success */
|
||||
|
||||
#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR)
|
||||
extern int
|
||||
get_longjmp_target PARAMS ((CORE_ADDR *));
|
||||
|
||||
/* Tell gdb that we can attach and detach other processes */
|
||||
#define ATTACH_DETACH
|
||||
extern int get_longjmp_target (CORE_ADDR *);
|
||||
|
||||
/* ptrace register ``addresses'' are absolute. */
|
||||
|
||||
#define U_REGS_OFFSET 0
|
||||
|
||||
/* FIXME: This is probably true, or should be, on all GNU/Linux ports.
|
||||
IA64? Sparc64? */
|
||||
#define PTRACE_ARG3_TYPE long
|
||||
|
||||
/* ptrace transfers longs, the ptrace man page is lying. */
|
||||
|
|
@ -44,23 +50,12 @@ get_longjmp_target PARAMS ((CORE_ADDR *));
|
|||
|
||||
#define CANNOT_STEP_BREAKPOINT
|
||||
|
||||
/* Linux has shared libraries. */
|
||||
/* GNU/Linux has shared libraries. */
|
||||
|
||||
#define GDB_TARGET_HAS_SHARED_LIBS
|
||||
|
||||
/* Support for shared libraries. */
|
||||
|
||||
#include "solib.h"
|
||||
|
||||
#ifdef __ELF__
|
||||
#define SVR4_SHARED_LIBS
|
||||
#define TARGET_ELF64
|
||||
#endif
|
||||
|
||||
/* This is a lie. It's actually in stdio.h. */
|
||||
|
||||
#define PSIGNAL_IN_SIGNAL_H
|
||||
|
||||
/* Given a pointer to either a gregset_t or fpregset_t, return a
|
||||
pointer to the first register. */
|
||||
#define ALPHA_REGSET_BASE(regsetp) ((long *) (regsetp))
|
||||
|
||||
#endif /* NM_LINUX_H */
|
||||
|
|
|
|||
|
|
@ -1,21 +1,22 @@
|
|||
/* Native definitions for alpha running OSF/1.
|
||||
Copyright (C) 1993, 1994 Free Software Foundation, Inc.
|
||||
Copyright 1993, 1994, 1995, 1998, 2000 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Figure out where the longjmp will land. We expect that we have just entered
|
||||
longjmp and haven't yet setup the stack frame, so the args are still in the
|
||||
|
|
@ -24,8 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||
This routine returns true on success */
|
||||
|
||||
#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR)
|
||||
extern int
|
||||
get_longjmp_target PARAMS ((CORE_ADDR *));
|
||||
extern int get_longjmp_target (CORE_ADDR *);
|
||||
|
||||
/* ptrace register ``addresses'' are absolute. */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,21 +1,22 @@
|
|||
/* Native definitions for alpha running OSF/1-2.x, using procfs.
|
||||
Copyright (C) 1995 Free Software Foundation, Inc.
|
||||
Copyright 1995, 1996, 2000 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Get generic OSF/1 definitions. */
|
||||
#include "alpha/nm-osf.h"
|
||||
|
|
@ -44,7 +45,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||
/* Return sizeof user struct to callers in less machine dependent routines */
|
||||
|
||||
#define KERNEL_U_SIZE kernel_u_size()
|
||||
extern int kernel_u_size PARAMS ((void));
|
||||
extern int kernel_u_size (void);
|
||||
|
||||
/* poll() doesn't seem to work properly for /proc in this version of the OS.
|
||||
If we only specify POLLPRI, things hang. It seems to get better when we set
|
||||
|
|
|
|||
|
|
@ -1,21 +1,22 @@
|
|||
/* Native definitions for alpha running OSF/1-3.x and higher, using procfs.
|
||||
Copyright (C) 1995 Free Software Foundation, Inc.
|
||||
Copyright 1995 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* OSF/1-3.x fixes some OSF/1-2.x procfs peculiarities and adds
|
||||
a new one. */
|
||||
|
|
|
|||
|
|
@ -1,22 +1,26 @@
|
|||
/* Definitions to make GDB run on an Alpha box under Linux. The
|
||||
definitions here are used when the _target_ system is running Linux.
|
||||
Copyright 1996 Free Software Foundation, Inc.
|
||||
/* Definitions to make GDB run on an Alpha box under GNU/Linux. The
|
||||
definitions here are used when the _target_ system is running
|
||||
GNU/Linux.
|
||||
|
||||
This file is part of GDB.
|
||||
Copyright 1996, 1998, 1999, 2000, 2002 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This file is part of GDB.
|
||||
|
||||
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.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef TM_LINUXALPHA_H
|
||||
#define TM_LINUXALPHA_H
|
||||
|
|
@ -25,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||
|
||||
/* Are we currently handling a signal ? */
|
||||
|
||||
extern long alpha_linux_sigtramp_offset PARAMS ((CORE_ADDR));
|
||||
extern long alpha_linux_sigtramp_offset (CORE_ADDR);
|
||||
#undef IN_SIGTRAMP
|
||||
#define IN_SIGTRAMP(pc, name) (alpha_linux_sigtramp_offset (pc) >= 0)
|
||||
|
||||
|
|
@ -37,7 +41,7 @@ extern long alpha_linux_sigtramp_offset PARAMS ((CORE_ADDR));
|
|||
|
||||
/* Number of traps that happen between exec'ing the shell to run an
|
||||
inferior, and when we finally get to the inferior code. This is 2
|
||||
on Linux and most implementations. */
|
||||
on GNU/Linux and most implementations. */
|
||||
|
||||
#undef START_INFERIOR_TRAPS_EXPECTED
|
||||
#define START_INFERIOR_TRAPS_EXPECTED 2
|
||||
|
|
@ -68,13 +72,12 @@ extern long alpha_linux_sigtramp_offset PARAMS ((CORE_ADDR));
|
|||
|
||||
/* If FRAME refers to a sigtramp frame, return the address of the next frame.
|
||||
|
||||
Under Linux, sigtramp handlers have dynamically generated procedure
|
||||
descriptors that make this hack unnecessary. */
|
||||
Under GNU/Linux, sigtramp handlers have dynamically generated
|
||||
procedure descriptors that make this hack unnecessary. */
|
||||
|
||||
#undef FRAME_PAST_SIGTRAMP_FRAME
|
||||
#define FRAME_PAST_SIGTRAMP_FRAME(frame, pc) (0)
|
||||
|
||||
/* We need this for the SOLIB_TRAMPOLINE stuff. */
|
||||
#include "tm-sysv4.h"
|
||||
#include "tm-linux.h"
|
||||
|
||||
#endif /* TM_LINUXALPHA_H */
|
||||
|
|
|
|||
45
contrib/gdb/gdb/config/alpha/tm-fbsd.h
Normal file
45
contrib/gdb/gdb/config/alpha/tm-fbsd.h
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/* Target-dependent definitions for FreeBSD/Alpha.
|
||||
Copyright 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef TM_FBSD_H
|
||||
#define TM_FBSD_H
|
||||
|
||||
#include "alpha/tm-alpha.h"
|
||||
|
||||
/* FreeBSD uses the old gcc convention for struct returns. */
|
||||
|
||||
#undef USE_STRUCT_CONVENTION
|
||||
#define USE_STRUCT_CONVENTION(gcc_p, type) \
|
||||
alphafbsd_use_struct_convention (gcc_p, type)
|
||||
|
||||
/* FreeBSD doesn't mark the outermost frame. While some FreeBSD/Alpha
|
||||
releases include (a minimal amount of) debugging info in its
|
||||
startup code (crt1.o), the safest thing is to consider the user
|
||||
code entry point as the outermost frame. */
|
||||
#define FRAME_CHAIN_VALID(chain, thisframe) \
|
||||
func_frame_chain_valid(chain, thisframe)
|
||||
|
||||
/* Number of traps that happen between exec'ing the shell to run an
|
||||
inferior, and when we finally get to the inferior code. The
|
||||
default is right for FreeBSD. */
|
||||
|
||||
#undef START_INFERIOR_TRAPS_EXPECTED
|
||||
|
||||
#endif /* TM_FBSD_H */
|
||||
|
|
@ -1,29 +1,26 @@
|
|||
/* Host definitions for GDB running on an Alpha under Linux
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
/* Host definitions for GDB running on an Alpha under GNU/Linux.
|
||||
|
||||
This file is part of GDB.
|
||||
Copyright 1996, 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This file is part of GDB.
|
||||
|
||||
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.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
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.
|
||||
|
||||
#if !defined (HOST_BYTE_ORDER)
|
||||
#define HOST_BYTE_ORDER LITTLE_ENDIAN
|
||||
#endif
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* The alpha has no siginterrupt routine. */
|
||||
#define NO_SIGINTERRUPT
|
||||
|
||||
#define HAVE_TERMIOS
|
||||
#define HAVE_SIGSETMASK 1
|
||||
#define USG
|
||||
|
|
|
|||
|
|
@ -1,25 +1,22 @@
|
|||
/* Host definitions for GDB running on an alpha under OSF/1
|
||||
Copyright (C) 1992, 1993 Free Software Foundation, Inc.
|
||||
Copyright 1992, 1993, 1996 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#if !defined (HOST_BYTE_ORDER)
|
||||
#define HOST_BYTE_ORDER LITTLE_ENDIAN
|
||||
#endif
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* The alpha has no siginterrupt routine. */
|
||||
#define NO_SIGINTERRUPT
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue