Virgin import of gdb-4.18

This commit is contained in:
Doug Rabson 1999-05-02 10:18:14 +00:00
parent 145f6cb629
commit f2489878f0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/gdb/dist/; revision=46283
387 changed files with 142231 additions and 21514 deletions

View File

@ -2,7 +2,7 @@
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@ -279,7 +279,7 @@ POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
@ -305,7 +305,8 @@ the "copyright" line and a pointer to where the full notice is found.
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.
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.

View File

@ -2,7 +2,7 @@
Version 2, June 1991
Copyright (C) 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@ -464,7 +464,8 @@ convey the exclusion of warranty; and each file should have at least the
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
Also add information on how to contact you by electronic and paper mail.

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@ This directory contains various GNU compilers, assemblers, linkers,
debuggers, etc., plus their support routines, definitions, and documentation.
If you are receiving this as part of a GDB release, see the file gdb/README.
If with a gas release, see gas/README; if with a libg++ release,
If with a binutils release, see binutils/README; if with a libg++ release,
see libg++/README, etc. That'll give you info about this
package -- supported targets, how to use it, how to report bugs, etc.
@ -19,7 +19,7 @@ To install them (by default in /usr/local/bin, /usr/local/lib, etc),
then do:
make install
If the configure script can't determine your type of computer, give it
(If the configure script can't determine your type of computer, give it
the name as an argument, for instance ``./configure sun4''. You can
use the script ``config.sub'' to test whether a name is recognized; if
it is, config.sub translates it to a triplet specifying CPU, vendor,
@ -30,21 +30,18 @@ explicitly set CC in the environment before running configure, and to
also set CC when running make. For example (assuming sh/bash/ksh):
CC=gcc ./configure
make CC=gcc
make
A similar example using csh:
setenv CC gcc
./configure
make CC=gcc
See etc/cfg-paper.texi, etc/configure.texi, and/or the README files in
various subdirectories, for more details.
make
Much of the code and documentation enclosed is copyright by
the Free Software Foundation, Inc. See the file COPYING or
COPYING.LIB in the various directories, for a description of the
GNU General Public License terms under which you can copy the files.
REPORTING BUGS: Again, see gdb/README, gas/README, etc., for info on where and
how to report problems.
REPORTING BUGS: Again, see gdb/README, binutils/README, etc., for info
on where and how to report problems.

624
contrib/gdb/config-ml.in Normal file
View File

@ -0,0 +1,624 @@
# Configure fragment invoked in the post-target section for subdirs
# wanting multilib support.
#
# It is advisable to support a few --enable/--disable options to let the
# user select which libraries s/he really wants.
#
# Subdirectories wishing to use multilib should put the following lines
# in the "post-target" section of configure.in.
#
# if [ "${srcdir}" = "." ] ; then
# if [ "${with_target_subdir}" != "." ] ; then
# . ${with_multisrctop}../../config-ml.in
# else
# . ${with_multisrctop}../config-ml.in
# fi
# else
# . ${srcdir}/../config-ml.in
# fi
#
# See librx/configure.in in the libg++ distribution for an example of how
# to handle autoconf'd libraries.
#
# Things are complicated because 6 separate cases must be handled:
# 2 (native, cross) x 3 (absolute-path, relative-not-dot, dot) = 6.
#
# srcdir=. is special. It must handle make programs that don't handle VPATH.
# To implement this, a symlink tree is built for each library and for each
# multilib subdir.
#
# The build tree is layed out as
#
# ./
# libg++
# newlib
# m68020/
# libg++
# newlib
# m68881/
# libg++
# newlib
#
# The nice feature about this arrangement is that inter-library references
# in the build tree work without having to care where you are. Note that
# inter-library references also work in the source tree because symlink trees
# are built when srcdir=.
#
# Unfortunately, trying to access the libraries in the build tree requires
# the user to manually choose which library to use as GCC won't be able to
# find the right one. This is viewed as the lesser of two evils.
#
# Configure variables:
# ${with_target_subdir} = "." for native, or ${target_alias} for cross.
# Set by top level Makefile.
# ${with_multisrctop} = how many levels of multilibs there are in the source
# tree. It exists to handle the case of configuring in the source tree:
# ${srcdir} is not constant.
# ${with_multisubdir} = name of multilib subdirectory (eg: m68020/m68881).
#
# Makefile variables:
# MULTISRCTOP = number of multilib levels in source tree (+1 if cross)
# (FIXME: note that this is different than ${with_multisrctop}. Check out.).
# MULTIBUILDTOP = number of multilib levels in build tree
# MULTIDIRS = list of multilib subdirs (eg: m68000 m68020 ...)
# (only defined in each library's main Makefile).
# MULTISUBDIR = installed subdirectory name with leading '/' (eg: /m68000)
# (only defined in each multilib subdir).
# FIXME: Multilib is currently disabled by default for everything other than
# newlib. It is up to each target to turn on multilib support for the other
# libraries as desired.
# We have to handle being invoked by both Cygnus configure and Autoconf.
#
# Cygnus configure incoming variables:
# srcdir, subdir, target, arguments
#
# Autoconf incoming variables:
# srcdir, target, ac_configure_args
#
# We *could* figure srcdir and target out, but we'd have to do work that
# our caller has already done to figure them out and requiring these two
# seems reasonable.
if [ -n "${ac_configure_args}" ]; then
Makefile=${ac_file-Makefile}
ml_config_shell=${CONFIG_SHELL-/bin/sh}
ml_arguments="${ac_configure_args}"
ml_realsrcdir=${srcdir}
else
Makefile=${Makefile-Makefile}
ml_config_shell=${config_shell-/bin/sh}
ml_arguments="${arguments}"
if [ -n "${subdir}" -a "${subdir}" != "." ] ; then
ml_realsrcdir=${srcdir}/${subdir}
else
ml_realsrcdir=${srcdir}
fi
fi
# Scan all the arguments and set all the ones we need.
ml_verbose=--verbose
for option in ${ml_arguments}
do
case $option in
--*) ;;
-*) option=-$option ;;
esac
case $option in
--*=*)
optarg=`echo $option | sed -e 's/^[^=]*=//'`
;;
esac
case $option in
--disable-*)
enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
eval $enableopt=no
;;
--enable-*)
case "$option" in
*=*) ;;
*) optarg=yes ;;
esac
enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
eval $enableopt="$optarg"
;;
--norecursion | --no*)
ml_norecursion=yes
;;
--silent | --sil* | --quiet | --q*)
ml_verbose=--silent
;;
--verbose | --v | --verb*)
ml_verbose=--verbose
;;
--with-*)
case "$option" in
*=*) ;;
*) optarg=yes ;;
esac
withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
eval $withopt="$optarg"
;;
--without-*)
withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
eval $withopt=no
;;
esac
done
# Only do this if --enable-multilib.
if [ "${enable_multilib}" = yes ]; then
# Compute whether this is the library's top level directory
# (ie: not a multilib subdirectory, and not a subdirectory like libg++/src).
# ${with_multisubdir} tells us we're in the right branch, but we could be
# in a subdir of that.
# ??? The previous version could void this test by separating the process into
# two files: one that only the library's toplevel configure.in ran (to
# configure the multilib subdirs), and another that all configure.in's ran to
# update the Makefile. It seemed reasonable to collapse all multilib support
# into one file, but it does leave us with having to perform this test.
ml_toplevel_p=no
if [ -z "${with_multisubdir}" ]; then
if [ "${srcdir}" = "." ]; then
# Use ${ml_realsrcdir} instead of ${srcdir} here to account for ${subdir}.
# ${with_target_subdir} = "." for native, otherwise target alias.
if [ "${with_target_subdir}" = "." ]; then
if [ -f ${ml_realsrcdir}/../config-ml.in ]; then
ml_toplevel_p=yes
fi
else
if [ -f ${ml_realsrcdir}/../../config-ml.in ]; then
ml_toplevel_p=yes
fi
fi
else
# Use ${ml_realsrcdir} instead of ${srcdir} here to account for ${subdir}.
if [ -f ${ml_realsrcdir}/../config-ml.in ]; then
ml_toplevel_p=yes
fi
fi
fi
# If this is the library's top level directory, set multidirs to the
# multilib subdirs to support. This lives at the top because we need
# `multidirs' set right away.
if [ "${ml_toplevel_p}" = yes ]; then
multidirs=
for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do
dir=`echo $i | sed -e 's/;.*$//'`
if [ "${dir}" = "." ]; then
true
else
if [ -z "${multidirs}" ]; then
multidirs="${dir}"
else
multidirs="${multidirs} ${dir}"
fi
fi
done
case "${target}" in
arc-*-elf*)
if [ x$enable_biendian != xyes ]
then
old_multidirs=${multidirs}
multidirs=""
for x in ${old_multidirs}; do
case "${x}" in
*be*) : ;;
*) multidirs="${multidirs} ${x}" ;;
esac
done
fi
;;
m68*-*-*)
if [ x$enable_softfloat = xno ]
then
old_multidirs="${multidirs}"
multidirs=""
for x in ${old_multidirs}; do
case "$x" in
*soft-float* ) : ;;
*) multidirs="${multidirs} ${x}" ;;
esac
done
fi
if [ x$enable_m68881 = xno ]
then
old_multidirs="${multidirs}"
multidirs=""
for x in ${old_multidirs}; do
case "$x" in
*m68881* ) : ;;
*) multidirs="${multidirs} ${x}" ;;
esac
done
fi
if [ x$enable_m68000 = xno ]
then
old_multidirs="${multidirs}"
multidirs=""
for x in ${old_multidirs}; do
case "$x" in
*m68000* ) : ;;
*) multidirs="${multidirs} ${x}" ;;
esac
done
fi
if [ x$enable_m68020 = xno ]
then
old_multidirs="${multidirs}"
multidirs=""
for x in ${old_multidirs}; do
case "$x" in
*m68020* ) : ;;
*) multidirs="${multidirs} ${x}" ;;
esac
done
fi
;;
mips*-*-*)
if [ x$enable_single_float = xno ]
then
old_multidirs="${multidirs}"
multidirs=""
for x in ${old_multidirs}; do
case "$x" in
*single* ) : ;;
*) 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
*el* ) : ;;
*eb* ) : ;;
*) multidirs="${multidirs} ${x}" ;;
esac
done
fi
if [ x$enable_softfloat = xno ]
then
old_multidirs="${multidirs}"
multidirs=""
for x in ${old_multidirs}; do
case "$x" in
*soft-float* ) : ;;
*) multidirs="${multidirs} ${x}" ;;
esac
done
fi
;;
powerpc*-*-* | rs6000*-*-*)
if [ x$enable_softfloat = xno ]
then
old_multidirs="${multidirs}"
multidirs=""
for x in ${old_multidirs}; do
case "$x" in
*soft-float* ) : ;;
*) multidirs="${multidirs} ${x}" ;;
esac
done
fi
if [ x$enable_powercpu = xno ]
then
old_multidirs="${multidirs}"
multidirs=""
for x in ${old_multidirs}; do
case "$x" in
power | */power | */power/* ) : ;;
*) multidirs="${multidirs} ${x}" ;;
esac
done
fi
if [ x$enable_powerpccpu = xno ]
then
old_multidirs="${multidirs}"
multidirs=""
for x in ${old_multidirs}; do
case "$x" in
*powerpc* ) : ;;
*) multidirs="${multidirs} ${x}" ;;
esac
done
fi
if [ x$enable_powerpcos = xno ]
then
old_multidirs="${multidirs}"
multidirs=""
for x in ${old_multidirs}; do
case "$x" in
*mcall-linux* | *mcall-solaris* ) : ;;
*) 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
*mlittle* | *mbig* ) : ;;
*) multidirs="${multidirs} ${x}" ;;
esac
done
fi
if [ x$enable_sysv = xno ]
then
old_multidirs="${multidirs}"
multidirs=""
for x in ${old_multidirs}; do
case "$x" in
*mcall-sysv* ) : ;;
*) multidirs="${multidirs} ${x}" ;;
esac
done
fi
if [ x$enable_aix = xno ]
then
old_multidirs="${multidirs}"
multidirs=""
for x in ${old_multidirs}; do
case "$x" in
*mcall-aix* ) : ;;
*) multidirs="${multidirs} ${x}" ;;
esac
done
fi
;;
esac
# Remove extraneous blanks from multidirs.
# Tests like `if [ -n "$multidirs" ]' require it.
multidirs=`echo "$multidirs" | sed -e 's/^[ ][ ]*//' -e 's/[ ][ ]*$//' -e 's/[ ][ ]*/ /g'`
# Add code to library's top level makefile to handle building the multilib
# subdirs.
cat > Multi.tem <<\EOF
# FIXME: There should be an @-sign in front of the `if'.
# Leave out until this is tested a bit more.
multi-do:
if [ -z "$(MULTIDIRS)" ]; then \
true; \
else \
rootpre=`pwd`/; export rootpre; \
srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \
lib=`echo $${rootpre} | sed -e 's,^.*/\([^/][^/]*\)/$$,\1,'`; \
compiler="$(CC)"; \
for i in `$${compiler} --print-multi-lib 2>/dev/null`; do \
dir=`echo $$i | sed -e 's/;.*$$//'`; \
if [ "$${dir}" = "." ]; then \
true; \
else \
if [ -d ../$${dir}/$${lib} ]; then \
flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) \
CFLAGS="$(CFLAGS) $${flags}" \
CXXFLAGS="$(CXXFLAGS) $${flags}" \
LIBCFLAGS="$(LIBCFLAGS) $${flags}" \
LIBCXXFLAGS="$(LIBCXXFLAGS) $${flags}" \
LDFLAGS="$(LDFLAGS) $${flags}" \
$(DO)); then \
true; \
else \
exit 1; \
fi; \
else true; \
fi; \
fi; \
done; \
fi
# FIXME: There should be an @-sign in front of the `if'.
# Leave out until this is tested a bit more.
multi-clean:
if [ -z "$(MULTIDIRS)" ]; then \
true; \
else \
lib=`pwd | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \
for dir in Makefile $(MULTIDIRS); do \
if [ -f ../$${dir}/$${lib}/Makefile ]; then \
if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) $(DO)); \
then true; \
else exit 1; \
fi; \
else true; \
fi; \
done; \
fi
EOF
cat ${Makefile} Multi.tem > Makefile.tem
rm -f ${Makefile} Multi.tem
mv Makefile.tem ${Makefile}
fi # ${ml_toplevel_p} = yes
if [ "${ml_verbose}" = --verbose ]; then
echo "Adding multilib support to Makefile in ${ml_realsrcdir}"
if [ "${ml_toplevel_p}" = yes ]; then
echo "multidirs=${multidirs}"
fi
echo "with_multisubdir=${with_multisubdir}"
fi
if [ "${srcdir}" = "." ]; then
if [ "${with_target_subdir}" != "." ]; then
ml_srcdotdot="../"
else
ml_srcdotdot=""
fi
else
ml_srcdotdot=""
fi
if [ -z "${with_multisubdir}" ]; then
ml_subdir=
ml_builddotdot=
: # ml_srcdotdot= # already set
else
ml_subdir="/${with_multisubdir}"
# The '[^/][^/]*' appears that way to work around a SunOS sed bug.
ml_builddotdot=`echo ${with_multisubdir} | sed -e 's:[^/][^/]*:..:g'`/
if [ "$srcdir" = "." ]; then
ml_srcdotdot=${ml_srcdotdot}${ml_builddotdot}
else
: # ml_srcdotdot= # already set
fi
fi
if [ "${ml_toplevel_p}" = yes ]; then
ml_do='$(MAKE)'
ml_clean='$(MAKE)'
else
ml_do=true
ml_clean=true
fi
# TOP is used by newlib and should not be used elsewhere for this purpose.
# MULTI{SRC,BUILD}TOP are the proper ones to use. MULTISRCTOP is empty
# when srcdir != builddir. MULTIBUILDTOP is always some number of ../'s.
# FIXME: newlib needs to be updated to use MULTI{SRC,BUILD}TOP so we can
# delete TOP. Newlib may wish to continue to use TOP for its own purposes
# of course.
# MULTIDIRS is non-empty for the cpu top level Makefile (eg: newlib/Makefile)
# and lists the subdirectories to recurse into.
# MULTISUBDIR is non-empty in each cpu subdirectory's Makefile
# (eg: newlib/h8300h/Makefile) and is the installed subdirectory name with
# a leading '/'.
# MULTIDO is used for targets like all, install, and check where
# $(FLAGS_TO_PASS) augmented with the subdir's compiler option is needed.
# MULTICLEAN is used for the *clean targets.
#
# ??? It is possible to merge MULTIDO and MULTICLEAN into one. They are
# currently kept separate because we don't want the *clean targets to require
# the existence of the compiler (which MULTIDO currently requires) and
# therefore we'd have to record the directory options as well as names
# (currently we just record the names and use --print-multi-lib to get the
# options).
sed -e "s:^TOP[ ]*=[ ]*\([./]*\)[ ]*$:TOP = ${ml_builddotdot}\1:" \
-e "s:^MULTISRCTOP[ ]*=.*$:MULTISRCTOP = ${ml_srcdotdot}:" \
-e "s:^MULTIBUILDTOP[ ]*=.*$:MULTIBUILDTOP = ${ml_builddotdot}:" \
-e "s:^MULTIDIRS[ ]*=.*$:MULTIDIRS = ${multidirs}:" \
-e "s:^MULTISUBDIR[ ]*=.*$:MULTISUBDIR = ${ml_subdir}:" \
-e "s:^MULTIDO[ ]*=.*$:MULTIDO = $ml_do:" \
-e "s:^MULTICLEAN[ ]*=.*$:MULTICLEAN = $ml_clean:" \
${Makefile} > Makefile.tem
rm -f ${Makefile}
mv Makefile.tem ${Makefile}
# If this is the library's top level, configure each multilib subdir.
# This is done at the end because this is the loop that runs configure
# in each multilib subdir and it seemed reasonable to finish updating the
# Makefile before going on to configure the subdirs.
if [ "${ml_toplevel_p}" = yes ]; then
# We must freshly configure each subdirectory. This bit of code is
# actually partially stolen from the main configure script. FIXME.
if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then
if [ "${ml_verbose}" = --verbose ]; then
echo "Running configure in multilib subdirs ${multidirs}"
echo "pwd: `pwd`"
fi
ml_origdir=`pwd`
ml_libdir=`echo $ml_origdir | sed -e 's,^.*/,,'`
# cd to top-level-build-dir/${with_target_subdir}
cd ..
for ml_dir in ${multidirs}; do
if [ "${ml_verbose}" = --verbose ]; then
echo "Running configure in multilib subdir ${ml_dir}"
echo "pwd: `pwd`"
fi
if [ -d ${ml_dir} ]; then true; else mkdir ${ml_dir}; fi
if [ -d ${ml_dir}/${ml_libdir} ]; then true; else mkdir ${ml_dir}/${ml_libdir}; fi
# Eg: if ${ml_dir} = m68000/m68881, dotdot = ../../
dotdot=../`echo ${ml_dir} | sed -e 's|[^/]||g' -e 's|/|../|g'`
case ${srcdir} in
".")
echo Building symlink tree in `pwd`/${ml_dir}/${ml_libdir}
if [ "${with_target_subdir}" != "." ]; then
ml_unsubdir="../"
else
ml_unsubdir=""
fi
(cd ${ml_dir}/${ml_libdir};
../${dotdot}${ml_unsubdir}symlink-tree ../${dotdot}${ml_unsubdir}${ml_libdir} "")
if [ -f ${ml_dir}/${ml_libdir}/Makefile ]; then
if [ x"${MAKE}" = x ]; then
(cd ${ml_dir}/${ml_libdir}; make distclean)
else
(cd ${ml_dir}/${ml_libdir}; ${MAKE} distclean)
fi
fi
ml_newsrcdir="."
ml_srcdiroption=
multisrctop=${dotdot}
;;
*)
case "${srcdir}" in
/*) # absolute path
ml_newsrcdir=${srcdir}
;;
*) # otherwise relative
ml_newsrcdir=${dotdot}${srcdir}
;;
esac
ml_srcdiroption="-srcdir=${ml_newsrcdir}"
multisrctop=
;;
esac
case "${progname}" in
/*) ml_recprog=${progname} ;;
*) ml_recprog=${dotdot}${progname} ;;
esac
# FIXME: POPDIR=${PWD=`pwd`} doesn't work here.
ML_POPDIR=`pwd`
cd ${ml_dir}/${ml_libdir}
if [ -f ${ml_newsrcdir}/configure ]; then
ml_recprog=${ml_newsrcdir}/configure
fi
if eval ${ml_config_shell} ${ml_recprog} \
--with-multisubdir=${ml_dir} --with-multisrctop=${multisrctop} \
${ml_arguments} ${ml_srcdiroption} ; then
true
else
exit 1
fi
cd ${ML_POPDIR}
done
cd ${ml_origdir}
fi
fi # ${ml_toplevel_p} = yes
fi # ${enable_multilib} = yes

View File

@ -1,6 +1,6 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 93, 94, 95, 1996 Free Software Foundation, Inc.
# Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 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
@ -51,15 +51,55 @@ trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
alpha:OSF1:[VX]*:*)
# After 1.2, OSF1 uses "V1.3" for uname -r.
# After 4.x, OSF1 uses "X4.x" for uname -r.
echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VX]//'`
exit 0 ;;
alpha:OSF1:*:*)
if test $UNAME_RELEASE = "V4.0"; then
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
fi
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
echo alpha-dec-osf${UNAME_RELEASE}
exit 0 ;;
cat <<EOF >dummy.s
.globl main
.ent main
main:
.frame \$30,0,\$26,0
.prologue 0
.long 0x47e03d80 # implver $0
lda \$2,259
.long 0x47e20c21 # amask $2,$1
srl \$1,8,\$2
sll \$2,2,\$2
sll \$0,3,\$0
addl \$1,\$0,\$0
addl \$2,\$0,\$0
ret \$31,(\$26),1
.end main
EOF
${CC-cc} dummy.s -o dummy 2>/dev/null
if test "$?" = 0 ; then
./dummy
case "$?" in
7)
UNAME_MACHINE="alpha"
;;
15)
UNAME_MACHINE="alphaev5"
;;
14)
UNAME_MACHINE="alphaev56"
;;
10)
UNAME_MACHINE="alphapca56"
;;
16)
UNAME_MACHINE="alphaev6"
;;
esac
fi
rm -f dummy.s dummy
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
exit 0 ;;
21064:Windows_NT:50:3)
echo alpha-dec-winnt3.5
exit 0 ;;
@ -69,21 +109,58 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
amiga:NetBSD:*:*)
echo m68k-cbm-netbsd${UNAME_RELEASE}
exit 0 ;;
amiga:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
*:[Aa]miga[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-amigaos
exit 0 ;;
arc64:OpenBSD:*:*)
echo mips64el-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
arc:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
hkmips:OpenBSD:*:*)
echo mips-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
pmax:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
sgi:OpenBSD:*:*)
echo mips-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
wgrisc:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit 0;;
Pyramid*:OSx*:*:*)
arm32:NetBSD:*:*)
echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;;
SR2?01:HI-UX/MPP:*:*)
echo hppa1.1-hitachi-hiuxmpp
exit 0;;
Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
if test "`(/bin/universe) 2>/dev/null`" = att ; then
echo pyramid-pyramid-sysv3
else
echo pyramid-pyramid-bsd
fi
exit 0 ;;
sun4*:SunOS:5.*:*)
NILE:*:*:dcosx)
echo pyramid-pyramid-svr4
exit 0 ;;
sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
i86pc:SunOS:5.*:*)
echo i386-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
@ -103,25 +180,81 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
sun3*:SunOS:*:*)
echo m68k-sun-sunos${UNAME_RELEASE}
exit 0 ;;
sun*:*:4.2BSD:*)
UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
case "`/bin/arch`" in
sun3)
echo m68k-sun-sunos${UNAME_RELEASE}
;;
sun4)
echo sparc-sun-sunos${UNAME_RELEASE}
;;
esac
exit 0 ;;
aushp:SunOS:*:*)
echo sparc-auspex-sunos${UNAME_RELEASE}
exit 0 ;;
atari*:NetBSD:*:*)
echo m68k-atari-netbsd${UNAME_RELEASE}
exit 0 ;;
atari*:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
sun3*:NetBSD:*:*)
echo m68k-sun-netbsd${UNAME_RELEASE}
exit 0 ;;
sun3*:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:NetBSD:*:*)
echo m68k-apple-netbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mvme68k:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mvme88k:OpenBSD:*:*)
echo m88k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
exit 0 ;;
RISC*:Mach:*:*)
echo mips-dec-mach_bsd4.3
exit 0 ;;
RISC*:ULTRIX:*:*)
echo mips-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
mips:*:4*:UMIPS)
echo mips-mips-riscos4sysv
2020:CLIX:*:*)
echo clipper-intergraph-clix${UNAME_RELEASE}
exit 0 ;;
mips:*:5*:RISCos)
mips:*:*:UMIPS | mips:*:*:RISCos)
sed 's/^ //' << EOF >dummy.c
int main (argc, argv) int argc; char **argv; {
#if defined (host_mips) && defined (MIPSEB)
#if defined (SYSTYPE_SYSV)
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_SVR4)
printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
#endif
#endif
exit (-1);
}
EOF
${CC-cc} dummy.c -o dummy \
&& ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
&& rm dummy.c dummy && exit 0
rm -f dummy.c dummy
echo mips-mips-riscos${UNAME_RELEASE}
exit 0 ;;
Night_Hawk:Power_UNIX:*:*)
@ -138,8 +271,8 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
exit 0 ;;
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`uname -p`
if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88100 ] ; then
UNAME_PROCESSOR=`/usr/bin/uname -p`
if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
-o ${TARGET_BINARY_INTERFACE}x = x ] ; then
echo m88k-dg-dgux${UNAME_RELEASE}
@ -165,10 +298,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:IRIX*:*:*)
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
exit 0 ;;
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
i[34]86:AIX:*:*)
i?86:AIX:*:*)
echo i386-ibm-aix
exit 0 ;;
*:AIX:2:3)
@ -213,7 +346,7 @@ EOF
echo romp-ibm-bsd4.4
exit 0 ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
exit 0 ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
echo rs6000-bull-bosx
@ -227,12 +360,48 @@ EOF
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
echo m68k-hp-bsd4.4
exit 0 ;;
9000/[3478]??:HP-UX:*:*)
*9??*:MPE/iX:*:*)
echo hppa1.0-hp-mpeix
exit 0 ;;
9000/[34678]??:HP-UX:*:*)
case "${UNAME_MACHINE}" in
9000/31? ) HP_ARCH=m68000 ;;
9000/[34]?? ) HP_ARCH=m68k ;;
9000/7?? | 9000/8?[679] ) HP_ARCH=hppa1.1 ;;
9000/8?? ) HP_ARCH=hppa1.0 ;;
9000/[678][0-9][0-9] )
sed 's/^ //' << EOF >dummy.c
#include <stdlib.h>
#include <unistd.h>
int main ()
{
#if defined(_SC_KERNEL_BITS)
long bits = sysconf(_SC_KERNEL_BITS);
#endif
long cpu = sysconf (_SC_CPU_VERSION);
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
case CPU_PA_RISC2_0:
#if defined(_SC_KERNEL_BITS)
switch (bits)
{
case 64: puts ("hppa2.0w"); break;
case 32: puts ("hppa2.0n"); break;
default: puts ("hppa2.0"); break;
} break;
#else /* !defined(_SC_KERNEL_BITS) */
puts ("hppa2.0"); break;
#endif
default: puts ("hppa1.0"); break;
}
exit (0);
}
EOF
(${CC-cc} dummy.c -o dummy 2>/dev/null ) && HP_ARCH=`./dummy`
rm -f dummy.c dummy
esac
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
@ -279,6 +448,13 @@ EOF
hp8??:OSF1:*:*)
echo hppa1.0-hp-osf
exit 0 ;;
i?86:OSF1:*:*)
if [ -x /usr/sbin/sysversion ] ; then
echo ${UNAME_MACHINE}-unknown-osf1mk
else
echo ${UNAME_MACHINE}-unknown-osf1
fi
exit 0 ;;
parisc*:Lites*:*:*)
echo hppa1.1-hp-lites
exit 0 ;;
@ -306,64 +482,219 @@ EOF
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE}
exit 0 ;;
CRAY*C90:*:*:*)
echo c90-cray-unicos${UNAME_RELEASE}
CRAY*[A-Z]90:*:*:*)
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
exit 0 ;;
CRAY*TS:*:*:*)
echo t90-cray-unicos${UNAME_RELEASE}
exit 0 ;;
CRAY-2:*:*:*)
echo cray2-cray-unicos
exit 0 ;;
F300:UNIX_System_V:*:*)
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit 0 ;;
F301:UNIX_System_V:*:*)
echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
exit 0 ;;
hp3[0-9][05]:NetBSD:*:*)
echo m68k-hp-netbsd${UNAME_RELEASE}
exit 0 ;;
i[34]86:BSD/386:*:* | *:BSD/OS:*:*)
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
hp300:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
i?86:BSD/386:*:* | *:BSD/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit 0 ;;
*:FreeBSD:*:*)
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
if test -x /usr/bin/objformat; then
if test "elf" = "`/usr/bin/objformat`"; then
echo ${UNAME_MACHINE}-unknown-freebsdelf`echo${UNAME_RELEASE}|sed -e 's/[-_].*//'`
exit 0
fi
fi
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit 0 ;;
*:NetBSD:*:*)
echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;;
i*:CYGWIN*:*)
echo i386-unknown-cygwin32
*:OpenBSD:*:*)
echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;;
i*:[Cc][Yy][Gg][Ww][Ii][Nn]*:*)
echo ${UNAME_MACHINE}-pc-cygwin32
exit 0 ;;
i*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit 0 ;;
p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin32
exit 0 ;;
prep*:SunOS:5.*:*)
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
*:GNU:*:*)
echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit 0 ;;
*:Linux:*:*)
# uname on the ARM produces all sorts of strangeness, and we need to
# filter it out.
case "$UNAME_MACHINE" in
arm* | sa110*) UNAME_MACHINE="arm" ;;
esac
# The BFD linker knows what the default object file format is, so
# first see if it will tell us.
ld_help_string=`ld --help 2>&1`
if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i[345]86"; then
echo "${UNAME_MACHINE}-unknown-linux" ; exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i[345]86linux"; then
echo "${UNAME_MACHINE}-unknown-linuxaout" ; exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i[345]86coff"; then
echo "${UNAME_MACHINE}-unknown-linuxcoff" ; exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68kelf"; then
echo "${UNAME_MACHINE}-unknown-linux" ; exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68klinux"; then
echo "${UNAME_MACHINE}-unknown-linuxaout" ; exit 0
elif test "${UNAME_MACHINE}" = "alpha" ; then
echo alpha-unknown-linux ; exit 0
else
# Either a pre-BFD a.out linker (linuxoldld) or one that does not give us
# useful --help. Gcc wants to distinguish between linuxoldld and linuxaout.
test ! -d /usr/lib/ldscripts/. \
&& echo "${UNAME_MACHINE}-unknown-linuxoldld" && exit 0
# Determine whether the default compiler is a.out or elf
ld_supported_emulations=`echo $ld_help_string \
| sed -ne '/supported emulations:/!d
s/[ ][ ]*/ /g
s/.*supported emulations: *//
s/ .*//
p'`
case "$ld_supported_emulations" in
i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;;
i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;;
sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
elf32ppc)
# Determine Lib Version
cat >dummy.c <<EOF
#include <features.h>
#if defined(__GLIBC__)
extern char __libc_version[];
extern char __libc_release[];
#endif
main(argc, argv)
int argc;
char *argv[];
{
#if defined(__GLIBC__)
printf("%s %s\n", __libc_version, __libc_release);
#else
printf("unkown\n");
#endif
return 0;
}
EOF
LIBC=""
${CC-cc} dummy.c -o dummy 2>/dev/null
if test "$?" = 0 ; then
./dummy | grep 1\.99 > /dev/null
if test "$?" = 0 ; then
LIBC="libc1"
fi
fi
rm -f dummy.c dummy
echo powerpc-unknown-linux-gnu${LIBC} ; exit 0 ;;
esac
if test "${UNAME_MACHINE}" = "alpha" ; then
sed 's/^ //' <<EOF >dummy.s
.globl main
.ent main
main:
.frame \$30,0,\$26,0
.prologue 0
.long 0x47e03d80 # implver $0
lda \$2,259
.long 0x47e20c21 # amask $2,$1
srl \$1,8,\$2
sll \$2,2,\$2
sll \$0,3,\$0
addl \$1,\$0,\$0
addl \$2,\$0,\$0
ret \$31,(\$26),1
.end main
EOF
LIBC=""
${CC-cc} dummy.s -o dummy 2>/dev/null
if test "$?" = 0 ; then
./dummy
case "$?" in
7)
UNAME_MACHINE="alpha"
;;
15)
UNAME_MACHINE="alphaev5"
;;
14)
UNAME_MACHINE="alphaev56"
;;
10)
UNAME_MACHINE="alphapca56"
;;
16)
UNAME_MACHINE="alphaev6"
;;
esac
objdump --private-headers dummy | \
grep ld.so.1 > /dev/null
if test "$?" = 0 ; then
LIBC="libc1"
fi
fi
rm -f dummy.s dummy
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
elif test "${UNAME_MACHINE}" = "mips" ; then
cat >dummy.c <<EOF
main(argc, argv)
int argc;
char *argv[];
int argc;
char *argv[];
{
#ifdef __MIPSEB__
printf ("%s-unknown-linux-gnu\n", argv[1]);
#endif
#ifdef __MIPSEL__
printf ("%sel-unknown-linux-gnu\n", argv[1]);
#endif
return 0;
}
EOF
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
else
# Either a pre-BFD a.out linker (linux-gnuoldld)
# or one that does not give us useful --help.
# GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
# If ld does not provide *any* "supported emulations:"
# that means it is gnuoldld.
echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
case "${UNAME_MACHINE}" in
i?86)
VENDOR=pc;
;;
*)
VENDOR=unknown;
;;
esac
# Determine whether the default compiler is a.out or elf
cat >dummy.c <<EOF
#include <features.h>
main(argc, argv)
int argc;
char *argv[];
{
#ifdef __ELF__
printf ("%s-unknown-linux\n", argv[1]);
# ifdef __GLIBC__
# if __GLIBC__ >= 2
printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
# else
printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
# endif
# else
printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
# endif
#else
printf ("%s-unknown-linuxaout\n", argv[1]);
printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
#endif
return 0;
}
@ -373,32 +704,63 @@ EOF
fi ;;
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
# are messed up and put the nodename in both sysname and nodename.
i[34]86:DYNIX/ptx:4*:*)
i?86:DYNIX/ptx:4*:*)
echo i386-sequent-sysv4
exit 0 ;;
i[34]86:*:4.*:* | i[34]86:SYSTEM_V:4.*:*)
i?86:UNIX_SV:4.2MP:2.*)
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
# I am not positive that other SVR4 systems won't match this,
# I just have to hope. -- rms.
# Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
exit 0 ;;
i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
else
echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}
echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
fi
exit 0 ;;
i[34]86:*:3.2:*)
i?86:*:5:7*)
UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586
# 5.0.4c returns "Pent II". 5.0.5 returns PentII
(/bin/uname -X|egrep '^Machine.*Pent.*II' >/dev/null) \
&& UNAME_MACHINE=i686
(/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
&& UNAME_MACHINE=i686
echo ${UNAME_MACHINE}-${UNAME_SYSTEM}${UNAME_VERSION}-sysv${UNAME_RELEASE}
exit 0 ;;
i?86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
echo ${UNAME_MACHINE}-unknown-isc$UNAME_REL
echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
elif /bin/uname -X 2>/dev/null >/dev/null ; then
UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586
echo ${UNAME_MACHINE}-unknown-sco$UNAME_REL
(/bin/uname -X|egrep '^Machine.*PentII' >/dev/null) \
&& UNAME_MACHINE=i686
(/bin/uname -X|egrep '^Machine.*Pent II' >/dev/null) \
&& UNAME_MACHINE=i686
(/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
&& UNAME_MACHINE=i686
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
else
echo ${UNAME_MACHINE}-unknown-sysv32
echo ${UNAME_MACHINE}-pc-sysv32
fi
exit 0 ;;
pc:*:*:*)
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i386.
echo i386-pc-msdosdjgpp
exit 0 ;;
Intel:Mach:3*:*)
echo i386-unknown-mach3
echo i386-pc-mach3
exit 0 ;;
paragon:*:*:*)
echo i860-intel-osf1
@ -414,28 +776,36 @@ EOF
# "miniframe"
echo m68010-convergent-sysv
exit 0 ;;
M680[234]0:*:R3V[567]*:*)
M68*:*:R3V[567]*:*)
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0)
uname -p 2>/dev/null | grep 86 >/dev/null \
&& echo i486-ncr-sysv4.3 && exit 0 ;;
3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& echo i486-ncr-sysv4.3${OS_REL} && exit 0
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
uname -p 2>/dev/null | grep 86 >/dev/null \
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& echo i486-ncr-sysv4 && exit 0 ;;
m680[234]0:LynxOS:2.[23]*:*)
echo m68k-lynx-lynxos${UNAME_RELEASE}
m68*:LynxOS:2.*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
exit 0 ;;
i[34]86:LynxOS:2.[23]*:*)
echo i386-lynx-lynxos${UNAME_RELEASE}
i?86:LynxOS:2.*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
TSUNAMI:LynxOS:2.[23]*:*)
echo sparc-lynx-lynxos${UNAME_RELEASE}
TSUNAMI:LynxOS:2.*:*)
echo sparc-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
rs6000:LynxOS:2.[23]*:*)
echo rs6000-lynx-lynxos${UNAME_RELEASE}
rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
SM[BE]S:UNIX_SV:*:*)
echo mips-dde-sysv${UNAME_RELEASE}
exit 0 ;;
RM*:SINIX-*:*:*)
echo mips-sni-sysv4
@ -448,16 +818,41 @@ EOF
echo ns32k-sni-sysv
fi
exit 0 ;;
PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says <Richard.M.Bartel@ccMail.Census.GOV>
echo i586-unisys-sysv4
exit 0 ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes <hewes@openmarket.com>.
# How about differentiating between stratus architectures? -djm
echo hppa1.1-stratus-sysv4
exit 0 ;;
*:*:*:FTX*)
# From seanf@swdc.stratus.com.
echo i860-stratus-sysv4
exit 0 ;;
mc68*:A/UX:*:*)
echo m68k-apple-aux${UNAME_RELEASE}
exit 0 ;;
R3000:*System_V*:*:*)
news*:NEWS-OS:*:6*)
echo mips-sony-newsos6
exit 0 ;;
R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R4000:UNIX_SV:*:*)
if [ -d /usr/nec ]; then
echo mips-nec-sysv${UNAME_RELEASE}
else
echo mips-unknown-sysv${UNAME_RELEASE}
fi
exit 0 ;;
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
echo powerpc-be-beos
exit 0 ;;
BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
echo powerpc-apple-beos
exit 0 ;;
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
echo i586-pc-beos
exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
@ -501,7 +896,7 @@ main ()
#endif
int version;
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
printf ("%s-next-nextstep%s\n", __ARCHITECTURE__, version==2 ? "2" : "3");
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
exit (0);
#endif
@ -518,7 +913,7 @@ main ()
#endif
#if defined (__386BSD__)
printf ("i386-unknown-bsd\n"); exit (0);
printf ("i386-pc-bsd\n"); exit (0);
#endif
#if defined (sequent)

87
contrib/gdb/config.if Normal file
View File

@ -0,0 +1,87 @@
#! /dev/null
# Don't call it directly. This shell script fragment is called to
# determine:
#
# 1. libstcxx_interface: the interface name for libstdc++.
# 2. cxx_interface: the interface name for c++.
# 3. libc_interface: the interface name for libc.
#
# Get the top level src dir.
if [ -z "${topsrcdir}" -a -z "${top_srcdir}" ]
then
echo "Undefined top level src dir: topsrcdir and top_srcdir are empty" >&2
exit 1
fi
if [ -n "${topsrcdir}" ]
then
if_topsrcdir=${topsrcdir}
else
if_topsrcdir=${top_srcdir}
fi
if [ -f ${if_topsrcdir}/libstdc++/Makefile.in ]; then
# We check libstdc++ for libstdcxx_interface.
libstdcxx_interface=`grep "^INTERFACE" ${if_topsrcdir}/libstdc++/Makefile.in | sed 's/INTERFACE[ ]*=[ ]*\(.*\)/\1/'`
else
libstdcxx_interface=
fi
if [ -f ${if_topsrcdir}/gcc/cp/Makefile.in ]; then
# We check gcc/cp for cxx_interface.
cxx_interface=`grep "^INTERFACE" ${if_topsrcdir}/gcc/cp/Makefile.in | sed 's/INTERFACE[ ]*=[ ]*\(.*\)/\1/'`
else
cxx_interface=
fi
# The trickiest part is libc_interface.
if [ -z "${libc_interface}" ]
then
case ${target_os} in
*linux*libc1*|*linux*libc5*)
case ${target_alias} in
*alpha*|*powerpc*)
libc_interface=-libc5.9-
;;
*)
libc_interface=-libc5-
;;
esac
;;
*linux*gnu*)
# We have to work harder to figure it out.
if [ ${target_alias} = ${build_alias} ]
then
dummy=if$$
cat >$dummy.c <<EOF
#include <features.h>
main(argc, argv)
int argc;
char *argv[];
{
printf("%d\n", __GLIBC_MINOR__);
return 0;
}
EOF
${CC-cc} $dummy.c -o $dummy 2>/dev/null
if [ "$?" = 0 ]
then
libc_interface=-libc6.`./$dummy`-
rm -f $dummy.c $dummy
else
# It should never happen.
echo "Cannot find the GNU C library minor version number." >&2
rm -f $dummy.c $dummy
exit 1
fi
else
# Cross compiling. Assume glibc 2.1.
libc_interface=-libc6.1-
fi
;;
*)
libc_interface=-
;;
esac
fi

334
contrib/gdb/config.sub vendored
View File

@ -1,9 +1,9 @@
#! /bin/sh
# Configuration validation subroutine script, version 1.1.
# Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
# Copyright (C) 1991, 92-97, 1998, 1999 Free Software Foundation, Inc.
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
# can handle that machine. It does not imply ALL GNU software can.
# can handle that machine. It does not imply ALL GNU software can.
#
# 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
@ -41,6 +41,8 @@
# The goal of this file is to map all the various variations of a given
# machine specification into a single specification in the form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or in some cases, the newer four-part form:
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# It is wrong to echo any other type of specification.
if [ x$1 = x ]
@ -62,11 +64,33 @@ case $1 in
;;
esac
# Separate what the user gave into CPU-COMPANY and OS (if any).
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ]
then os=`echo $1 | sed 's/.*-/-/'`
else os=; fi
# CYGNUS LOCAL marketing-names
# Here we handle any "marketing" names - translating them to
# standard triplets
case $1 in
mips-tx39-elf)
set mipstx39-unknown-elf
;;
*)
;;
esac
# END CYGNUS LOCAL marketing-names
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
linux-gnu*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
*)
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ]
then os=`echo $1 | sed 's/.*-/-/'`
else os=; fi
;;
esac
### Let's recognize common machines as not being operating systems so
### that things like config.sub decstation-3100 work. We also
@ -81,7 +105,8 @@ case $os in
-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp )
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple)
os=
basic_machine=$1
;;
@ -89,10 +114,6 @@ case $os in
os=
basic_machine=$1
;;
-apple*) # CYGNUS LOCAL
os=
basic_machine=$1
;;
-scout) # CYGNUS LOCAL
;;
-wrs) # CYGNUS LOCAL
@ -103,34 +124,37 @@ case $os in
os=-hiuxwe2
;;
-sco5)
os=sco3.2v5
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
os=-sco3.2v5
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco4)
os=-sco3.2v4
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2.[4-9]*)
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2v[4-9]*)
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco*)
os=-sco3.2v2
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-udk*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-isc)
os=-isc2.2
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-clix*)
basic_machine=clipper-intergraph
;;
-isc*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-lynx*)
os=-lynxos
@ -150,16 +174,27 @@ esac
case $basic_machine in
# Recognize the basic CPU types without company name.
# Some are omitted here because they have special meanings below.
tahoe | i[3456]86 | i860 | m68k | m68000 | m88k | ns32k | arm \
| arme[lb] | pyramid \
| tron | a29k | 580 | i960 | h8300 | hppa1.0 | hppa1.1 \
| alpha | we32k | ns16k | clipper | i370 | sh \
| powerpc | powerpcle | 1750a | dsp16xx | mips64 | mipsel \
| pdp11 | mips64el | mips64orion | mips64orionel \
| sparc | sparclet | sparclite | sparc64)
tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
| arme[lb] | pyramid | mn10200 | mn10300 \
| tron | a29k | 580 | i960 | h8300 \
| hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \
| alpha | alphaev[45678] | alphaev56 | alphapca5[67] \
| we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \
| 1750a | dsp16xx | pdp11 \
| mips64 | mipsel | mips64el | mips64orion | mips64orionel \
| mipstx39 | mipstx39el \
| sparc | sparclet | sparclite | sparc64 | sparc86x | v850 \
| c4x)
basic_machine=$basic_machine-unknown
;;
m88110 | m680[01234]0 | m683?2 | m68360 | z8k | v70 | h8500 | w65) # CYGNUS LOCAL
m88110 | m680[012346]0 | m683?2 | m68360 | m5200 | z8k | v70 \
| h8500 | w65 | fr30) # CYGNUS LOCAL
basic_machine=$basic_machine-unknown
;;
strongarm) # CYGNUS LOCAL nickc/strongarm
basic_machine=$basic_machine-unknown
;;
thumb)
basic_machine=$basic_machine-unknown
;;
mips64vr4300 | mips64vr4300el) # CYGNUS LOCAL jsmith/vr4300
@ -168,27 +203,85 @@ case $basic_machine in
mips64vr4100 | mips64vr4100el) # CYGNUS LOCAL jsmith/vr4100
basic_machine=$basic_machine-unknown
;;
mips64vr5000 | mips64vr5000el) # CYGNUS LOCAL ian/vr5000
basic_machine=$basic_machine-unknown
;;
mips16)
basic_machine=$basic_machine-unknown
;;
tic30) # CYGNUS LOCAL ian/tic30
basic_machine=$basic_machine-unknown
;;
c30) # CYGNUS LOCAL ian/tic30
basic_machine=tic30-unknown
;;
v850e) # CYGNUS LOCAL jtc/v850
basic_machine=$basic_machine-unknown
;;
v850ea) # CYGNUS LOCAL jtc/v850
basic_machine=$basic_machine-unknown
;;
d10v)
basic_machine=$basic_machine-unknown
;;
d30v) # CYGNUS LOCAL hunt/d30v
basic_machine=$basic_machine-unknown
;;
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users.
i[34567]86)
basic_machine=$basic_machine-pc
;;
# Object if more than one company name word.
*-*-*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
;;
# Recognize the basic CPU types with company name.
vax-* | tahoe-* | i[3456]86-* | i860-* | m68k-* | m68000-* | m88k-* \
| sparc-* | ns32k-* | fx80-* | arm-* | arme[lb]-* | c[123]* \
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \
| none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
| hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
| pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
| pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \
| mips64el-* | mips64orion-* | mips64orionel-*)
vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \
| m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
| power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \
| xmp-* | ymp-* \
| hppa-* | hppa1.0-* | hppa1.1-* \
| hppa2.0-* | hppa2.0w-* | hppa2.0n-* \
| alpha-* | alphaev[45678]-* | alphaev56-* | alphapca5[67]-* \
| we32k-* | cydra-* | ns16k-* | pn-* | np1-* \
| xps100-* | clipper-* | orion-* \
| sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
| sparc64-* | sparcv9-* | sparc86x-* | mips64-* | mipsel-* \
| mips64el-* | mips64orion-* | mips64orionel-* \
| mipstx39-* | mipstx39el-* \
| f301-* \
| fr30-*) # CYGNUS LOCAL
;;
m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | h8500-*) # CYGNUS LOCAL
m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | h8500-* | d10v-*) # CYGNUS LOCAL
;;
strongarm-*) # CYGNUS LOCAL nickc/strongarm
;;
thumb-*) # CYGNUS LOCAL angela/thumb
;;
v850-*) # CYGNUS LOCAL
;;
v850e-*) # CYGNUS LOCAL
;;
v850ea-*) # CYGNUS LOCAL
;;
d30v-*) # CYGNUS LOCAL
;;
mips64vr4300-* | mips64vr4300el-*) # CYGNUS LOCAL jsmith/vr4300
;;
mips64vr4100-* | mips64vr4100el-*) # CYGNUS LOCAL jsmith/vr4100
;;
mips16-*) # CYGNUS LOCAL krk/mips16
;;
tic30-*) # CYGNUS LOCAL ian/tic30
;;
c30-*) # CYGNUS LOCAL ian/tic30
basic_machine=tic30-unknown
;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
386bsd) # CYGNUS LOCAL
@ -226,9 +319,9 @@ case $basic_machine in
amiga | amiga-*)
basic_machine=m68k-cbm
;;
amigados)
amigaos | amigados)
basic_machine=m68k-cbm
os=-amigados
os=-amigaos
;;
amigaunix | amix)
basic_machine=m68k-cbm
@ -242,10 +335,6 @@ case $basic_machine in
basic_machine=m68k-apollo
os=-bsd
;;
arm | armel | armeb)
basic_machine=arm-arm
os=-aout
;;
aux)
basic_machine=m68k-apple
os=-aux
@ -282,6 +371,10 @@ case $basic_machine in
basic_machine=cray2-cray
os=-unicos
;;
[ctj]90-cray)
basic_machine=c90-cray
os=-unicos
;;
crds | unos)
basic_machine=m68k-crds
;;
@ -379,18 +472,39 @@ case $basic_machine in
basic_machine=hppa1.1-hp
os=-proelf
;;
hp3k9[0-9][0-9] | hp9[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hp9k2[0-9][0-9] | hp9k31[0-9])
basic_machine=m68000-hp
;;
hp9k3[2-9][0-9])
basic_machine=m68k-hp
;;
hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
hp9k6[0-9][0-9] | hp6[0-9][0-9] )
basic_machine=hppa1.0-hp
;;
hp9k7[0-79][0-9] | hp7[0-79][0-9] )
basic_machine=hppa1.1-hp
;;
hp9k78[0-9] | hp78[0-9] )
# FIXME: really hppa2.0-hp
basic_machine=hppa1.1-hp
;;
hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | \
hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893 )
# FIXME: really hppa2.0-hp
basic_machine=hppa1.1-hp
;;
hp9k8[0-9][13679] | hp8[0-9][13679] )
basic_machine=hppa1.1-hp
;;
hp9k8[0-9][0-9] | hp8[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hppa-next)
os=-nextstep3
;;
hppaosf) # CYGNUS LOCAL
basic_machine=hppa1.1-hp
os=-osf
@ -400,20 +514,20 @@ case $basic_machine in
os=-mvs
;;
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
i[3456]86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
i[34567]86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv32
;;
i[3456]86v4*)
basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
i[34567]86v4*)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv4
;;
i[3456]86v)
basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
i[34567]86v)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv
;;
i[3456]86sol2)
basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
i[34567]86sol2)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-solaris2
;;
i386mach) # CYGNUS LOCAL
@ -428,6 +542,10 @@ case $basic_machine in
basic_machine=i386-unknown
os=-go32
;;
i386-mingw32 | mingw32)
basic_machine=i386-unknown
os=-mingw32
;;
iris | iris4d)
basic_machine=mips-sgi
case $os in
@ -456,6 +574,14 @@ case $basic_machine in
miniframe)
basic_machine=m68000-convergent
;;
mipsel*-linux*)
basic_machine=mipsel-unknown
os=-linux-gnu
;;
mips*-linux*)
basic_machine=mips-unknown
os=-linux-gnu
;;
mips3*-*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
;;
@ -519,7 +645,7 @@ case $basic_machine in
basic_machine=i960-intel
os=-nindy
;;
mon960)
mon960) # CYGNUS LOCAL
basic_machine=i960-intel
os=-mon960
;;
@ -551,25 +677,23 @@ case $basic_machine in
pc532 | pc532-*)
basic_machine=ns32k-pc532
;;
pentium | p5)
basic_machine=i586-intel
pentium | p5 | k5 | nexen)
basic_machine=i586-pc
;;
pentiumpro | p6)
basic_machine=i686-intel
pentiumpro | p6 | k6 | 6x86)
basic_machine=i686-pc
;;
pentium-* | p5-*)
pentiumii | pentium2)
basic_machine=i786-pc
;;
pentium-* | p5-* | k5-* | nexen-*)
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumpro-* | p6-*)
pentiumpro-* | p6-* | k6-* | 6x86-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
k5)
# We don't have specific support for AMD's K5 yet, so just call it a Pentium
basic_machine=i586-amd
;;
nexen)
# We don't have specific support for Nexgen yet, so just call it a Pentium
basic_machine=i586-nexgen
pentiumii-* | pentium2-*)
basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pn)
basic_machine=pn-gould
@ -672,6 +796,12 @@ case $basic_machine in
basic_machine=i386-sequent
os=-dynix
;;
tx39)
basic_machine=mipstx39-unknown
;;
tx39el)
basic_machine=mipstx39el-unknown
;;
tower | tower-32)
basic_machine=m68k-ncr
;;
@ -695,6 +825,9 @@ case $basic_machine in
basic_machine=vax-dec
os=-vms
;;
vpp*|vx|vx-*)
basic_machine=f301-fujitsu
;;
vxworks960)
basic_machine=i960-wrs
os=-vxworks
@ -739,7 +872,11 @@ case $basic_machine in
basic_machine=hppa1.1-oki
;;
mips)
basic_machine=mips-mips
if [ x$os = x-linux-gnu ]; then
basic_machine=mips-unknown
else
basic_machine=mips-mips
fi
;;
romp)
basic_machine=romp-ibm
@ -756,7 +893,7 @@ case $basic_machine in
we32k)
basic_machine=we32k-att
;;
sparc)
sparc | sparcv9)
basic_machine=sparc-sun
;;
cydra)
@ -774,6 +911,10 @@ case $basic_machine in
pmac | pmac-mpw) # CYGNUS LOCAL
basic_machine=powerpc-apple
;;
c4x*)
basic_machine=c4x-none
os=-coff
;;
*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
@ -797,6 +938,8 @@ esac
if [ x"$os" != x"" ]
then
case $os in
# First match some system type aliases
# that might get confused with valid system types.
# -solaris* is a basic system type, with this one exception.
-solaris1 | -solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'`
@ -804,38 +947,46 @@ case $os in
-solaris)
os=-solaris2
;;
-unixware* | svr4*)
-svr4*)
os=-sysv4
;;
-unixware*)
os=-sysv4.2uw
;;
-gnu/linux*)
os=`echo $os | sed -e 's|gnu/linux|linux|'`
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
;;
# First accept the basic system types.
# The portable systems comes first.
# Each alternative MUST END IN A *, to match a version number.
# -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[3456]* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
| -amigados* | -msdos* | -moss* | -newsos* | -unicos* | -aos* | -aof* \
| -nindy* | -mon960* | -vxworks* | -ebmon* | -hms* | -mvs* | -clix* \
| -riscos* | -linux* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -netbsd* | -freebsd* | -riscix* \
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -cygwin32* | -pe* | -psos*)
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
# CYGNUS LOCAL
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
| -windows* | -osx | -abug | -netware* | -proelf | -os9* \
| -macos* | -mpw* | -magic*)
| -windows* | -osx | -abug | -netware* | -os9* | -beos* \
| -macos* | -mpw* | -magic* | -mon960* | -lnews* )
;;
-mac*)
os=`echo $os | sed -e 's|mac|macos|'`
;;
# END CYGNUS LOCAL
-linux*)
os=`echo $os | sed -e 's|linux|linux-gnu|'`
;;
-sunos5*)
os=`echo $os | sed -e 's|sunos5|solaris2|'`
;;
@ -952,12 +1103,18 @@ case $basic_machine in
mips*-cisco) # CYGNUS LOCAL
os=-elf
;;
mips*-*) # CYGNUS LOCAL
os=-elf
;;
*-tti) # must be before sparc entry or we get the wrong os.
os=-sysv3
;;
sparc-* | *-sun)
os=-sunos4.1.1
;;
*-be)
os=-beos
;;
*-ibm)
os=-aix
;;
@ -980,7 +1137,7 @@ case $basic_machine in
os=-sysv
;;
*-cbm)
os=-amigados
os=-amigaos
;;
*-dg)
os=-dgux
@ -1030,6 +1187,9 @@ case $basic_machine in
*-masscomp)
os=-rtu
;;
f301-fujitsu)
os=-uxpv
;;
*-rom68k) # CYGNUS LOCAL
os=-coff
;;
@ -1057,18 +1217,18 @@ case $basic_machine in
-sunos*)
vendor=sun
;;
-bosx*) # CYGNUS LOCAL
vendor=bull
;;
-lynxos*)
vendor=lynx
;;
-aix*)
vendor=ibm
;;
-beos*)
vendor=be
;;
-hpux*)
vendor=hp
;;
-mpeix*)
vendor=hp
;;
-hiux*)
vendor=hitachi
;;
@ -1090,7 +1250,7 @@ case $basic_machine in
-ptx*)
vendor=sequent
;;
-vxworks*)
-vxsim* | -vxworks*)
vendor=wrs
;;
-aux*)

549
contrib/gdb/configure vendored
View File

@ -3,7 +3,8 @@
### WARNING: this file contains embedded tabs. Do not run untabify on this file.
# Configuration script
# Copyright (C) 1988, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
# Copyright (C) 1988, 90, 91, 92, 93, 94, 95, 96, 1997
# 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
@ -47,20 +48,25 @@ Makefile=Makefile
Makefile_in=Makefile.in
arguments=
build_alias=
cache_file=
cache_file=config.cache
cache_file_option=
configdirs=
extraconfigdirs=
diroptions=
exec_prefix=
exec_prefixoption=
fatal=
floating_point=default
gas=default
gcc_version=
gcc_version_trigger=
host_alias=NOHOST
host_makefile_frag=
moveifchange=
norecursion=
other_options=
package_makefile_frag=
package_makefile_rules_frag=
prefix=/usr/local
progname=
program_prefix=
@ -69,7 +75,7 @@ program_suffix=
program_suffixoption=
program_transform_name=
program_transform_nameoption=
redirect=">/dev/null"
redirect=
removing=
site=
site_makefile_frag=
@ -80,11 +86,54 @@ subdirs=
target_alias=NOTARGET
target_makefile_frag=
undefs=NOUNDEFS
version="$Revision: 1.222.4.1 $"
version="$Revision: 1.270 $"
x11=default
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
datadir='${prefix}/share'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
libdir='${exec_prefix}/lib'
includedir='${prefix}/include'
oldincludedir='/usr/include'
infodir='${prefix}/info'
mandir='${prefix}/man'
### we might need to use some other shell than /bin/sh for running subshells
#
### If we are on Windows, search for the shell. This will permit people
### to not have /bin/sh, but to be able to see /SOME/PATH/sh configure
### without also having to set CONFIG_SHELL. This code will work when
### using bash, which sets OSTYPE.
case "${OSTYPE}" in
*win32*)
if [ x${CONFIG_SHELL} = x ]; then
if [ ! -f /bin/sh ]; then
if [ x${SHELL} != x ] && [ -f ${SHELL} ]; then
CONFIG_SHELL=${SHELL}
export CONFIG_SHELL
else
for prog in sh sh.exe bash bash.exe; do
IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
for dir in $PATH; do
test -z "$dir" && dir=.
if test -f $dir/$prog; then
CONFIG_SHELL=$dir/$prog
export CONFIG_SHELL
break
fi
done
IFS="$save_ifs"
test -n "${CONFIG_SHELL}" && break
done
fi
fi
fi
;;
esac
config_shell=${CONFIG_SHELL-/bin/sh}
NO_EDIT="This file was generated automatically by configure. Do not edit."
@ -157,6 +206,10 @@ do
# Now, process the options
case $option in
--bi*)
bindir=$optarg
diroptions="$diroptions --bindir=$optarg"
;;
--build* | --bu*)
case "$build_alias" in
"") build_alias=$optarg ;;
@ -168,6 +221,10 @@ do
--cache*)
cache_file=$optarg
;;
--da*)
datadir=$optarg
diroptions="$diroptions --datadir=$optarg"
;;
--disable-*)
enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
eval $enableopt=no
@ -201,6 +258,30 @@ do
;;
esac
;;
--inc*)
includedir=$optarg
diroptions="$diroptions --includedir=$optarg"
;;
--inf*)
infodir=$optarg
diroptions="$diroptions --infodir=$optarg"
;;
--libd*)
libdir=$optarg
diroptions="$diroptions --libdir=$optarg"
;;
--libe*)
libexecdir=$optarg
diroptions="$diroptions --libexecdir=$optarg"
;;
--lo*)
localstatedir=$optarg
diroptions="$diroptions --localstatedir=$optarg"
;;
--ma*)
mandir=$optarg
diroptions="$diroptions --mandir=$optarg"
;;
--nfp | --nf*)
floating_point=no
floating_pointoption="--nfp"
@ -208,6 +289,10 @@ do
--norecursion | --no*)
norecursion=yes
;;
--ol*)
oldincludedir=$optarg
diroptions="$diroptions --oldincludedir=$optarg"
;;
--prefix* | --pre*)
prefix=$optarg
prefixoption="--prefix=$optarg"
@ -228,6 +313,14 @@ do
--rm)
removing=--rm
;;
--sb*)
sbindir=$optarg
diroptions="$diroptions --sbindir=$optarg"
;;
--sh*)
sharedstatedir=$optarg
diroptions="$diroptions --sharedstatedir=$optarg"
;;
--silent | --sil* | --quiet | --q*)
redirect=">/dev/null"
verbose=--silent
@ -246,6 +339,10 @@ do
--srcdir* | --sr*)
srcdir=$optarg
;;
--sy*)
sysconfdir=$optarg
diroptions="$diroptions --sysconfdir=$optarg"
;;
--target* | --ta*)
case $target_alias in
NOTARGET) target_alias=$optarg ;;
@ -286,9 +383,6 @@ do
;;
--x-i* | --x-l*) other_options="$other_options $orig_option"
;;
--bi* | --sb* | --li* | --da* | --sy* | --sh* | --lo* | --in* | --ol* | --ma*)
# These options were added to autoconf for emacs.
;;
--*)
echo "configure: Unrecognized option: \"$orig_option\"; use --help for usage." >&2
exit 1
@ -340,7 +434,7 @@ case "${fatal}" in
# Neither --host option nor undefs were present.
# Call config.guess.
guesssys=`echo ${progname} | sed 's/configure$/config.guess/'`
if host_alias=`${guesssys}`
if host_alias=`${config_shell} ${guesssys}`
then
# If the string we are going to use for
# the target is a prefix of the string
@ -424,9 +518,11 @@ fi
configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
topsrcdir=`cd \`dirname ${progname}\`; pwd`
# this is a hack. sun4 must always be a valid host alias or this will fail.
if ${configsub} sun4 >/dev/null 2>&1 ; then
if ${config_shell} ${configsub} sun4 >/dev/null 2>&1 ; then
true
else
echo '***' cannot find config.sub. 1>&2
@ -434,7 +530,7 @@ else
fi
touch config.junk
if ${moveifchange} config.junk config.trash ; then
if ${config_shell} ${moveifchange} config.junk config.trash ; then
true
else
echo '***' cannot find move-if-change. 1>&2
@ -480,12 +576,35 @@ case "${srcdir}" in
fi
esac
# default exec_prefix
case "${exec_prefixoption}" in
"") exec_prefix="\$(prefix)" ;;
*) ;;
esac
# Define the trigger file to make sure configure will re-run whenever
# 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}`
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}`
case "$arguments" in
*--with-gcc-version-trigger=$gcc_version_trigger* )
;;
* )
# Make sure configure.in knows about this.
arguments="--with-gcc-version-trigger=$gcc_version_trigger $arguments"
;;
esac
withoptions="--with-gcc-version-trigger=$gcc_version_trigger $withoptions"
fi
fi
### break up ${srcdir}/configure.in.
case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
"")
@ -508,7 +627,7 @@ case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
eval exec ${config_shell} ${srcdir}/configure ${verbose} \
${buildopt} --host=${host_alias} --target=${target_alias} \
${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
${srcdiroption} \
${srcdiroption} ${diroptions} \
${program_prefixoption} ${program_suffixoption} \
${program_transform_nameoption} ${site_option} \
${withoptions} ${withoutoptions} \
@ -559,8 +678,24 @@ fi
### do common part of configure.in
# If the language specific compiler does not exist, but the "gcc" directory does,
# we will skip this directory; in this case the sub-directory's common part
# of configure.in will create a small shell script "skip-this-dir" containing
# commands to completely clean up any temporary or created files.
. ${tmpfile}.com
if test -f skip-this-dir; then
# Perform the same cleanup as the trap handler, minus the "exit 1" of course,
# and reset the trap handler.
trap 0
rm -f Makefile* ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos
# Execute the final clean-up actions
${config_shell} skip-this-dir
# and stop configuring this directory.
exit 0
fi
# some sanity checks on configure.in
case "${srctrigger}" in
"")
@ -573,9 +708,9 @@ esac
case "${build_alias}" in
"")
if result=`${config_shell} ${configsub} ${host_alias}` ; then
build_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
build_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
build_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
build=${build_cpu}-${build_vendor}-${build_os}
build_alias=${host_alias}
fi
@ -583,9 +718,9 @@ case "${build_alias}" in
*)
if result=`${config_shell} ${configsub} ${build_alias}` ; then
buildopt="--build=${build_alias}"
build_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
build_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
build_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
build=${build_cpu}-${build_vendor}-${build_os}
else
echo "Unrecognized build system name ${build_alias}." 1>&2
@ -600,9 +735,9 @@ else
echo "Unrecognized host system name ${host_alias}." 1>&2
exit 1
fi
host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
host_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
host_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
host_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
host=${host_cpu}-${host_vendor}-${host_os}
. ${tmpfile}.hst
@ -613,9 +748,9 @@ else
echo "Unrecognized target system name ${target_alias}." 1>&2
exit 1
fi
target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
target_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
target_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
target_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
target=${target_cpu}-${target_vendor}-${target_os}
. ${tmpfile}.tgt
@ -670,26 +805,46 @@ fi
# If CC and CXX are not set in the environment, and the Makefile
# exists, try to extract them from it. This is to handle running
# ./config.status by hand.
if [ -z "${CC}" -a -r Makefile ]; then
if [ -z "${CC}" ] && [ -r Makefile ]; then
sed -n -e ':loop
/\\$/ N
/\\$/ b loop
s/\\\n//g
t loop
/^CC[ ]*=/ s/CC[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
CC=`tail -1 Makefile.cc`
rm -f Makefile.cc
fi
if [ -z "${CXX}" -a -r Makefile ]; then
if [ -z "${CFLAGS}" ] && [ -r Makefile ]; then
sed -n -e ':loop
/\\$/ N
/\\$/ b loop
s/\\\n//g
t loop
/^CFLAGS[ ]*=/ s/CFLAGS[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
CFLAGS=`tail -1 Makefile.cc`
rm -f Makefile.cc
fi
if [ -z "${CXX}" ] && [ -r Makefile ]; then
sed -n -e ':loop
/\\$/ N
s/\\\n//g
t loop
/^CXX[ ]*=/ s/CXX[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
CXX=`tail -1 Makefile.cc`
rm -f Makefile.cc
fi
if [ -z "${CXXFLAGS}" ] && [ -r Makefile ]; then
sed -n -e ':loop
/\\$/ N
s/\\\n//g
t loop
/^CXXFLAGS[ ]*=/ s/CXXFLAGS[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
CXXFLAGS=`tail -1 Makefile.cc`
rm -f Makefile.cc
fi
# Generate a default definition for YACC. This is used if the makefile can't
# locate bison or byacc in objdir.
@ -709,6 +864,25 @@ do
test -n "$DEFAULT_YACC" && break
done
# Generate a default definition for M4. This is used if the makefile can't
# locate m4 in objdir.
for prog in gm4 gnum4 m4
do
set dummy $prog; tmp=$2
IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
for dir in $PATH; do
test -z "$dir" && dir=.
if test -f $dir/$tmp; then
DEFAULT_M4="$prog"
break
fi
done
IFS="$save_ifs"
test -n "$DEFAULT_M4" && break
done
# Generate a default definition for LEX. This is used if the makefile can't
# locate flex in objdir.
@ -734,16 +908,17 @@ if [ "${build}" != "${host}" ]; then
tools="AR AR_FOR_TARGET AS AS_FOR_TARGET BISON CC_FOR_BUILD"
tools="${tools} CC_FOR_TARGET CXX_FOR_TARGET"
tools="${tools} DLLTOOL DLLTOOL_FOR_TARGET HOST_PREFIX"
tools="${tools} DLLTOOL DLLTOOL_FOR_TARGET GCC_FOR_TARGET HOST_PREFIX"
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"
for var in ${tools}; do
if [ -z "`eval 'echo $'"${var}"`" -a -r Makefile ]; then
if [ -z "`eval 'echo $'"${var}"`" ] && [ -r Makefile ]; then
sed -n -e ':loop
/\\$/ N
/\\$/ b loop
s/\\\n//g
t loop
/^'"${var}"'[ ]*=/ s/'"${var}"'[ ]*=[ ]*\(.*\)/\1/p' \
< Makefile > Makefile.v
t=`tail -1 Makefile.v`
@ -758,13 +933,17 @@ s/\\\n//g
AR_FOR_TARGET=${AR_FOR_TARGET-${target_alias}-ar}
AS=${AS-${host_alias}-as}
AS_FOR_TARGET=${AS_FOR_TARGET-${target_alias}-as}
BISON=${BISON-bison}
CC=${CC-${host_alias}-gcc}
CXX=${CXX-${host_alias}-gcc}
CFLAGS=${CFLAGS-"-g -O2"}
CXX=${CXX-${host_alias}-c++}
CXXFLAGS=${CXXFLAGS-"-g -O2"}
CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
CC_FOR_TARGET=${CC_FOR_TARGET-${target_alias}-gcc}
CXX_FOR_TARGET=${CXX_FOR_TARGET-${target_alias}-gcc}
CXX_FOR_TARGET=${CXX_FOR_TARGET-${target_alias}-c++}
DLLTOOL=${DLLTOOL-${host_alias}-dlltool}
DLLTOOL_FOR_TARGET=${DLLTOOL_FOR_TARGET-${target_alias}-dlltool}
GCC_FOR_TARGET=${GCC_FOR_TARGET-${CC_FOR_TARGET-${target_alias}-gcc}}
HOST_PREFIX=${build_alias}-
HOST_PREFIX_1=${build_alias}-
LD=${LD-${host_alias}-ld}
@ -774,26 +953,30 @@ s/\\\n//g
NM_FOR_TARGET=${NM_FOR_TARGET-${target_alias}-nm}
RANLIB=${RANLIB-${host_alias}-ranlib}
RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET-${target_alias}-ranlib}
WINDRES=${WINDRES-${host_alias}-windres}
WINDRES_FOR_TARGET=${WINDRES_FOR_TARGET-${target_alias}-windres}
if [ -z "${BISON}" ]; then
if [ -z "${YACC}" ]; then
IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
for dir in $PATH; do
test -z "$dir" && dir=.
if test -f $dir/byacc; then
BISON=byacc
if test -f $dir/bison; then
YACC="bison -y"
break
fi
if test -f $dir/bison; then
BISON=bison
if test -f $dir/byacc; then
YACC=byacc
break
fi
if test -f $dir/yacc; then
BISON=yacc
YACC=yacc
break
fi
done
IFS="$save_ifs"
BISON=${BISON-bison}
if [ -z "${YACC}" ]; then
YACC="bison -y"
fi
fi
if [ -z "${LEX}" ]; then
@ -821,6 +1004,7 @@ s/\\\n//g
export LD
export NM
export RANLIB
export WINDRES
else
# If CC is still not set, try to get gcc.
if [ -z "${CC}" ]; then
@ -828,31 +1012,51 @@ else
for dir in $PATH; do
test -z "$dir" && dir=.
if test -f $dir/gcc; then
CC="gcc -O2"
CC="gcc"
echo 'void f(){}' > conftest.c
if test -z "`${CC} -g -c conftest.c 2>&1`"; then
CFLAGS=${CFLAGS-"-g -O2"}
CXXFLAGS=${CXXFLAGS-"-g -O2"}
else
CFLAGS=${CFLAGS-"-O2"}
CXXFLAGS=${CXXFLAGS-"-O2"}
fi
rm -f conftest*
break
fi
done
IFS="$save_ifs"
CC=${CC-cc}
else
if test -z "${CFLAGS}"; then
# Here CC is set but CFLAGS is not. Use a quick hack to use -O2 if CC
# is set to a version of gcc.
case "${CC}" in
*gcc)
echo 'void f(){}' > conftest.c
if test -z "`${CC} -g -c conftest.c 2>&1`"; then
CFLAGS=${CFLAGS-"-g -O2"}
CXXFLAGS=${CXXFLAGS-"-g -O2"}
else
CFLAGS=${CFLAGS-"-O2"}
CXXFLAGS=${CXXFLAGS-"-O2"}
fi
rm -f conftest*
;;
esac
fi
fi
CXX=${CXX-"gcc"}
CXX=${CXX-"c++"}
CFLAGS=${CFLAGS-"-g"}
CXXFLAGS=${CXXFLAGS-"-g -O2"}
fi
export CC
export CXX
export CFLAGS
export CXXFLAGS
case "$host" in
*go32*)
enable_gdbtk=no ;;
esac
# Determine whether gdb needs tk/tcl or not.
if [ "$enable_gdbtk" != "no" ]; then
GDB_TK="all-tcl all-tk"
else
GDB_TK=""
fi
for subdir in . ${subdirs} ; do
@ -911,27 +1115,34 @@ for subdir in . ${subdirs} ; do
set ${links}; link=$1; shift; links=$*
if [ ! -r ${srcdir}/${file} ] ; then
if [ ! -r ${file} ] ; then
echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
exit 1
else
srcfile=${file}
fi
else
srcfile=${srcdir}/${file}
fi
${remove} -f ${link}
# Make a symlink if possible, otherwise try a hard link
if ${symbolic_link} ${srcdir}/${file} ${link} >/dev/null 2>&1 ; then
if ${symbolic_link} ${srcfile} ${link} >/dev/null 2>&1 ; then
true
else
# We need to re-remove the file because Lynx leaves a
# very strange directory there when it fails an NFS symlink.
${remove} -r -f ${link}
${hard_link} ${srcdir}/${file} ${link}
${hard_link} ${srcfile} ${link}
fi
if [ ! -r ${link} ] ; then
echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
echo '***' "${progname}: unable to link \"${link}\" to \"${srcfile}\"." 1>&2
exit 1
fi
echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
echo "Linked \"${link}\" to \"${srcfile}\"."
done
# Create a .gdbinit file which runs the one in srcdir
@ -957,88 +1168,101 @@ EOF
# been somewhat optimized and is perhaps a bit twisty.
# code is order so as to try to sed the smallest input files we know.
# so do these separately because I don't trust the order of sed -e expressions.
# the four makefile fragments MUST end up in the resulting Makefile in this order:
# package, target, host, and site. so do these separately because I don't trust the
# order of sed -e expressions.
# the five makefile fragments MUST end up in the resulting Makefile in this order:
# package macros, target, host, site, and package rules.
if [ -f ${srcdir}/${subdir}/${Makefile_in} ] ; then
# Conditionalize for this site from "Makefile.in" (or whatever it's called) into Makefile.tem
rm -f ${subdir}/Makefile.tem
case "${site}" in
# Conditionalize the makefile for this package from "Makefile.in" (or whatever it's called) into Makefile.tem.
rm -f ${subdir}/${Makefile}.tem
case "${package_makefile_rules_frag}" in
"") cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem ;;
*)
if [ ! -f ${package_makefile_rules_frag} ] ; then
package_makefile_rules_frag=${srcdir}/${package_makefile_rules_frag}
fi
if [ -f ${package_makefile_rules_frag} ] ; then
sed -e "/^####/ r ${package_makefile_rules_frag}" ${srcdir}/${subdir}/${Makefile_in} > ${Makefile}.tem
else
echo '***' Expected package makefile rules fragment \"${package_makefile_rules_frag}\" 1>&2
echo '***' is missing in ${PWD=`pwd`}. 1>&2
cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem
fi
esac
# working copy now in ${Makefile}.tem
# Conditionalize for this site.
rm -f ${Makefile}
case "${site}" in
"") mv ${subdir}/Makefile.tem ${Makefile} ;;
*)
site_makefile_frag=${srcdir}/config/ms-${site}
if [ -f ${site_makefile_frag} ] ; then
sed -e "/^####/ r ${site_makefile_frag}" ${srcdir}/${subdir}/${Makefile_in} \
> ${subdir}/Makefile.tem
sed -e "/^####/ r ${site_makefile_frag}" ${subdir}/Makefile.tem \
> ${Makefile}
else
cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem
mv ${subdir}/Makefile.tem ${Makefile}
site_makefile_frag=
fi
;;
esac
# working copy now in ${subdir}/Makefile.tem
# working copy now in ${Makefile}
# Conditionalize the makefile for this host.
rm -f ${Makefile}
rm -f ${subdir}/Makefile.tem
case "${host_makefile_frag}" in
"") mv ${subdir}/Makefile.tem ${Makefile} ;;
"") mv ${Makefile} ${subdir}/Makefile.tem ;;
*)
if [ ! -f ${host_makefile_frag} ] ; then
host_makefile_frag=${srcdir}/${host_makefile_frag}
fi
if [ -f ${host_makefile_frag} ] ; then
sed -e "/^####/ r ${host_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
sed -e "/^####/ r ${host_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
else
echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
echo '***' is missing in ${PWD=`pwd`}. 1>&2
mv ${subdir}/Makefile.tem ${Makefile}
mv ${Makefile} ${subdir}/Makefile.tem
fi
esac
# working copy now in ${Makefile}
# working copy now in ${subdir)/Makefile.tem
# Conditionalize the makefile for this target.
rm -f ${subdir}/Makefile.tem
rm -f ${Makefile}
case "${target_makefile_frag}" in
"") mv ${Makefile} ${subdir}/Makefile.tem ;;
"") mv ${subdir}/Makefile.tem ${Makefile} ;;
*)
if [ ! -f ${target_makefile_frag} ] ; then
target_makefile_frag=${srcdir}/${target_makefile_frag}
fi
if [ -f ${target_makefile_frag} ] ; then
sed -e "/^####/ r ${target_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
sed -e "/^####/ r ${target_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
else
mv ${Makefile} ${subdir}/Makefile.tem
mv ${subdir}/Makefile.tem ${Makefile}
target_makefile_frag=
fi
;;
esac
# real copy now in ${subdir}/Makefile.tem
# working copy now in ${Makefile}
# Conditionalize the makefile for this package.
rm -f ${Makefile}
# Emit the default values of this package's macros.
rm -f ${subdir}/Makefile.tem
case "${package_makefile_frag}" in
"") mv ${subdir}/Makefile.tem ${Makefile} ;;
"") mv ${Makefile} ${subdir}/Makefile.tem ;;
*)
if [ ! -f ${package_makefile_frag} ] ; then
package_makefile_frag=${srcdir}/${package_makefile_frag}
fi
if [ -f ${package_makefile_frag} ] ; then
sed -e "/^####/ r ${package_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
rm -f ${subdir}/Makefile.tem
sed -e "/^####/ r ${package_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
else
echo '***' Expected package makefile fragment \"${package_makefile_frag}\" 1>&2
echo '***' Expected package makefile fragment \"${package_makefile_rules_frag}\" 1>&2
echo '***' is missing in ${PWD=`pwd`}. 1>&2
mv ${subdir}/Makefile.tem ${Makefile}
mv ${Makefile} ${subdir}/Makefile.tem
fi
esac
# working copy now in ${Makefile}
mv ${Makefile} ${subdir}/Makefile.tem
# real copy now in ${subdir}/Makefile.tem
# prepend warning about editting, and a bunch of variables.
@ -1091,43 +1315,118 @@ 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}
else
echo enable_shared = ${enable_shared} >> ${Makefile}
fi
# record if we want to rumtime library stuff installed in libsubdir.
if test -z "${enable_version_specific_runtime_libs}"; then
echo enable_version_specific_runtime_libs = no >> ${Makefile}
else
echo enable_version_specific_runtime_libs = ${enable_version_specific_runtime_libs} >> ${Makefile}
fi
# Emit a macro which describes the file containing gcc's
# version number.
echo gcc_version_trigger = ${gcc_version_trigger} >> ${Makefile}
# And emit a macro defining gcc's version number.
echo gcc_version = ${gcc_version} >> ${Makefile}
# reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
# remove any form feeds.
if [ -z "${subdirs}" ]; then
rm -f ${subdir}/Makefile.tem2
rm -f ${subdir}/Makefile.tm2
sed -e "s:^SUBDIRS[ ]*=.*$:SUBDIRS = ${configdirs}:" \
-e "s:^NONSUBDIRS[ ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
${subdir}/Makefile.tem > ${subdir}/Makefile.tem2
${subdir}/Makefile.tem > ${subdir}/Makefile.tm2
rm -f ${subdir}/Makefile.tem
mv ${subdir}/Makefile.tem2 ${subdir}/Makefile.tem
fi
sed -e "s:^prefix[ ]*=.*$:prefix = ${prefix}:" \
-e "s:^exec_prefix[ ]*=.*$:exec_prefix = ${exec_prefix}:" \
mv ${subdir}/Makefile.tm2 ${subdir}/Makefile.tem
fi
sed -e "s|^prefix[ ]*=.*$|prefix = ${prefix}|" \
-e "s|^exec_prefix[ ]*=.*$|exec_prefix = ${exec_prefix}|" \
-e "s|^bindir[ ]*=.*$|bindir = ${bindir}|" \
-e "s|^sbindir[ ]*=.*$|sbindir = ${sbindir}|" \
-e "s|^libexecdir[ ]*=.*$|libexecdir = ${libexecdir}|" \
-e "s|^datadir[ ]*=.*$|datadir = ${datadir}|" \
-e "s|^sysconfdir[ ]*=.*$|sysconfdir = ${sysconfdir}|" \
-e "s|^sharedstatedir[ ]*=.*$|sharedstatedir = ${sharedstatedir}|" \
-e "s|^localstatedir[ ]*=.*$|localstatedir = ${localstatedir}|" \
-e "s|^libdir[ ]*=.*$|libdir = ${libdir}|" \
-e "s|^includedir[ ]*=.*$|includedir = ${includedir}|" \
-e "s|^oldincludedir[ ]*=.*$|oldincludedir = ${oldincludedir}|" \
-e "s|^infodir[ ]*=.*$|infodir = ${infodir}|" \
-e "s|^mandir[ ]*=.*$|mandir = ${mandir}|" \
-e "/^CC[ ]*=/{
:loop1
/\\\\$/ N
/\\\\$/ b loop1
s/\\\\\\n//g
t loop1
s%^CC[ ]*=.*$%CC = ${CC}%
}" \
-e "/^CXX[ ]*=/{
:loop2
/\\\\$/ N
/\\\\$/ b loop2
s/\\\\\\n//g
t loop2
s%^CXX[ ]*=.*$%CXX = ${CXX}%
}" \
-e "s:^SHELL[ ]*=.*$:SHELL = ${config_shell}:" \
-e "s:^GDB_TK[ ]*=.*$:GDB_TK = ${GDB_TK}:" \
-e "s:^srcdir[ ]*=.*$:srcdir = ${makesrcdir}:" \
-e "/^CFLAGS[ ]*=/{
:loop3
/\\\\$/ N
s/\\\\\\n//g
t loop3
s%^CFLAGS[ ]*=.*$%CFLAGS = ${CFLAGS}%
}" \
-e "/^CXXFLAGS[ ]*=/{
:loop4
/\\\\$/ N
s/\\\\\\n//g
t loop4
s%^CXXFLAGS[ ]*=.*$%CXXFLAGS = ${CXXFLAGS}%
}" \
-e "s|^SHELL[ ]*=.*$|SHELL = ${config_shell}|" \
-e "s|^srcdir[ ]*=.*$|srcdir = ${makesrcdir}|" \
-e "s/ //" \
-e "s:^program_prefix[ ]*=.*$:program_prefix = ${program_prefix}:" \
-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|^tooldir[ ]*=.*$|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}
# If this is a Canadian Cross, preset the values of many more
# tools.
@ -1202,27 +1501,41 @@ ${progname}" ${arguments} "
if [ -r ${subdir}/config.back ] ; then
mv -f ${subdir}/config.back ${subdir}/config.status
fi
${moveifchange} ${subdir}/config.new ${subdir}/config.status
${config_shell} ${moveifchange} ${subdir}/config.new ${subdir}/config.status
;;
*) rm -f ${Makefile} ${subdir}/config.status ${links} ;;
esac
done
# If there are subdirectories, then recur.
if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
for configdir in ${configdirs} ; do
# If there are subdirectories, then recur.
if [ -z "${norecursion}" ] && [ -n "${configdirs}" ] ; then
for configdir in ${configdirs} ${extraconfigdirs} ; do
if [ -d ${srcdir}/${configdir} ] ; then
# If configdir contains ',' it is
# srcdir,builddir,target_alias
# These come from extraconfigdirs.
case ${configdir} in
*,*)
eval `echo ${configdir} | sed -e 's/\([^,]*\),\([^,]*\),\(.*\)/cfg_dir=\1 bld_dir=\2 tgt_alias=\3/'`
;;
*)
cfg_dir=${configdir}
bld_dir=${configdir}
tgt_alias=${target_alias}
;;
esac
if [ -d ${srcdir}/${cfg_dir} ] ; then
eval echo Configuring ${configdir}... ${redirect}
case "${srcdir}" in
".") ;;
*)
if [ ! -d ./${configdir} ] ; then
if mkdir ./${configdir} ; then
if [ ! -d ./${bld_dir} ] ; then
if mkdir ./${bld_dir} ; then
true
else
echo '***' "${progname}: could not make ${PWD=`pwd`}/${configdir}" 1>&2
echo '***' "${progname}: could not make ${PWD=`pwd`}/${bld_dir}" 1>&2
exit 1
fi
fi
@ -1230,17 +1543,21 @@ if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
esac
POPDIR=${PWD=`pwd`}
cd ${configdir}
cd ${bld_dir}
### figure out what to do with srcdir
case "${srcdir}" in
".") newsrcdir=${srcdir} ;; # no -srcdir option. We're building in place.
/*) # absolute path
newsrcdir=${srcdir}/${configdir}
newsrcdir=${srcdir}/${cfg_dir}
srcdiroption="--srcdir=${newsrcdir}"
;;
?:*) # absolute path on win32
newsrcdir=${srcdir}/${cfg_dir}
srcdiroption="--srcdir=${newsrcdir}"
;;
*) # otherwise relative
newsrcdir=../${srcdir}/${configdir}
newsrcdir=../${srcdir}/${cfg_dir}
srcdiroption="--srcdir=${newsrcdir}"
;;
esac
@ -1252,6 +1569,9 @@ if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
/*) # absolute path
cache_file_option="--cache-file=${cache_file}"
;;
?:*) # absolute path on win32
cache_file_option="--cache-file=${cache_file}"
;;
*) # relative path
cache_file_option="--cache-file=../${cache_file}"
;;
@ -1263,18 +1583,19 @@ if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
elif [ -f ${newsrcdir}/configure.in ] ; then
case "${progname}" in
/*) recprog=${progname} ;;
?:*) recprog=${progname} ;;
*) recprog=../${progname} ;;
esac
else
eval echo No configuration information in ${configdir} ${redirect}
eval echo No configuration information in ${cfg_dir} ${redirect}
recprog=
fi
### The recursion line is here.
if [ ! -z "${recprog}" ] ; then
if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${target_alias} \
if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${tgt_alias} \
${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${floating_pointoption} ${cache_file_option} ${removing} ${other_options} ${redirect} ; then
${srcdiroption} ${diroptions} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${floating_pointoption} ${cache_file_option} ${removing} ${other_options} ${redirect} ; then
true
else
echo Configure in `pwd` failed, exiting. 1>&2

View File

@ -1,3 +1,4 @@
#! /bin/bash
##############################################################################
## This file is a shell script fragment that supplies the information
@ -13,6 +14,23 @@
## 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.
#
# 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
# 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.
##############################################################################
### To add a new directory to the tree, first choose whether it is a target
@ -24,26 +42,27 @@
# these libraries are used by various programs built for the host environment
#
host_libs="mmalloc libiberty opcodes bfd readline gash tcl tk tclX"
host_libs="intl mmalloc libiberty opcodes bfd readline gash db tcl tk tcl8.1 tk8.1 tclX itcl tix libgui"
if [ "${enable_gdbgui}" = "yes" ] ; then
host_libs="${host_libs} libgui"
fi
# these tools are built for the host environment
#
host_tools="byacc flex bison binutils ld gas gcc gdb make patch
prms send-pr gprof gdbtest tgas etc expect dejagnu sim
m4 autoconf ispell grep diff rcs cvs fileutils shellutils
textutils wdiff find emacs emacs19 uudecode hello tar gzip indent
recode release sed utils"
# 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"
# 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)
#
target_libs="target-libiberty target-libgloss target-newlib target-libio target-librx target-libstdc++ target-libg++"
target_libs="target-libiberty \
target-libgloss \
target-newlib \
target-libio \
target-librx \
target-libstdc++ \
target-libg++"
# these tools are built using the target libs, and are intended to run only
# in the target environment
@ -52,7 +71,7 @@ target_libs="target-libiberty target-libgloss target-newlib target-libio target-
# list belongs in this list. those programs are also very likely
# candidates for the "native_only" list which follows
#
target_tools="target-examples target-groff"
target_tools="target-examples target-groff target-gperf"
################################################################################
@ -64,13 +83,13 @@ target_tools="target-examples target-groff"
# directories to be built in the native environment only
#
native_only="autoconf cvs emacs emacs19 fileutils find grep gzip hello
indent ispell m4 rcs recode sed shellutils tar textutils gash
uudecode wdiff gprof target-groff"
# This must be a single line because of the way it is searched by grep in
# the code below.
native_only="autoconf automake libtool cvssrc emacs emacs19 fileutils find gawk gettext grep gzip hello indent ispell m4 rcs recode sed shellutils tar textutils gash uudecode wdiff gprof target-groff guile perl apache inet time ash bash bzip2 prms snavigator gnuserv target-gperf"
# directories to be built in a cross environment only
#
cross_only="target-libiberty target-libgloss target-newlib"
cross_only="target-libgloss target-newlib target-cygmon target-opcodes target-libstub"
## All tools belong in one of the four categories, and are assigned above
## We assign ${configdirs} this way to remove all embedded newlines. This
@ -94,45 +113,132 @@ appdirs=""
# Work in distributions that contain no compiler tools, like Autoconf.
if [ -d ${srcdir}/config ]; then
case "${host}" in
m68k-hp-hpux*) host_makefile_frag=config/mh-hp300 ;;
m68k-apollo-sysv*) host_makefile_frag=config/mh-apollo68 ;;
m68k-apollo-bsd*) host_makefile_frag=config/mh-a68bsd ;;
m68k-*-linux*) host_makefile_frag=config/mh-linux ;;
m88k-dg-dgux*) host_makefile_frag=config/mh-dgux ;;
m88k-harris-cxux*) host_makefile_frag=config/mh-cxux ;;
m88k-motorola-sysv*) host_makefile_frag=config/mh-delta88;;
mips*-dec-ultrix*) host_makefile_frag=config/mh-decstation ;;
mips*-nec-sysv4*) host_makefile_frag=config/mh-necv4 ;;
mips*-sgi-irix[56]*) host_makefile_frag=config/mh-irix5 ;;
mips*-sgi-irix4*) host_makefile_frag=config/mh-irix4 ;;
mips*-sgi-irix3*) host_makefile_frag=config/mh-sysv ;;
mips*-*-sysv4*) host_makefile_frag=config/mh-sysv4 ;;
mips*-*-sysv*) host_makefile_frag=config/mh-riscos ;;
i[345]86-ncr-sysv4.3) host_makefile_frag=config/mh-ncrsvr43 ;;
i[345]86-ncr-sysv4*) host_makefile_frag=config/mh-ncr3000 ;;
i[345]86-*-sco3.2v5*) host_makefile_frag=config/mh-sysv ;;
i[345]86-*-sco*) host_makefile_frag=config/mh-sco ;;
i[345]86-*-isc*) host_makefile_frag=config/mh-sysv ;;
i[345]86-*-linux*) host_makefile_frag=config/mh-linux ;;
i[345]86-*-solaris2*) host_makefile_frag=config/mh-sysv4 ;;
i[345]86-*-aix*) host_makefile_frag=config/mh-aix386 ;;
i[345]86-*-go32*) host_makefile_frag=config/mh-go32 ;;
vax-*-ultrix2*) host_makefile_frag=config/mh-vaxult2 ;;
*-*-solaris2*) host_makefile_frag=config/mh-solaris ;;
m68k-sun-sunos*) host_makefile_frag=config/mh-sun3 ;;
*-hp-hpux[78]*) host_makefile_frag=config/mh-hpux8 ;;
*-hp-hpux*) host_makefile_frag=config/mh-hpux ;;
*-*-hiux*) host_makefile_frag=config/mh-hpux ;;
rs6000-*-lynxos*) host_makefile_frag=config/mh-lynxrs6k ;;
*-*-lynxos*) host_makefile_frag=config/mh-lynxos ;;
*-*-sysv4*) host_makefile_frag=config/mh-sysv4 ;;
*-*-sysv*) host_makefile_frag=config/mh-sysv ;;
m68k-hp-hpux*)
host_makefile_frag="${host_makefile_frag} config/mh-hp300"
;;
m68k-apollo-sysv*)
host_makefile_frag="${host_makefile_frag} config/mh-apollo68"
;;
m68k-apollo-bsd*)
host_makefile_frag="${host_makefile_frag} config/mh-a68bsd"
;;
m88k-dg-dgux*)
host_makefile_frag="${host_makefile_frag} config/mh-dgux"
;;
m88k-harris-cxux*)
host_makefile_frag="${host_makefile_frag} config/mh-cxux"
;;
m88k-motorola-sysv*)
host_makefile_frag="${host_makefile_frag} config/mh-delta88"
;;
mips*-dec-ultrix*)
host_makefile_frag="${host_makefile_frag} config/mh-decstation"
;;
mips*-nec-sysv4*)
host_makefile_frag="${host_makefile_frag} config/mh-necv4"
;;
mips*-sgi-irix6*)
host_makefile_frag="${host_makefile_frag} config/mh-irix6"
;;
mips*-sgi-irix5*)
host_makefile_frag="${host_makefile_frag} config/mh-irix5"
;;
mips*-sgi-irix4*)
host_makefile_frag="${host_makefile_frag} config/mh-irix4"
;;
mips*-sgi-irix3*)
host_makefile_frag="${host_makefile_frag} config/mh-sysv"
;;
mips*-*-sysv4*)
host_makefile_frag="${host_makefile_frag} config/mh-sysv4"
;;
mips*-*-sysv*)
host_makefile_frag="${host_makefile_frag} config/mh-riscos"
;;
i[3456]86-*-sysv5*)
host_makefile_frag="${host_makefile_frag} config/mh-sysv5"
;;
i[3456]86-*-dgux*)
host_makefile_frag="${host_makefile_frag} config/mh-dgux386"
;;
i[3456]86-ncr-sysv4.3*)
host_makefile_frag="${host_makefile_frag} config/mh-ncrsvr43"
;;
i[3456]86-ncr-sysv4*)
host_makefile_frag="${host_makefile_frag} config/mh-ncr3000"
;;
i[3456]86-*-sco3.2v5*)
host_makefile_frag="${host_makefile_frag} config/mh-sysv"
;;
i[3456]86-*-sco*)
host_makefile_frag="${host_makefile_frag} config/mh-sco"
;;
i[3456]86-*-udk*)
host_makefile_frag="${host_makefile_frag} config/mh-sysv5"
;;
i[3456]86-*-isc*)
host_makefile_frag="${host_makefile_frag} config/mh-sysv"
;;
i[3456]86-*-solaris2*)
host_makefile_frag="${host_makefile_frag} config/mh-sysv4"
;;
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"
;;
*-cygwin*)
host_makefile_frag="${host_makefile_frag} config/mh-cygwin"
;;
*-mingw32*)
host_makefile_frag="${host_makefile_frag} config/mh-mingw32"
;;
*-windows*)
host_makefile_frag="${host_makefile_frag} config/mh-windows"
;;
vax-*-ultrix2*)
host_makefile_frag="${host_makefile_frag} config/mh-vaxult2"
;;
*-*-solaris2*)
host_makefile_frag="${host_makefile_frag} config/mh-solaris"
;;
m68k-sun-sunos*)
host_makefile_frag="${host_makefile_frag} config/mh-sun3"
;;
*-hp-hpux[78]*)
host_makefile_frag="${host_makefile_frag} config/mh-hpux8"
;;
*-hp-hpux*)
host_makefile_frag="${host_makefile_frag} config/mh-hpux"
;;
*-*-hiux*)
host_makefile_frag="${host_makefile_frag} config/mh-hpux"
;;
rs6000-*-lynxos*)
host_makefile_frag="${host_makefile_frag} config/mh-lynxrs6k"
;;
*-*-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"
;;
*-*-sysv*)
host_makefile_frag="${host_makefile_frag} config/mh-sysv"
;;
esac
fi
# If we aren't going to be using gcc, see if we can extract a definition
# of CC from the fragment.
if [ -z "${CC}" -a "${build}" = "${host}" ]; then
if [ -z "${CC}" ] && [ "${build}" = "${host}" ]; then
IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
found=
for dir in $PATH; do
@ -143,7 +249,7 @@ if [ -z "${CC}" -a "${build}" = "${host}" ]; then
fi
done
IFS="$save_ifs"
if [ -z "${found}" -a -n "${host_makefile_frag}" -a -f "${srcdir}/${host_makefile_frag}" ]; then
if [ -z "${found}" ] && [ -n "${host_makefile_frag}" ] && [ -f "${srcdir}/${host_makefile_frag}" ]; then
xx=`sed -n -e 's/^[ ]*CC[ ]*=[ ]*\(.*\)$/\1/p' < ${srcdir}/${host_makefile_frag}`
if [ -n "${xx}" ] ; then
CC=$xx
@ -155,37 +261,90 @@ fi
# Well, we don't yet, but we will.
if false && [ "${host}" = "${target}" ] && [ x${enable_shared} = x ]; then
case "${target}" in
alpha-dec-osf*) enable_shared=yes ;;
alpha*-dec-osf*) enable_shared=yes ;;
alpha*-*-linux*) enable_shared=yes ;;
mips-sgi-irix5*) enable_shared=yes ;;
*) enable_shared=no ;;
esac
fi
if [ x${enable_shared} = xyes ]; then
waugh=
case "${enable_shared}" in
yes) shared=yes ;;
no) shared=no ;;
"") shared=no ;;
*) shared=yes ;;
esac
if [ x${shared} = xyes ]; then
case "${host}" in
hppa*) waugh=config/mh-papic ;;
i[345]86-*) waugh=config/mh-x86pic ;;
sparc64-*) waugh=config/mh-sparcpic ;;
*) waugh=config/mh-${host_cpu}pic ;;
hppa*)
host_makefile_frag="${host_makefile_frag} config/mh-papic"
;;
i[3456]86-*-cygwin*)
# We don't want -fPIC on Cygwin.
;;
i[3456]86-*)
host_makefile_frag="${host_makefile_frag} config/mh-x86pic"
;;
sparc64-*)
host_makefile_frag="${host_makefile_frag} config/mh-sparcpic"
;;
powerpc*-*)
host_makefile_frag="${host_makefile_frag} config/mh-ppcpic"
;;
alpha*-*-linux*)
host_makefile_frag="${host_makefile_frag} config/mh-elfalphapic"
;;
*)
if test -f ${srcdir}/config/mh-${host_cpu}pic; then
host_makefile_frag="${host_makefile_frag} config/mh-${host_cpu}pic"
fi
;;
esac
if [ -f ${srcdir}/${waugh} ]; then
if [ -n "${host_makefile_frag}" ] ; then
cat ${srcdir}/${host_makefile_frag} > mh-frag
cat ${srcdir}/${waugh} >> mh-frag
host_makefile_frag=mh-frag
else
host_makefile_frag=${waugh}
fi
fi
fi
rm -f mh-frag
if [ -n "${host_makefile_frag}" ] ; then
for f in ${host_makefile_frag}
do
cat ${srcdir}/$f >> mh-frag
done
host_makefile_frag=mh-frag
fi
# per-target:
case "${target}" in
v810*) target_makefile_frag=config/mt-v810 ;;
i[345]86-*-netware*) target_makefile_frag=config/mt-netware ;;
powerpc-*-netware*) target_makefile_frag=config/mt-netware ;;
v810*)
target_makefile_frag="${target_makefile_frag} config/mt-v810"
;;
i[3456]86-*-netware*)
target_makefile_frag="${target_makefile_frag} config/mt-netware"
;;
powerpc-*-netware*)
target_makefile_frag="${target_makefile_frag} config/mt-netware"
;;
*-*-linux-gnu)
target_makefile_frag="${target_makefile_frag} config/mt-linux"
;;
esac
# If --enable-target-optspace always use -Os instead of -O2 to build
# the target libraries, similarly if it is not specified, use -Os
# on selected platforms.
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-*)
target_makefile_frag="${target_makefile_frag} config/mt-ospace"
;;
no:* | :*)
;;
*)
echo "*** bad value \"${enable_target_optspace}\" for --enable-target-optspace flag; ignored" 1>&2
;;
esac
skipdirs=
@ -200,7 +359,7 @@ case ${with_x} in
yes | "") # the default value for this tree is that X11 is available
;;
no)
skipdirs="${skipdirs} tk gash"
skipdirs="${skipdirs} tk libgui gash"
;;
*)
echo "*** bad value \"${with_x}\" for -with-x flag; ignored" 1>&2
@ -219,22 +378,25 @@ if [ x"${host}" = x"${target}" ] ; then
# that are in the 'cross only' list
skipdirs="${skipdirs} ${cross_only}"
is_cross_compiler=no
target_subdir=.
else
# similarly, don't build the targets in the 'native only'
# list when building a cross compiler
skipdirs="${skipdirs} ${native_only}"
is_cross_compiler=yes
target_subdir=${target_alias}
if [ ! -d ${target_subdir} ] ; then
if mkdir ${target_subdir} ; then true
else
echo "'*** could not make ${PWD=`pwd`}/${target_subdir}" 1>&2
exit 1
fi
fi
fi
# We always want to use the same name for this directory, so that dejagnu
# can reliably find it.
target_subdir=${target_alias}
if [ ! -d ${target_subdir} ] ; then
if mkdir ${target_subdir} ; then true
else
echo "'*** could not make ${PWD=`pwd`}/${target_subdir}" 1>&2
exit 1
fi
fi
copy_dirs=
# Handle --with-headers=XXX. The contents of the named directory are
@ -287,7 +449,9 @@ fi
# Default to using --with-stabs for certain targets.
if [ x${with_stabs} = x ]; then
case "${target}" in
mips*-*-* | alpha*-*-osf* | i[345]86*-*-sysv4* | i[345]86*-*-unixware*)
mips*-*-irix6*)
;;
mips*-*-* | alpha*-*-osf*)
with_stabs=yes;
withoptions="${withoptions} --with-stabs"
;;
@ -309,7 +473,7 @@ while [ $# != 0 ]; do
:
else
echo >config.temp
${srcdir}/install.sh -c -m 644 config.temp $2/COPIED
${srcdir}/install-sh -c -m 644 config.temp $2/COPIED
fi
# Copy the directory, assuming we have tar.
@ -328,8 +492,12 @@ done
# Configure extra directories which are host specific
case "${host}" in
i[345]86-*-go32*)
i[3456]86-*-go32*)
configdirs="$configdirs dosrel" ;;
i[3456]86-*-mingw32*)
configdirs="$configdirs dosrel" ;;
*-cygwin*)
configdirs="$configdirs libtermcap dosrel" ;;
esac
# Remove more programs from consideration, based on the host or
@ -339,46 +507,132 @@ esac
noconfigdirs=""
case "${host}" in
i[345]86-*-vsta)
noconfigdirs="tcl expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff"
i[3456]86-*-vsta)
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[345]86-*-go32)
noconfigdirs="tcl tk expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff"
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"
;;
*-*-cygwin32)
noconfigdirs="patch diff make tk tcl expect dejagnu cvs autoconf texinfo bison send-pr gprof rcs"
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"
;;
*-*-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=
;;
*-*-netbsd*)
noconfigdirs="rcs"
;;
ppc*-*-pe)
noconfigdirs="patch diff make tk tcl expect dejagnu cvs autoconf texinfo bison send-pr gprof rcs"
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"
;;
esac
case "${target}" in
*-*-netware)
noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-librx target-newlib target-libiberty"
noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-librx target-newlib target-libiberty target-libgloss"
;;
*-*-rtems*)
noconfigdirs="$noconfigdirs target-libgloss"
;;
*-*-vxworks*)
noconfigdirs="$noconfigdirs target-newlib"
noconfigdirs="$noconfigdirs target-newlib target-libgloss"
;;
alpha-dec-osf*)
alpha*-dec-osf*)
# ld works, but does not support shared libraries. emacs doesn't
# work. newlib is not 64 bit ready. I'm not sure about fileutils or grep.
# work. newlib is not 64 bit ready. I'm not sure about fileutils.
# gas doesn't generate exception information.
noconfigdirs="$noconfigdirs gas ld emacs fileutils grep target-newlib"
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"
;;
alpha*-*-*)
# newlib is not 64 bit ready
noconfigdirs="$noconfigdirs target-newlib"
noconfigdirs="$noconfigdirs target-newlib target-libgloss"
;;
arc-*-*)
noconfigdirs="$noconfigdirs target-libgloss"
;;
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"
;;
thumb-*-coff)
noconfigdirs="$noconfigdirs target-libgloss"
;;
# CYGNUS LOCAL clm/arm-elf
thumb-*-elf)
noconfigdirs="$noconfigdirs target-libgloss"
;;
thumb-*-oabi)
noconfigdirs="$noconfigdirs target-libgloss"
;;
# END CYGNUS LOCAL
# CYGNUS LOCAL nickc/strongarm
strongarm-*-elf)
noconfigdirs="$noconfigdirs target-libgloss"
if [ x${is_cross_compiler} != xno ] ; then
target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
fi
;;
strongarm-*-coff)
noconfigdirs="$noconfigdirs target-libgloss"
;;
# END CYGNUS LOCAL
thumb-*-pe) # CYGNUS LOCAL nickc/thumb
noconfigdirs="$noconfigdirs target-libgloss"
;;
arm-*-riscix*)
noconfigdirs="$noconfigdirs ld"
noconfigdirs="$noconfigdirs ld target-libgloss"
;;
d10v-*-*)
noconfigdirs="$noconfigdirs target-librx target-libg++ target-libstdc++ target-libio target-libgloss"
;;
# 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*-*-* | \
h8500-*-*)
noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-libio target-librx"
noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-libio target-librx target-libgloss"
;;
hppa*-*-*elf* | \
hppa*-*-lites*)
@ -394,115 +648,198 @@ case "${target}" in
esac
noconfigdirs="$noconfigdirs ld shellutils"
;;
i[345]86-*-go32)
i[3456]86-*-coff | i[3456]86-*-elf)
if [ x${is_cross_compiler} != xno ] ; then
target_configdirs="${target_configdirs} target-libstub target-cygmon"
fi
;;
i[3456]86-*-go32* | i[3456]-*-msdosdjgpp*)
# but don't build gdb
noconfigdirs="$noconfigdirs gdb target-libg++ target-libstdc++ target-libio target-librx"
;;
*-*-cygwin32)
*-*-linux*)
# linux has rx in libc
skipdirs="$skipdirs target-librx"
;;
i[3456]86-*-mingw32*)
target_configdirs="$target_configdirs target-mingw"
noconfigdirs="$noconfigdirs expect target-libgloss"
# make/glob's configure uses some AC_TRY_RUN type tests
target_configdirs="$target_configdirs target-winsup"
noconfigdirs="$noconfigdirs tcl tk expect make"
# Can't build gdb for mingw32 if not native.
case "${host}" in
i[3456]86-*-mingw32) ;; # keep gdb tcl tk expect etc.
*) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl tix db snavigator gnuserv"
;;
esac
;;
*-*-cygwin*)
target_configdirs="$target_configdirs target-libtermcap target-winsup"
noconfigdirs="$noconfigdirs target-libgloss"
# always build newlib.
skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
# Can't build gdb for cygwin32 if not native.
case "${host}:${build}" in
*-*-cygwin32 | *-*-cygwin32:*-*-cygwin32) ;; # keep gdb
*) noconfigdirs="$noconfigdirs gdb"
# Can't build gdb for Cygwin if not native.
case "${host}" in
*-*-cygwin*) ;; # keep gdb tcl tk expect etc.
*) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl tix libgui db snavigator gnuserv"
;;
esac
;;
i[345]86-*-pe)
noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-libio target-librx"
i[3456]86-*-pe)
noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-libio target-librx target-libgloss"
;;
i[345]86-*-sco3.2v5*)
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 gprof ld"
noconfigdirs="$noconfigdirs ld target-libgloss"
;;
i[345]86-*-sco*)
noconfigdirs="$noconfigdirs gprof"
i[3456]86-*-sco*)
noconfigdirs="$noconfigdirs gprof target-libgloss"
;;
i[345]86-*-solaris2*)
# The linker does static linking correctly, but the Solaris C library
# has bugs such that some important functions won't work when statically
# linked. (See man pages for getpwuid, for example.)
noconfigdirs="$noconfigdirs ld"
i[3456]86-*-solaris2*)
noconfigdirs="$noconfigdirs target-libgloss"
;;
i[345]86-*-sysv4*)
i[3456]86-*-sysv4*)
# The SYSV4 C compiler doesn't handle Emacs correctly
case "${CC}" in
"" | cc*) noconfigdirs="$noconfigdirs emacs emacs19" ;;
*) ;;
esac
# but that's okay since emacs doesn't work anyway
noconfigdirs="$noconfigdirs emacs emacs19"
noconfigdirs="$noconfigdirs emacs emacs19 target-libgloss"
;;
m68k-*-*)
if [ x${is_cross_compiler} != xno ] ; then
target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
fi
;;
mn10200-*-*)
noconfigdirs="$noconfigdirs"
if [ x${is_cross_compiler} != xno ] ; then
target_configdirs="${target_configdirs} target-libstub target-cygmon"
fi
;;
mn10300-*-*)
noconfigdirs="$noconfigdirs"
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 cvs"
noconfigdirs="$noconfigdirs gprof cvssrc target-libgloss"
# This is needed until gcc and ld are fixed to work together.
use_gnu_ld=no
;;
powerpc*-*-winnt* | powerpc*-*-pe* | ppc*-*-pe)
target_configdirs="$target_configdirs target-winsup"
noconfigdirs="$noconfigdirs gdb tcl tk make expect"
noconfigdirs="$noconfigdirs gdb tcl tk make expect target-libgloss itcl tix db snavigator gnuserv"
# 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"
;;
powerpc-*-eabi)
if [ x${is_cross_compiler} != xno ] ; then
target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
fi
;;
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 cvs"
noconfigdirs="$noconfigdirs target-newlib gprof cvssrc"
;;
rs6000-*-aix*)
noconfigdirs="$noconfigdirs gprof"
# This is needed until gcc and ld are fixed to work together.
use_gnu_ld=no
;;
rs6000-*-*)
noconfigdirs="$noconfigdirs gprof"
;;
m68k-apollo-*)
noconfigdirs="$noconfigdirs ld binutils gprof"
noconfigdirs="$noconfigdirs ld binutils gprof target-libgloss"
;;
mips*-*-irix5*)
# The GNU linker does not support shared libraries.
# emacs is emacs 18, which does not work on Irix 5 (emacs19 does work)
noconfigdirs="$noconfigdirs ld gprof emacs"
noconfigdirs="$noconfigdirs ld gprof emacs target-libgloss"
;;
mips*-*-irix6*)
# The GNU assembler and linker do 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"
;;
mips*-dec-bsd*)
noconfigdirs="$noconfigdirs gprof"
noconfigdirs="$noconfigdirs gprof target-libgloss"
;;
mips*-*-bsd*)
noconfigdirs="$noconfigdirs gprof"
noconfigdirs="$noconfigdirs gprof target-libgloss"
;;
mipstx39-*-*)
noconfigdirs="$noconfigdirs gprof" # same as generic mips
target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
;;
mips*-*-*)
noconfigdirs="$noconfigdirs gprof"
;;
romp-*-*)
noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes"
noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss"
;;
sh-*-*)
case "${host}" in
i[345]86-*-vsta) ;; # don't add gprof back in
i[345]86-*-go32) ;; # don't add gprof back in
i[3456]86-*-vsta) ;; # don't add gprof back in
i[3456]86-*-go32*) ;; # don't add gprof back in
i[3456]86-*-msdosdjgpp*) ;; # don't add gprof back in
*) skipdirs=`echo " ${skipdirs} " | sed -e 's/ gprof / /'` ;;
esac
noconfigdirs="$noconfigdirs target-libgloss"
;;
sparc-*-elf*)
if [ x${is_cross_compiler} != xno ] ; then
target_configdirs="${target_configdirs} target-libstub target-cygmon"
fi
;;
sparc64-*-elf*)
if [ x${is_cross_compiler} != xno ] ; then
target_configdirs="${target_configdirs} target-libstub target-cygmon"
fi
;;
sparclite-*-*)
if [ x${is_cross_compiler} != xno ] ; then
target_configdirs="${target_configdirs} target-libstub target-cygmon"
fi
;;
sparc-*-sunos4*)
if [ x${is_cross_compiler} != xno ] ; then
noconfigdirs="$noconfigdirs gdb gdbtest target-newlib"
noconfigdirs="$noconfigdirs gdb gdbtest target-newlib target-libgloss"
else
use_gnu_ld=no
fi
;;
v810-*-*)
noconfigdirs="$noconfigdirs bfd binutils gas gcc gdb ld target-libio target-libg++ target-libstdc++ opcodes"
noconfigdirs="$noconfigdirs bfd binutils gas gcc gdb ld target-libio target-libg++ target-libstdc++ opcodes target-libgloss"
;;
v850-*-*)
noconfigdirs="$noconfigdirs target-libgloss"
;;
v850e-*-*) # CYGNUS LOCAL v850e
noconfigdirs="$noconfigdirs target-libgloss"
;;
v850ea-*-*)
noconfigdirs="$noconfigdirs target-libgloss"
;; # END CYGNUS LOCAL
vax-*-vms)
noconfigdirs="$noconfigdirs bfd binutils gdb ld target-newlib opcodes"
noconfigdirs="$noconfigdirs bfd binutils gdb ld target-newlib opcodes target-libgloss"
;;
vax-*-*)
noconfigdirs="$noconfigdirs target-newlib"
noconfigdirs="$noconfigdirs target-newlib target-libgloss"
;;
*-*-lynxos*)
# Newlib makes problems for libg++ in crosses.
noconfigdirs="$noconfigdirs target-newlib"
noconfigdirs="$noconfigdirs target-newlib target-libgloss"
;;
*-*-macos* | \
*-*-mpw*)
@ -511,19 +848,13 @@ case "${target}" in
;;
esac
# targets that need a second pass
case "${target}" in
*-gm-magic*)
noconfigdirs="$noconfigdirs libgloss"
;;
# If we aren't building newlib, then don't build libgloss, since libgloss
# depends upon some newlib header files.
case "${noconfigdirs}" in
*target-libgloss*) ;;
*target-newlib*) noconfigdirs="$noconfigdirs target-libgloss" ;;
esac
# If we are building a Canadian Cross, discard tools that can not be built
# using a cross compiler. FIXME: These tools should be fixed.
if [ "${build}" != "${host}" ]; then
noconfigdirs="$noconfigdirs expect dejagnu make texinfo diff"
fi
# Make sure we don't let GNU ld be added if we didn't want it.
if [ x$with_gnu_ld = xno ]; then
use_gnu_ld=no
@ -587,12 +918,12 @@ fi
# Deconfigure all subdirectories, in case we are changing the
# configuration from one where a subdirectory is supported to one where it
# is not.
if [ -z "${norecursion}" -a -n "${configdirs}" ]; then
if [ -z "${norecursion}" ] && [ -n "${configdirs}" ]; then
for i in `echo ${configdirs} | sed -e s/target-//g` ; do
rm -f $i/Makefile
done
fi
if [ -z "${norecursion}" -a -n "${target_configdirs}" ]; then
if [ -z "${norecursion}" ] && [ -n "${target_configdirs}" ]; then
for i in `echo ${target_configdirs} | sed -e s/target-//g` ; do
rm -f ${target_subdir}/$i/Makefile
done
@ -660,14 +991,45 @@ if [ x${use_gnu_ld} = x ] ; then
fi
fi
if [ x${enable_shared} = xyes ]; then
# If using newlib, add --with-newlib to the withoptions so that gcc/configure
# can detect this case.
if [ x${with_newlib} != xno ] && echo " ${target_configdirs} " | grep " target-newlib " > /dev/null 2>&1 && [ -d ${srcdir}/newlib ] ; then
with_newlib=yes
withoptions="$withoptions --with-newlib"
fi
if [ x${shared} = xyes ]; then
case "${target}" in
hppa*) target_makefile_frag=config/mt-papic ;;
i[345]86-*) target_makefile_frag=config/mt-x86pic ;;
*) target_makefile_frag=config/mt-${target_cpu}pic ;;
hppa*)
target_makefile_frag="${target_makefile_frag} config/mt-papic"
;;
i[3456]86-*)
target_makefile_frag="${target_makefile_frag} config/mt-x86pic"
;;
powerpc*-*)
target_makefile_frag="${target_makefile_frag} config/mt-ppcpic"
;;
alpha*-*-linux*)
target_makefile_frag="${target_makefile_frag} config/mt-elfalphapic"
;;
*)
if test -f ${srcdir}/config/mt-${target_cpu}pic; then
target_makefile_frag="${target_makefile_frag} config/mt-${target_cpu}pic"
fi
;;
esac
fi
rm -f mt-frag
if [ -n "${target_makefile_frag}" ] ; then
for f in ${target_makefile_frag}
do
cat ${srcdir}/$f >> mt-frag
done
target_makefile_frag=mt-frag
fi
# post-target:
# Make sure that the compiler is able to generate an executable. If it
@ -676,7 +1038,7 @@ fi
# can be created. At this point the main configure script has set CC.
echo "int main () { return 0; }" > conftest.c
${CC} -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c
if [ $? = 0 ] && [ -s conftest ]; then
if [ $? = 0 ] && [ -s conftest -o -s conftest.exe ]; then
:
else
echo 1>&2 "*** The command '${CC} -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c' failed."
@ -689,7 +1051,8 @@ rm -f conftest*
# The Solaris /usr/ucb/cc compiler does not appear to work.
case "${host}" in
sparc-sun-solaris2*)
if [ "`/usr/bin/which ${CC-cc}`" = "/usr/ucb/cc" ] ; then
CCBASE="`echo ${CC-cc} | sed 's/ .*$//'`"
if [ "`/usr/bin/which $CCBASE`" = "/usr/ucb/cc" ] ; then
could_use=
[ -d /opt/SUNWspro/bin ] && could_use="/opt/SUNWspro/bin"
if [ -d /opt/cygnus/bin ] ; then
@ -715,7 +1078,7 @@ esac
# If --enable-shared was set, we must set LD_LIBRARY_PATH so that the
# binutils tools will find libbfd.so.
if [ "${enable_shared}" = "yes" ]; then
if [ "${shared}" = "yes" ]; then
sed -e 's/^SET_LIB_PATH[ ]*=.*$/SET_LIB_PATH = $(REALLY_SET_LIB_PATH)/' \
Makefile > Makefile.tem
rm -f Makefile
@ -723,7 +1086,7 @@ if [ "${enable_shared}" = "yes" ]; then
case "${host}" in
*-*-hpux*)
sed -e 's/RPATH_ENVVAR[ ]*=.*$/RPATH_ENVVAR = SHLIB_PATH/' \
sed -e 's/^RPATH_ENVVAR[ ]*=.*$/RPATH_ENVVAR = SHLIB_PATH/' \
Makefile > Makefile.tem
rm -f Makefile
mv -f Makefile.tem Makefile
@ -734,9 +1097,10 @@ fi
# Record target_configdirs and the configure arguments in Makefile.
target_configdirs=`echo "${target_configdirs}" | sed -e 's/target-//g'`
targargs=`echo "${arguments}" | \
sed -e 's/--norecursion//' \
sed -e 's/--no[^ ]*//' \
-e 's/--cache[a-z-]*=[^ ]*//' \
-e 's/--ho[a-z-]*=[^ ]*//' \
-e 's/--bu[a-z-]*=[^ ]*//' \
-e 's/--ta[a-z-]*=[^ ]*//'`
# Passing a --with-cross-host argument lets the target libraries know
@ -748,7 +1112,18 @@ if [ x${is_cross_compiler} = xyes ]; then
targargs="--with-cross-host=${host_alias} ${targargs}"
fi
targargs="--host=${target_alias} ${targargs}"
# Default to --enable-multilib.
if [ x${enable_multilib} = x ]; then
targargs="--enable-multilib ${targargs}"
fi
# Pass --with-newlib if appropriate. Note that target_configdirs has
# changed from the earlier setting of with_newlib.
if [ x${with_newlib} != xno ] && echo " ${target_configdirs} " | grep " newlib " > /dev/null 2>&1 && [ -d ${srcdir}/newlib ] ; then
targargs="--with-newlib ${targargs}"
fi
targargs="--host=${target_alias} --build=${build_alias} ${targargs}"
sed -e "s:^TARGET_CONFIGDIRS[ ]*=.*$:TARGET_CONFIGDIRS = ${target_configdirs}:" \
-e "s%^CONFIG_ARGUMENTS[ ]*=.*$%CONFIG_ARGUMENTS = ${targargs}%" \
-e "s%^TARGET_SUBDIR[ ]*=.*$%TARGET_SUBDIR = ${target_subdir}%" \

View File

@ -2,7 +2,7 @@
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@ -279,7 +279,7 @@ POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
@ -305,7 +305,8 @@ the "copyright" line and a pointer to where the full notice is found.
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.
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,6 @@ Fri Dec 29 16:30:58 1995 Stan Shebs <shebs@andros.cygnus.com>
* symfile.c (find_sym_fns): Add PowerMac to xcoff file recognition
kludge.
Fri Dec 22 11:05:59 1995 Michael Meissner <meissner@tiktok.cygnus.com>
* configure.in (gdb_host): Add support for DG/UX running on x86 as
@ -108,7 +107,6 @@ Mon Dec 11 18:19:16 1995 Stan Shebs <shebs@andros.cygnus.com>
* mac-gdb.r: Fix version resources to use symbolic version strings.
(cfrg): New resource, code fragment for PowerMac.
Mon Dec 11 14:13:03 1995 Fred Fish <fnf@amigalib.com>
* dbxread.c (process_one_symbol): When looking at the next
@ -119,7 +117,7 @@ Mon Dec 11 15:56:55 1995 Per Bothner <bothner@kalessin.cygnus.com>
* eval.c (evaluate_struct_tuple): Fix thinko.
Mon Dec 11 06:52:02 1995 Wilfried Moser (Alcatel) <moser@rtl.cygnus.com>
Mon Dec 11 06:52:02 1995 Wilfried Moser <moser@rtl.cygnus.com>
* ch-typeprint.c (chill_type_print_base): Slightly change of printing
of variant structures.
@ -843,7 +841,8 @@ Fri Oct 27 09:54:07 1995 Stu Grossman (grossman@cygnus.com)
startup. Eliminate sleeps. Clear breakpoints (if using monitor
breakpoints). Re-init frame.
* (mips_detach): Close down target.
* (mips_wait): Handle return status with registers, or breakpoint stuff.
* (mips_wait): Handle return status with registers, or breakpoint
* stuff.
* (mips_kill): Add ^C handling.
* (mips_insert_breakpoint mips_remove_breakpoint): Call new
breakpoint stuff if enabled.
@ -856,7 +855,6 @@ Fri Oct 27 09:54:07 1995 Stu Grossman (grossman@cygnus.com)
user-defined commands to suppress auto-repeat (by hittin return key).
* valops.c: Add start of auto function-call abandonment capability.
Thu Oct 26 22:02:27 1995 Stan Shebs <shebs@andros.cygnus.com>
* mpw-config.in: Add support for PowerMac host, add beginnings
@ -1817,7 +1815,7 @@ Tue Aug 1 11:44:53 1995 J.T. Conklin <jtc@rtl.cygnus.com>
inflow.c, infptrace.c, infrun.c, irix5-nat.c, language.c,
m2-typeprint.c, main.c, mdebugread.c, minsyms.c, mipsread.c,
monitor.c, nlmread.c, objfiles.c, os9kread.c, osfsolib.c, parse.c,
printcmd.c, procfs.c, regex.c, remote-adapt.c, remote-arc.c,
printcmd.c, procfs.c, regex.c, remote-adapt.c,
remote-array.c, remote-bug.c, remote-e7000.c, remote-eb.c,
remote-es.c, remote-hms.c, remote-mm.c, remote-os9k.c,
remote-pa.c, remote-sim.c, remote-st.c, remote-udi.c,
@ -2237,7 +2235,6 @@ Thu Jul 13 13:42:38 1995 Jeffrey A. Law <law@rtl.cygnus.com>
* m3-nat.c (m3_ops): Likewise.
* monitor.c (monitor_ops): Likewise.
* procfs.c (procfs_ops): Likewise.
* remote-arc.c (arc_ops): Likewise.
* remote-array.c (array_ops): Likewise.
* remote-e7000.c (e7000_ops): Likewise.
* remote-es.c (es1800_ops, es1800_child_ops): Likewise.
@ -2551,6 +2548,16 @@ Sat Jun 3 01:54:56 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
* value.h (struct value): Change `repetitions' field from
`short' to `int' type.
Fri Jun 2 11:17:23 1995 Doug Evans <dje@canuck.cygnus.com>
* arc-tdep.c (arc_bfd_mach_type): New static global.
(codestream_fill): Handle byte order differences.
(setup_prologue_scan): Don't read stdarg function's "sub sp,sp,N".
(arc_get_frame_setup): Read it here.
(arc_frame_saved_pc): And here.
(arc_print_insn): New function.
(arc_set_cpu_type): Set arc_bfd_mach_type. Don't set tm_print_insn.
(_initialize_arc_tdep): Set tm_print_insn to arc_print_insn.
Wed May 31 12:04:01 1995 J.T. Conklin <jtc@rtl.cygnus.com>
@ -2884,6 +2891,7 @@ Tue May 2 18:32:24 1995 Stan Shebs <shebs@andros.cygnus.com>
* remote-nrom.c: New file, NetROM target support.
* config/a29k/a29k-udi.mt, config/i960/vxworks960.mt: Use
REMOTE_OBS instead of REMOTE_O.
* config/arc/arc.mt: Ditto.
Fri Apr 28 23:30:00 1995 Stu Grossman (grossman@cygnus.com)
@ -3056,6 +3064,41 @@ Wed Apr 12 14:34:31 1995 Jim Kingdon <kingdon@deneb.cygnus.com>
* xcoffread.c: Call complain() rather than error() or printing a
warning.
Wed Apr 12 08:15:27 1995 Doug Evans <dje@canuck.cygnus.com>
* arc-tdep.c: #include "gdbcmd.h".
(codestream_seek): Pass CORE_ADDR.
(arc_cpu_type, tmp_arc_cpu_type, arc_cpu_type_table): New globals.
(debug_pipeline_p): Likewise.
(X_...): Instruction field access macros.
(BUILD_INSN): Define.
(codestream_tell): Allow for stream elements > 1 byte.
(codestream_fill): Likewise.
(setup_prologue_scan): New function.
(arc_get_frame_setup): Call it. Update to current spec
regarding prologues. Use BUILD_INSN.
(skip_prologue): New argument `frameless_p'. Use BUILD_INSN.
(arc_frame_saved_pc): New function.
(frame_find_saved_regs): Use BUILD_INSN.
(get_insn_type, single_step): New functions.
(one_stepped): New global.
(arc_set_cpu_type_command, arc_show_cpu_type_command): New functions.
(arc_set_cpu_type): New function.
(_initialize_arc_tdep): Define new `set' commands `cpu',
`displaypipeline', and `debugpipeline'.
* arc/tm-arc.h (TARGET_BYTE_ORDER): Delete.
(TARGET_BYTE_ORDER_SELECTABLE): Define.
(DEFAULT_ARC_CPU_TYPE): Define.
(SKIP_PROLOGUE_FRAMELESS_P): Define.
(BREAKPOINT): Delete.
(BIG_BREAKPOINT, LITTLE_BREAKPOINT): Define.
(DECR_PC_AFTER_BREAK): Change to 8.
(NO_SINGLE_STEP): Define.
(ARC_PC_TO_REAL_ADDRESS): Define.
(SAVED_PC_AFTER_CALL): Use it.
(NUM_REGS, REGISTER_BYTES): Fix.
(FRAME_SAVED_PC): Call arc_frame_saved_pc.
(FRAME_LOCALS_ADDRESS): Fix.
Tue Apr 11 16:42:37 1995 Jim Kingdon (kingdon@lioth.cygnus.com)
@ -3647,6 +3690,9 @@ Mon Mar 13 15:25:47 1995 Jim Kingdon <kingdon@deneb.cygnus.com>
* alpha-tdep.c (find_proc_desc): If pdr.framereg field is -1, don't
use the PDR, just examine prologues instead.
Fri Mar 10 16:13:18 1995 Kung Hsu <kung@mexican.cygnus.com>
* config/arc/tm-arc.h: Change arc register names.
Fri Mar 10 02:49:40 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
@ -3742,9 +3788,9 @@ Tue Mar 7 00:23:47 1995 Stu Grossman (grossman@cygnus.com)
match the IDP monitor. Also, set NUM_REGS to 18 cuz there's no
floating-point for this card.
* serial.h, ser-go32.c, ser-go32-para.c, ser-mac.c, ser-tcp.c,
ser-unix.c: Add SERIAL_SETSTOPBITS to set the number of stopbits
(needed for IDP board?!?!?).
* serial.h, ser-go32.c, ser-mac.c, ser-tcp.c, ser-unix.c: Add
SERIAL_SETSTOPBITS to set the number of stopbits (needed for IDP
board?!?!?).
* defs.h, utils.c, remote-hms.c, remote-pa.c, remote.c: Fix defs
and usage of fputc_unfiltered and putchar_unfiltered. Eliminate
@ -3901,7 +3947,8 @@ Tue Feb 28 14:38:39 1995 Kung Hsu <kung@mexican.cygnus.com>
* defs.h (SWAP_TARGET_AND_HOST): check endianess at runtime not
compile time.
* arc-tdep.c (_initialize_arc_tdep): set tm_print_insn according to
processor.
* vx-share/ptrace.h: merge in WRS new ptrace requests.
@ -4147,6 +4194,7 @@ Mon Feb 6 18:50:59 1995 Stan Shebs <shebs@andros.cygnus.com>
* i386-tdep.c (_initialize_i386_tdep): Put void decl on separate
line, so init.c generation works correctly.
* arc-tdep.c (_initialize_arc_tdep): Ditto.
Mon Feb 6 14:44:36 1995 Rob Savoye <rob@darkstar.cygnus.com>
@ -4160,10 +4208,6 @@ Sat Feb 4 13:29:52 1995 Stan Shebs <shebs@andros.cygnus.com>
* config/m68k/est.mt (TDEPFILES): Remove m68k-pinsn.o.
Fri Feb 3 16:47:31 1995 Kung Hsu <kung@mexican.cygnus.com>
* ser-go32-para.c (dos_read): fix syntax errors.
Fri Feb 3 11:19:20 1995 Stu Grossman (grossman@cygnus.com)
* core.c (dis_asm_read_memory), defs.h, top.c: Get rid of
@ -4190,7 +4234,11 @@ Thu Feb 2 19:02:45 1995 Rob Savoye <rob@darkstar.cygnus.com>
Thu Feb 2 16:11:04 1995 Kung Hsu <kung@mexican.cygnus.com>
* ser-go32-para.c: new file for go32 parallel port communication.
* config/arc/arc.mt: new target makefile for arc processor.
* config/arc/tm-arc.h: new target header for arc processor.
* config/arc/go32.mh: new go32 host makefile for arc processor.
* config/arc/xm-go32.h: new go32 host header for arc processor.
* arc-tdep.c: new target dependent codes for arc processor.
Thu Feb 2 13:58:40 1995 Stan Shebs <shebs@andros.cygnus.com>
@ -4473,21 +4521,6 @@ Wed Jan 25 01:11:21 1995 Jeff Law (law@snake.cs.utah.edu)
* hpread.c (hpread_process_one_debug_symbol): Fix lines garbled
by an ill-advised global search and replace.
Tue Jan 24 12:10:28 1995 Stu Grossman (grossman@cygnus.com)
* gdbtk.tcl (create_registers_window): Work around a radiobutton
widget bug to make Options|Natural button work.
* gdbtk.c (gdb_disassemble): Fix problem with source+assembly and
g++ caused by out-of-order pc's.
* gdbtk.tcl (files_command): Remove duplicate file names. Also,
add scrollbar.
Mon Jan 23 17:21:09 1995 Stu Grossman (grossman@cygnus.com)
* gdbtk.tcl: Take .gdbtkinit if it exists. Makes gdbtk match the
doc!
Mon Jan 23 13:11:46 1995 Per Bothner <bothner@kalessin.cygnus.com>
Add support for Chill bitstring literals (e.h. H'FF00').

5116
contrib/gdb/gdb/ChangeLog-96 Normal file

File diff suppressed because it is too large Load Diff

2855
contrib/gdb/gdb/ChangeLog-97 Normal file

File diff suppressed because it is too large Load Diff

7122
contrib/gdb/gdb/ChangeLog-98 Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,279 @@
What has changed in GDB?
(Organized release by release)
*** 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*
* New targets
Fujitsu FR30 fr30-*-elf*
Intel StrongARM strongarm-*-*
Mitsubishi D30V d30v-*-*
* OBSOLETE configurations
Gould PowerNode, NP1 np1-*-*, pn-*-*
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.
* ANSI/ISO C
As a compatibility experiment, GDB's source files buildsym.h and
buildsym.c have been converted to pure standard C, no longer
containing any K&R compatibility code. We believe that all systems in
use today either come with a standard C compiler, or have a GCC port
available. If this is not true, please report the affected
configuration to bug-gdb@gnu.org immediately. See the README file for
information about getting a standard C compiler if you don't have one
already.
* Readline 2.2
GDB now uses readline 2.2.
* set extension-language
You can now control the mapping between filename extensions and source
languages by using the `set extension-language' command. For instance,
you can ask GDB to treat .c files as C++ by saying
set extension-language .c c++
The command `info extensions' lists all of the recognized extensions
and their associated languages.
* Setting processor type for PowerPC and RS/6000
When GDB is configured for a powerpc*-*-* or an rs6000*-*-* target,
you can use the `set processor' command to specify what variant of the
PowerPC family you are debugging. The command
set processor NAME
sets the PowerPC/RS6000 variant to NAME. GDB knows about the
following PowerPC and RS6000 variants:
ppc-uisa PowerPC UISA - a PPC processor as viewed by user-level code
rs6000 IBM RS6000 ("POWER") architecture, user-level view
403 IBM PowerPC 403
403GC IBM PowerPC 403GC
505 Motorola PowerPC 505
860 Motorola PowerPC 860 or 850
601 Motorola PowerPC 601
602 Motorola PowerPC 602
603 Motorola/IBM PowerPC 603 or 603e
604 Motorola PowerPC 604 or 604e
750 Motorola/IBM PowerPC 750 or 750
At the moment, this command just tells GDB what to name the
special-purpose processor registers. Since almost all the affected
registers are inaccessible to user-level programs, this command is
only useful for remote debugging in its present form.
* HP-UX support
Thanks to a major code donation from Hewlett-Packard, GDB now has much
more extensive support for HP-UX. Added features include shared
library support, kernel threads and hardware watchpoints for 11.00,
support for HP's ANSI C and C++ compilers, and a compatibility mode
for xdb and dbx commands.
* Catchpoints
HP's donation includes the new concept of catchpoints, which is a
generalization of the old catch command. On HP-UX, it is now possible
to catch exec, fork, and vfork, as well as library loading.
This means that the existing catch command has changed; its first
argument now specifies the type of catch to be set up. See the
output of "help catch" for a list of catchpoint types.
* Debugging across forks
On HP-UX, you can choose which process to debug when a fork() happens
in the inferior.
* TUI
HP has donated a curses-based terminal user interface (TUI). To get
it, build with --enable-tui. Although this can be enabled for any
configuration, at present it only works for native HP debugging.
* GDB remote protocol additions
A new protocol packet 'X' that writes binary data is now available.
Default behavior is to try 'X', then drop back to 'M' if the stub
fails to respond. The settable variable `remotebinarydownload'
allows explicit control over the use of 'X'.
For 64-bit targets, the memory packets ('M' and 'm') can now contain a
full 64-bit address. The command
set remoteaddresssize 32
can be used to revert to the old behaviour. For existing remote stubs
the change should not be noticed, as the additional address information
will be discarded.
In order to assist in debugging stubs, you may use the maintenance
command `packet' to send any text string to the stub. For instance,
maint packet heythere
sends the packet "$heythere#<checksum>". Note that it is very easy to
disrupt a debugging session by sending the wrong packet at the wrong
time.
The compare-sections command allows you to compare section data on the
target to what is in the executable file without uploading or
downloading, by comparing CRC checksums.
* Tracing can collect general expressions
You may now collect general expressions at tracepoints. This requires
further additions to the target-side stub; see tracepoint.c and
doc/agentexpr.texi for further details.
* mask-address variable for Mips
For Mips targets, you may control the zeroing of the upper 32 bits of
a 64-bit address by entering `set mask-address on'. This is mainly
of interest to users of embedded R4xxx and R5xxx processors.
* Higher serial baud rates
GDB's serial code now allows you to specify baud rates 57600, 115200,
230400, and 460800 baud. (Note that your host system may not be able
to achieve all of these rates.)
* i960 simulator
The i960 configuration now includes an initial implementation of a
builtin simulator, contributed by Jim Wilson.
*** Changes in GDB-4.17:
* New native configurations
Alpha GNU/Linux alpha*-*-linux*
Unixware 2.x i[3456]86-unixware2*
Irix 6.x mips*-sgi-irix6*
PowerPC GNU/Linux powerpc-*-linux*
PowerPC Solaris powerpcle-*-solaris*
Sparc GNU/Linux sparc-*-linux*
Motorola sysV68 R3V7.1 m68k-motorola-sysv
* New targets
Argonaut Risc Chip (ARC) arc-*-*
Hitachi H8/300S h8300*-*-*
Matsushita MN10200 w/simulator mn10200-*-*
Matsushita MN10300 w/simulator mn10300-*-*
MIPS NEC VR4100 mips64*vr4100*{,el}-*-elf*
MIPS NEC VR5000 mips64*vr5000*{,el}-*-elf*
MIPS Toshiba TX39 mips64*tx39*{,el}-*-elf*
Mitsubishi D10V w/simulator d10v-*-*
Mitsubishi M32R/D w/simulator m32r-*-elf*
Tsqware Sparclet sparclet-*-*
NEC V850 w/simulator v850-*-*
* New debugging protocols
ARM with RDI protocol arm*-*-*
M68K with dBUG monitor m68*-*-{aout,coff,elf}
DDB and LSI variants of PMON protocol mips*-*-*
PowerPC with DINK32 monitor powerpc{,le}-*-eabi
PowerPC with SDS protocol powerpc{,le}-*-eabi
Macraigor OCD (Wiggler) devices powerpc{,le}-*-eabi
* DWARF 2
All configurations can now understand and use the DWARF 2 debugging
format. The choice is automatic, if the symbol file contains DWARF 2
information.
* Java frontend
GDB now includes basic Java language support. This support is
only useful with Java compilers that produce native machine code.
* solib-absolute-prefix and solib-search-path
For SunOS and SVR4 shared libraries, you may now set the prefix for
loading absolute shared library symbol files, and the search path for
locating non-absolute shared library symbol files.
* Live range splitting
GDB can now effectively debug code for which GCC has performed live
range splitting as part of its optimization. See gdb/doc/LRS for
more details on the expected format of the stabs information.
* Hurd support
GDB's support for the GNU Hurd, including thread debugging, has been
updated to work with current versions of the Hurd.
* ARM Thumb support
GDB's ARM target configuration now handles the ARM7T (Thumb) 16-bit
instruction set. ARM GDB automatically detects when Thumb
instructions are in use, and adjusts disassembly and backtracing
accordingly.
* MIPS16 support
GDB's MIPS target configurations now handle the MIP16 16-bit
instruction set.
* Overlay support
GDB now includes support for overlays; if an executable has been
linked such that multiple sections are based at the same address, GDB
will decide which section to use for symbolic info. You can choose to
control the decision manually, using overlay commands, or implement
additional target-side support and use "overlay load-target" to bring
in the overlay mapping. Do "help overlay" for more detail.
* info symbol
The command "info symbol <address>" displays information about
the symbol at the specified address.
* Trace support
The standard remote protocol now includes an extension that allows
asynchronous collection and display of trace data. This requires
extensive support in the target-side debugging stub. Tracing mode
includes a new interaction mode in GDB and new commands: see the
file tracepoint.c for more details.
* MIPS simulator
Configurations for embedded MIPS now include a simulator contributed
by Cygnus Solutions. The simulator supports the instruction sets
of most MIPS variants.
* Sparc simulator
Sparc configurations may now include the ERC32 simulator contributed
by the European Space Agency. The simulator is not built into
Sparc targets by default; configure with --enable-sim to include it.
* set architecture
For target configurations that may include multiple variants of a
basic architecture (such as MIPS and SH), you may now set the
architecture explicitly. "set arch" sets, "info arch" lists
the possible architectures.
*** Changes in GDB-4.16:
* New native configurations

View File

@ -1,9 +1,12 @@
README for gdb-4.16 release
Updated 10-Apr-96 by Fred Fish
README for gdb-4.18 release
Updated 4 Apr 1999 by Jim Blandy
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.
Unpacking and Installation -- quick overview
==========================
@ -11,7 +14,7 @@ Unpacking and Installation -- quick overview
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.16 directory. The idea is that a variety of GNU
underneath the gdb-4.18 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
@ -20,8 +23,8 @@ 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.16.tar.gz file, you'll find a directory
called `gdb-4.16', which contains:
When you unpack the gdb-4.18.tar.gz file, you'll find a directory
called `gdb-4.18', which contains:
COPYING config.sub* libiberty/ opcodes/
COPYING.LIB configure* mmalloc/ readline/
@ -33,7 +36,7 @@ called `gdb-4.16', which contains:
To build GDB, you can just do:
cd gdb-4.16
cd gdb-4.18
./configure
make
cp gdb/gdb /usr/local/bin/gdb (or wherever you want)
@ -45,6 +48,11 @@ argument, e.g., sun4 or decstation.
If you get compiler warnings during this stage, see the `Reporting Bugs'
section below; there are a few known problems.
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).
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.
@ -52,22 +60,6 @@ while debugging a program running on a machine of another type. See below.
More Documentation
******************
The GDB 4 release includes an already-formatted reference card,
ready for printing with PostScript or Ghostscript, in the `gdb'
subdirectory of the main source directory. (In `gdb-4.16/gdb/refcard.ps'.)
If you can use PostScript or Ghostscript with your printer, you can
print the reference card immediately with `refcard.ps'.
The release also includes the source for the reference card. You
can format it, using TeX, by typing:
make refcard.dvi
The GDB reference card is designed to print in landscape mode on US
"letter" size paper; that is, on a sheet 11 inches wide by 8.5 inches
high. You will need to specify this form of printing as an option to
your DVI output program.
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
@ -76,27 +68,28 @@ 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' subdirectory. The main Info file is
`gdb-VERSION-NUMBER/gdb/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.
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.
If you want to format these Info files yourself, you need one of the
Info formatting programs, such as `texinfo-format-buffer' or `makeinfo'.
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.16', in the case of version 4.16), you can make
source directory (`gdb-4.18', in the case of version 4.18), you can make
the Info file by typing:
cd gdb
make gdb.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.
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'.
TeX is a typesetting program; it does not print files directly, but
produces output files called DVI files. To print a typeset document,
@ -110,11 +103,11 @@ 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-VERSION-NUMBER/texinfo' directory.
`gdb-4.18/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.16/gdb') and then type:
the main source directory (for example, to `gdb-4.18/gdb') and then type:
make gdb.dvi
@ -130,58 +123,71 @@ 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.16 distribution is in the `gdb-4.16'
For example, the GDB version 4.18 distribution is in the `gdb-4.18'
directory. That directory contains:
`gdb-4.16/{COPYING,COPYING.LIB}'
`gdb-4.18/{COPYING,COPYING.LIB}'
Standard GNU license files. Please read them.
`gdb-4.16/bfd'
`gdb-4.18/bfd'
source for the Binary File Descriptor library
`gdb-4.16/config*'
`gdb-4.18/config*'
script for configuring GDB, along with other support files
`gdb-4.16/gdb'
`gdb-4.18/gdb'
the source specific to GDB itself
`gdb-4.16/include'
`gdb-4.18/include'
GNU include files
`gdb-4.16/libiberty'
`gdb-4.18/libiberty'
source for the `-liberty' free software library
`gdb-4.16/mmalloc'
`gdb-4.18/mmalloc'
source for the GNU memory-mapped malloc package
`gdb-4.16/opcodes'
`gdb-4.18/opcodes'
source for the library of opcode tables and disassemblers
`gdb-4.16/readline'
`gdb-4.18/readline'
source for the GNU command-line interface
'gdb-4.16/sim'
source for some simulators (z8000, H8/300, H8/500, etc)
`gdb-4.18/sim'
source for some simulators (ARM, D10V, SPARC, M32R, MIPS, PPC, V850, etc)
`gdb-4.18/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'
The `texinfo.tex' file, which you need in order to make a printed
manual using TeX.
`gdb-4.18/etc'
Coding standards, useful files for editing GDB, and other
miscellanea.
`gdb-4.18/utils'
A grab bag of random utilities.
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.16' directory.
is the `gdb-4.18' directory.
First switch to the `gdb-VERSION-NUMBER' source directory if you are
not already in it; then run `configure'. Pass the identifier for the
platform on which GDB will run as an argument.
not already in it; then run `configure'.
For example:
cd gdb-4.16
./configure HOST
cd gdb-4.18
./configure
make
where HOST is an identifier such as `sun4' or `decstation', that
identifies the platform where GDB will run.
Running `configure HOST' followed by `make' builds the `bfd',
`readline', `mmalloc', and `libiberty' libraries, then `gdb' itself.
Running `configure' followed by `make' builds the `bfd',
`readline', `mmalloc', and `libiberty' libraries, then `gdb' itself.
The configured source files, and the binaries, are left in the
corresponding source directories.
@ -189,11 +195,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 HOST
sh configure
If you run `configure' from a directory that contains source
directories for multiple libraries or programs, such as the `gdb-4.16'
source directory for version 4.16, `configure' creates configuration
directories for multiple libraries or programs, such as the `gdb-4.18'
source directory for version 4.18, `configure' creates configuration
files for every directory level underneath (unless you tell it not to,
with the `--norecursion' option).
@ -201,11 +207,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.16, type the following to configure only
For example, with version 4.18, type the following to configure only
the `bfd' subdirectory:
cd gdb-4.16/bfd
../configure HOST
cd gdb-4.18/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'
@ -233,13 +239,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.16, you can build GDB in a separate
For example, with version 4.18, you can build GDB in a separate
directory for a Sun 4 like this:
cd gdb-4.16
cd gdb-4.18
mkdir ../gdb-sun4
cd ../gdb-sun4
../gdb-4.16/configure sun4
../gdb-4.18/configure sun4
make
When `configure' builds a configuration using a remote source
@ -260,8 +266,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.16' (or in a separate configured directory configured with
`--srcdir=PATH/gdb-4.16'), you will build all the required libraries,
as `gdb-4.18' (or in a separate configured directory configured with
`--srcdir=PATH/gdb-4.18'), you will build all the required libraries,
and then build GDB.
When you have multiple hosts or targets configured in separate
@ -291,20 +297,20 @@ abbreviations to full names; you can read the script, if you wish, or
you can use it to test your guesses on abbreviations--for example:
% sh config.sub sun4
sparc-sun-sunos411
sparc-sun-sunos4.1.1
% sh config.sub sun3
m68k-sun-sunos411
m68k-sun-sunos4.1.1
% sh config.sub decstation
mips-dec-ultrix42
mips-dec-ultrix4.2
% sh config.sub hp300bsd
m68k-hp-bsd
% sh config.sub i386v
i386-unknown-sysv
i386-pc-sysv
% sh config.sub i786v
Invalid configuration `i786v': machine `i786v' not recognized
`config.sub' is also distributed in the GDB source directory
(`gdb-4.16', for version 4.16).
(`gdb-4.18', for version 4.18).
`configure' options
@ -319,7 +325,10 @@ for a full explanation of `configure'.
[--prefix=DIR]
[--srcdir=PATH]
[--norecursion] [--rm]
[--target=TARGET] HOST
[--enable-build-warnings]
[--target=TARGET]
[--host=HOST]
[HOST]
You may introduce options with a single `-' rather than `--' if you
prefer; but you may abbreviate option names if you use `--'.
@ -350,6 +359,17 @@ prefer; but you may abbreviate option names if you use `--'.
`--rm'
Remove the configuration that the other arguments specify.
`--enable-build-warnings'
When building the GDB sources, ask the compiler to warn about any
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
-Wpointer-arith
-Wstrict-prototypes
-Wmissing-prototypes
-Wmissing-declarations
`--target=TARGET'
Configure GDB for cross-debugging programs running on the specified
TARGET. Without this option, GDB is configured to debug programs
@ -358,12 +378,16 @@ prefer; but you may abbreviate option names if you use `--'.
There is no convenient way to generate a list of all available
targets.
`HOST ...'
`--host=HOST'
Configure GDB to run on the specified HOST.
There is no convenient way to generate a list of all available
hosts.
`HOST ...'
Same as `--host=HOST'. If you omit this, GDB will guess; it's
quite accurate.
`configure' accepts other options, for compatibility with configuring
other GNU tools recursively; but these are the only options that affect
GDB or its supporting libraries.
@ -372,7 +396,8 @@ GDB or its supporting libraries.
Languages other than C
=======================
See the GDB manual (doc/gdb.texinfo) for information on this.
See the GDB manual (gdb/doc/gdb.texinfo) for information on this.
Kernel debugging
=================
@ -391,26 +416,35 @@ 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 file rem-multi.shar contains a general stub that can probably
run on various different flavors of unix to allow debugging over a
serial line from one machine to another.
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.
There are a number of remote interfaces for talking to existing ROM
monitors and other hardware:
Some working remote interfaces for talking to existing ROM monitors
are:
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
remote-est.c EST emulator
remote-hms.c Hitachi Micro Systems H8/300 monitor
remote-mips.c MIPS remote debugging protocol
remote-mm.c AMD 29000 "minimon"
remote-nindy.c Intel 960 "Nindy"
remote-nrom.c NetROM ROM emulator
remote-os9k.c PC running OS/9000
remote-rdi.c ARM with Angel monitor
remote-rdp.c ARM with Demon monitor
remote-sds.c PowerPC SDS monitor
remote-sim.c Generalized simulator protocol
remote-st.c Tandem ST-2000 monitor
remote-udi.c AMD 29000 using the AMD "Universal Debug Interface"
remote-vx.c VxWorks realtime kernel
remote-z8k.c Zilog Z8000 simulator
Remote-vx.c and the vx-share subdirectory contain a remote interface for the
VxWorks realtime kernel, which communicates over TCP using the Sun
@ -429,9 +463,9 @@ Reporting Bugs
===============
The correct address for reporting bugs found in gdb is
"bug-gdb@prep.ai.mit.edu". Please email all bugs, and all requests for
"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.16), and how you configured it (e.g., "sun4" or "mach386
(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
@ -489,10 +523,8 @@ Known bugs:
subsystem that is on the IDO CD, otherwise you will get complaints
that certain files such as `/usr/include/syms.h' cannot be found.
* Unixware 2.x is not yet supported.
* Notes for BSD/386:
To compile gdb-4.16 on BSD/386, you must run the configure script and
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'
@ -514,17 +546,28 @@ the compiler actually outputs or the debugger actually understands.
X Windows versus GDB
=====================
There is an "xxgdb", which seems to work for simple operations,
which was posted to comp.sources.x.
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:
For those interested in auto display of source and the availability of
an editor while debugging I suggest trying gdb-mode in GNU Emacs
(Try typing M-x gdb RETURN). Comments on this mode are welcome.
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.
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
=====================
@ -532,9 +575,7 @@ 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. In particular, see the nodes Getting Started,
Debugging GDB, New Architectures, Coding Style, Clean Design, and
Submitting Patches.
`info' program.
If you are pondering writing anything but a short patch, especially
take note of the information about copyrights in the node Submitting
@ -549,24 +590,18 @@ GDB Testsuite
There is a DejaGNU based testsuite available for testing your newly
built GDB, or for regression testing GDBs with local modifications.
The testsuite is distributed separately from the base GDB distribution
for the convenience of people that wish to get either GDB or the testsuite
separately.
The name of the testsuite is gdb-4.16-testsuite.tar.gz. You unpack it in the
same directory in which you unpacked the base GDB distribution, and it
will create and populate the directory gdb-4.16/gdb/testsuite.
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. Once DejaGNU is installed, you can run
the tests in one of two ways:
(1) cd gdb-4.16/gdb (assuming you also unpacked gdb)
(1) cd gdb-4.18/gdb (assuming you also unpacked gdb)
make check
or
(2) cd gdb-4.16/gdb/testsuite
(2) cd gdb-4.18/gdb/testsuite
make site.exp (builds the site specific file)
runtest -tool gdb GDB=../gdb (or GDB=<somepath> as appropriate)

View File

@ -9,6 +9,9 @@ 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.
Add an "info bfd" command that displays supported object formats,
similarly to objdump -i.
START_INFERIOR_TRAPS_EXPECTED need never be defined to 2, since that
is its default value. Clean this up.

169
contrib/gdb/gdb/abug-rom.c Normal file
View File

@ -0,0 +1,169 @@
/* Remote debugging interface for ABug Rom monitor for GDB, the GNU debugger.
Copyright 1995, 1996, 1998 Free Software Foundation, Inc.
Written by Rob Savoye of Cygnus Support
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 "gdbcore.h"
#include "target.h"
#include "monitor.h"
#include "serial.h"
/* Prototypes for local functions. */
static void abug_open PARAMS ((char *args, int from_tty));
static void
abug_supply_register (regname, regnamelen, val, vallen)
char *regname;
int regnamelen;
char *val;
int vallen;
{
int regno;
if (regnamelen != 2)
return;
switch (regname[0])
{
case 'S':
if (regname[1] != 'R')
return;
regno = PS_REGNUM;
break;
case 'P':
if (regname[1] != 'C')
return;
regno = PC_REGNUM;
break;
case 'D':
if (regname[1] < '0' || regname[1] > '7')
return;
regno = regname[1] - '0' + D0_REGNUM;
break;
case 'A':
if (regname[1] < '0' || regname[1] > '7')
return;
regno = regname[1] - '0' + A0_REGNUM;
break;
default:
return;
}
monitor_supply_register (regno, val);
}
/*
* This array of registers needs to match the indexes used by GDB. The
* whole reason this exists is because the various ROM monitors use
* different names than GDB does, and don't support all the
* registers either. So, typing "info reg sp" becomes an "A7".
*/
static char *abug_regnames[NUM_REGS] =
{
"D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
"A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7",
"PC",
};
/*
* Define the monitor command strings. Since these are passed directly
* through to a printf style function, we need can include formatting
* strings. We also need a CR or LF on the end.
*/
static struct target_ops abug_ops;
static char *abug_inits[] = {"\r", NULL};
static struct monitor_ops abug_cmds ;
static void
init_abug_cmds(void)
{
abug_cmds.flags = MO_CLR_BREAK_USES_ADDR;
abug_cmds.init = abug_inits; /* Init strings */
abug_cmds.cont = "g\r"; /* continue command */
abug_cmds.step = "t\r"; /* single step */
abug_cmds.stop = NULL; /* interrupt command */
abug_cmds.set_break = "br %x\r"; /* set a breakpoint */
abug_cmds.clr_break = "nobr %x\r"; /* clear a breakpoint */
abug_cmds.clr_all_break = "nobr\r"; /* clear all breakpoints */
abug_cmds.fill = "bf %x:%x %x;b\r"; /* fill (start count val) */
abug_cmds.setmem.cmdb = "ms %x %02x\r"; /* setmem.cmdb (addr, value) */
abug_cmds.setmem.cmdw = "ms %x %04x\r"; /* setmem.cmdw (addr, value) */
abug_cmds.setmem.cmdl = "ms %x %08x\r"; /* setmem.cmdl (addr, value) */
abug_cmds.setmem.cmdll = NULL; /* setmem.cmdll (addr, value) */
abug_cmds.setmem.resp_delim = NULL; /* setreg.resp_delim */
abug_cmds.setmem.term = NULL; /* setreg.term */
abug_cmds.setmem.term_cmd = NULL; /* setreg.term_cmd */
abug_cmds.getmem.cmdb = "md %x:%x;b\r"; /* getmem.cmdb (addr, len) */
abug_cmds.getmem.cmdw = "md %x:%x;b\r"; /* getmem.cmdw (addr, len) */
abug_cmds.getmem.cmdl = "md %x:%x;b\r"; /* getmem.cmdl (addr, len) */
abug_cmds.getmem.cmdll = NULL; /* getmem.cmdll (addr, len) */
abug_cmds.getmem.resp_delim = " "; /* getmem.resp_delim */
abug_cmds.getmem.term = NULL; /* getmem.term */
abug_cmds.getmem.term_cmd = NULL; /* getmem.term_cmd */
abug_cmds.setreg.cmd = "rm %s %x\r"; /* setreg.cmd (name, value) */
abug_cmds.setreg.resp_delim = "="; /* setreg.resp_delim */
abug_cmds.setreg.term = "? "; /* setreg.term */
abug_cmds.setreg.term_cmd = ".\r" ; /* setreg.term_cmd */
abug_cmds.getreg.cmd = "rm %s\r"; /* getreg.cmd (name) */
abug_cmds.getreg.resp_delim = "="; /* getreg.resp_delim */
abug_cmds.getreg.term = "? "; /* getreg.term */
abug_cmds.getreg.term_cmd = ".\r" ; /* getreg.term_cmd */
abug_cmds.dump_registers = "rd\r"; /* dump_registers */
abug_cmds.register_pattern = "\\(\\w+\\) +=\\([0-9a-fA-F]+\\b\\)"; /* register_pattern */
abug_cmds.supply_register = abug_supply_register; /* supply_register */
abug_cmds.load_routine = NULL; /* load_routine (defaults to SRECs) */
abug_cmds.load = "lo 0\r"; /* download command */
abug_cmds.loadresp = "\n"; /* load response */
abug_cmds.prompt = "135Bug>"; /* monitor command prompt */
abug_cmds.line_term = "\r"; /* end-of-line terminator */
abug_cmds.cmd_end = NULL; /* optional command terminator */
abug_cmds.target = &abug_ops; /* target operations */
abug_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */
abug_cmds.regnames = abug_regnames; /* registers names */
abug_cmds.magic = MONITOR_OPS_MAGIC ; /* magic */
};
static void
abug_open(args, from_tty)
char *args;
int from_tty;
{
monitor_open (args, &abug_cmds, from_tty);
}
void
_initialize_abug_rom ()
{
init_abug_cmds() ;
init_monitor_ops (&abug_ops);
abug_ops.to_shortname = "abug";
abug_ops.to_longname = "ABug monitor";
abug_ops.to_doc = "Debug via the ABug monitor.\n\
Specify the serial device it is connected to (e.g. /dev/ttya).";
abug_ops.to_open = abug_open;
add_target (&abug_ops);
}

View File

@ -1,9 +1,95 @@
/* 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
@TOP@
/* Define if pstatus_t type is available */
#undef HAVE_PSTATUS_T
/* Define if prrun_t type is available */
#undef HAVE_PRRUN_T
/* Define if fpregset_t type is available. */
#undef HAVE_FPREGSET_T
/* Define if gregset_t type is available. */
#undef HAVE_GREGSET_T
/* 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
/* Define if the "ll" format works to print long long ints. */
#undef PRINTF_HAS_LONG_LONG
/* Define if the "%Lg" format works to print long doubles. */
#undef PRINTF_HAS_LONG_DOUBLE
/* Define if the "%Lg" format works to scan long doubles. */
#undef SCANF_HAS_LONG_DOUBLE
/* Define if using Solaris thread debugging. */
#undef HAVE_THREAD_DB_LIB
/* Define on a GNU/Linux system to work around problems in sys/procfs.h. */
#undef START_INFERIOR_TRAPS_EXPECTED
#undef sys_quotactl
/* Define if you have HPUX threads */
#undef HAVE_HPUX_THREAD_SUPPORT
/* Define if you want to use the memory mapped malloc package (mmalloc). */
#undef USE_MMALLOC
/* Define if the runtime uses a routine from mmalloc before gdb has a chance
to initialize mmalloc, and we want to force checking to be used anyway.
This may cause spurious memory corruption messages if the runtime tries
to explicitly deallocate that memory when gdb calls exit. */
#undef MMCHECK_FORCE
/* Define to 1 if NLS is requested. */
#undef ENABLE_NLS
/* Define as 1 if you have catgets and don't want to use GNU gettext. */
#undef HAVE_CATGETS
/* Define as 1 if you have gettext and don't want to use GNU gettext. */
#undef HAVE_GETTEXT
/* Define as 1 if you have the stpcpy function. */
#undef HAVE_STPCPY
/* Define if your locale.h file contains LC_MESSAGES. */
#undef HAVE_LC_MESSAGES
/* 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
/* Set to true if the save_state_t structure is present */
#define HAVE_STRUCT_SAVE_STATE_T 0
/* Set to true if the save_state_t structure has the ss_wide member */
#define HAVE_STRUCT_MEMBER_SS_WIDE 0

View File

@ -0,0 +1,861 @@
dnl written by Rob Savoye <rob@cygnus.com> for Cygnus Support
dnl major rewriting for Tcl 7.5 by Don Libes <libes@nist.gov>
dnl gdb/configure.in uses BFD_NEED_DECLARATION, so get its definition.
sinclude(../bfd/acinclude.m4)
dnl This gets the standard macros, like the TCL, TK, etc ones.
sinclude(../config/acinclude.m4)
dnl CYGNUS LOCAL: This gets the right posix flag for gcc
AC_DEFUN(CY_AC_TCL_LYNX_POSIX,
[AC_REQUIRE([AC_PROG_CC])AC_REQUIRE([AC_PROG_CPP])
AC_MSG_CHECKING([if running LynxOS])
AC_CACHE_VAL(ac_cv_os_lynx,
[AC_EGREP_CPP(yes,
[/*
* The old Lynx "cc" only defines "Lynx", but the newer one uses "__Lynx__"
*/
#if defined(__Lynx__) || defined(Lynx)
yes
#endif
], ac_cv_os_lynx=yes, ac_cv_os_lynx=no)])
#
if test "$ac_cv_os_lynx" = "yes" ; then
AC_MSG_RESULT(yes)
AC_DEFINE(LYNX)
AC_MSG_CHECKING([whether -mposix or -X is available])
AC_CACHE_VAL(ac_cv_c_posix_flag,
[AC_TRY_COMPILE(,[
/*
* This flag varies depending on how old the compiler is.
* -X is for the old "cc" and "gcc" (based on 1.42).
* -mposix is for the new gcc (at least 2.5.8).
*/
#if defined(__GNUC__) && __GNUC__ >= 2
choke me
#endif
], ac_cv_c_posix_flag=" -mposix", ac_cv_c_posix_flag=" -X")])
CC="$CC $ac_cv_c_posix_flag"
AC_MSG_RESULT($ac_cv_c_posix_flag)
else
AC_MSG_RESULT(no)
fi
])
#
# Sometimes the native compiler is a bogus stub for gcc or /usr/ucb/cc. This
# makes configure think it's cross compiling. If --target wasn't used, then
# we can't configure, so something is wrong. We don't use the cache
# here cause if somebody fixes their compiler install, we want this to work.
AC_DEFUN(CY_AC_C_WORKS,
[# If we cannot compile and link a trivial program, we can't expect anything to work
AC_MSG_CHECKING(whether the compiler ($CC) actually works)
AC_TRY_COMPILE(, [/* don't need anything here */],
c_compiles=yes, c_compiles=no)
AC_TRY_LINK(, [/* don't need anything here */],
c_links=yes, c_links=no)
if test x"${c_compiles}" = x"no" ; then
AC_MSG_ERROR(the native compiler is broken and won't compile.)
fi
if test x"${c_links}" = x"no" ; then
AC_MSG_ERROR(the native compiler is broken and won't link.)
fi
AC_MSG_RESULT(yes)
])
AC_DEFUN(CY_AC_PATH_TCLH, [
#
# Ok, lets find the tcl source trees so we can use the headers
# Warning: transition of version 9 to 10 will break this algorithm
# because 10 sorts before 9. We also look for just tcl. We have to
# be careful that we don't match stuff like tclX by accident.
# the alternative search directory is involked by --with-tclinclude
#
no_tcl=true
AC_MSG_CHECKING(for Tcl private headers. dir=${configdir})
AC_ARG_WITH(tclinclude, [ --with-tclinclude=DIR Directory where tcl private headers are], with_tclinclude=${withval})
AC_CACHE_VAL(ac_cv_c_tclh,[
# first check to see if --with-tclinclude was specified
if test x"${with_tclinclude}" != x ; then
if test -f ${with_tclinclude}/tclInt.h ; then
ac_cv_c_tclh=`(cd ${with_tclinclude}; pwd)`
elif test -f ${with_tclinclude}/generic/tclInt.h ; then
ac_cv_c_tclh=`(cd ${with_tclinclude}/generic; pwd)`
else
AC_MSG_ERROR([${with_tclinclude} directory doesn't contain private headers])
fi
fi
# next check if it came with Tcl configuration file
if test x"${ac_cv_c_tclconfig}" = x ; then
if test -f $ac_cv_c_tclconfig/../generic/tclInt.h ; then
ac_cv_c_tclh=`(cd $ac_cv_c_tclconfig/..; pwd)`
fi
fi
# next check in private source directory
#
# since ls returns lowest version numbers first, reverse its output
if test x"${ac_cv_c_tclh}" = x ; then
for i in \
${srcdir}/../tcl \
`ls -dr ${srcdir}/../tcl[[7-9]]* 2>/dev/null` \
${srcdir}/../../tcl \
`ls -dr ${srcdir}/../../tcl[[7-9]]* 2>/dev/null` \
${srcdir}/../../../tcl \
`ls -dr ${srcdir}/../../../tcl[[7-9]]* 2>/dev/null ` ; do
if test -f $i/generic/tclInt.h ; then
ac_cv_c_tclh=`(cd $i/generic; pwd)`
break
fi
done
fi
# finally check in a few common install locations
#
# since ls returns lowest version numbers first, reverse its output
if test x"${ac_cv_c_tclh}" = x ; then
for i in \
`ls -dr /usr/local/src/tcl[[7-9]]* 2>/dev/null` \
`ls -dr /usr/local/lib/tcl[[7-9]]* 2>/dev/null` \
/usr/local/src/tcl \
/usr/local/lib/tcl \
${prefix}/include ; do
if test -f $i/generic/tclInt.h ; then
ac_cv_c_tclh=`(cd $i/generic; pwd)`
break
fi
done
fi
# see if one is installed
if test x"${ac_cv_c_tclh}" = x ; then
AC_HEADER_CHECK(tclInt.h, ac_cv_c_tclh=installed, ac_cv_c_tclh="")
fi
])
if test x"${ac_cv_c_tclh}" = x ; then
TCLHDIR="# no Tcl private headers found"
AC_MSG_ERROR([Can't find Tcl private headers])
fi
if test x"${ac_cv_c_tclh}" != x ; then
no_tcl=""
if test x"${ac_cv_c_tclh}" = x"installed" ; then
AC_MSG_RESULT([is installed])
TCLHDIR=""
else
AC_MSG_RESULT([found in ${ac_cv_c_tclh}])
# this hack is cause the TCLHDIR won't print if there is a "-I" in it.
TCLHDIR="-I${ac_cv_c_tclh}"
fi
fi
AC_SUBST(TCLHDIR)
])
AC_DEFUN(CY_AC_PATH_TCLCONFIG, [
#
# Ok, lets find the tcl configuration
# First, look for one uninstalled.
# the alternative search directory is invoked by --with-tclconfig
#
if test x"${no_tcl}" = x ; then
# we reset no_tcl in case something fails here
no_tcl=true
AC_ARG_WITH(tclconfig, [ --with-tclconfig=DIR Directory containing tcl configuration (tclConfig.sh)],
with_tclconfig=${withval})
AC_MSG_CHECKING([for Tcl configuration])
AC_CACHE_VAL(ac_cv_c_tclconfig,[
# First check to see if --with-tclconfig was specified.
if test x"${with_tclconfig}" != x ; then
if test -f "${with_tclconfig}/tclConfig.sh" ; then
ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
else
AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
fi
fi
# then check for a private Tcl installation
if test x"${ac_cv_c_tclconfig}" = x ; then
for i in \
../tcl \
`ls -dr ../tcl[[7-9]]* 2>/dev/null` \
../../tcl \
`ls -dr ../../tcl[[7-9]]* 2>/dev/null` \
../../../tcl \
`ls -dr ../../../tcl[[7-9]]* 2>/dev/null` ; do
if test -f "$i/${configdir}/tclConfig.sh" ; then
ac_cv_c_tclconfig=`(cd $i/${configdir}; pwd)`
break
fi
done
fi
# check in a few common install locations
if test x"${ac_cv_c_tclconfig}" = x ; then
for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
if test -f "$i/tclConfig.sh" ; then
ac_cv_c_tclconfig=`(cd $i; pwd)`
break
fi
done
fi
# check in a few other private locations
if test x"${ac_cv_c_tclconfig}" = x ; then
for i in \
${srcdir}/../tcl \
`ls -dr ${srcdir}/../tcl[[7-9]]* 2>/dev/null` ; do
if test -f "$i/${configdir}/tclConfig.sh" ; then
ac_cv_c_tclconfig=`(cd $i/${configdir}; pwd)`
break
fi
done
fi
])
if test x"${ac_cv_c_tclconfig}" = x ; then
TCLCONFIG="# no Tcl configs found"
AC_MSG_WARN(Can't find Tcl configuration definitions)
else
no_tcl=
TCLCONFIG=${ac_cv_c_tclconfig}/tclConfig.sh
AC_MSG_RESULT(found $TCLCONFIG)
fi
fi
])
# Defined as a separate macro so we don't have to cache the values
# from PATH_TCLCONFIG (because this can also be cached).
AC_DEFUN(CY_AC_LOAD_TCLCONFIG, [
. $TCLCONFIG
AC_SUBST(TCL_VERSION)
AC_SUBST(TCL_MAJOR_VERSION)
AC_SUBST(TCL_MINOR_VERSION)
AC_SUBST(TCL_CC)
AC_SUBST(TCL_DEFS)
dnl not used, don't export to save symbols
dnl AC_SUBST(TCL_LIB_FILE)
dnl don't export, not used outside of configure
dnl AC_SUBST(TCL_LIBS)
dnl not used, don't export to save symbols
dnl AC_SUBST(TCL_PREFIX)
dnl not used, don't export to save symbols
dnl AC_SUBST(TCL_EXEC_PREFIX)
AC_SUBST(TCL_SHLIB_CFLAGS)
AC_SUBST(TCL_SHLIB_LD)
dnl don't export, not used outside of configure
AC_SUBST(TCL_SHLIB_LD_LIBS)
AC_SUBST(TCL_SHLIB_SUFFIX)
dnl not used, don't export to save symbols
AC_SUBST(TCL_DL_LIBS)
AC_SUBST(TCL_LD_FLAGS)
dnl don't export, not used outside of configure
AC_SUBST(TCL_LD_SEARCH_FLAGS)
AC_SUBST(TCL_COMPAT_OBJS)
AC_SUBST(TCL_RANLIB)
AC_SUBST(TCL_BUILD_LIB_SPEC)
AC_SUBST(TCL_LIB_SPEC)
AC_SUBST(TCL_LIB_VERSIONS_OK)
dnl not used, don't export to save symbols
dnl AC_SUBST(TCL_SHARED_LIB_SUFFIX)
dnl not used, don't export to save symbols
dnl AC_SUBST(TCL_UNSHARED_LIB_SUFFIX)
])
# Warning: Tk definitions are very similar to Tcl definitions but
# are not precisely the same. There are a couple of differences,
# so don't do changes to Tcl thinking you can cut and paste it do
# the Tk differences and later simply substitute "Tk" for "Tcl".
# Known differences:
# - Acceptable Tcl major version #s is 7-9 while Tk is 4-9
# - Searching for Tcl includes looking for tclInt.h, Tk looks for tk.h
# - Computing major/minor versions is different because Tk depends on
# headers to Tcl, Tk, and X.
# - Symbols in tkConfig.sh are different than tclConfig.sh
# - Acceptable for Tk to be missing but not Tcl.
AC_DEFUN(CY_AC_PATH_TKH, [
#
# Ok, lets find the tk source trees so we can use the headers
# If the directory (presumably symlink) named "tk" exists, use that one
# in preference to any others. Same logic is used when choosing library
# and again with Tcl. The search order is the best place to look first, then in
# decreasing significance. The loop breaks if the trigger file is found.
# Note the gross little conversion here of srcdir by cd'ing to the found
# directory. This converts the path from a relative to an absolute, so
# recursive cache variables for the path will work right. We check all
# the possible paths in one loop rather than many seperate loops to speed
# things up.
# the alternative search directory is involked by --with-tkinclude
#
no_tk=true
AC_MSG_CHECKING(for Tk private headers)
AC_ARG_WITH(tkinclude, [ --with-tkinclude=DIR Directory where tk private headers are], with_tkinclude=${withval})
AC_CACHE_VAL(ac_cv_c_tkh,[
# first check to see if --with-tkinclude was specified
if test x"${with_tkinclude}" != x ; then
if test -f ${with_tkinclude}/tk.h ; then
ac_cv_c_tkh=`(cd ${with_tkinclude}; pwd)`
elif test -f ${with_tkinclude}/generic/tk.h ; then
ac_cv_c_tkh=`(cd ${with_tkinclude}/generic; pwd)`
else
AC_MSG_ERROR([${with_tkinclude} directory doesn't contain private headers])
fi
fi
# next check if it came with Tk configuration file
if test x"${ac_cv_c_tkconfig}" = x ; then
if test -f $ac_cv_c_tkconfig/../generic/tk.h ; then
ac_cv_c_tkh=`(cd $ac_cv_c_tkconfig/..; pwd)`
fi
fi
# next check in private source directory
#
# since ls returns lowest version numbers first, reverse its output
if test x"${ac_cv_c_tkh}" = x ; then
for i in \
${srcdir}/../tk \
`ls -dr ${srcdir}/../tk[[4-9]]* 2>/dev/null` \
${srcdir}/../../tk \
`ls -dr ${srcdir}/../../tk[[4-9]]* 2>/dev/null` \
${srcdir}/../../../tk \
`ls -dr ${srcdir}/../../../tk[[4-9]]* 2>/dev/null ` ; do
if test -f $i/generic/tk.h ; then
ac_cv_c_tkh=`(cd $i/generic; pwd)`
break
fi
done
fi
# finally check in a few common install locations
#
# since ls returns lowest version numbers first, reverse its output
if test x"${ac_cv_c_tkh}" = x ; then
for i in \
`ls -dr /usr/local/src/tk[[4-9]]* 2>/dev/null` \
`ls -dr /usr/local/lib/tk[[4-9]]* 2>/dev/null` \
/usr/local/src/tk \
/usr/local/lib/tk \
${prefix}/include ; do
if test -f $i/generic/tk.h ; then
ac_cv_c_tkh=`(cd $i/generic; pwd)`
break
fi
done
fi
# see if one is installed
if test x"${ac_cv_c_tkh}" = x ; then
AC_HEADER_CHECK(tk.h, ac_cv_c_tkh=installed, ac_cv_c_tkh="")
fi
])
if test x"${ac_cv_c_tkh}" != x ; then
no_tk=""
if test x"${ac_cv_c_tkh}" = x"installed" ; then
AC_MSG_RESULT([is installed])
TKHDIR=""
else
AC_MSG_RESULT([found in ${ac_cv_c_tkh}])
# this hack is cause the TKHDIR won't print if there is a "-I" in it.
TKHDIR="-I${ac_cv_c_tkh}"
fi
else
TKHDIR="# no Tk directory found"
AC_MSG_WARN([Can't find Tk private headers])
no_tk=true
fi
AC_SUBST(TKHDIR)
])
AC_DEFUN(CY_AC_PATH_TKCONFIG, [
#
# Ok, lets find the tk configuration
# First, look for one uninstalled.
# the alternative search directory is invoked by --with-tkconfig
#
if test x"${no_tk}" = x ; then
# we reset no_tk in case something fails here
no_tk=true
AC_ARG_WITH(tkconfig, [ --with-tkconfig=DIR Directory containing tk configuration (tkConfig.sh)],
with_tkconfig=${withval})
AC_MSG_CHECKING([for Tk configuration])
AC_CACHE_VAL(ac_cv_c_tkconfig,[
# First check to see if --with-tkconfig was specified.
if test x"${with_tkconfig}" != x ; then
if test -f "${with_tkconfig}/tkConfig.sh" ; then
ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
else
AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
fi
fi
# then check for a private Tk library
if test x"${ac_cv_c_tkconfig}" = x ; then
for i in \
../tk \
`ls -dr ../tk[[4-9]]* 2>/dev/null` \
../../tk \
`ls -dr ../../tk[[4-9]]* 2>/dev/null` \
../../../tk \
`ls -dr ../../../tk[[4-9]]* 2>/dev/null` ; do
if test -f "$i/${configdir}/tkConfig.sh" ; then
ac_cv_c_tkconfig=`(cd $i/${configdir}; pwd)`
break
fi
done
fi
# check in a few common install locations
if test x"${ac_cv_c_tkconfig}" = x ; then
for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
if test -f "$i/tkConfig.sh" ; then
ac_cv_c_tkconfig=`(cd $i; pwd)`
break
fi
done
fi
# check in a few other private locations
if test x"${ac_cv_c_tkconfig}" = x ; then
for i in \
${srcdir}/../tk \
`ls -dr ${srcdir}/../tk[[4-9]]* 2>/dev/null` ; do
if test -f "$i/${configdir}/tkConfig.sh" ; then
ac_cv_c_tkconfig=`(cd $i/${configdir}; pwd)`
break
fi
done
fi
])
if test x"${ac_cv_c_tkconfig}" = x ; then
TKCONFIG="# no Tk configs found"
AC_MSG_WARN(Can't find Tk configuration definitions)
else
no_tk=
TKCONFIG=${ac_cv_c_tkconfig}/tkConfig.sh
AC_MSG_RESULT(found $TKCONFIG)
fi
fi
])
# Defined as a separate macro so we don't have to cache the values
# from PATH_TKCONFIG (because this can also be cached).
AC_DEFUN(CY_AC_LOAD_TKCONFIG, [
if test -f "$TKCONFIG" ; then
. $TKCONFIG
fi
AC_SUBST(TK_VERSION)
dnl not actually used, don't export to save symbols
dnl AC_SUBST(TK_MAJOR_VERSION)
dnl AC_SUBST(TK_MINOR_VERSION)
AC_SUBST(TK_DEFS)
dnl not used, don't export to save symbols
dnl AC_SUBST(TK_LIB_FILE)
dnl not used outside of configure
dnl AC_SUBST(TK_LIBS)
dnl not used, don't export to save symbols
dnl AC_SUBST(TK_PREFIX)
dnl not used, don't export to save symbols
dnl AC_SUBST(TK_EXEC_PREFIX)
AC_SUBST(TK_BUILD_INCLUDES)
AC_SUBST(TK_XINCLUDES)
AC_SUBST(TK_XLIBSW)
AC_SUBST(TK_BUILD_LIB_SPEC)
AC_SUBST(TK_LIB_SPEC)
])
# check for Itcl headers.
AC_DEFUN(CY_AC_PATH_ITCLCONFIG, [
#
# Ok, lets find the itcl configuration
# First, look for one uninstalled.
# the alternative search directory is invoked by --with-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)],
with_itclconfig=${withval})
AC_MSG_CHECKING([for Itcl configuration])
AC_CACHE_VAL(ac_cv_c_itclconfig,[
# First check to see if --with-itclconfig was specified.
if test x"${with_itclconfig}" != x ; then
if test -f "${with_itclconfig}/itclConfig.sh" ; then
ac_cv_c_itclconfig=`(cd ${with_itclconfig}; pwd)`
else
AC_MSG_ERROR([${with_itclconfig} directory doesn't contain itclConfig.sh])
fi
fi
# then check for a private Itcl library
if test x"${ac_cv_c_itclconfig}" = x ; then
for i in \
../itcl/itcl \
`ls -dr ../itcl[[4-9]]*/itcl 2>/dev/null` \
../../itcl \
`ls -dr ../../itcl[[4-9]]*/itcl 2>/dev/null` \
../../../itcl \
`ls -dr ../../../itcl[[4-9]]*/itcl 2>/dev/null` ; do
if test -f "$i/itclConfig.sh" ; then
ac_cv_c_itclconfig=`(cd $i; pwd)`
break
fi
done
fi
# check in a few common install locations
if test x"${ac_cv_c_itclconfig}" = x ; then
for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
if test -f "$i/itclConfig.sh" ; then
ac_cv_c_itclconfig=`(cd $i; pwd)`
break
fi
done
fi
# check in a few other private locations
if test x"${ac_cv_c_itclconfig}" = x ; then
for i in \
${srcdir}/../itcl/itcl \
`ls -dr ${srcdir}/../itcl[[4-9]]*/itcl 2>/dev/null` ; do
if test -f "$i/itclConfig.sh" ; then
ac_cv_c_itclconfig=`(cd $i; pwd)`
break
fi
done
fi
])
if test x"${ac_cv_c_itclconfig}" = x ; then
ITCLCONFIG="# no Itcl configs found"
AC_MSG_WARN(Can't find Itcl configuration definitions)
else
no_itcl=
ITCLCONFIG=${ac_cv_c_itclconfig}/itclConfig.sh
AC_MSG_RESULT(found $ITCLCONFIG)
fi
fi
])
# Defined as a separate macro so we don't have to cache the values
# from PATH_ITCLCONFIG (because this can also be cached).
AC_DEFUN(CY_AC_LOAD_ITCLCONFIG, [
if test -f "$ITCLCONFIG" ; then
. $ITCLCONFIG
fi
AC_SUBST(ITCL_VERSION)
dnl not actually used, don't export to save symbols
dnl AC_SUBST(ITCL_MAJOR_VERSION)
dnl AC_SUBST(ITCL_MINOR_VERSION)
AC_SUBST(ITCL_DEFS)
dnl not used, don't export to save symbols
dnl AC_SUBST(ITCL_LIB_FILE)
dnl not used outside of configure
dnl AC_SUBST(ITCL_LIBS)
dnl not used, don't export to save symbols
dnl AC_SUBST(ITCL_PREFIX)
dnl not used, don't export to save symbols
dnl AC_SUBST(ITCL_EXEC_PREFIX)
AC_SUBST(ITCL_BUILD_INCLUDES)
AC_SUBST(ITCL_BUILD_LIB_SPEC)
AC_SUBST(ITCL_LIB_SPEC)
])
# check for Itcl headers.
AC_DEFUN(CY_AC_PATH_ITCLH, [
AC_MSG_CHECKING(for Itcl private headers. srcdir=${srcdir})
if test x"${ac_cv_c_itclh}" = x ; then
for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itcl; do
if test -f $i/generic/itcl.h ; then
ac_cv_c_itclh=`(cd $i/generic; pwd)`
break
fi
done
fi
if test x"${ac_cv_c_itclh}" = x ; then
ITCLHDIR="# no Itcl private headers found"
AC_MSG_ERROR([Can't find Itcl private headers])
fi
if test x"${ac_cv_c_itclh}" != x ; then
ITCLHDIR="-I${ac_cv_c_itclh}"
fi
# should always be here
# ITCLLIB="../itcl/itcl/unix/libitcl.a"
AC_SUBST(ITCLHDIR)
#AC_SUBST(ITCLLIB)
])
AC_DEFUN(CY_AC_PATH_ITKCONFIG, [
#
# Ok, lets find the itk configuration
# First, look for one uninstalled.
# the alternative search directory is invoked by --with-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)],
with_itkconfig=${withval})
AC_MSG_CHECKING([for Itk configuration])
AC_CACHE_VAL(ac_cv_c_itkconfig,[
# First check to see if --with-itkconfig was specified.
if test x"${with_itkconfig}" != x ; then
if test -f "${with_itkconfig}/itkConfig.sh" ; then
ac_cv_c_itkconfig=`(cd ${with_itkconfig}; pwd)`
else
AC_MSG_ERROR([${with_itkconfig} directory doesn't contain itkConfig.sh])
fi
fi
# then check for a private Itk library
if test x"${ac_cv_c_itkconfig}" = x ; then
for i in \
../itcl/itk \
`ls -dr ../itcl[[4-9]]*/itk 2>/dev/null` \
../../itk \
`ls -dr ../../itcl[[4-9]]*/itk 2>/dev/null` \
../../../itk \
`ls -dr ../../../itcl[[4-9]]*/itk 2>/dev/null` ; do
if test -f "$i/itkConfig.sh" ; then
ac_cv_c_itkconfig=`(cd $i; pwd)`
break
fi
done
fi
# check in a few common install locations
if test x"${ac_cv_c_itkconfig}" = x ; then
for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
if test -f "$i/itkConfig.sh" ; then
ac_cv_c_itkconfig=`(cd $i; pwd)`
break
fi
done
fi
# check in a few other private locations
if test x"${ac_cv_c_itkconfig}" = x ; then
for i in \
${srcdir}/../itcl/itk \
`ls -dr ${srcdir}/../itcl[[4-9]]*/itk 2>/dev/null` ; do
if test -f "$i/itkConfig.sh" ; then
ac_cv_c_itkconfig=`(cd $i; pwd)`
break
fi
done
fi
])
if test x"${ac_cv_c_itkconfig}" = x ; then
ITKCONFIG="# no Itk configs found"
AC_MSG_WARN(Can't find Itk configuration definitions)
else
no_itk=
ITKCONFIG=${ac_cv_c_itkconfig}/itkConfig.sh
AC_MSG_RESULT(found $ITKCONFIG)
fi
fi
])
# Defined as a separate macro so we don't have to cache the values
# from PATH_ITKCONFIG (because this can also be cached).
AC_DEFUN(CY_AC_LOAD_ITKCONFIG, [
if test -f "$ITKCONFIG" ; then
. $ITKCONFIG
fi
AC_SUBST(ITK_VERSION)
dnl not actually used, don't export to save symbols
dnl AC_SUBST(ITK_MAJOR_VERSION)
dnl AC_SUBST(ITK_MINOR_VERSION)
AC_SUBST(ITK_DEFS)
dnl not used, don't export to save symbols
dnl AC_SUBST(ITK_LIB_FILE)
dnl not used outside of configure
dnl AC_SUBST(ITK_LIBS)
dnl not used, don't export to save symbols
dnl AC_SUBST(ITK_PREFIX)
dnl not used, don't export to save symbols
dnl AC_SUBST(ITK_EXEC_PREFIX)
AC_SUBST(ITK_BUILD_INCLUDES)
AC_SUBST(ITK_BUILD_LIB_SPEC)
AC_SUBST(ITK_LIB_SPEC)
])
AC_DEFUN(CY_AC_PATH_ITKH, [
AC_MSG_CHECKING(for Itk private headers. srcdir=${srcdir})
if test x"${ac_cv_c_itkh}" = x ; then
for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itk; do
if test -f $i/generic/itk.h ; then
ac_cv_c_itkh=`(cd $i/generic; pwd)`
break
fi
done
fi
if test x"${ac_cv_c_itkh}" = x ; then
ITKHDIR="# no Itk private headers found"
AC_MSG_ERROR([Can't find Itk private headers])
fi
if test x"${ac_cv_c_itkh}" != x ; then
ITKHDIR="-I${ac_cv_c_itkh}"
fi
# should always be here
# ITKLIB="../itcl/itk/unix/libitk.a"
AC_SUBST(ITKHDIR)
#AC_SUBST(ITKLIB)
])
# check for Tix headers.
AC_DEFUN(CY_AC_PATH_TIXH, [
AC_MSG_CHECKING(for Tix private headers. srcdir=${srcdir})
if test x"${ac_cv_c_tixh}" = x ; then
for i in ${srcdir}/../tix ${srcdir}/../../tix ${srcdir}/../../../tix ; do
if test -f $i/generic/tix.h ; then
ac_cv_c_tixh=`(cd $i/generic; pwd)`
break
fi
done
fi
if test x"${ac_cv_c_tixh}" = x ; then
TIXHDIR="# no Tix private headers found"
AC_MSG_ERROR([Can't find Tix private headers])
fi
if test x"${ac_cv_c_tixh}" != x ; then
TIXHDIR="-I${ac_cv_c_tixh}"
fi
AC_SUBST(TIXHDIR)
])
AC_DEFUN(CY_AC_PATH_TIXCONFIG, [
#
# Ok, lets find the tix configuration
# First, look for one uninstalled.
# the alternative search directory is invoked by --with-itkconfig
#
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)],
with_tixconfig=${withval})
AC_MSG_CHECKING([for Tix configuration])
AC_CACHE_VAL(ac_cv_c_tixconfig,[
# First check to see if --with-tixconfig was specified.
if test x"${with_tixconfig}" != x ; then
if test -f "${with_tixconfig}/tixConfig.sh" ; then
ac_cv_c_tixconfig=`(cd ${with_tixconfig}; pwd)`
else
AC_MSG_ERROR([${with_tixconfig} directory doesn't contain tixConfig.sh])
fi
fi
# then check for a private Tix library
if test x"${ac_cv_c_tixconfig}" = x ; then
for i in \
../tix \
`ls -dr ../tix 2>/dev/null` \
../../tix \
`ls -dr ../../tix 2>/dev/null` \
../../../tix \
`ls -dr ../../../tix 2>/dev/null` ; do
echo "**** Looking at $i - with ${configdir}"
if test -f "$i/tixConfig.sh" ; then
ac_cv_c_tixconfig=`(cd $i; pwd)`
break
fi
done
fi
# check in a few common install locations
if test x"${ac_cv_c_tixconfig}" = x ; then
for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
echo "**** Looking at $i"
if test -f "$i/tixConfig.sh" ; then
ac_cv_c_tixconfig=`(cd $i; pwd)`
break
fi
done
fi
# check in a few other private locations
echo "**** Other private locations"
if test x"${ac_cv_c_tixconfig}" = x ; then
for i in \
${srcdir}/../tix \
`ls -dr ${srcdir}/../tix 2>/dev/null` ; do
echo "**** Looking at $i - with ${configdir}"
if test -f "$i/${configdir}/tixConfig.sh" ; then
ac_cv_c_tixconfig=`(cd $i/${configdir}; pwd)`
break
fi
done
fi
])
if test x"${ac_cv_c_tixconfig}" = x ; then
TIXCONFIG="# no Tix configs found"
AC_MSG_WARN(Can't find Tix configuration definitions)
else
no_tix=
TIXCONFIG=${ac_cv_c_tixconfig}/tixConfig.sh
AC_MSG_RESULT(found $TIXCONFIG)
fi
fi
])
# Defined as a separate macro so we don't have to cache the values
# from PATH_TIXCONFIG (because this can also be cached).
AC_DEFUN(CY_AC_LOAD_TIXCONFIG, [
if test -f "$TIXCONFIG" ; then
. $TIXCONFIG
fi
AC_SUBST(TIX_VERSION)
dnl not actually used, don't export to save symbols
dnl AC_SUBST(TIX_MAJOR_VERSION)
dnl AC_SUBST(TIX_MINOR_VERSION)
dnl AC_SUBST(TIX_DEFS)
dnl not used, don't export to save symbols
dnl dnl AC_SUBST(TIX_LIB_FILE)
dnl not used outside of configure
dnl AC_SUBST(TIX_LIBS)
dnl not used, don't export to save symbols
dnl AC_SUBST(TIX_PREFIX)
dnl not used, don't export to save symbols
dnl AC_SUBST(TIX_EXEC_PREFIX)
dnl AC_SUBST(TIX_BUILD_INCLUDES)
AC_SUBST(TIX_BUILD_LIB_SPEC)
dnl AC_SUBST(TIX_LIB_SPEC)
])

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/* Low level Alpha interface, for GDB when running native.
Copyright 1993, 1995, 1996 Free Software Foundation, Inc.
Copyright 1993, 1995, 1996, 1998 Free Software Foundation, Inc.
This file is part of GDB.
@ -22,9 +22,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "gdbcore.h"
#include "target.h"
#include <sys/ptrace.h>
#include <machine/reg.h>
#ifdef __linux__
# include <asm/reg.h>
# include <alpha/ptrace.h>
#else
# include <machine/reg.h>
#endif
#include <sys/user.h>
/* Prototypes for local functions. */
static void fetch_osf_core_registers PARAMS ((char *,
unsigned, int, CORE_ADDR));
static void fetch_elf_core_registers PARAMS ((char *,
unsigned, int, CORE_ADDR));
/* Size of elements in jmpbuf */
#define JB_ELEMENT_SIZE 8
@ -74,11 +86,11 @@ get_longjmp_target (pc)
*/
static void
fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
fetch_osf_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
char *core_reg_sect;
unsigned core_reg_size;
int which;
unsigned reg_addr;
CORE_ADDR reg_addr;
{
register int regno;
register int addr;
@ -121,10 +133,42 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
}
if (bad_reg >= 0)
{
error ("Register %s not found in core file.", reg_names[bad_reg]);
error ("Register %s not found in core file.", REGISTER_NAME (bad_reg));
}
}
static void
fetch_elf_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
char *core_reg_sect;
unsigned core_reg_size;
int which;
CORE_ADDR reg_addr;
{
if (core_reg_size < 32*8)
{
error ("Core file register section too small (%u bytes).", core_reg_size);
return;
}
if (which == 2)
{
/* The FPU Registers. */
memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)], core_reg_sect, 31*8);
memset (&registers[REGISTER_BYTE (FP0_REGNUM+31)], 0, 8);
memset (&register_valid[FP0_REGNUM], 1, 32);
}
else
{
/* The General Registers. */
memcpy (&registers[REGISTER_BYTE (V0_REGNUM)], core_reg_sect, 31*8);
memcpy (&registers[REGISTER_BYTE (PC_REGNUM)], core_reg_sect+31*8, 8);
memset (&registers[REGISTER_BYTE (ZERO_REGNUM)], 0, 8);
memset (&register_valid[V0_REGNUM], 1, 32);
register_valid[PC_REGNUM] = 1;
}
}
/* Map gdb internal register number to a ptrace ``address''.
These ``addresses'' are defined in <sys/ptrace.h> */
@ -136,10 +180,10 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
/* Return the ptrace ``address'' of register REGNO. */
unsigned int
CORE_ADDR
register_addr (regno, blockend)
int regno;
int blockend;
CORE_ADDR blockend;
{
return REGISTER_PTRACE_ADDR (regno);
}
@ -150,7 +194,7 @@ kernel_u_size ()
return (sizeof (struct user));
}
#ifdef USE_PROC_FS
#if defined(USE_PROC_FS) || defined(HAVE_GREGSET_T)
#include <sys/procfs.h>
/*
@ -162,7 +206,7 @@ supply_gregset (gregsetp)
gregset_t *gregsetp;
{
register int regi;
register long *regp = gregsetp->regs;
register long *regp = ALPHA_REGSET_BASE (gregsetp);
static char zerobuf[MAX_REGISTER_RAW_SIZE] = {0};
for (regi = 0; regi < 31; regi++)
@ -181,7 +225,7 @@ fill_gregset (gregsetp, regno)
int regno;
{
int regi;
register long *regp = gregsetp->regs;
register long *regp = ALPHA_REGSET_BASE (gregsetp);
for (regi = 0; regi < 31; regi++)
if ((regno == -1) || (regno == regi))
@ -201,7 +245,7 @@ supply_fpregset (fpregsetp)
fpregset_t *fpregsetp;
{
register int regi;
register long *regp = fpregsetp->regs;
register long *regp = ALPHA_REGSET_BASE (fpregsetp);
for (regi = 0; regi < 32; regi++)
supply_register (regi + FP0_REGNUM, (char *)(regp + regi));
@ -213,7 +257,7 @@ fill_fpregset (fpregsetp, regno)
int regno;
{
int regi;
register long *regp = fpregsetp->regs;
register long *regp = ALPHA_REGSET_BASE (fpregsetp);
for (regi = FP0_REGNUM; regi < FP0_REGNUM + 32; regi++)
{
@ -229,15 +273,25 @@ fill_fpregset (fpregsetp, regno)
/* Register that we are able to handle alpha core file formats. */
static struct core_fns alpha_core_fns =
static struct core_fns alpha_osf_core_fns =
{
bfd_target_aout_flavour,
fetch_core_registers,
/* This really is bfd_target_unknown_flavour. */
bfd_target_unknown_flavour,
fetch_osf_core_registers,
NULL
};
static struct core_fns alpha_elf_core_fns =
{
bfd_target_elf_flavour,
fetch_elf_core_registers,
NULL
};
void
_initialize_core_alpha ()
{
add_core_fns (&alpha_core_fns);
add_core_fns (&alpha_osf_core_fns);
add_core_fns (&alpha_elf_core_fns);
}

View File

@ -1,5 +1,5 @@
/* Target-dependent code for the ALPHA architecture, for GDB, the GNU Debugger.
Copyright 1993, 1994, 1995 Free Software Foundation, Inc.
Copyright 1993, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
This file is part of GDB.
@ -31,11 +31,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* FIXME: Some of this code should perhaps be merged with mips-tdep.c. */
/* FIXME: Put this declaration in frame.h. */
extern struct obstack frame_cache_obstack;
/* Prototypes for local functions. */
/* Forward declarations. */
static alpha_extra_func_info_t push_sigtramp_desc PARAMS ((CORE_ADDR low_addr));
static CORE_ADDR read_next_frame_reg PARAMS ((struct frame_info *, int));
@ -131,6 +129,113 @@ struct linked_proc_info
struct linked_proc_info *next;
} *linked_proc_desc_table = NULL;
/* Under GNU/Linux, signal handler invocations can be identified by the
designated code sequence that is used to return from a signal
handler. In particular, the return address of a signal handler
points to the following sequence (the first instruction is quadword
aligned):
bis $30,$30,$16
addq $31,0x67,$0
call_pal callsys
Each instruction has a unique encoding, so we simply attempt to
match the instruction the pc is pointing to with any of the above
instructions. If there is a hit, we know the offset to the start
of the designated sequence and can then check whether we really are
executing in a designated sequence. If not, -1 is returned,
otherwise the offset from the start of the desingated sequence is
returned.
There is a slight chance of false hits: code could jump into the
middle of the designated sequence, in which case there is no
guarantee that we are in the middle of a sigreturn syscall. Don't
think this will be a problem in praxis, though.
*/
long
alpha_linux_sigtramp_offset (CORE_ADDR pc)
{
unsigned int i[3], w;
long off;
if (read_memory_nobpt(pc, (char *) &w, 4) != 0)
return -1;
off = -1;
switch (w)
{
case 0x47de0410: off = 0; break; /* bis $30,$30,$16 */
case 0x43ecf400: off = 4; break; /* addq $31,0x67,$0 */
case 0x00000083: off = 8; break; /* call_pal callsys */
default: return -1;
}
pc -= off;
if (pc & 0x7)
{
/* designated sequence is not quadword aligned */
return -1;
}
if (read_memory_nobpt(pc, (char *) i, sizeof(i)) != 0)
return -1;
if (i[0] == 0x47de0410 && i[1] == 0x43ecf400 && i[2] == 0x00000083)
return off;
return -1;
}
/* Under OSF/1, the __sigtramp routine is frameless and has a frame
size of zero, but we are able to backtrace through it. */
CORE_ADDR
alpha_osf_skip_sigtramp_frame (frame, pc)
struct frame_info *frame;
CORE_ADDR pc;
{
char *name;
find_pc_partial_function (pc, &name, (CORE_ADDR *)NULL, (CORE_ADDR *)NULL);
if (IN_SIGTRAMP (pc, name))
return frame->frame;
else
return 0;
}
/* Dynamically create a signal-handler caller procedure descriptor for
the signal-handler return code starting at address LOW_ADDR. The
descriptor is added to the linked_proc_desc_table. */
static alpha_extra_func_info_t
push_sigtramp_desc (low_addr)
CORE_ADDR low_addr;
{
struct linked_proc_info *link;
alpha_extra_func_info_t proc_desc;
link = (struct linked_proc_info *)
xmalloc (sizeof (struct linked_proc_info));
link->next = linked_proc_desc_table;
linked_proc_desc_table = link;
proc_desc = &link->info;
proc_desc->numargs = 0;
PROC_LOW_ADDR (proc_desc) = low_addr;
PROC_HIGH_ADDR (proc_desc) = low_addr + 3 * 4;
PROC_DUMMY_FRAME (proc_desc) = 0;
PROC_FRAME_OFFSET (proc_desc) = 0x298; /* sizeof(struct sigcontext_struct) */
PROC_FRAME_REG (proc_desc) = SP_REGNUM;
PROC_REG_MASK (proc_desc) = 0xffff;
PROC_FREG_MASK (proc_desc) = 0xffff;
PROC_PC_REG (proc_desc) = 26;
PROC_LOCALOFF (proc_desc) = 0;
SET_PROC_DESC_IS_DYN_SIGTRAMP (proc_desc);
return (proc_desc);
}
/* Guaranteed to set frame->saved_regs to some values (it never leaves it
NULL). */
@ -145,9 +250,7 @@ alpha_find_saved_regs (frame)
alpha_extra_func_info_t proc_desc;
int returnreg;
frame->saved_regs = (struct frame_saved_regs *)
obstack_alloc (&frame_cache_obstack, sizeof(struct frame_saved_regs));
memset (frame->saved_regs, 0, sizeof (struct frame_saved_regs));
frame_saved_regs_zalloc (frame);
/* If it is the frame for __sigtramp, the saved registers are located
in a sigcontext structure somewhere on the stack. __sigtramp
@ -161,25 +264,20 @@ alpha_find_saved_regs (frame)
#endif
if (frame->signal_handler_caller)
{
CORE_ADDR sigcontext_pointer_addr;
CORE_ADDR sigcontext_addr;
if (frame->next)
sigcontext_pointer_addr = frame->next->frame;
else
sigcontext_pointer_addr = frame->frame;
sigcontext_addr = read_memory_integer(sigcontext_pointer_addr, 8);
sigcontext_addr = SIGCONTEXT_ADDR (frame);
for (ireg = 0; ireg < 32; ireg++)
{
reg_position = sigcontext_addr + SIGFRAME_REGSAVE_OFF + ireg * 8;
frame->saved_regs->regs[ireg] = reg_position;
frame->saved_regs[ireg] = reg_position;
}
for (ireg = 0; ireg < 32; ireg++)
{
reg_position = sigcontext_addr + SIGFRAME_FPREGSAVE_OFF + ireg * 8;
frame->saved_regs->regs[FP0_REGNUM + ireg] = reg_position;
frame->saved_regs[FP0_REGNUM + ireg] = reg_position;
}
frame->saved_regs->regs[PC_REGNUM] = sigcontext_addr + SIGFRAME_PC_OFF;
frame->saved_regs[PC_REGNUM] = sigcontext_addr + SIGFRAME_PC_OFF;
return;
}
@ -202,7 +300,7 @@ alpha_find_saved_regs (frame)
register number. */
if (mask & (1 << returnreg))
{
frame->saved_regs->regs[returnreg] = reg_position;
frame->saved_regs[returnreg] = reg_position;
reg_position += 8;
mask &= ~(1 << returnreg); /* Clear bit for RA so we
don't save again later. */
@ -211,7 +309,7 @@ alpha_find_saved_regs (frame)
for (ireg = 0; ireg <= 31 ; ++ireg)
if (mask & (1 << ireg))
{
frame->saved_regs->regs[ireg] = reg_position;
frame->saved_regs[ireg] = reg_position;
reg_position += 8;
}
@ -224,11 +322,11 @@ alpha_find_saved_regs (frame)
for (ireg = 0; ireg <= 31 ; ++ireg)
if (mask & (1 << ireg))
{
frame->saved_regs->regs[FP0_REGNUM+ireg] = reg_position;
frame->saved_regs[FP0_REGNUM+ireg] = reg_position;
reg_position += 8;
}
frame->saved_regs->regs[PC_REGNUM] = frame->saved_regs->regs[returnreg];
frame->saved_regs[PC_REGNUM] = frame->saved_regs[returnreg];
}
static CORE_ADDR
@ -246,8 +344,8 @@ read_next_frame_reg(fi, regno)
{
if (fi->saved_regs == NULL)
alpha_find_saved_regs (fi);
if (fi->saved_regs->regs[regno])
return read_memory_integer(fi->saved_regs->regs[regno], 8);
if (fi->saved_regs[regno])
return read_memory_integer(fi->saved_regs[regno], 8);
}
}
return read_register(regno);
@ -285,13 +383,28 @@ alpha_saved_pc_after_call (frame)
proc_desc = find_proc_desc (pc, frame->next);
pcreg = proc_desc ? PROC_PC_REG (proc_desc) : RA_REGNUM;
return read_register (pcreg);
if (frame->signal_handler_caller)
return alpha_frame_saved_pc (frame);
else
return read_register (pcreg);
}
static struct alpha_extra_func_info temp_proc_desc;
static struct frame_saved_regs temp_saved_regs;
/* Nonzero if instruction at PC is a return instruction. "ret
$zero,($ra),1" on alpha. */
static int
alpha_about_to_return (pc)
CORE_ADDR pc;
{
return read_memory_integer (pc, 4) == 0x6bfa8001;
}
/* This fencepost looks highly suspicious to me. Removing it also
seems suspicious as it could affect remote debugging across serial
lines. */
@ -342,8 +455,8 @@ Otherwise, you told GDB there was a function where there isn't one, or\n\
return 0;
}
else if (ABOUT_TO_RETURN(start_pc))
break;
else if (alpha_about_to_return (start_pc))
break;
start_pc += 4; /* skip return */
return start_pc;
@ -382,7 +495,15 @@ heuristic_proc_desc(start_pc, limit_pc, next_frame)
word = extract_unsigned_integer (buf, 4);
if ((word & 0xffff0000) == 0x23de0000) /* lda $sp,n($sp) */
frame_size += (-word) & 0xffff;
{
if (word & 0x8000)
frame_size += (-word) & 0xffff;
else
/* Exit loop if a positive stack adjustment is found, which
usually means that the stack cleanup code in the function
epilogue is reached. */
break;
}
else if ((word & 0xfc1f0000) == 0xb41e0000 /* stq reg,n($sp) */
&& (word & 0xffff0000) != 0xb7fe0000) /* reg != $zero */
{
@ -404,14 +525,18 @@ heuristic_proc_desc(start_pc, limit_pc, next_frame)
rearrange the register saves.
So we recognize only a few registers (t7, t9, ra) within
the procedure prologue as valid return address registers.
If we encounter a return instruction, we extract the
the return address register from it.
FIXME: Rewriting GDB to access the procedure descriptors,
e.g. via the minimal symbol table, might obviate this hack. */
if (pcreg == -1
&& cur_pc < (start_pc + 20)
&& cur_pc < (start_pc + 80)
&& (reg == T7_REGNUM || reg == T9_REGNUM || reg == RA_REGNUM))
pcreg = reg;
}
else if ((word & 0xffe0ffff) == 0x6be08001) /* ret zero,reg,1 */
pcreg = (word >> 16) & 0x1f;
else if (word == 0x47de040f) /* bis sp,sp fp */
has_frame_reg = 1;
}
@ -419,15 +544,13 @@ heuristic_proc_desc(start_pc, limit_pc, next_frame)
{
/* If we haven't found a valid return address register yet,
keep searching in the procedure prologue. */
while (cur_pc < (limit_pc + 20) && cur_pc < (start_pc + 20))
while (cur_pc < (limit_pc + 80) && cur_pc < (start_pc + 80))
{
char buf[4];
unsigned long word;
int status;
status = read_memory_nobpt (cur_pc, buf, 4);
if (status)
memory_error (status, cur_pc);
if (read_memory_nobpt (cur_pc, buf, 4))
break;
cur_pc += 4;
word = extract_unsigned_integer (buf, 4);
@ -441,6 +564,11 @@ heuristic_proc_desc(start_pc, limit_pc, next_frame)
break;
}
}
else if ((word & 0xffe0ffff) == 0x6be08001) /* ret zero,reg,1 */
{
pcreg = (word >> 16) & 0x1f;
break;
}
}
}
@ -471,6 +599,9 @@ after_prologue (pc, proc_desc)
if (proc_desc)
{
if (PROC_DESC_IS_DYN_SIGTRAMP (proc_desc))
return PROC_LOW_ADDR (proc_desc); /* "prologue" is in kernel */
/* If function is frameless, then we need to do it the hard way. I
strongly suspect that frameless always means prologueless... */
if (PROC_FRAME_REG (proc_desc) == SP_REGNUM
@ -493,7 +624,7 @@ after_prologue (pc, proc_desc)
}
/* Return non-zero if we *might* be in a function prologue. Return zero if we
are definatly *not* in a function prologue. */
are definitively *not* in a function prologue. */
static int
alpha_in_prologue (pc, proc_desc)
@ -599,6 +730,8 @@ find_proc_desc (pc, next_frame)
}
else
{
long offset;
/* Is linked_proc_desc_table really necessary? It only seems to be used
by procedure call dummys. However, the procedures being called ought
to have their own proc_descs, and even if they don't,
@ -610,7 +743,19 @@ find_proc_desc (pc, next_frame)
&& PROC_HIGH_ADDR(&link->info) > pc)
return &link->info;
if (startaddr == 0)
/* If PC is inside a dynamically generated sigtramp handler,
create and push a procedure descriptor for that code: */
offset = DYNAMIC_SIGTRAMP_OFFSET (pc);
if (offset >= 0)
return push_sigtramp_desc (pc - offset);
/* If heuristic_fence_post is non-zero, determine the procedure
start address by examining the instructions.
This allows us to find the start address of static functions which
have no symbolic information, as startaddr would have been set to
the preceding global function start address by the
find_pc_partial_function call above. */
if (startaddr == 0 || heuristic_fence_post != 0)
startaddr = heuristic_proc_start (pc);
proc_desc =
@ -650,17 +795,7 @@ alpha_frame_chain(frame)
/* The previous frame from a sigtramp frame might be frameless
and have frame size zero. */
&& !frame->signal_handler_caller)
{
/* The alpha __sigtramp routine is frameless and has a frame size
of zero, but we are able to backtrace through it. */
char *name;
find_pc_partial_function (saved_pc, &name,
(CORE_ADDR *)NULL, (CORE_ADDR *)NULL);
if (IN_SIGTRAMP (saved_pc, name))
return frame->frame;
else
return 0;
}
return FRAME_PAST_SIGTRAMP_FRAME (frame, saved_pc);
else
return read_next_frame_reg(frame, PROC_FRAME_REG(proc_desc))
+ PROC_FRAME_OFFSET(proc_desc);
@ -696,7 +831,8 @@ init_extra_frame_info (frame)
/* This may not be quite right, if proc has a real frame register.
Get the value of the frame relative sp, procedure might have been
interrupted by a signal at it's very start. */
else if (frame->pc == PROC_LOW_ADDR (proc_desc) && !PROC_DESC_IS_DUMMY (proc_desc))
else if (frame->pc == PROC_LOW_ADDR (proc_desc)
&& !PROC_DESC_IS_DYN_SIGTRAMP (proc_desc))
frame->frame = read_next_frame_reg (frame->next, SP_REGNUM);
else
frame->frame = read_next_frame_reg (frame->next, PROC_FRAME_REG (proc_desc))
@ -713,12 +849,11 @@ init_extra_frame_info (frame)
(CORE_ADDR *)NULL,(CORE_ADDR *)NULL);
if (!IN_SIGTRAMP (frame->pc, name))
{
frame->saved_regs = (struct frame_saved_regs*)
obstack_alloc (&frame_cache_obstack,
sizeof (struct frame_saved_regs));
*frame->saved_regs = temp_saved_regs;
frame->saved_regs->regs[PC_REGNUM]
= frame->saved_regs->regs[RA_REGNUM];
frame->saved_regs = (CORE_ADDR*)
frame_obstack_alloc (SIZEOF_FRAME_SAVED_REGS);
memcpy (frame->saved_regs, temp_saved_regs.regs, SIZEOF_FRAME_SAVED_REGS);
frame->saved_regs[PC_REGNUM]
= frame->saved_regs[RA_REGNUM];
}
}
}
@ -878,7 +1013,7 @@ alpha_push_dummy_frame()
*/
/* MASK(i,j) == (1<<i) + (1<<(i+1)) + ... + (1<<j)). Assume i<=j<31. */
#define MASK(i,j) (((1L << ((j)+1)) - 1) ^ ((1L << (i)) - 1))
#define MASK(i,j) ((((LONGEST)1 << ((j)+1)) - 1) ^ (((LONGEST)1 << (i)) - 1))
#define GEN_REG_SAVE_MASK (MASK(0,8) | MASK(16,29))
#define GEN_REG_SAVE_COUNT 24
#define FLOAT_REG_SAVE_MASK (MASK(0,1) | MASK(10,30))
@ -974,17 +1109,18 @@ alpha_pop_frame()
for (regnum = 32; --regnum >= 0; )
if (PROC_REG_MASK(proc_desc) & (1 << regnum))
write_register (regnum,
read_memory_integer (frame->saved_regs->regs[regnum],
read_memory_integer (frame->saved_regs[regnum],
8));
for (regnum = 32; --regnum >= 0; )
if (PROC_FREG_MASK(proc_desc) & (1 << regnum))
write_register (regnum + FP0_REGNUM,
read_memory_integer (frame->saved_regs->regs[regnum + FP0_REGNUM], 8));
read_memory_integer (frame->saved_regs[regnum + FP0_REGNUM], 8));
}
write_register (SP_REGNUM, new_sp);
flush_cached_frames ();
if (proc_desc && PROC_DESC_IS_DUMMY(proc_desc))
if (proc_desc && (PROC_DESC_IS_DUMMY(proc_desc)
|| PROC_DESC_IS_DYN_SIGTRAMP (proc_desc)))
{
struct linked_proc_info *pi_ptr, *prev_ptr;
@ -1129,7 +1265,7 @@ alpha_register_convert_to_virtual (regnum, valtype, raw_buffer, virtual_buffer)
}
else if (TYPE_CODE (valtype) == TYPE_CODE_INT && TYPE_LENGTH (valtype) <= 4)
{
unsigned LONGEST l;
ULONGEST l;
l = extract_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (regnum));
l = ((l >> 32) & 0xc0000000) | ((l >> 29) & 0x3fffffff);
store_unsigned_integer (virtual_buffer, TYPE_LENGTH (valtype), l);
@ -1158,7 +1294,7 @@ alpha_register_convert_to_raw (valtype, regnum, virtual_buffer, raw_buffer)
}
else if (TYPE_CODE (valtype) == TYPE_CODE_INT && TYPE_LENGTH (valtype) <= 4)
{
unsigned LONGEST l;
ULONGEST l;
if (TYPE_UNSIGNED (valtype))
l = extract_unsigned_integer (virtual_buffer, TYPE_LENGTH (valtype));
else

View File

@ -1,5 +1,5 @@
/* Annotation routines for GDB.
Copyright 1986, 1989, 1990, 1991, 1992, 1995 Free Software Foundation, Inc.
Copyright 1986, 89, 90, 91, 92, 95, 1998 Free Software Foundation, Inc.
This file is part of GDB.
@ -24,8 +24,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "gdbtypes.h"
#include "breakpoint.h"
/* Prototypes for local functions. */
static void print_value_flags PARAMS ((struct type *));
static void breakpoint_changed PARAMS ((struct breakpoint *));
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
print_value_flags (t)
struct type *t;
@ -54,6 +64,14 @@ annotate_breakpoint (num)
printf_filtered ("\n\032\032breakpoint %d\n", num);
}
void
annotate_catchpoint (num)
int num;
{
if (annotation_level > 1)
printf_filtered ("\n\032\032catchpoint %d\n", num);
}
void
annotate_watchpoint (num)
int num;
@ -65,30 +83,49 @@ annotate_watchpoint (num)
void
annotate_starting ()
{
if (annotation_level > 1)
if (annotate_starting_hook)
annotate_starting_hook ();
else
{
printf_filtered ("\n\032\032starting\n");
if (annotation_level > 1)
{
printf_filtered ("\n\032\032starting\n");
}
}
}
void
annotate_stopped ()
{
if (annotation_level > 1)
printf_filtered ("\n\032\032stopped\n");
if (annotate_stopped_hook)
annotate_stopped_hook ();
else
{
if (annotation_level > 1)
printf_filtered ("\n\032\032stopped\n");
}
}
void
annotate_exited (exitstatus)
int exitstatus;
{
if (annotation_level > 1)
printf_filtered ("\n\032\032exited %d\n", exitstatus);
if (annotate_exited_hook)
annotate_exited_hook ();
else
{
if (annotation_level > 1)
printf_filtered ("\n\032\032exited %d\n", exitstatus);
}
}
void
annotate_signalled ()
{
if (annotate_signalled_hook)
annotate_signalled_hook ();
if (annotation_level > 1)
printf_filtered ("\n\032\032signalled\n");
}

View File

@ -17,9 +17,13 @@ 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 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));
@ -93,3 +97,8 @@ 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_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));

733
contrib/gdb/gdb/arc-tdep.c Normal file
View File

@ -0,0 +1,733 @@
/* ARC target-dependent stuff.
Copyright (C) 1995, 1997 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 "frame.h"
#include "inferior.h"
#include "gdbcore.h"
#include "target.h"
#include "floatformat.h"
#include "symtab.h"
#include "gdbcmd.h"
/* Current CPU, set with the "set cpu" command. */
static int arc_bfd_mach_type;
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 }
};
/* Used by simulator. */
int display_pipeline_p;
int cpu_timer;
/* This one must have the same type as used in the emulator.
It's currently an enum so this should be ok for now. */
int debug_pipeline_p;
#define ARC_CALL_SAVED_REG(r) ((r) >= 16 && (r) < 24)
#define OPMASK 0xf8000000
/* Instruction field accessor macros.
See the Programmer's Reference Manual. */
#define X_OP(i) (((i) >> 27) & 0x1f)
#define X_A(i) (((i) >> 21) & 0x3f)
#define X_B(i) (((i) >> 15) & 0x3f)
#define X_C(i) (((i) >> 9) & 0x3f)
#define X_D(i) ((((i) & 0x1ff) ^ 0x100) - 0x100)
#define X_L(i) (((((i) >> 5) & 0x3ffffc) ^ 0x200000) - 0x200000)
#define X_N(i) (((i) >> 5) & 3)
#define X_Q(i) ((i) & 0x1f)
/* Return non-zero if X is a short immediate data indicator. */
#define SHIMM_P(x) ((x) == 61 || (x) == 63)
/* Return non-zero if X is a "long" (32 bit) immediate data indicator. */
#define LIMM_P(x) ((x) == 62)
/* Build a simple instruction. */
#define BUILD_INSN(op, a, b, c, d) \
((((op) & 31) << 27) \
| (((a) & 63) << 21) \
| (((b) & 63) << 15) \
| (((c) & 63) << 9) \
| ((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));
#define CODESTREAM_BUFSIZ 16
static CORE_ADDR codestream_next_addr;
static CORE_ADDR codestream_addr;
static unsigned int codestream_buf[CODESTREAM_BUFSIZ];
static int codestream_off;
static int codestream_cnt;
#define codestream_tell() \
(codestream_addr + codestream_off * sizeof (codestream_buf[0]))
#define codestream_peek() \
(codestream_cnt == 0 \
? codestream_fill (1) \
: codestream_buf[codestream_off])
#define codestream_get() \
(codestream_cnt-- == 0 \
? codestream_fill (0) \
: codestream_buf[codestream_off++])
static unsigned int
codestream_fill (peek_flag)
int peek_flag;
{
codestream_addr = codestream_next_addr;
codestream_next_addr += CODESTREAM_BUFSIZ * sizeof (codestream_buf[0]);
codestream_off = 0;
codestream_cnt = CODESTREAM_BUFSIZ;
read_memory (codestream_addr, (char *) codestream_buf,
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;
}
if (peek_flag)
return codestream_peek ();
else
return codestream_get ();
}
static void
codestream_seek (place)
CORE_ADDR place;
{
codestream_next_addr = place / CODESTREAM_BUFSIZ;
codestream_next_addr *= CODESTREAM_BUFSIZ;
codestream_cnt = 0;
codestream_fill (1);
while (codestream_tell () != place)
codestream_get ();
}
/* This function is currently unused but leave in for now. */
static void
codestream_read (buf, count)
unsigned int *buf;
int count;
{
unsigned int *p;
int i;
p = buf;
for (i = 0; i < count; i++)
*p++ = codestream_get ();
}
/* Set up prologue scanning and return the first insn. */
static unsigned int
setup_prologue_scan (pc)
CORE_ADDR pc;
{
unsigned int insn;
codestream_seek (pc);
insn = codestream_get ();
return insn;
}
/*
* Find & return amount a local space allocated, and advance codestream to
* first register push (if any).
* If entry sequence doesn't make sense, return -1, and leave
* codestream pointer random.
*/
static long
arc_get_frame_setup (pc)
CORE_ADDR pc;
{
unsigned int insn;
/* Size of frame or -1 if unrecognizable prologue. */
int frame_size = -1;
/* An initial "sub sp,sp,N" may or may not be for a stdarg fn. */
int maybe_stdarg_decr = -1;
insn = setup_prologue_scan (pc);
/* The authority for what appears here is the home-grown ABI.
The most recent version is 1.2. */
/* First insn may be "sub sp,sp,N" if stdarg fn. */
if ((insn & BUILD_INSN (-1, -1, -1, -1, 0))
== BUILD_INSN (10, SP_REGNUM, SP_REGNUM, SHIMM_REGNUM, 0))
{
maybe_stdarg_decr = X_D (insn);
insn = codestream_get ();
}
if ((insn & BUILD_INSN (-1, 0, -1, -1, -1)) /* st blink,[sp,4] */
== BUILD_INSN (2, 0, SP_REGNUM, BLINK_REGNUM, 4))
{
insn = codestream_get ();
/* Frame may not be necessary, even though blink is saved.
At least this is something we recognize. */
frame_size = 0;
}
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))
return -1;
/* Check for stack adjustment sub sp,sp,N. */
insn = codestream_peek ();
if ((insn & BUILD_INSN (-1, -1, -1, 0, 0))
== BUILD_INSN (10, SP_REGNUM, SP_REGNUM, 0, 0))
{
if (LIMM_P (X_C (insn)))
frame_size = codestream_get ();
else if (SHIMM_P (X_C (insn)))
frame_size = X_D (insn);
else
return -1;
if (frame_size < 0)
return -1;
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)
codestream_get ();
}
/* Frameless fn. */
else
{
frame_size = 0;
}
}
/* If we found a "sub sp,sp,N" and nothing else, it may or may not be a
stdarg fn. The stdarg decrement is not treated as part of the frame size,
so we have a dilemma: what do we return? For now, if we get a
"sub sp,sp,N" and nothing else assume this isn't a stdarg fn. One way
to fix this completely would be to add a bit to the function descriptor
that says the function is a stdarg function. */
if (frame_size < 0 && maybe_stdarg_decr > 0)
return maybe_stdarg_decr;
return frame_size;
}
/* Given a pc value, skip it forward past the function prologue by
disassembling instructions that appear to be a prologue.
If FRAMELESS_P is set, we are only testing to see if the function
is frameless. If it is a frameless function, return PC unchanged.
This allows a quicker answer. */
CORE_ADDR
skip_prologue (pc, frameless_p)
CORE_ADDR pc;
int frameless_p;
{
unsigned int insn;
int i, frame_size;
if ((frame_size = arc_get_frame_setup (pc)) < 0)
return (pc);
if (frameless_p)
return frame_size == 0 ? pc : codestream_tell ();
/* Skip over register saves. */
for (i = 0; i < 8; i++)
{
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;
codestream_get ();
}
return codestream_tell ();
}
/* Return the return address for a frame.
This is used to implement FRAME_SAVED_PC.
This is taken from frameless_look_for_prologue. */
CORE_ADDR
arc_frame_saved_pc (frame)
struct frame_info *frame;
{
CORE_ADDR func_start;
unsigned int insn;
func_start = get_pc_function_start (frame->pc) + FUNCTION_START_OFFSET;
if (func_start == 0)
{
/* Best guess. */
return ARC_PC_TO_REAL_ADDRESS (read_memory_integer (FRAME_FP (frame) + 4, 4));
}
/* The authority for what appears here is the home-grown ABI.
The most recent version is 1.2. */
insn = setup_prologue_scan (func_start);
/* First insn may be "sub sp,sp,N" if stdarg fn. */
if ((insn & BUILD_INSN (-1, -1, -1, -1, 0))
== BUILD_INSN (10, SP_REGNUM, SP_REGNUM, SHIMM_REGNUM, 0))
insn = codestream_get ();
/* If the next insn is "st blink,[sp,4]" we can get blink from there.
Otherwise this is a leaf function and we can use blink. Note that
this still allows for the case where a leaf function saves/clobbers/
restores blink. */
if ((insn & BUILD_INSN (-1, 0, -1, -1, -1)) /* st blink,[sp,4] */
!= BUILD_INSN (2, 0, SP_REGNUM, BLINK_REGNUM, 4))
return ARC_PC_TO_REAL_ADDRESS (read_register (BLINK_REGNUM));
else
return ARC_PC_TO_REAL_ADDRESS (read_memory_integer (FRAME_FP (frame) + 4, 4));
}
/*
* Parse the first few instructions of the function to see
* what registers were stored.
*
* The startup sequence can be at the start of the function.
* 'st blink,[sp+4], st fp,[sp], mov fp,sp'
*
* Local space is allocated just below by sub sp,sp,nnn.
* Next, the registers used by this function are stored (as offsets from sp).
*/
void
frame_find_saved_regs (fip, fsrp)
struct frame_info *fip;
struct frame_saved_regs *fsrp;
{
long locals;
unsigned int insn;
CORE_ADDR dummy_bottom;
CORE_ADDR adr;
int i, regnum, offset;
memset (fsrp, 0, sizeof *fsrp);
/* If frame is the end of a dummy, compute where the beginning would be. */
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)
{
/* all regs were saved by push_call_dummy () */
adr = fip->frame;
for (i = 0; i < NUM_REGS; i++)
{
adr -= REGISTER_RAW_SIZE (i);
fsrp->regs[i] = adr;
}
return;
}
locals = arc_get_frame_setup (get_pc_function_start (fip->pc));
if (locals >= 0)
{
/* Set `adr' to the value of `sp'. */
adr = fip->frame - locals;
for (i = 0; i < 8; i++)
{
insn = codestream_get ();
if ((insn & BUILD_INSN (-1, 0, -1, 0, 0))
!= BUILD_INSN (2, 0, SP_REGNUM, 0, 0))
break;
regnum = X_C (insn);
offset = X_D (insn);
fsrp->regs[regnum] = adr + offset;
}
}
fsrp->regs[PC_REGNUM] = fip->frame + 4;
fsrp->regs[FP_REGNUM] = fip->frame;
}
void
push_dummy_frame ()
{
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);
read_register_gen (FP_REGNUM, regbuf);
write_memory (sp, regbuf, REGISTER_SIZE);
write_register (FP_REGNUM, sp);
for (regnum = 0; regnum < NUM_REGS; regnum++)
{
read_register_gen (regnum, regbuf);
sp = push_bytes (sp, regbuf, REGISTER_RAW_SIZE (regnum));
}
sp += (2*REGISTER_SIZE);
write_register (SP_REGNUM, sp);
}
void
pop_frame ()
{
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++)
{
CORE_ADDR adr;
adr = fsr.regs[regnum];
if (adr)
{
read_memory (adr, regbuf, REGISTER_RAW_SIZE (regnum));
write_register_bytes (REGISTER_BYTE (regnum), regbuf,
REGISTER_RAW_SIZE (regnum));
}
}
write_register (FP_REGNUM, read_memory_integer (fp, 4));
write_register (PC_REGNUM, read_memory_integer (fp + 4, 4));
write_register (SP_REGNUM, fp + 8);
flush_cached_frames ();
}
/* Simulate single-step. */
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;
/* 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;
{
unsigned long limm;
switch (insn >> 27)
{
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 */
*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! */
if (X_N (insn) == 0)
return BRANCH4;
return BRANCH8;
case 7 : /* jump insns */
if (LIMM_P (X_B (insn)))
{
limm = read_memory_integer (pc + 4, 4);
*target = ARC_PC_TO_REAL_ADDRESS (limm);
return BRANCH8;
}
if (SHIMM_P (X_B (insn)))
*target = ARC_PC_TO_REAL_ADDRESS (X_D (insn));
else
*target = ARC_PC_TO_REAL_ADDRESS (read_register (X_B (insn)));
if (X_Q (insn) == 0 && X_N (insn) == 0)
return BRANCH4;
return BRANCH8;
default : /* arithmetic insns, etc. */
if (LIMM_P (X_A (insn))
|| LIMM_P (X_B (insn))
|| LIMM_P (X_C (insn)))
return NORMAL8;
return NORMAL4;
}
}
/* single_step() is called just before we want to resume the inferior, if we
want to single-step it but there is no hardware or kernel single-step
support. We find all the possible targets of the coming instruction and
breakpoint them.
single_step is also called just after the inferior stops. If we had
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;
{
static CORE_ADDR next_pc, target;
static int brktrg_p;
typedef char binsn_quantum[BREAKPOINT_MAX];
static binsn_quantum break_mem[2];
if (insert_breakpoints_p)
{
insn_type type;
CORE_ADDR pc;
unsigned long insn;
pc = read_register (PC_REGNUM);
insn = read_memory_integer (pc, 4);
type = get_insn_type (insn, pc, &target);
/* Always set a breakpoint for the insn after the branch. */
next_pc = pc + ((type == NORMAL8 || type == BRANCH8) ? 8 : 4);
target_insert_breakpoint (next_pc, break_mem[0]);
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. */
&& target != next_pc)
{
brktrg_p = 1;
target_insert_breakpoint (target, break_mem[1]);
}
}
else
{
/* Remove breakpoints. */
target_remove_breakpoint (next_pc, break_mem[0]);
if (brktrg_p)
target_remove_breakpoint (target, break_mem[1]);
/* Fix the pc. */
stop_pc -= DECR_PC_AFTER_BREAK;
write_pc (stop_pc);
}
}
#ifdef GET_LONGJMP_TARGET
/* 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;
{
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 */
buf,
TARGET_PTR_BIT / TARGET_CHAR_BIT))
return 0;
jb_addr = extract_address (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
if (target_read_memory (jb_addr + JB_PC * JB_ELEMENT_SIZE, buf,
TARGET_PTR_BIT / TARGET_CHAR_BIT))
return 0;
*pc = extract_address (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
return 1;
}
#endif /* GET_LONGJMP_TARGET */
/* Disassemble one instruction. */
static int
arc_print_insn (vma, info)
bfd_vma vma;
disassemble_info *info;
{
static int current_mach;
static int current_endian;
static disassembler_ftype current_disasm;
if (current_disasm == NULL
|| arc_bfd_mach_type != current_mach
|| TARGET_BYTE_ORDER != current_endian)
{
current_mach = arc_bfd_mach_type;
current_endian = TARGET_BYTE_ORDER;
current_disasm = arc_get_disassembler (current_mach,
current_endian == BIG_ENDIAN);
}
return (*current_disasm) (vma, info);
}
/* Command to set cpu type. */
void
arc_set_cpu_type_command (args, from_tty)
char *args;
int from_tty;
{
int i;
if (tmp_arc_cpu_type == NULL || *tmp_arc_cpu_type == '\0')
{
printf_unfiltered ("The known ARC cpu types are as follows:\n");
for (i = 0; arc_cpu_type_table[i].name != NULL; ++i)
printf_unfiltered ("%s\n", arc_cpu_type_table[i].name);
/* Restore the value. */
tmp_arc_cpu_type = strsave (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);
}
}
static void
arc_show_cpu_type_command (args, from_tty)
char *args;
int from_tty;
{
}
/* Modify the actual cpu type.
Result is a boolean indicating success. */
int
arc_set_cpu_type (str)
char *str;
{
int i, j;
if (str == NULL)
return 0;
for (i = 0; arc_cpu_type_table[i].name != NULL; ++i)
{
if (strcasecmp (str, arc_cpu_type_table[i].name) == 0)
{
arc_cpu_type = str;
arc_bfd_mach_type = arc_cpu_type_table[i].value;
return 1;
}
}
return 0;
}
void
_initialize_arc_tdep ()
{
struct cmd_list_element *c;
c = add_set_cmd ("cpu", class_support, var_string_noescape,
(char *) &tmp_arc_cpu_type,
"Set the type of ARC cpu in use.\n\
This command has two purposes. In a multi-cpu system it lets one\n\
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;
c = add_show_from_set (c, &showlist);
c->function.cfunc = 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);
arc_set_cpu_type (tmp_arc_cpu_type);
c = add_set_cmd ("displaypipeline", class_support, var_zinteger,
(char *) &display_pipeline_p,
"Set pipeline display (simulator only).\n\
When enabled, the state of the pipeline after each cycle is displayed.",
&setlist);
c = add_show_from_set (c, &showlist);
c = add_set_cmd ("debugpipeline", class_support, var_zinteger,
(char *) &debug_pipeline_p,
"Set pipeline debug display (simulator only).\n\
When enabled, debugging information about the pipeline is displayed.",
&setlist);
c = add_show_from_set (c, &showlist);
c = add_set_cmd ("cputimer", class_support, var_zinteger,
(char *) &cpu_timer,
"Set maximum cycle count (simulator only).\n\
Control will return to gdb if the timer expires.\n\
A negative value disables the timer.",
&setlist);
c = add_show_from_set (c, &showlist);
tm_print_insn = arc_print_insn;
}

File diff suppressed because it is too large Load Diff

View File

@ -246,10 +246,10 @@ core_file_command (filename, from_tty)
if (val < 0
|| (val = myread (corechan, buf, sizeof buf)) < 0)
{
char * buffer = (char *) alloca (strlen (reg_names[regno])
char * buffer = (char *) alloca (strlen (REGISTER_NAME (regno))
+ 30);
strcpy (buffer, "Reading register ");
strcat (buffer, reg_names[regno]);
strcat (buffer, REGISTER_NAME (regno));
perror_with_name (buffer);
}
@ -274,3 +274,286 @@ core_file_command (filename, from_tty)
else if (from_tty)
printf ("No core file now.\n");
}
#if 0
/* Work with core dump and executable files, for GDB.
This code would be in corefile.c if it weren't machine-dependent. */
/* Structure to describe the chain of shared libraries used
by the execfile.
e.g. prog shares Xt which shares X11 which shares c. */
struct shared_library {
struct exec_header header;
char name[SHLIBLEN];
CORE_ADDR text_start; /* CORE_ADDR of 1st byte of text, this file */
long data_offset; /* offset of data section in file */
int chan; /* file descriptor for the file */
struct shared_library *shares; /* library this one shares */
};
static struct shared_library *shlib = 0;
/* Hook for `exec_file_command' command to call. */
extern void (*exec_file_display_hook) ();
static CORE_ADDR unshared_text_start;
/* extended header from exec file (for shared library info) */
static struct exec_header exec_header;
void
exec_file_command (filename, from_tty)
char *filename;
int from_tty;
{
int val;
/* Eliminate all traces of old exec file.
Mark text segment as empty. */
if (execfile)
free (execfile);
execfile = 0;
data_start = 0;
data_end -= exec_data_start;
text_start = 0;
unshared_text_start = 0;
text_end = 0;
exec_data_start = 0;
exec_data_end = 0;
if (execchan >= 0)
close (execchan);
execchan = -1;
if (shlib) {
close_shared_library(shlib);
shlib = 0;
}
/* Now open and digest the file the user requested, if any. */
if (filename)
{
filename = tilde_expand (filename);
make_cleanup (free, filename);
execchan = openp (getenv ("PATH"), 1, filename, O_RDONLY, 0,
&execfile);
if (execchan < 0)
perror_with_name (filename);
{
struct stat st_exec;
#ifdef HEADER_SEEK_FD
HEADER_SEEK_FD (execchan);
#endif
val = myread (execchan, &exec_header, sizeof exec_header);
exec_aouthdr = exec_header.a_exec;
if (val < 0)
perror_with_name (filename);
text_start = 0x8000;
/* Look for shared library if needed */
if (exec_header.a_exec.a_magic & MF_USES_SL)
shlib = open_shared_library(exec_header.a_shlibname, text_start);
text_offset = N_TXTOFF (exec_aouthdr);
exec_data_offset = N_TXTOFF (exec_aouthdr) + exec_aouthdr.a_text;
if (shlib) {
unshared_text_start = shared_text_end(shlib) & ~0x7fff;
stack_start = shlib->header.a_exec.a_sldatabase;
stack_end = STACK_END_ADDR;
} else
unshared_text_start = 0x8000;
text_end = unshared_text_start + exec_aouthdr.a_text;
exec_data_start = unshared_text_start + exec_aouthdr.a_text;
exec_data_end = exec_data_start + exec_aouthdr.a_data;
data_start = exec_data_start;
data_end += exec_data_start;
fstat (execchan, &st_exec);
exec_mtime = st_exec.st_mtime;
}
validate_files ();
}
else if (from_tty)
printf ("No executable file now.\n");
/* Tell display code (if any) about the changed file name. */
if (exec_file_display_hook)
(*exec_file_display_hook) (filename);
}
#endif
#if 0
/* Read from the program's memory (except for inferior processes).
This function is misnamed, since it only reads, never writes; and
since it will use the core file and/or executable file as necessary.
It should be extended to write as well as read, FIXME, for patching files.
Return 0 if address could be read, EIO if addresss out of bounds. */
int
xfer_core_file (memaddr, myaddr, len)
CORE_ADDR memaddr;
char *myaddr;
int len;
{
register int i;
register int val;
int xferchan;
char **xferfile;
int fileptr;
int returnval = 0;
while (len > 0)
{
xferfile = 0;
xferchan = 0;
/* Determine which file the next bunch of addresses reside in,
and where in the file. Set the file's read/write pointer
to point at the proper place for the desired address
and set xferfile and xferchan for the correct file.
If desired address is nonexistent, leave them zero.
i is set to the number of bytes that can be handled
along with the next address.
We put the most likely tests first for efficiency. */
/* Note that if there is no core file
data_start and data_end are equal. */
if (memaddr >= data_start && memaddr < data_end)
{
i = min (len, data_end - memaddr);
fileptr = memaddr - data_start + data_offset;
xferfile = &corefile;
xferchan = corechan;
}
/* Note that if there is no core file
stack_start and stack_end define the shared library data. */
else if (memaddr >= stack_start && memaddr < stack_end)
{
if (corechan < 0) {
struct shared_library *lib;
for (lib = shlib; lib; lib = lib->shares)
if (memaddr >= lib->header.a_exec.a_sldatabase &&
memaddr < lib->header.a_exec.a_sldatabase +
lib->header.a_exec.a_data)
break;
if (lib) {
i = min (len, lib->header.a_exec.a_sldatabase +
lib->header.a_exec.a_data - memaddr);
fileptr = lib->data_offset + memaddr -
lib->header.a_exec.a_sldatabase;
xferfile = execfile;
xferchan = lib->chan;
}
} else {
i = min (len, stack_end - memaddr);
fileptr = memaddr - stack_start + stack_offset;
xferfile = &corefile;
xferchan = corechan;
}
}
else if (corechan < 0
&& memaddr >= exec_data_start && memaddr < exec_data_end)
{
i = min (len, exec_data_end - memaddr);
fileptr = memaddr - exec_data_start + exec_data_offset;
xferfile = &execfile;
xferchan = execchan;
}
else if (memaddr >= text_start && memaddr < text_end)
{
struct shared_library *lib;
for (lib = shlib; lib; lib = lib->shares)
if (memaddr >= lib->text_start &&
memaddr < lib->text_start + lib->header.a_exec.a_text)
break;
if (lib) {
i = min (len, lib->header.a_exec.a_text +
lib->text_start - memaddr);
fileptr = memaddr - lib->text_start + text_offset;
xferfile = &execfile;
xferchan = lib->chan;
} else {
i = min (len, text_end - memaddr);
fileptr = memaddr - unshared_text_start + text_offset;
xferfile = &execfile;
xferchan = execchan;
}
}
else if (memaddr < text_start)
{
i = min (len, text_start - memaddr);
}
else if (memaddr >= text_end
&& memaddr < (corechan >= 0? data_start : exec_data_start))
{
i = min (len, data_start - memaddr);
}
else if (corechan >= 0
&& memaddr >= data_end && memaddr < stack_start)
{
i = min (len, stack_start - memaddr);
}
else if (corechan < 0 && memaddr >= exec_data_end)
{
i = min (len, - memaddr);
}
else if (memaddr >= stack_end && stack_end != 0)
{
i = min (len, - memaddr);
}
else
{
/* Address did not classify into one of the known ranges.
This shouldn't happen; we catch the endpoints. */
fatal ("Internal: Bad case logic in xfer_core_file.");
}
/* Now we know which file to use.
Set up its pointer and transfer the data. */
if (xferfile)
{
if (*xferfile == 0)
if (xferfile == &execfile)
error ("No program file to examine.");
else
error ("No core dump file or running program to examine.");
val = lseek (xferchan, fileptr, 0);
if (val < 0)
perror_with_name (*xferfile);
val = myread (xferchan, myaddr, i);
if (val < 0)
perror_with_name (*xferfile);
}
/* If this address is for nonexistent memory,
read zeros if reading, or do nothing if writing.
Actually, we never right. */
else
{
memset (myaddr, '\0', i);
returnval = EIO;
}
memaddr += i;
myaddr += i;
len -= i;
}
return returnval;
}
#endif

1942
contrib/gdb/gdb/ax-gdb.c Normal file

File diff suppressed because it is too large Load Diff

111
contrib/gdb/gdb/ax-gdb.h Normal file
View File

@ -0,0 +1,111 @@
/* GDB-specific functions for operating on agent expressions
Copyright 1998 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. */
/* $Id: ax-gdb.h,v 1.3.20.1 1999/04/01 17:33:04 jimb Exp $ */
#ifndef AX_GDB_H
#define AX_GDB_H
/* Types and enums */
/* GDB stores expressions in the form of a flattened tree (struct
expression), so we just walk that tree and generate agent bytecodes
as we go along.
GDB's normal evaluation uses struct value, which contains the
expression's value as well as its address or the register it came
from. The `+' operator uses the value, whereas the unary `&'
operator will use the address portion. The `=' operator will use
the address or register number of its left hand side.
The issues are different when generating agent bytecode. Given a
variable reference expression, we should not necessarily generate
code to fetch its value, because the next operator may be `=' or
unary `&'. Instead, when we recurse on a subexpression, we
indicate whether we want that expression to produce an lvalue or an
rvalue. If we requested an lvalue, then the recursive call tells
us whether it generated code to compute an address on the stack, or
whether the lvalue lives in a register.
The `axs' prefix here means `agent expression, static', because
this is all static analysis of the expression, i.e. analysis which
doesn't depend on the contents of memory and registers. */
/* 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,
/* 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
};
/* 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 */
/* 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));
/* 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));
/* 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 *));
#endif /* AX_GDB_H */

View File

@ -0,0 +1,552 @@
/* Functions for manipulating expressions designed to be executed on the agent
Copyright 1998 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. */
/* $Id: ax-general.c,v 1.3 1998/12/02 23:22:58 msnyder Exp $ */
/* Despite what the above comment says about this file being part of
GDB, we would like to keep these functions free of GDB
dependencies, since we want to be able to use them in contexts
outside of GDB (test suites, the stub, etc.) */
#include "defs.h"
#include "ax.h"
/* Functions for building expressions. */
/* Allocate a new, empty agent expression. */
struct agent_expr *
new_agent_expr (scope)
CORE_ADDR scope;
{
struct agent_expr *x = xmalloc (sizeof (*x));
x->len = 0;
x->size = 1; /* Change this to a larger value once
reallocation code is tested. */
x->buf = xmalloc (x->size);
x->scope = scope;
return x;
}
/* Free a agent expression. */
void
free_agent_expr (x)
struct agent_expr *x;
{
free (x->buf);
free (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;
{
if (x->len + n > x->size)
{
x->size *= 2;
if (x->size < x->len + n)
x->size = x->len + n + 10;
x->buf = xrealloc (x->buf, x->size);
}
}
/* 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;
{
int i;
grow_expr (x, n);
for (i = n - 1; i >= 0; i--)
{
x->buf[x->len + i] = val & 0xff;
val >>= 8;
}
x->len += 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;
{
int i;
LONGEST accum = 0;
/* Make sure we're not reading off the end of the expression. */
if (o + n > x->len)
error ("GDB bug: ax-general.c (read_const): incomplete constant");
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;
{
grow_expr (x, 1);
x->buf[x->len++] = 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;
{
/* N must fit in a byte. */
if (n < 0 || n > 255)
error ("GDB bug: ax-general.c (generic_ext): bit count out of range");
/* That had better be enough range. */
if (sizeof (LONGEST) * 8 > 255)
error ("GDB bug: ax-general.c (generic_ext): opcode has inadequate range");
grow_expr (x, 2);
x->buf[x->len++] = op;
x->buf[x->len++] = 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;
{
generic_ext (x, aop_ext, 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;
{
generic_ext (x, aop_zero_ext, n);
}
/* Append a trace_quick instruction to EXPR, to record N bytes. */
void
ax_trace_quick (x, n)
struct agent_expr *x;
int n;
{
/* N must fit in a byte. */
if (n < 0 || n > 255)
error ("GDB bug: ax-general.c (ax_trace_quick): size out of range for trace_quick");
grow_expr (x, 2);
x->buf[x->len++] = aop_trace_quick;
x->buf[x->len++] = 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,
because it's probably a forward branch, so we leave space in EXPR
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;
{
grow_expr (x, 3);
x->buf[x->len + 0] = op;
x->buf[x->len + 1] = 0xff;
x->buf[x->len + 2] = 0xff;
x->len += 3;
return x->len - 2;
}
/* 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)
to patch TARGET into the ax_goto instruction. */
void
ax_label (x, patch, target)
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;
}
/* Assemble code to push a constant on the stack. */
void
ax_const_l (x, l)
struct agent_expr *x;
LONGEST l;
{
static enum agent_op ops[]
= { aop_const8, aop_const16, aop_const32, aop_const64 };
int size;
int op;
/* How big is the number? 'op' keeps track of which opcode to use.
Notice that we don't really care whether the original number was
signed or unsigned; we always reproduce the value exactly, and
use the shortest representation. */
for (op = 0, size = 8; size < 64; size *= 2, op++)
if (-((LONGEST) 1 << size) <= l && l < ((LONGEST) 1 << size))
break;
/* Emit the right opcode... */
ax_simple (x, ops[op]);
/* Emit the low SIZE bytes as an unsigned number. We know that
sign-extending this will yield l. */
append_const (x, l, size / 8);
/* Now, if it was negative, and not full-sized, sign-extend it. */
if (l < 0 && size < 64)
ax_ext (x, size);
}
void
ax_const_d (x, 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");
}
/* Assemble code to push the value of register number REG on the
stack. */
void ax_reg (x, 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 + 1] = (reg >> 8) & 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 */
};
/* Disassemble the expression EXPR, writing to F. */
void
ax_print (f, x)
GDB_FILE *f;
struct agent_expr *x;
{
int i;
int is_float = 0;
/* Check the size of the name array against the number of entries in
the enum, to catch additions that people didn't sync. */
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; )
{
enum agent_op op = x->buf[i];
if (op >= (sizeof (aop_map) / sizeof (aop_map[0]))
|| ! aop_map[op].name)
{
fprintf_filtered (f, "%3d <bad opcode %02x>\n", i, op);
i++;
continue;
}
if (i + 1 + aop_map[op].op_size > x->len)
{
fprintf_filtered (f, "%3d <incomplete opcode %s>\n",
i, aop_map[op].name);
break;
}
fprintf_filtered (f, "%3d %s", i, aop_map[op].name);
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));
}
fprintf_filtered (f, "\n");
i += 1 + aop_map[op].op_size;
is_float = (op == aop_float);
}
}
/* 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;
{
int i;
int height;
/* Bit vector for registers used. */
int reg_mask_len = 1;
unsigned char *reg_mask = xmalloc (reg_mask_len * sizeof (reg_mask[0]));
/* Jump target table. targets[i] is non-zero iff there is a jump to
offset i. */
char *targets = (char *) alloca (ax->len * sizeof (targets[0]));
/* Instruction boundary table. boundary[i] is non-zero iff an
instruction starts at offset i. */
char *boundary = (char *) alloca (ax->len * sizeof (boundary[0]));
/* Stack height record. iff either targets[i] or boundary[i] is
non-zero, heights[i] is the height the stack should have before
executing the bytecode at that point. */
int *heights = (int *) alloca (ax->len * sizeof (heights[0]));
/* Pointer to a description of the present op. */
struct aop_map *op;
memset (reg_mask, 0, reg_mask_len * sizeof (reg_mask[0]));
memset (targets, 0, ax->len * sizeof (targets[0]));
memset (boundary, 0, ax->len * sizeof (boundary[0]));
reqs->max_height = reqs->min_height = height = 0;
reqs->flaw = agent_flaw_none;
reqs->max_data_size = 0;
for (i = 0; i < ax->len; i += 1 + op->op_size)
{
if (ax->buf[i] > (sizeof (aop_map) / sizeof (aop_map[0])))
{
reqs->flaw = agent_flaw_bad_instruction;
free (reg_mask);
return;
}
op = &aop_map[ax->buf[i]];
if (! op->name)
{
reqs->flaw = agent_flaw_bad_instruction;
free (reg_mask);
return;
}
if (i + 1 + op->op_size > ax->len)
{
reqs->flaw = agent_flaw_incomplete_instruction;
free (reg_mask);
return;
}
/* If this instruction is a jump target, does the current stack
height match the stack height at the jump source? */
if (targets[i] && (heights[i] != height))
{
reqs->flaw = agent_flaw_height_mismatch;
free (reg_mask);
return;
}
boundary[i] = 1;
heights[i] = height;
height -= op->consumed;
if (height < reqs->min_height)
reqs->min_height = height;
height += op->produced;
if (height > reqs->max_height)
reqs->max_height = height;
if (op->data_size > reqs->max_data_size)
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. */
if (aop_goto == op - aop_map
|| aop_if_goto == op - aop_map)
{
int target = read_const (ax, i + 1, 2);
if (target < 0 || target >= ax->len)
{
reqs->flaw = agent_flaw_bad_jump;
free (reg_mask);
return;
}
/* Have we already found other jumps to the same location? */
else if (targets[target])
{
if (heights[i] != height)
{
reqs->flaw = agent_flaw_height_mismatch;
free (reg_mask);
return;
}
}
else
{
targets[target] = 1;
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])
{
reqs->flaw = agent_flaw_hole;
free (reg_mask);
return;
}
height = heights[i + 3];
}
/* For reg instructions, record the register in the bit mask. */
if (aop_reg == op - aop_map)
{
int reg = read_const (ax, i + 1, 2);
int byte = reg / 8;
/* Grow the bit mask if necessary. */
if (byte >= reg_mask_len)
{
/* It's not appropriate to double here. This isn't a
string buffer. */
int new_len = byte + 1;
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]));
reg_mask_len = new_len;
}
reg_mask[byte] |= 1 << (reg % 8);
}
}
/* Check that all the targets are on boundaries. */
for (i = 0; i < ax->len; i++)
if (targets[i] && !boundary[i])
{
reqs->flaw = agent_flaw_bad_jump;
free (reg_mask);
return;
}
reqs->final_height = height;
reqs->reg_mask_len = reg_mask_len;
reqs->reg_mask = reg_mask;
}

285
contrib/gdb/gdb/ax.h Normal file
View File

@ -0,0 +1,285 @@
/* Definitions for expressions designed to be executed on the agent
Copyright 1998 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. */
/* $Id: ax.h,v 1.3.20.1 1999/04/01 17:33:04 jimb Exp $ */
#ifndef AGENTEXPR_H
#define AGENTEXPR_H
/* 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
stop at it), and specify a bunch of expressions to record the
values of when that tracepoint is reached. As the program runs,
GDB collects the values. At any point (possibly while values are
still being collected), the user can display the collected values.
This is used with remote debugging; we don't really support it on
native configurations.
This means that expressions are being evaluated by the remote agent,
which doesn't have any access to the symbol table information, and
needs to be small and simple.
The agent_expr routines and datatypes are a bytecode language
designed to be executed by the agent. Agent expressions work in
terms of fixed-width values, operators, memory references, and
register references. You can evaluate a agent expression just given
a bunch of memory and register values to sniff at; you don't need
any symbolic information like variable names, types, etc.
GDB translates source expressions, whose meaning depends on
symbolic information, into agent bytecode expressions, whose meaning
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.
The bytecode operation indicates which element we should access;
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;
};
/* 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;
};
/* The actual values of the various bytecode operations.
Other independent implementations of the agent bytecode engine will
rely on the exact values of these enums, and may not be recompiled
when we change this table. The numeric values should remain fixed
whenever possible. Thus, we assign them values explicitly here (to
allow gaps to form safely), and the disassembly table in
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
};
/* Functions for building expressions. */
/* Allocate a new, empty agent expression. */
extern struct agent_expr *new_agent_expr PARAMS ((CORE_ADDR));
/* Free a agent expression. */
extern void free_agent_expr PARAMS ((struct agent_expr *));
/* Append a simple operator OP to EXPR. */
extern void ax_simple PARAMS ((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));
/* 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));
/* Append a trace_quick instruction to EXPR, to record N bytes. */
extern void ax_trace_quick PARAMS ((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,
because it's probably a forward branch, so we leave space in EXPR
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));
/* 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)
to patch TARGET into the ax_goto instruction. */
extern void ax_label PARAMS ((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));
/* Assemble code to push the value of register number REG on the
stack. */
extern void ax_reg PARAMS ((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));
/* An entry in the opcode 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;
/* 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;
/* 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;
};
/* 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 */
/* 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,
/* 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 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 {
/* 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;
/* 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;
/* Bit vector of registers used. Register R is used iff
reg_mask[R / 8] & (1 << (R % 8))
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.
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));
#endif /* AGENTEXPR_H */

View File

@ -1,6 +1,6 @@
/* Implement a cached obstack.
Written by Fred Fish (fnf@cygnus.com)
Copyright 1995 Free Software Foundation, Inc.
Copyright 1995, 1998 Free Software Foundation, Inc.
This file is part of GDB.
@ -23,6 +23,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bcache.h"
#include "gdb_string.h" /* For memcpy declaration */
/* Prototypes for local functions. */
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. */
@ -173,16 +179,40 @@ print_bcache_statistics (bcachep, id)
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: %d%%\n", ((bcachep -> cache_hits) * 100) / (bcachep -> cache_hits + 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: %d%%\n",
(hcount * 100) / (tcount * BCACHE_HASHSIZE));
printf_filtered (" Average chain length %d\n", lcount / hcount);
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);
}

View File

@ -47,7 +47,7 @@ struct hashlink {
a hashlink struct to hold the next pointer and the data. */
#define BCACHE_DATA_ALIGNMENT \
(((char *) &BCACHE_DATA((struct hashlink*) 0) - (char *) 0))
(((char *) BCACHE_DATA((struct hashlink*) 0) - (char *) 0))
struct bcache {
struct obstack cache;

View File

@ -1,6 +1,6 @@
/* Get info from stack frames;
convert between frames, blocks, functions and pc values.
Copyright 1986, 1987, 1988, 1989, 1991, 1994, 1995
Copyright 1986, 87, 88, 89, 91, 94, 95, 96, 97, 1998
Free Software Foundation, Inc.
This file is part of GDB.
@ -31,6 +31,47 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "inferior.h" /* for read_pc */
#include "annotate.h"
/* Prototypes for exported functions. */
void _initialize_blockframe PARAMS ((void));
/* A default FRAME_CHAIN_VALID, in the form that is suitable for most
targets. If FRAME_CHAIN_VALID returns zero it means that the given
frame is the outermost one and has no caller. */
int
default_frame_chain_valid (chain, thisframe)
CORE_ADDR chain;
struct frame_info *thisframe;
{
return ((chain) != 0
&& !inside_main_func ((thisframe) -> pc)
&& !inside_entry_func ((thisframe) -> pc));
}
/* Use the alternate method of avoiding running up off the end of the
frame chain or following frames back into the startup code. See
the comments in objfiles.h. */
int
alternate_frame_chain_valid (chain, thisframe)
CORE_ADDR chain;
struct frame_info *thisframe;
{
return ((chain) != 0
&& !inside_entry_file (FRAME_SAVED_PC (thisframe)));
}
/* A very simple method of determining a valid frame */
int
nonnull_frame_chain_valid (chain, thisframe)
CORE_ADDR chain;
struct frame_info *thisframe;
{
return ((chain) != 0);
}
/* Is ADDR inside the startup file? Note that if your machine
has a way to detect the bottom of the stack, there is no need
to call this function from FRAME_CHAIN_VALID; the reason for
@ -50,7 +91,8 @@ inside_entry_file (addr)
#if CALL_DUMMY_LOCATION == AT_ENTRY_POINT
/* Do not stop backtracing if the pc is in the call dummy
at the entry point. */
if (PC_IN_CALL_DUMMY (addr, 0, 0))
/* FIXME: Won't always work with zeros for the last two arguments */
if (PC_IN_CALL_DUMMY (addr, 0, 0))
return 0;
#endif
return (addr >= symfile_objfile -> ei.entry_file_lowpc &&
@ -69,7 +111,6 @@ int
inside_main_func (pc)
CORE_ADDR pc;
{
struct symbol *mainsym;
if (pc == 0)
return 1;
if (symfile_objfile == 0)
@ -82,13 +123,16 @@ struct symbol *mainsym;
if (symfile_objfile -> ei.main_func_lowpc == INVALID_ENTRY_LOWPC &&
symfile_objfile -> ei.main_func_highpc == INVALID_ENTRY_HIGHPC)
{
struct symbol *mainsym;
mainsym = lookup_symbol ("main", NULL, VAR_NAMESPACE, NULL, NULL);
if (mainsym && SYMBOL_CLASS(mainsym) == LOC_BLOCK)
{
symfile_objfile->ei.main_func_lowpc = BLOCK_START (SYMBOL_BLOCK_VALUE (mainsym));
symfile_objfile->ei.main_func_highpc = BLOCK_END (SYMBOL_BLOCK_VALUE (mainsym));
symfile_objfile->ei.main_func_lowpc =
BLOCK_START (SYMBOL_BLOCK_VALUE (mainsym));
symfile_objfile->ei.main_func_highpc =
BLOCK_END (SYMBOL_BLOCK_VALUE (mainsym));
}
}
return (symfile_objfile -> ei.main_func_lowpc <= pc &&
symfile_objfile -> ei.main_func_highpc > pc);
@ -113,6 +157,7 @@ CORE_ADDR pc;
#if CALL_DUMMY_LOCATION == AT_ENTRY_POINT
/* Do not stop backtracing if the pc is in the call dummy
at the entry point. */
/* FIXME: Won't always work with zeros for the last two arguments */
if (PC_IN_CALL_DUMMY (pc, 0, 0))
return 0;
#endif
@ -128,7 +173,24 @@ static struct frame_info *current_frame;
inferior is stopped. Control variables for the frame cache should
be local to this module. */
struct obstack frame_cache_obstack;
static struct obstack frame_cache_obstack;
void *
frame_obstack_alloc (size)
unsigned long size;
{
return obstack_alloc (&frame_cache_obstack, size);
}
void
frame_saved_regs_zalloc (fi)
struct frame_info *fi;
{
fi->saved_regs = (CORE_ADDR*)
frame_obstack_alloc (SIZEOF_FRAME_SAVED_REGS);
memset (fi->saved_regs, 0, SIZEOF_FRAME_SAVED_REGS);
}
/* Return the innermost (currently executing) stack frame. */
@ -168,6 +230,7 @@ create_new_frame (addr, pc)
sizeof (struct frame_info));
/* Arbitrary frame */
fi->saved_regs = NULL;
fi->next = NULL;
fi->prev = NULL;
fi->frame = addr;
@ -244,9 +307,10 @@ frameless_look_for_prologue (frame)
struct frame_info *frame;
{
CORE_ADDR func_start, after_prologue;
func_start = (get_pc_function_start (frame->pc) + FUNCTION_START_OFFSET);
func_start = get_pc_function_start (frame->pc);
if (func_start)
{
func_start += FUNCTION_START_OFFSET;
after_prologue = func_start;
#ifdef SKIP_PROLOGUE_FRAMELESS_P
/* This is faster, since only care whether there *is* a prologue,
@ -257,6 +321,12 @@ frameless_look_for_prologue (frame)
#endif
return after_prologue == func_start;
}
else if (frame->pc == 0)
/* A frame with a zero PC is usually created by dereferencing a NULL
function pointer, normally causing an immediate core dump of the
inferior. Mark function as frameless, as the inferior has no chance
of setting up a stack frame. */
return 1;
else
/* If we can't find the start of the function, we don't really
know whether the function is frameless, but we should be able
@ -358,6 +428,7 @@ get_prev_frame_info (next_frame)
obstack_alloc (&frame_cache_obstack,
sizeof (struct frame_info));
prev->saved_regs = NULL;
if (next_frame)
next_frame->prev = prev;
prev->next = next_frame;
@ -449,7 +520,10 @@ get_frame_pc (frame)
return frame->pc;
}
#if defined (FRAME_FIND_SAVED_REGS)
#ifdef FRAME_FIND_SAVED_REGS
/* XXX - deprecated. This is a compatibility function for targets
that do not yet implement FRAME_INIT_SAVED_REGS. */
/* Find the addresses in which registers are saved in FRAME. */
void
@ -457,7 +531,22 @@ get_frame_saved_regs (frame, saved_regs_addr)
struct frame_info *frame;
struct frame_saved_regs *saved_regs_addr;
{
FRAME_FIND_SAVED_REGS (frame, *saved_regs_addr);
if (frame->saved_regs == NULL)
{
frame->saved_regs = (CORE_ADDR*)
frame_obstack_alloc (SIZEOF_FRAME_SAVED_REGS);
}
if (saved_regs_addr == NULL)
{
struct frame_saved_regs saved_regs;
FRAME_FIND_SAVED_REGS (frame, saved_regs);
memcpy (frame->saved_regs, &saved_regs, SIZEOF_FRAME_SAVED_REGS);
}
else
{
FRAME_FIND_SAVED_REGS (frame, *saved_regs_addr);
memcpy (frame->saved_regs, saved_regs_addr, SIZEOF_FRAME_SAVED_REGS);
}
}
#endif
@ -526,27 +615,32 @@ get_frame_function (frame)
return block_function (bl);
}
/* Return the blockvector immediately containing the innermost lexical block
containing the specified pc value, or 0 if there is none.
containing the specified pc value and section, or 0 if there is none.
PINDEX is a pointer to the index value of the block. If PINDEX
is NULL, we don't pass this information back to the caller. */
struct blockvector *
blockvector_for_pc (pc, pindex)
blockvector_for_pc_sect (pc, section, pindex, symtab)
register CORE_ADDR pc;
struct sec *section;
int *pindex;
struct symtab *symtab;
{
register struct block *b;
register int bot, top, half;
register struct symtab *s;
struct blockvector *bl;
/* First search all symtabs for one whose file contains our pc */
s = find_pc_symtab (pc);
if (s == 0)
return 0;
if (symtab == 0) /* if no symtab specified by caller */
{
/* First search all symtabs for one whose file contains our pc */
if ((symtab = find_pc_sect_symtab (pc, section)) == 0)
return 0;
}
bl = BLOCKVECTOR (s);
bl = BLOCKVECTOR (symtab);
b = BLOCKVECTOR_BLOCK (bl, 0);
/* Then search that symtab for the smallest block that wins. */
@ -570,7 +664,7 @@ blockvector_for_pc (pc, pindex)
while (bot >= 0)
{
b = BLOCKVECTOR_BLOCK (bl, bot);
if (BLOCK_END (b) > pc)
if (BLOCK_END (b) >= pc)
{
if (pindex)
*pindex = bot;
@ -578,45 +672,80 @@ blockvector_for_pc (pc, pindex)
}
bot--;
}
return 0;
}
/* Return the innermost lexical block containing the specified pc value,
or 0 if there is none. */
/* Return the blockvector immediately containing the innermost lexical block
containing the specified pc value, or 0 if there is none.
Backward compatibility, no section. */
struct blockvector *
blockvector_for_pc (pc, pindex)
register CORE_ADDR pc;
int *pindex;
{
return blockvector_for_pc_sect (pc, find_pc_mapped_section (pc),
pindex, NULL);
}
/* Return the innermost lexical block containing the specified pc value
in the specified section, or 0 if there is none. */
struct block *
block_for_pc (pc)
block_for_pc_sect (pc, section)
register CORE_ADDR pc;
struct sec *section;
{
register struct blockvector *bl;
int index;
bl = blockvector_for_pc (pc, &index);
bl = blockvector_for_pc_sect (pc, section, &index, NULL);
if (bl)
return BLOCKVECTOR_BLOCK (bl, index);
return 0;
}
/* Return the function containing pc value PC.
/* Return the innermost lexical block containing the specified pc value,
or 0 if there is none. Backward compatibility, no section. */
struct block *
block_for_pc (pc)
register CORE_ADDR pc;
{
return block_for_pc_sect (pc, find_pc_mapped_section (pc));
}
/* Return the function containing pc value PC in section SECTION.
Returns 0 if function is not known. */
struct symbol *
find_pc_function (pc)
find_pc_sect_function (pc, section)
CORE_ADDR pc;
struct sec *section;
{
register struct block *b = block_for_pc (pc);
register struct block *b = block_for_pc_sect (pc, section);
if (b == 0)
return 0;
return block_function (b);
}
/* Return the function containing pc value PC.
Returns 0 if function is not known. Backward compatibility, no section */
struct symbol *
find_pc_function (pc)
CORE_ADDR pc;
{
return find_pc_sect_function (pc, find_pc_mapped_section (pc));
}
/* These variables are used to cache the most recent result
* of find_pc_partial_function. */
static CORE_ADDR cache_pc_function_low = 0;
static CORE_ADDR cache_pc_function_high = 0;
static char *cache_pc_function_name = 0;
static CORE_ADDR cache_pc_function_low = 0;
static CORE_ADDR cache_pc_function_high = 0;
static char *cache_pc_function_name = 0;
static struct sec *cache_pc_function_section = NULL;
/* Clear cache, e.g. when symbol table is discarded. */
@ -626,50 +755,58 @@ clear_pc_function_cache()
cache_pc_function_low = 0;
cache_pc_function_high = 0;
cache_pc_function_name = (char *)0;
cache_pc_function_section = NULL;
}
/* Finds the "function" (text symbol) that is smaller than PC but
greatest of all of the potential text symbols. Sets *NAME and/or
*ADDRESS conditionally if that pointer is non-null. If ENDADDR is
non-null, then set *ENDADDR to be the end of the function
(exclusive), but passing ENDADDR as non-null means that the
function might cause symbols to be read. This function either
greatest of all of the potential text symbols in SECTION. Sets
*NAME and/or *ADDRESS conditionally if that pointer is non-null.
If ENDADDR is non-null, then set *ENDADDR to be the end of the
function (exclusive), but passing ENDADDR as non-null means that
the function might cause symbols to be read. This function either
succeeds or fails (not halfway succeeds). If it succeeds, it sets
*NAME, *ADDRESS, and *ENDADDR to real information and returns 1.
If it fails, it sets *NAME, *ADDRESS, and *ENDADDR to zero
and returns 0. */
If it fails, it sets *NAME, *ADDRESS, and *ENDADDR to zero and
returns 0. */
int
find_pc_partial_function (pc, name, address, endaddr)
CORE_ADDR pc;
char **name;
find_pc_sect_partial_function (pc, section, name, address, endaddr)
CORE_ADDR pc;
asection *section;
char **name;
CORE_ADDR *address;
CORE_ADDR *endaddr;
{
struct partial_symtab *pst;
struct symbol *f;
struct symbol *f;
struct minimal_symbol *msymbol;
struct partial_symbol *psb;
struct obj_section *sec;
struct obj_section *osect;
int i;
CORE_ADDR mapped_pc;
if (pc >= cache_pc_function_low && pc < cache_pc_function_high)
mapped_pc = overlay_mapped_address (pc, section);
if (mapped_pc >= cache_pc_function_low &&
mapped_pc < cache_pc_function_high &&
section == cache_pc_function_section)
goto return_cached_value;
/* If sigtramp is in the u area, it counts as a function (especially
important for step_1). */
#if defined SIGTRAMP_START
if (IN_SIGTRAMP (pc, (char *)NULL))
if (IN_SIGTRAMP (mapped_pc, (char *)NULL))
{
cache_pc_function_low = SIGTRAMP_START;
cache_pc_function_high = SIGTRAMP_END;
cache_pc_function_name = "<sigtramp>";
cache_pc_function_low = SIGTRAMP_START (mapped_pc);
cache_pc_function_high = SIGTRAMP_END (mapped_pc);
cache_pc_function_name = "<sigtramp>";
cache_pc_function_section = section;
goto return_cached_value;
}
#endif
msymbol = lookup_minimal_symbol_by_pc (pc);
pst = find_pc_psymtab (pc);
msymbol = lookup_minimal_symbol_by_pc_section (mapped_pc, section);
pst = find_pc_sect_psymtab (mapped_pc, section);
if (pst)
{
/* Need to read the symbols to get a good value for the end address. */
@ -685,15 +822,16 @@ find_pc_partial_function (pc, name, address, endaddr)
{
/* Checking whether the msymbol has a larger value is for the
"pathological" case mentioned in print_frame_info. */
f = find_pc_function (pc);
f = find_pc_sect_function (mapped_pc, section);
if (f != NULL
&& (msymbol == NULL
|| (BLOCK_START (SYMBOL_BLOCK_VALUE (f))
>= SYMBOL_VALUE_ADDRESS (msymbol))))
{
cache_pc_function_low = BLOCK_START (SYMBOL_BLOCK_VALUE (f));
cache_pc_function_high = BLOCK_END (SYMBOL_BLOCK_VALUE (f));
cache_pc_function_name = SYMBOL_NAME (f);
cache_pc_function_low = BLOCK_START (SYMBOL_BLOCK_VALUE (f));
cache_pc_function_high = BLOCK_END (SYMBOL_BLOCK_VALUE (f));
cache_pc_function_name = SYMBOL_NAME (f);
cache_pc_function_section = section;
goto return_cached_value;
}
}
@ -702,7 +840,7 @@ find_pc_partial_function (pc, name, address, endaddr)
/* Now that static symbols go in the minimal symbol table, perhaps
we could just ignore the partial symbols. But at least for now
we use the partial or minimal symbol, whichever is larger. */
psb = find_pc_psymbol (pst, pc);
psb = find_pc_sect_psymbol (pst, mapped_pc, section);
if (psb
&& (msymbol == NULL ||
@ -725,9 +863,9 @@ find_pc_partial_function (pc, name, address, endaddr)
of the text seg doesn't appear to be part of the last function in the
text segment. */
sec = find_pc_section (pc);
osect = find_pc_sect_section (mapped_pc, section);
if (!sec)
if (!osect)
msymbol = NULL;
/* Must be in the minimal symbol table. */
@ -743,30 +881,79 @@ find_pc_partial_function (pc, name, address, endaddr)
return 0;
}
cache_pc_function_low = SYMBOL_VALUE_ADDRESS (msymbol);
cache_pc_function_name = SYMBOL_NAME (msymbol);
cache_pc_function_low = SYMBOL_VALUE_ADDRESS (msymbol);
cache_pc_function_name = SYMBOL_NAME (msymbol);
cache_pc_function_section = section;
/* Use the lesser of the next minimal symbol, or the end of the section, as
the end of the function. */
/* Use the lesser of the next minimal symbol in the same section, or
the end of the section, as the end of the function. */
/* Step over other symbols at this same address, and symbols in
other sections, to find the next symbol in this section with
a different address. */
if (SYMBOL_NAME (msymbol + 1) != NULL
&& SYMBOL_VALUE_ADDRESS (msymbol + 1) < sec->endaddr)
cache_pc_function_high = SYMBOL_VALUE_ADDRESS (msymbol + 1);
for (i=1; SYMBOL_NAME (msymbol+i) != NULL; i++)
{
if (SYMBOL_VALUE_ADDRESS (msymbol+i) != SYMBOL_VALUE_ADDRESS (msymbol)
&& SYMBOL_BFD_SECTION (msymbol+i) == SYMBOL_BFD_SECTION (msymbol))
break;
}
if (SYMBOL_NAME (msymbol + i) != NULL
&& SYMBOL_VALUE_ADDRESS (msymbol + i) < osect->endaddr)
cache_pc_function_high = SYMBOL_VALUE_ADDRESS (msymbol + i);
else
/* We got the start address from the last msymbol in the objfile.
So the end address is the end of the section. */
cache_pc_function_high = sec->endaddr;
cache_pc_function_high = osect->endaddr;
return_cached_value:
if (address)
*address = cache_pc_function_low;
{
if (pc_in_unmapped_range (pc, section))
*address = overlay_unmapped_address (cache_pc_function_low, section);
else
*address = cache_pc_function_low;
}
if (name)
*name = cache_pc_function_name;
if (endaddr)
*endaddr = cache_pc_function_high;
{
if (pc_in_unmapped_range (pc, section))
{
/* Because the high address is actually beyond the end of
the function (and therefore possibly beyond the end of
the overlay), we must actually convert (high - 1)
and then add one to that. */
*endaddr = 1 + overlay_unmapped_address (cache_pc_function_high - 1,
section);
}
else
*endaddr = cache_pc_function_high;
}
return 1;
}
/* Backward compatibility, no section argument */
int
find_pc_partial_function (pc, name, address, endaddr)
CORE_ADDR pc;
char **name;
CORE_ADDR *address;
CORE_ADDR *endaddr;
{
asection *section;
section = find_pc_overlay (pc);
return find_pc_sect_partial_function (pc, section, name, address, endaddr);
}
/* Return the innermost stack frame executing inside of BLOCK,
or NULL if there is no such frame. If BLOCK is NULL, just return NULL. */
@ -847,6 +1034,266 @@ sigtramp_saved_pc (frame)
}
#endif /* SIGCONTEXT_PC_OFFSET */
#ifdef USE_GENERIC_DUMMY_FRAMES
/*
* GENERIC DUMMY FRAMES
*
* The following code serves to maintain the dummy stack frames for
* inferior function calls (ie. when gdb calls into the inferior via
* call_function_by_hand). This code saves the machine state before
* the call in host memory, so we must maintain an independant stack
* and keep it consistant etc. I am attempting to make this code
* generic enough to be used by many targets.
*
* The cheapest and most generic way to do CALL_DUMMY on a new target
* is probably to define CALL_DUMMY to be empty, CALL_DUMMY_LENGTH to
* zero, and CALL_DUMMY_LOCATION to AT_ENTRY. Then you must remember
* to define PUSH_RETURN_ADDRESS, because no call instruction will be
* being executed by the target. Also FRAME_CHAIN_VALID as
* generic_frame_chain_valid. */
static struct dummy_frame *dummy_frame_stack = NULL;
/* Function: find_dummy_frame(pc, fp, sp)
Search the stack of dummy frames for one matching the given PC, FP and SP.
This is the work-horse for pc_in_call_dummy and read_register_dummy */
char *
generic_find_dummy_frame (pc, fp)
CORE_ADDR pc;
CORE_ADDR fp;
{
struct dummy_frame * dummyframe;
if (pc != entry_point_address ())
return 0;
for (dummyframe = dummy_frame_stack; dummyframe != NULL;
dummyframe = dummyframe->next)
if (fp == dummyframe->fp || fp == dummyframe->sp)
/* The frame in question lies between the saved fp and sp, inclusive */
return dummyframe->regs;
return 0;
}
/* Function: pc_in_call_dummy (pc, fp)
Return true if this is a dummy frame created by gdb for an inferior call */
int
generic_pc_in_call_dummy (pc, fp)
CORE_ADDR pc;
CORE_ADDR fp;
{
/* if find_dummy_frame succeeds, then PC is in a call dummy */
return (generic_find_dummy_frame (pc, fp) != 0);
}
/* Function: read_register_dummy
Find a saved register from before GDB calls a function in the inferior */
CORE_ADDR
generic_read_register_dummy (pc, fp, regno)
CORE_ADDR pc;
CORE_ADDR fp;
int regno;
{
char *dummy_regs = generic_find_dummy_frame (pc, fp);
if (dummy_regs)
return extract_address (&dummy_regs[REGISTER_BYTE (regno)],
REGISTER_RAW_SIZE(regno));
else
return 0;
}
/* Save all the registers on the dummy frame stack. Most ports save the
registers on the target stack. This results in lots of unnecessary memory
references, which are slow when debugging via a serial line. Instead, we
save all the registers internally, and never write them to the stack. The
registers get restored when the called function returns to the entry point,
where a breakpoint is laying in wait. */
void
generic_push_dummy_frame ()
{
struct dummy_frame *dummy_frame;
CORE_ADDR fp = (get_current_frame ())->frame;
/* check to see if there are stale dummy frames,
perhaps left over from when a longjump took us out of a
function that was called by the debugger */
dummy_frame = dummy_frame_stack;
while (dummy_frame)
if (INNER_THAN (dummy_frame->fp, fp)) /* stale -- destroy! */
{
dummy_frame_stack = dummy_frame->next;
free (dummy_frame);
dummy_frame = dummy_frame_stack;
}
else
dummy_frame = dummy_frame->next;
dummy_frame = xmalloc (sizeof (struct dummy_frame));
dummy_frame->pc = read_register (PC_REGNUM);
dummy_frame->sp = read_register (SP_REGNUM);
dummy_frame->fp = fp;
read_register_bytes (0, dummy_frame->regs, REGISTER_BYTES);
dummy_frame->next = dummy_frame_stack;
dummy_frame_stack = dummy_frame;
}
/* Function: pop_frame
Restore the machine state from either the saved dummy stack or a
real stack frame. */
void
generic_pop_current_frame (pop)
void (*pop) PARAMS ((struct frame_info *frame));
{
struct frame_info *frame = get_current_frame ();
if (PC_IN_CALL_DUMMY(frame->pc, frame->frame, frame->frame))
generic_pop_dummy_frame ();
else
pop (frame);
}
/* Function: pop_dummy_frame
Restore the machine state from a saved dummy stack frame. */
void
generic_pop_dummy_frame ()
{
struct dummy_frame *dummy_frame = dummy_frame_stack;
/* FIXME: what if the first frame isn't the right one, eg..
because one call-by-hand function has done a longjmp into another one? */
if (!dummy_frame)
error ("Can't pop dummy frame!");
dummy_frame_stack = dummy_frame->next;
write_register_bytes (0, dummy_frame->regs, REGISTER_BYTES);
flush_cached_frames ();
free (dummy_frame);
}
/* Function: frame_chain_valid
Returns true for a user frame or a call_function_by_hand dummy frame,
and false for the CRT0 start-up frame. Purpose is to terminate backtrace */
int
generic_frame_chain_valid (fp, fi)
CORE_ADDR fp;
struct frame_info *fi;
{
if (PC_IN_CALL_DUMMY(FRAME_SAVED_PC(fi), fp, fp))
return 1; /* don't prune CALL_DUMMY frames */
else /* fall back to default algorithm (see frame.h) */
return (fp != 0
&& (INNER_THAN (fi->frame, fp) || fi->frame == fp)
&& !inside_entry_file (FRAME_SAVED_PC(fi)));
}
/* Function: get_saved_register
Find register number REGNUM relative to FRAME and put its (raw,
target format) contents in *RAW_BUFFER.
Set *OPTIMIZED if the variable was optimized out (and thus can't be
fetched). Note that this is never set to anything other than zero
in this implementation.
Set *LVAL to lval_memory, lval_register, or not_lval, depending on
whether the value was fetched from memory, from a register, or in a
strange and non-modifiable way (e.g. a frame pointer which was
calculated rather than fetched). We will use not_lval for values
fetched from generic dummy frames.
Set *ADDRP to the address, either in memory on as a REGISTER_BYTE
offset into the registers array. If the value is stored in a dummy
frame, set *ADDRP to zero.
To use this implementation, define a function called
"get_saved_register" in your target code, which simply passes all
of its arguments to this function.
The argument RAW_BUFFER must point to aligned memory. */
void
generic_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
char *raw_buffer;
int *optimized;
CORE_ADDR *addrp;
struct frame_info *frame;
int regnum;
enum lval_type *lval;
{
if (!target_has_registers)
error ("No registers.");
/* Normal systems don't optimize out things with register numbers. */
if (optimized != NULL)
*optimized = 0;
if (addrp) /* default assumption: not found in memory */
*addrp = 0;
/* Note: since the current frame's registers could only have been
saved by frames INTERIOR TO the current frame, we skip examining
the current frame itself: otherwise, we would be getting the
previous frame's registers which were saved by the current frame. */
while (frame && ((frame = frame->next) != NULL))
{
if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
{
if (lval) /* found it in a CALL_DUMMY frame */
*lval = not_lval;
if (raw_buffer)
memcpy (raw_buffer,
generic_find_dummy_frame (frame->pc, frame->frame) +
REGISTER_BYTE (regnum),
REGISTER_RAW_SIZE (regnum));
return;
}
FRAME_INIT_SAVED_REGS (frame);
if (frame->saved_regs != NULL
&& frame->saved_regs[regnum] != 0)
{
if (lval) /* found it saved on the stack */
*lval = lval_memory;
if (regnum == SP_REGNUM)
{
if (raw_buffer) /* SP register treated specially */
store_address (raw_buffer, REGISTER_RAW_SIZE (regnum),
frame->saved_regs[regnum]);
}
else
{
if (addrp) /* any other register */
*addrp = frame->saved_regs[regnum];
if (raw_buffer)
read_memory (frame->saved_regs[regnum], raw_buffer,
REGISTER_RAW_SIZE (regnum));
}
return;
}
}
/* If we get thru the loop to this point, it means the register was
not saved in any frame. Return the actual live-register value. */
if (lval) /* found it in a live register */
*lval = lval_register;
if (addrp)
*addrp = REGISTER_BYTE (regnum);
if (raw_buffer)
read_register_gen (regnum, raw_buffer);
}
#endif /* USE_GENERIC_DUMMY_FRAMES */
void
_initialize_blockframe ()
{

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/* Data structures associated with breakpoints in GDB.
Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
Copyright (C) 1992, 93, 94, 95, 96, 98, 1999 Free Software Foundation, Inc.
This file is part of GDB.
@ -38,6 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
possible like a single-step to wait_for_inferior). */
enum bptype {
bp_none = 0, /* Eventpoint has been deleted. */
bp_breakpoint, /* Normal breakpoint */
bp_hardware_breakpoint, /* Hardware assisted breakpoint */
bp_until, /* used by until command */
@ -87,17 +88,55 @@ enum bptype {
when these significant events occur. GDB can then re-examine
the dynamic linker's data structures to discover any newly loaded
dynamic libraries. */
bp_shlib_event
bp_shlib_event,
/* These breakpoints are used to implement the "catch load" command
on platforms whose dynamic linkers support such functionality. */
bp_catch_load,
/* These breakpoints are used to implement the "catch unload" command
on platforms whose dynamic linkers support such functionality. */
bp_catch_unload,
/* These are not really breakpoints, but are catchpoints that
implement the "catch fork", "catch vfork" and "catch exec" commands
on platforms whose kernel support such functionality. (I.e.,
kernels which can raise an event when a fork or exec occurs, as
opposed to the debugger setting breakpoints on functions named
"fork" or "exec".) */
bp_catch_fork,
bp_catch_vfork,
bp_catch_exec,
/* These are catchpoints to implement "catch catch" and "catch throw"
commands for C++ exception handling. */
bp_catch_catch,
bp_catch_throw
};
/* States of enablement of breakpoint. */
enum enable { disabled, enabled, shlib_disabled};
enum enable {
disabled, /* The eventpoint is inactive, and cannot trigger. */
enabled, /* The eventpoint is active, and can trigger. */
shlib_disabled, /* The eventpoint's address is within an unloaded solib.
The eventpoint will be automatically enabled & reset
when that solib is loaded. */
call_disabled /* The eventpoint has been disabled while a call into
the inferior is "in flight", because some eventpoints
interfere with the implementation of a call on some
targets. The eventpoint will be automatically enabled
& reset when the call "lands" (either completes, or
stops at another eventpoint). */
};
/* Disposition of breakpoint. Ie: what to do after hitting it. */
enum bpdisp {
del, /* Delete it */
del_at_next_stop, /* Delete at next stop, whether hit or not */
disable, /* Disable it */
donttouch /* Leave it alone */
};
@ -204,6 +243,24 @@ struct breakpoint
aborting, so you can back up to just before the abort. */
int hit_count;
/* Filename of a dynamically-linked library (dll), used for bp_catch_load
and bp_catch_unload (malloc'd), or NULL if any library is significant. */
char * dll_pathname;
/* Filename of a dll whose state change (e.g., load or unload)
triggered this catchpoint. This field is only vaid immediately
after this catchpoint has triggered. */
char * triggered_dll_pathname;
/* Process id of a child process whose forking triggered this catchpoint.
This field is only vaid immediately after this catchpoint has triggered. */
int forked_inferior_pid;
/* Filename of a program whose exec triggered this catchpoint. This
field is only vaid immediately after this catchpoint has triggered. */
char * exec_pathname;
asection *section;
};
/* The following stuff is an abstract data type "bpstat" ("breakpoint status").
@ -274,6 +331,10 @@ enum bpstat_what_main_action {
keep checking. */
BPSTAT_WHAT_CHECK_SHLIBS,
/* Check the dynamic linker's data structures for new libraries, then
resume out of the dynamic linker's callback, stop and print. */
BPSTAT_WHAT_CHECK_SHLIBS_RESUME_FROM_HOOK,
/* This is just used to keep track of how many enums there are. */
BPSTAT_WHAT_LAST
};
@ -294,6 +355,18 @@ struct bpstat_what bpstat_what PARAMS ((bpstat));
/* Find the bpstat associated with a breakpoint. NULL otherwise. */
bpstat bpstat_find_breakpoint PARAMS ((bpstat, struct breakpoint *));
/* Find a step_resume breakpoint associated with this bpstat.
(If there are multiple step_resume bp's on the list, this function
will arbitrarily pick one.)
It is an error to use this function if BPSTAT doesn't contain a
step_resume breakpoint.
See wait_for_inferior's use of this function.
*/
extern struct breakpoint *
bpstat_find_step_resume_breakpoint PARAMS ((bpstat));
/* Nonzero if a signal that we got in wait() was due to circumstances
explained by the BS. */
/* Currently that is true if we have hit a breakpoint, or if there is
@ -305,6 +378,9 @@ bpstat bpstat_find_breakpoint PARAMS ((bpstat, struct breakpoint *));
just to things like whether watchpoints are set. */
extern int bpstat_should_step PARAMS ((void));
/* Nonzero if there are enabled hardware watchpoints. */
extern int bpstat_have_active_hw_watchpoints PARAMS ((void));
/* Print a message indicating what happened. Returns nonzero to
say that only the source line should be printed after this (zero
return means print the frame as well as the source line). */
@ -325,6 +401,12 @@ extern void bpstat_do_actions PARAMS ((bpstat *));
/* Modify BS so that the actions will not be performed. */
extern void bpstat_clear_actions PARAMS ((bpstat));
/* Given a bpstat that records zero or more triggered eventpoints, this
function returns another bpstat which contains only the catchpoints
on that first list, if any.
*/
extern void bpstat_get_triggered_catchpoints PARAMS ((bpstat, bpstat *));
/* Implementation: */
struct bpstats
{
@ -349,6 +431,14 @@ struct bpstats
bpstat_print, or -1 if it can't deal with it. */
int (*print_it) PARAMS((bpstat bs));
};
enum inf_context
{
inf_starting,
inf_running,
inf_exited
};
/* Prototypes for breakpoint-related functions. */
@ -358,6 +448,8 @@ struct frame_info;
extern int breakpoint_here_p PARAMS ((CORE_ADDR));
extern int breakpoint_inserted_here_p PARAMS ((CORE_ADDR));
extern int frame_in_dummy PARAMS ((struct frame_info *));
extern int breakpoint_thread_match PARAMS ((CORE_ADDR, int));
@ -366,7 +458,9 @@ extern void until_break_command PARAMS ((char *, int));
extern void breakpoint_re_set PARAMS ((void));
extern void clear_momentary_breakpoints PARAMS ((void));
extern void breakpoint_re_set_thread PARAMS ((struct breakpoint *));
extern int ep_is_exception_catchpoint PARAMS ((struct breakpoint *));
extern struct breakpoint *set_momentary_breakpoint
PARAMS ((struct symtab_and_line, struct frame_info *, enum bptype));
@ -377,7 +471,7 @@ extern void set_default_breakpoint PARAMS ((int, CORE_ADDR, struct symtab *, int
extern void mark_breakpoints_out PARAMS ((void));
extern void breakpoint_init_inferior PARAMS ((void));
extern void breakpoint_init_inferior PARAMS ((enum inf_context));
extern void delete_breakpoint PARAMS ((struct breakpoint *));
@ -387,16 +481,80 @@ extern void breakpoint_clear_ignore_counts PARAMS ((void));
extern void break_command PARAMS ((char *, int));
extern void tbreak_command PARAMS ((char *, int));
extern int insert_breakpoints PARAMS ((void));
extern int remove_breakpoints PARAMS ((void));
/* This function can be used to physically insert eventpoints from the
specified traced inferior process, without modifying the breakpoint
package's state. This can be useful for those targets which support
following the processes of a fork() or vfork() system call, when both
of the resulting two processes are to be followed. */
extern int reattach_breakpoints PARAMS ((int));
/* This function can be used to update the breakpoint package's state
after an exec() system call has been executed.
This function causes the following:
- All eventpoints are marked "not inserted".
- All eventpoints with a symbolic address are reset such that
the symbolic address must be reevaluated before the eventpoints
can be reinserted.
- The solib breakpoints are explicitly removed from the breakpoint
list.
- A step-resume breakpoint, if any, is explicitly removed from the
breakpoint list.
- All eventpoints without a symbolic address are removed from the
breakpoint list. */
extern void update_breakpoints_after_exec PARAMS ((void));
/* This function can be used to physically remove hardware breakpoints
and watchpoints from the specified traced inferior process, without
modifying the breakpoint package's state. This can be useful for
those targets which support following the processes of a fork() or
vfork() system call, when one of the resulting two processes is to
be detached and allowed to run free.
It is an error to use this function on the process whose id is
inferior_pid. */
extern int detach_breakpoints PARAMS ((int));
extern void enable_longjmp_breakpoint PARAMS ((void));
extern void disable_longjmp_breakpoint PARAMS ((void));
extern void set_longjmp_resume_breakpoint PARAMS ((CORE_ADDR,
struct frame_info *));
/* These functions respectively disable or reenable all currently
enabled watchpoints. When disabled, the watchpoints are marked
call_disabled. When reenabled, they are marked enabled.
The intended client of these functions is infcmd.c\run_stack_dummy.
The inferior must be stopped, and all breakpoints removed, when
these functions are used.
The need for these functions is that on some targets (e.g., HP-UX),
gdb is unable to unwind through the dummy frame that is pushed as
part of the implementation of a call command. Watchpoints can
cause the inferior to stop in places where this frame is visible,
and that can cause execution control to become very confused.
Note that if a user sets breakpoints in an interactively call
function, the call_disabled watchpoints will have been reenabled
when the first such breakpoint is reached. However, on targets
that are unable to unwind through the call dummy frame, watches
of stack-based storage may then be deleted, because gdb will
believe that their watched storage is out of scope. (Sigh.) */
extern void
disable_watchpoints_before_interactive_call_start PARAMS ((void));
extern void
enable_watchpoints_after_interactive_call_stop PARAMS ((void));
extern void clear_breakpoint_hit_counts PARAMS ((void));
@ -419,6 +577,28 @@ extern void create_solib_event_breakpoint PARAMS ((CORE_ADDR));
extern void remove_solib_event_breakpoints PARAMS ((void));
extern void disable_breakpoints_in_shlibs PARAMS ((int silent));
extern void re_enable_breakpoints_in_shlibs PARAMS ((void));
extern void create_solib_load_event_breakpoint PARAMS ((char *, int, char *, char *));
extern void create_solib_unload_event_breakpoint PARAMS ((char *, int, char *, char *));
extern void create_fork_event_catchpoint PARAMS ((int, char *));
extern void create_vfork_event_catchpoint PARAMS ((int, char *));
extern void create_exec_event_catchpoint PARAMS ((int, char *));
/* This function returns TRUE if ep is a catchpoint. */
extern int ep_is_catchpoint PARAMS ((struct breakpoint *));
/* This function returns TRUE if ep is a catchpoint of a
shared library (aka dynamically-linked library) event,
such as a library load or unload. */
extern int ep_is_shlib_catchpoint PARAMS ((struct breakpoint *));
extern struct breakpoint *set_breakpoint_sal PARAMS ((struct symtab_and_line));
#endif /* !defined (BREAKPOINT_H) */

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/* Build symbol tables in GDB's internal format.
Copyright (C) 1986-1996 Free Software Foundation, Inc.
Copyright 1986-1993, 1996-1999 Free Software Foundation, Inc.
This file is part of GDB.
@ -22,45 +22,47 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* This module provides definitions used for creating and adding to
the symbol table. These routines are called from various symbol-
file-reading routines.
file-reading routines.
They originated in dbxread.c of gdb-4.2, and were split out to
make xcoffread.c more maintainable by sharing code.
Variables declared in this file can be defined by #define-ing
the name EXTERN to null. It is used to declare variables that
are normally extern, but which get defined in a single module
using this technique. */
Variables declared in this file can be defined by #define-ing the
name EXTERN to null. It is used to declare variables that are
normally extern, but which get defined in a single module using
this technique. */
#ifndef EXTERN
#define EXTERN extern
#endif
#define HASHSIZE 127 /* Size of things hashed via hashname() */
#define HASHSIZE 127 /* Size of things hashed via
hashname() */
/* Name of source file whose symbol data we are now processing.
This comes from a symbol of type N_SO. */
/* Name of source file whose symbol data we are now processing. This
comes from a symbol of type N_SO. */
EXTERN char *last_source_file;
/* Core address of start of text of current source file.
This too comes from the N_SO symbol. */
/* Core address of start of text of current source file. This too
comes from the N_SO symbol. */
EXTERN CORE_ADDR last_source_start_addr;
/* The list of sub-source-files within the current individual compilation.
Each file gets its own symtab with its own linetable and associated info,
but they all share one blockvector. */
/* The list of sub-source-files within the current individual
compilation. Each file gets its own symtab with its own linetable
and associated info, but they all share one blockvector. */
struct subfile
{
struct subfile *next;
char *name;
char *dirname;
struct linetable *line_vector;
int line_vector_length;
enum language language;
};
{
struct subfile *next;
char *name;
char *dirname;
struct linetable *line_vector;
int line_vector_length;
enum language language;
char *debugformat;
};
EXTERN struct subfile *subfiles;
@ -79,65 +81,85 @@ EXTERN unsigned char processing_gcc_compilation;
EXTERN unsigned char processing_acc_compilation;
/* elz: added this flag to know when a block is compiled with HP
compilers (cc, aCC). This is necessary because of the macro
COERCE_FLOAT_TO_DOUBLE defined in tm_hppa.h, which causes a
coercion of float to double to always occur in parameter passing
for a function called by gdb (see the function value_arg_coerce in
valops.c). This is necessary only if the target was compiled with
gcc, not with HP compilers or with g++ */
EXTERN unsigned char processing_hp_compilation;
/* Count symbols as they are processed, for error messages. */
EXTERN unsigned int symnum;
/* Record the symbols defined for each context in a list.
We don't create a struct block for the context until we
know how long to make it. */
/* Record the symbols defined for each context in a list. We don't
create a struct block for the context until we know how long to
make it. */
#define PENDINGSIZE 100
struct pending
{
struct pending *next;
int nsyms;
struct symbol *symbol[PENDINGSIZE];
};
/* List of free `struct pending' structures for reuse. */
EXTERN struct pending *free_pendings;
{
struct pending *next;
int nsyms;
struct symbol *symbol[PENDINGSIZE];
};
/* Here are the three lists that symbols are put on. */
EXTERN struct pending *file_symbols; /* static at top level, and types */
/* static at top level, and types */
EXTERN struct pending *global_symbols; /* global functions and variables */
EXTERN struct pending *file_symbols;
EXTERN struct pending *local_symbols; /* everything local to lexic context */
/* global functions and variables */
/* Stack representing unclosed lexical contexts
(that will become blocks, eventually). */
EXTERN struct pending *global_symbols;
/* everything local to lexical context */
EXTERN struct pending *local_symbols;
/* func params local to lexical context */
EXTERN struct pending *param_symbols;
/* Stack representing unclosed lexical contexts (that will become
blocks, eventually). */
struct context_stack
{
/* Outer locals at the time we entered */
{
/* Outer locals at the time we entered */
struct pending *locals;
struct pending *locals;
/* Pointer into blocklist as of entry */
/* Pending func params at the time we entered */
struct pending_block *old_blocks;
struct pending *params;
/* Name of function, if any, defining context*/
/* Pointer into blocklist as of entry */
struct symbol *name;
struct pending_block *old_blocks;
/* PC where this context starts */
/* Name of function, if any, defining context */
CORE_ADDR start_addr;
struct symbol *name;
/* Temp slot for exception handling. */
/* PC where this context starts */
CORE_ADDR end_addr;
CORE_ADDR start_addr;
/* For error-checking matching push/pop */
/* Temp slot for exception handling. */
int depth;
CORE_ADDR end_addr;
};
/* For error-checking matching push/pop */
int depth;
};
EXTERN struct context_stack *context_stack;
@ -149,14 +171,14 @@ EXTERN int context_stack_depth;
EXTERN int context_stack_size;
/* Macro "function" for popping contexts from the stack. Pushing is done
by a real function, push_context. This returns a pointer to a struct
context_stack. */
/* Macro "function" for popping contexts from the stack. Pushing is
done by a real function, push_context. This returns a pointer to a
struct context_stack. */
#define pop_context() (&context_stack[--context_stack_depth]);
/* Nonzero if within a function (so symbols should be local,
if nothing says specifically). */
/* Nonzero if within a function (so symbols should be local, if
nothing says specifically). */
EXTERN int within_function;
@ -164,19 +186,24 @@ EXTERN int within_function;
This is used at the end to make the blockvector. */
struct pending_block
{
struct pending_block *next;
struct block *block;
};
{
struct pending_block *next;
struct block *block;
};
/* Pointer to the head of a linked list of symbol blocks which have
already been finalized (lexical contexts already closed) and which
are just waiting to be built into a blockvector when finalizing the
associated symtab. */
EXTERN struct pending_block *pending_blocks;
struct subfile_stack
{
struct subfile_stack *next;
char *name;
};
{
struct subfile_stack *next;
char *name;
};
EXTERN struct subfile_stack *subfile_stack;
@ -184,14 +211,13 @@ EXTERN struct subfile_stack *subfile_stack;
/* Function to invoke get the next symbol. Return the symbol name. */
EXTERN char *(*next_symbol_text_func) PARAMS ((struct objfile *));
EXTERN char *(*next_symbol_text_func) (struct objfile *);
/* Vector of types defined so far, indexed by their type numbers.
Used for both stabs and coff.
(In newer sun systems, dbx uses a pair of numbers in parens,
as in "(SUBFILENUM,NUMWITHINSUBFILE)". Then these numbers must be
translated through the type_translations hash table to get
the index into the type vector.) */
Used for both stabs and coff. (In newer sun systems, dbx uses a
pair of numbers in parens, as in "(SUBFILENUM,NUMWITHINSUBFILE)".
Then these numbers must be translated through the type_translations
hash table to get the index into the type vector.) */
EXTERN struct type **type_vector;
@ -199,61 +225,73 @@ EXTERN struct type **type_vector;
EXTERN int type_vector_length;
/* Initial size of type vector. Is realloc'd larger if needed,
and realloc'd down to the size actually used, when completed. */
/* Initial size of type vector. Is realloc'd larger if needed, and
realloc'd down to the size actually used, when completed. */
#define INITIAL_TYPE_VECTOR_LENGTH 160
extern void
add_symbol_to_list PARAMS ((struct symbol *, struct pending **));
extern void add_symbol_to_list (struct symbol *symbol,
struct pending **listhead);
extern struct symbol *
find_symbol_in_list PARAMS ((struct pending *, char *, int));
extern struct symbol *find_symbol_in_list (struct pending *list,
char *name, int length);
extern void
finish_block PARAMS ((struct symbol *, struct pending **,
struct pending_block *, CORE_ADDR, CORE_ADDR,
struct objfile *));
extern void finish_block (struct symbol *symbol,
struct pending **listhead,
struct pending_block *old_blocks,
CORE_ADDR start, CORE_ADDR end,
struct objfile *objfile);
extern void
really_free_pendings PARAMS ((int foo));
extern void really_free_pendings (int foo);
extern void
start_subfile PARAMS ((char *, char *));
extern void start_subfile (char *name, char *dirname);
extern void
patch_subfile_names PARAMS ((struct subfile *subfile, char *name));
extern void patch_subfile_names (struct subfile *subfile, char *name);
extern void
push_subfile PARAMS ((void));
extern void push_subfile (void);
extern char *
pop_subfile PARAMS ((void));
extern char *pop_subfile (void);
extern struct symtab *
end_symtab PARAMS ((CORE_ADDR, struct objfile *, int));
extern struct symtab *end_symtab (CORE_ADDR end_addr,
struct objfile *objfile, int section);
extern void
scan_file_globals PARAMS ((struct objfile *));
/* Defined in stabsread.c. */
extern void
buildsym_new_init PARAMS ((void));
extern void scan_file_globals (struct objfile *objfile);
extern void
buildsym_init PARAMS ((void));
extern void buildsym_new_init (void);
extern struct context_stack *
push_context PARAMS ((int, CORE_ADDR));
extern void buildsym_init (void);
extern void
record_line PARAMS ((struct subfile *, int, CORE_ADDR));
extern struct context_stack *push_context (int desc, CORE_ADDR valu);
extern void
start_symtab PARAMS ((char *, char *, CORE_ADDR));
extern void record_line (struct subfile *subfile, int line, CORE_ADDR pc);
extern int
hashname PARAMS ((char *));
extern void start_symtab (char *name, char *dirname, CORE_ADDR start_addr);
extern int hashname (char *name);
extern void free_pending_blocks (void);
/* FIXME: Note that this is used only in buildsym.c and dstread.c,
which should be fixed to not need direct access to
make_blockvector. */
extern struct blockvector *make_blockvector (struct objfile *objfile);
/* FIXME: Note that this is used only in buildsym.c and dstread.c,
which should be fixed to not need direct access to
record_pending_block. */
extern void record_pending_block (struct objfile *objfile,
struct block *block,
struct pending_block *opblock);
extern void record_debugformat (char *format);
extern void merge_symbol_lists (struct pending **srclist,
struct pending **targetlist);
#undef EXTERN
#endif /* defined (BUILDSYM_H) */
#endif /* defined (BUILDSYM_H) */

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/* YACC parser for C expressions, for GDB.
Copyright (C) 1986, 1989, 1990, 1991, 1993, 1994
Copyright (C) 1986, 1989, 1990, 1991, 1993, 1994, 1996, 1997
Free Software Foundation, Inc.
This file is part of GDB.
@ -49,6 +49,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "symfile.h" /* Required by objfiles.h. */
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
/* Flag indicating we're dealing with HP-compiled objects */
extern int hp_som_som_object_present;
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
as well as gratuitiously global symbol names, so we can have multiple
yacc generated parsers in gdb. Note that these are only the variables
@ -195,6 +198,9 @@ parse_number PARAMS ((char *, int, int, YYSTYPE *));
/* C++ */
%token THIS
%token TRUEKEYWORD
%token FALSEKEYWORD
%left ','
%left ABOVE_COMMA
@ -214,6 +220,7 @@ parse_number PARAMS ((char *, int, int, YYSTYPE *));
%right UNARY INCREMENT DECREMENT
%right ARROW '.' '[' '('
%token <ssym> BLOCKNAME
%token <bval> FILENAME
%type <bval> block
%left COLONCOLON
@ -288,6 +295,7 @@ exp : exp ARROW qualified_name
write_exp_elt_opcode (UNOP_ADDR);
write_exp_elt_opcode (STRUCTOP_MPTR); }
;
exp : exp ARROW '*' exp
{ write_exp_elt_opcode (STRUCTOP_MPTR); }
;
@ -298,7 +306,6 @@ exp : exp '.' name
write_exp_elt_opcode (STRUCTOP_STRUCT); }
;
exp : exp '.' qualified_name
{ /* exp.type::name becomes exp.*(&type::name) */
/* Note: this doesn't work if name is a
@ -528,22 +535,33 @@ exp : THIS
write_exp_elt_opcode (OP_THIS); }
;
exp : TRUEKEYWORD
{ write_exp_elt_opcode (OP_LONG);
write_exp_elt_type (builtin_type_bool);
write_exp_elt_longcst ((LONGEST) 1);
write_exp_elt_opcode (OP_LONG); }
;
exp : FALSEKEYWORD
{ write_exp_elt_opcode (OP_LONG);
write_exp_elt_type (builtin_type_bool);
write_exp_elt_longcst ((LONGEST) 0);
write_exp_elt_opcode (OP_LONG); }
;
/* end of C++. */
block : BLOCKNAME
{
if ($1.sym != 0)
$$ = SYMBOL_BLOCK_VALUE ($1.sym);
if ($1.sym)
$$ = SYMBOL_BLOCK_VALUE ($1.sym);
else
{
struct symtab *tem =
lookup_symtab (copy_name ($1.stoken));
if (tem)
$$ = BLOCKVECTOR_BLOCK (BLOCKVECTOR (tem), STATIC_BLOCK);
else
error ("No file or function \"%s\".",
copy_name ($1.stoken));
}
error ("No file or function \"%s\".",
copy_name ($1.stoken));
}
| FILENAME
{
$$ = $1;
}
;
@ -596,15 +614,14 @@ qualified_name: typebase COLONCOLON name
error ("`%s' is not defined as an aggregate type.",
TYPE_NAME (type));
if (!STREQ (type_name_no_tag (type), $4.ptr))
error ("invalid destructor `%s::~%s'",
type_name_no_tag (type), $4.ptr);
tmp_token.ptr = (char*) alloca ($4.length + 2);
tmp_token.length = $4.length + 1;
tmp_token.ptr[0] = '~';
memcpy (tmp_token.ptr+1, $4.ptr, $4.length);
tmp_token.ptr[tmp_token.length] = 0;
/* Check for valid destructor name. */
destructor_name_p (tmp_token.ptr, type);
write_exp_elt_opcode (OP_SCOPE);
write_exp_elt_type (type);
write_exp_string (tmp_token);
@ -826,6 +843,9 @@ typebase /* Implements (approximately): (type-qualifier)* type-specifier */
{ $$ = lookup_signed_typename (TYPE_NAME($2.type)); }
| SIGNED_KEYWORD
{ $$ = builtin_type_int; }
/* It appears that this rule for templates is never
reduced; template recognition happens by lookahead
in the token processing code in yylex. */
| TEMPLATE name '<' type '>'
{ $$ = lookup_template_type(copy_name($2), $4,
expression_context_block);
@ -907,7 +927,7 @@ parse_number (p, len, parsed_float, putithere)
here, and we do kind of silly things like cast to unsigned. */
register LONGEST n = 0;
register LONGEST prevn = 0;
unsigned LONGEST un;
ULONGEST un;
register int i = 0;
register int c;
@ -920,34 +940,38 @@ parse_number (p, len, parsed_float, putithere)
/* We have found a "L" or "U" suffix. */
int found_suffix = 0;
unsigned LONGEST high_bit;
ULONGEST high_bit;
struct type *signed_type;
struct type *unsigned_type;
if (parsed_float)
{
char c;
/* It's a float since it contains a point or an exponent. */
char c;
int num = 0; /* number of tokens scanned by scanf */
char saved_char = p[len];
p[len] = 0; /* null-terminate the token */
if (sizeof (putithere->typed_val_float.dval) <= sizeof (float))
sscanf (p, "%g", &putithere->typed_val_float.dval);
num = sscanf (p, "%g%c", (float *) &putithere->typed_val_float.dval,&c);
else if (sizeof (putithere->typed_val_float.dval) <= sizeof (double))
sscanf (p, "%lg", &putithere->typed_val_float.dval);
num = sscanf (p, "%lg%c", (double *) &putithere->typed_val_float.dval,&c);
else
{
#ifdef PRINTF_HAS_LONG_DOUBLE
sscanf (p, "%Lg", &putithere->typed_val_float.dval);
#ifdef SCANF_HAS_LONG_DOUBLE
num = sscanf (p, "%Lg%c", &putithere->typed_val_float.dval,&c);
#else
/* Scan it into a double, then assign it to the long double.
This at least wins with values representable in the range
of doubles. */
double temp;
sscanf (p, "%lg", &temp);
num = sscanf (p, "%lg%c", &temp,&c);
putithere->typed_val_float.dval = temp;
#endif
}
p[len] = saved_char; /* restore the input stream */
if (num != 1) /* check scanf found ONLY a float ... */
return ERROR;
/* See if it has `f' or `l' suffix (float or long double). */
c = tolower (p[len - 1]);
@ -1043,7 +1067,7 @@ parse_number (p, len, parsed_float, putithere)
on 0x123456789 when LONGEST is 32 bits. */
if (c != 'l' && c != 'u' && n != 0)
{
if ((unsigned_p && (unsigned LONGEST) prevn >= (unsigned LONGEST) n))
if ((unsigned_p && (ULONGEST) prevn >= (ULONGEST) n))
error ("Numeric constant too large.");
}
prevn = n;
@ -1061,11 +1085,11 @@ parse_number (p, len, parsed_float, putithere)
the case where it is we just always shift the value more than
once, with fewer bits each time. */
un = (unsigned LONGEST)n >> 2;
un = (ULONGEST)n >> 2;
if (long_p == 0
&& (un >> (TARGET_INT_BIT - 2)) == 0)
{
high_bit = ((unsigned LONGEST)1) << (TARGET_INT_BIT-1);
high_bit = ((ULONGEST)1) << (TARGET_INT_BIT-1);
/* A large decimal (not hex or octal) constant (between INT_MAX
and UINT_MAX) is a long or unsigned long, according to ANSI,
@ -1079,20 +1103,19 @@ parse_number (p, len, parsed_float, putithere)
else if (long_p <= 1
&& (un >> (TARGET_LONG_BIT - 2)) == 0)
{
high_bit = ((unsigned LONGEST)1) << (TARGET_LONG_BIT-1);
high_bit = ((ULONGEST)1) << (TARGET_LONG_BIT-1);
unsigned_type = builtin_type_unsigned_long;
signed_type = builtin_type_long;
}
else
{
high_bit = (((unsigned LONGEST)1)
<< (TARGET_LONG_LONG_BIT - 32 - 1)
<< 16
<< 16);
if (high_bit == 0)
int shift;
if (sizeof (ULONGEST) * HOST_CHAR_BIT < TARGET_LONG_LONG_BIT)
/* A long long does not fit in a LONGEST. */
high_bit =
(unsigned LONGEST)1 << (sizeof (LONGEST) * HOST_CHAR_BIT - 1);
shift = (sizeof (ULONGEST) * HOST_CHAR_BIT - 1);
else
shift = (TARGET_LONG_LONG_BIT - 1);
high_bit = (ULONGEST) 1 << shift;
unsigned_type = builtin_type_unsigned_long_long;
signed_type = builtin_type_long_long;
}
@ -1164,9 +1187,15 @@ yylex ()
int tempbufindex;
static char *tempbuf;
static int tempbufsize;
struct symbol * sym_class = NULL;
char * token_string = NULL;
int class_prefix = 0;
int unquoted_expr;
retry:
unquoted_expr = 1;
tokstart = lexptr;
/* See if it is a special token of length 3. */
for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
@ -1218,6 +1247,7 @@ yylex ()
if (namelen > 2)
{
lexptr = tokstart + namelen;
unquoted_expr = 0;
if (lexptr[-1] != '\'')
error ("Unmatched single quote.");
namelen -= 2;
@ -1402,15 +1432,45 @@ yylex ()
(c == '_' || c == '$' || (c >= '0' && c <= '9')
|| (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '<');)
{
if (c == '<')
{
int i = namelen;
while (tokstart[++i] && tokstart[i] != '>');
if (tokstart[i] == '>')
namelen = i;
}
c = tokstart[++namelen];
}
/* Template parameter lists are part of the name.
FIXME: This mishandles `print $a<4&&$a>3'. */
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",
there must be spaces before the '<', etc. */
char * p = find_template_name_end (tokstart + namelen);
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];
}
/* The token "if" terminates the expression and is NOT
removed from the input stream. */
@ -1446,9 +1506,13 @@ yylex ()
return DOUBLE_KEYWORD;
break;
case 5:
if (current_language->la_language == language_cplus
&& STREQN (tokstart, "class", 5))
return CLASS;
if (current_language->la_language == language_cplus)
{
if (STREQN (tokstart, "false", 5))
return FALSEKEYWORD;
if (STREQN (tokstart, "class", 5))
return CLASS;
}
if (STREQN (tokstart, "union", 5))
return UNION;
if (STREQN (tokstart, "short", 5))
@ -1461,17 +1525,22 @@ yylex ()
return ENUM;
if (STREQN (tokstart, "long", 4))
return LONG;
if (current_language->la_language == language_cplus
&& STREQN (tokstart, "this", 4))
{
static const char this_name[] =
{ CPLUS_MARKER, 't', 'h', 'i', 's', '\0' };
if (current_language->la_language == language_cplus)
{
if (STREQN (tokstart, "true", 4))
return TRUEKEYWORD;
if (lookup_symbol (this_name, expression_context_block,
VAR_NAMESPACE, (int *) NULL,
(struct symtab **) NULL))
return THIS;
}
if (STREQN (tokstart, "this", 4))
{
static const char this_name[] =
{ CPLUS_MARKER, 't', 'h', 'i', 's', '\0' };
if (lookup_symbol (this_name, expression_context_block,
VAR_NAMESPACE, (int *) NULL,
(struct symtab **) NULL))
return THIS;
}
}
break;
case 3:
if (STREQN (tokstart, "int", 3))
@ -1489,7 +1558,25 @@ yylex ()
write_dollar_variable (yylval.sval);
return VARIABLE;
}
/* Look ahead and see if we can consume more of the input
string to get a reasonable class/namespace spec or a
fully-qualified name. This is a kludge to get around the
HP aCC compiler's generation of symbol names with embedded
colons for namespace and nested classes. */
if (unquoted_expr)
{
/* Only do it if not inside single quotes */
sym_class = parse_nested_classes_for_hpacc (yylval.sval.ptr, yylval.sval.length,
&token_string, &class_prefix, &lexptr);
if (sym_class)
{
/* Replace the current token with the bigger one we found */
yylval.sval.ptr = token_string;
yylval.sval.length = strlen (token_string);
}
}
/* Use token-type BLOCKNAME for symbols that happen to be defined as
functions or symtabs. If this is not so, then ...
Use token-type TYPENAME for symbols that happen to be defined
@ -1509,13 +1596,25 @@ yylex ()
/* Call lookup_symtab, not lookup_partial_symtab, in case there are
no psymtabs (coff, xcoff, or some future change to blow away the
psymtabs once once symbols are read). */
if ((sym && SYMBOL_CLASS (sym) == LOC_BLOCK) ||
lookup_symtab (tmp))
if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
{
yylval.ssym.sym = sym;
yylval.ssym.is_a_field_of_this = is_a_field_of_this;
return BLOCKNAME;
}
else if (!sym)
{ /* See if it's a file name. */
struct symtab *symtab;
symtab = lookup_symtab (tmp);
if (symtab)
{
yylval.bval = BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), STATIC_BLOCK);
return FILENAME;
}
}
if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
{
#if 1

View File

@ -25,17 +25,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "language.h"
#include "c-lang.h"
static void c_emit_char PARAMS ((int c, GDB_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
emit_char (c, stream, quoter)
c_emit_char (c, stream, quoter)
register int c;
GDB_FILE *stream;
int quoter;
{
c &= 0xFF; /* Avoid sign bit follies */
if (PRINT_LITERAL_FORM (c))
@ -83,21 +84,23 @@ c_printchar (c, stream)
int c;
GDB_FILE *stream;
{
fputs_filtered ("'", stream);
emit_char (c, stream, '\'');
fputs_filtered ("'", stream);
fputc_filtered ('\'', stream);
LA_EMIT_CHAR (c, stream, '\'');
fputc_filtered ('\'', stream);
}
/* Print the character string STRING, printing at most LENGTH characters.
Printing stops early if the number hits print_max; repeat counts
are printed as appropriate. Print ellipses at the end if we
had to stop before printing LENGTH characters, or if FORCE_ELLIPSES. */
LENGTH is -1 if the string is nul terminated. Each character is WIDTH bytes
long. Printing stops early if the number hits print_max; repeat counts are
printed as appropriate. Print ellipses at the end if we had to stop before
printing LENGTH characters, or if FORCE_ELLIPSES. */
void
c_printstr (stream, string, length, force_ellipses)
c_printstr (stream, string, length, width, force_ellipses)
GDB_FILE *stream;
char *string;
unsigned int length;
int width;
int force_ellipses;
{
register unsigned int i;
@ -111,7 +114,9 @@ c_printstr (stream, string, length, force_ellipses)
/* 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 && string[length-1] == '\0')
if (!force_ellipses
&& length > 0
&& extract_unsigned_integer (string + (length - 1) * width, width) == '\0')
length--;
if (length == 0)
@ -127,6 +132,7 @@ c_printstr (stream, string, length, force_ellipses)
unsigned int rep1;
/* Number of repetitions we have detected so far. */
unsigned int reps;
unsigned long current_char;
QUIT;
@ -136,9 +142,13 @@ c_printstr (stream, string, length, force_ellipses)
need_comma = 0;
}
current_char = extract_unsigned_integer (string + i * width, width);
rep1 = i + 1;
reps = 1;
while (rep1 < length && string[rep1] == string[i])
while (rep1 < length
&& extract_unsigned_integer (string + rep1 * width, width)
== current_char)
{
++rep1;
++reps;
@ -154,7 +164,7 @@ c_printstr (stream, string, length, force_ellipses)
fputs_filtered ("\", ", stream);
in_quotes = 0;
}
c_printchar (string[i], stream);
LA_PRINT_CHAR (current_char, stream);
fprintf_filtered (stream, " <repeats %u times>", reps);
i = rep1 - 1;
things_printed += repeat_count_threshold;
@ -170,7 +180,7 @@ c_printstr (stream, string, length, force_ellipses)
fputs_filtered ("\"", stream);
in_quotes = 1;
}
emit_char (string[i], stream, '"');
LA_EMIT_CHAR (current_char, stream, '"');
++things_printed;
}
}
@ -235,10 +245,17 @@ c_create_fundamental_type (objfile, typeid)
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,
@ -324,6 +341,12 @@ c_create_fundamental_type (objfile, typeid)
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);
@ -369,7 +392,7 @@ const struct op_print c_op_print_tab[] =
{NULL, 0, 0, 0}
};
struct type ** const (c_builtin_types[]) =
struct type ** CONST_PTR (c_builtin_types[]) =
{
&builtin_type_int,
&builtin_type_long,
@ -402,6 +425,7 @@ const struct language_defn c_language_defn = {
evaluate_subexp_standard,
c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
c_emit_char, /* Print a single char */
c_create_fundamental_type, /* Create fundamental type in this language */
c_print_type, /* Print a type using appropriate syntax */
c_val_print, /* Print a value using appropriate syntax */
@ -417,10 +441,33 @@ const struct language_defn c_language_defn = {
LANG_MAGIC
};
struct type ** const (cplus_builtin_types[]) =
{
&builtin_type_int,
&builtin_type_long,
&builtin_type_short,
&builtin_type_char,
&builtin_type_float,
&builtin_type_double,
&builtin_type_void,
&builtin_type_long_long,
&builtin_type_signed_char,
&builtin_type_unsigned_char,
&builtin_type_unsigned_short,
&builtin_type_unsigned_int,
&builtin_type_unsigned_long,
&builtin_type_unsigned_long_long,
&builtin_type_long_double,
&builtin_type_complex,
&builtin_type_double_complex,
&builtin_type_bool,
0
};
const struct language_defn cplus_language_defn = {
"c++", /* Language name */
language_cplus,
c_builtin_types,
cplus_builtin_types,
range_check_off,
type_check_off,
c_parse,
@ -428,6 +475,7 @@ const struct language_defn cplus_language_defn = {
evaluate_subexp_standard,
c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
c_emit_char, /* Print a single char */
c_create_fundamental_type, /* Create fundamental type in this language */
c_print_type, /* Print a type using appropriate syntax */
c_val_print, /* Print a value using appropriate syntax */
@ -454,6 +502,7 @@ const struct language_defn asm_language_defn = {
evaluate_subexp_standard,
c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
c_emit_char, /* Print a single char */
c_create_fundamental_type, /* Create fundamental type in this language */
c_print_type, /* Print a type using appropriate syntax */
c_val_print, /* Print a value using appropriate syntax */

View File

@ -1,5 +1,5 @@
/* C language support definitions for GDB, the GNU debugger.
Copyright 1992 Free Software Foundation, Inc.
Copyright 1992, 1996 Free Software Foundation, Inc.
This file is part of GDB.
@ -17,9 +17,12 @@ 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 */
struct value;
#endif
#if !defined (C_LANG_H)
#define C_LANG_H 1
#include "value.h"
extern int
c_parse PARAMS ((void)); /* Defined in c-exp.y */
@ -31,7 +34,7 @@ extern void /* Defined in c-typeprint.c */
c_print_type PARAMS ((struct type *, char *, GDB_FILE *, int, int));
extern int
c_val_print PARAMS ((struct type *, char *, CORE_ADDR, GDB_FILE *, int, int,
c_val_print PARAMS ((struct type *, char *, int, CORE_ADDR, GDB_FILE *, int, int,
int, enum val_prettyprint));
extern int
@ -41,11 +44,13 @@ c_value_print PARAMS ((struct value *, GDB_FILE *, int, enum val_prettyprint));
extern void c_printchar PARAMS ((int, GDB_FILE*));
extern void c_printstr PARAMS ((GDB_FILE *, char *, unsigned int, int));
extern void c_printstr PARAMS ((GDB_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 ** const (c_builtin_types[]);
extern struct type ** CONST_PTR (c_builtin_types[]);
/* These are in c-typeprint.c: */
@ -55,17 +60,12 @@ c_type_print_base PARAMS ((struct type *, GDB_FILE *, int, int));
extern void
c_type_print_varspec_prefix PARAMS ((struct type *, GDB_FILE *, int, int));
extern void
cp_type_print_method_args PARAMS ((struct type **, char *, char *, int,
GDB_FILE *));
/* These are in cp-valprint.c */
extern void
cp_type_print_method_args PARAMS ((struct type **, char *, char *, int,
GDB_FILE *));
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 *));
@ -73,7 +73,7 @@ extern void
cp_print_class_method PARAMS ((char *, struct type *, GDB_FILE *));
extern void
cp_print_value_fields PARAMS ((struct type *, char *, CORE_ADDR,
cp_print_value_fields PARAMS ((struct type *, struct type *, char *, int, CORE_ADDR,
GDB_FILE *, int, int, enum val_prettyprint,
struct type**, int));
@ -82,3 +82,6 @@ cp_is_vtbl_ptr_type PARAMS ((struct type *));
extern int
cp_is_vtbl_member PARAMS ((struct type *));
#endif /* !defined (C_LANG_H) */

View File

@ -1,5 +1,5 @@
/* Support for printing C and C++ types for GDB, the GNU debugger.
Copyright 1986, 1988, 1989, 1991, 1993, 1994, 1995, 1996
Copyright 1986, 1988, 1989, 1991, 1993, 1994, 1995, 1996, 1998, 1999
Free Software Foundation, Inc.
This file is part of GDB.
@ -38,11 +38,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <errno.h>
#include <ctype.h>
static void
c_type_print_args PARAMS ((struct type *, GDB_FILE *));
/* Flag indicating target was compiled by HP compiler */
extern int hp_som_som_object_present;
static void
c_type_print_varspec_suffix PARAMS ((struct type *, GDB_FILE *, int, int, int));
c_type_print_args PARAMS ((struct type *, GDB_FILE *));
static void
cp_type_print_derivation_info PARAMS ((GDB_FILE *, struct type *));
@ -50,6 +50,10 @@ cp_type_print_derivation_info PARAMS ((GDB_FILE *, struct type *));
void
c_type_print_varspec_prefix PARAMS ((struct type *, GDB_FILE *, int, int));
static void
c_type_print_cv_qualifier PARAMS ((struct type *, GDB_FILE *, int, int));
/* Print a description of a type in the format of a
typedef for the current language.
@ -135,50 +139,16 @@ c_print_type (type, varstring, stream, show, level)
fputs_filtered (" ", stream);
c_type_print_varspec_prefix (type, stream, show, 0);
fputs_filtered (varstring, stream);
/* For demangled function names, we have the arglist as part of the name,
so don't print an additional pair of ()'s */
demangled_args = strchr(varstring, '(') != NULL;
c_type_print_varspec_suffix (type, stream, show, 0, demangled_args);
}
/* Print the C++ method arguments ARGS to the file STREAM. */
void
cp_type_print_method_args (args, prefix, varstring, staticp, stream)
struct type **args;
char *prefix;
char *varstring;
int staticp;
GDB_FILE *stream;
{
int i;
fprintf_symbol_filtered (stream, prefix, language_cplus, DMGL_ANSI);
fprintf_symbol_filtered (stream, varstring, language_cplus, DMGL_ANSI);
fputs_filtered (" (", stream);
if (args && args[!staticp] && args[!staticp]->code != TYPE_CODE_VOID)
if (varstring != NULL)
{
i = !staticp; /* skip the class variable */
while (1)
{
type_print (args[i++], "", stream, 0);
if (!args[i])
{
fprintf_filtered (stream, " ...");
break;
}
else if (args[i]->code != TYPE_CODE_VOID)
{
fprintf_filtered (stream, ", ");
}
else break;
}
fputs_filtered (varstring, stream);
/* For demangled function names, we have the arglist as part of the name,
so don't print an additional pair of ()'s */
demangled_args = strchr(varstring, '(') != NULL;
c_type_print_varspec_suffix (type, stream, show, 0, demangled_args);
}
fprintf_filtered (stream, ")");
}
/* If TYPE is a derived type, then print out derivation information.
@ -203,7 +173,10 @@ cp_type_print_method_args (args, prefix, varstring, staticp, stream)
}
In general, gdb should try to print the types as closely as possible to
the form that they appear in the source code. */
the form that they appear in the source code.
Note that in case of protected derivation gcc will not say 'protected'
but 'private'. The HP's aCC compiler emits specific information for
derivation via protected inheritance, so gdb can print it out */
static void
cp_type_print_derivation_info (stream, type)
@ -217,7 +190,8 @@ cp_type_print_derivation_info (stream, type)
{
fputs_filtered (i == 0 ? ": " : ", ", stream);
fprintf_filtered (stream, "%s%s ",
BASETYPE_VIA_PUBLIC (type, i) ? "public" : "private",
BASETYPE_VIA_PUBLIC (type, i) ? "public"
: (TYPE_FIELD_PROTECTED (type, i) ? "protected" : "private"),
BASETYPE_VIA_VIRTUAL(type, i) ? " virtual" : "");
name = type_name_no_tag (TYPE_BASECLASS (type, i));
fprintf_filtered (stream, "%s", name ? name : "(null)");
@ -227,6 +201,47 @@ cp_type_print_derivation_info (stream, type)
fputs_filtered (" ", stream);
}
}
/* Print the C++ method arguments ARGS to the file STREAM. */
void
cp_type_print_method_args (args, prefix, varstring, staticp, stream)
struct type **args;
char *prefix;
char *varstring;
int staticp;
GDB_FILE *stream;
{
int i;
fprintf_symbol_filtered (stream, prefix, language_cplus, DMGL_ANSI);
fprintf_symbol_filtered (stream, varstring, language_cplus, DMGL_ANSI);
fputs_filtered ("(", stream);
if (args && args[!staticp] && args[!staticp]->code != TYPE_CODE_VOID)
{
i = !staticp; /* skip the class variable */
while (1)
{
type_print (args[i++], "", stream, 0);
if (!args[i])
{
fprintf_filtered (stream, " ...");
break;
}
else if (args[i]->code != TYPE_CODE_VOID)
{
fprintf_filtered (stream, ", ");
}
else break;
}
}
else if (current_language->la_language == language_cplus)
{
fprintf_filtered (stream, "void");
}
fprintf_filtered (stream, ")");
}
/* Print any asterisks or open-parentheses needed before the
variable name (to describe its type).
@ -257,6 +272,7 @@ c_type_print_varspec_prefix (type, stream, show, passed_a_ptr)
case TYPE_CODE_PTR:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 1);
fprintf_filtered (stream, "*");
c_type_print_cv_qualifier (type, stream, 1, 0);
break;
case TYPE_CODE_MEMBER:
@ -274,7 +290,7 @@ c_type_print_varspec_prefix (type, stream, show, passed_a_ptr)
case TYPE_CODE_METHOD:
if (passed_a_ptr)
fprintf_unfiltered (stream, "(");
fprintf_filtered (stream, "(");
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 0);
if (passed_a_ptr)
{
@ -287,6 +303,7 @@ c_type_print_varspec_prefix (type, stream, show, passed_a_ptr)
case TYPE_CODE_REF:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 1);
fprintf_filtered (stream, "&");
c_type_print_cv_qualifier (type, stream, 1, 0);
break;
case TYPE_CODE_FUNC:
@ -323,6 +340,43 @@ c_type_print_varspec_prefix (type, stream, show, passed_a_ptr)
}
}
/* Print out "const" and "volatile" attributes.
TYPE is a pointer to the type being printed out.
STREAM is the output destination.
NEED_SPACE = 1 indicates an initial white space is needed */
static void
c_type_print_cv_qualifier (type, stream, need_pre_space, need_post_space)
struct type *type;
GDB_FILE *stream;
int need_pre_space;
int need_post_space;
{
int flag = 0;
if (TYPE_CONST (type))
{
if (need_pre_space)
fprintf_filtered (stream, " ");
fprintf_filtered (stream, "const");
flag = 1;
}
if (TYPE_VOLATILE (type))
{
if (flag || need_pre_space)
fprintf_filtered (stream, " ");
fprintf_filtered (stream, "volatile");
flag = 1;
}
if (flag && need_post_space)
fprintf_filtered (stream, " ");
}
static void
c_type_print_args (type, stream)
struct type *type;
@ -339,6 +393,11 @@ c_type_print_args (type, stream)
{
fprintf_filtered (stream, "...");
}
else if ((args[1]->code == TYPE_CODE_VOID) &&
(current_language->la_language == language_cplus))
{
fprintf_filtered (stream, "void");
}
else
{
for (i = 1;
@ -358,6 +417,11 @@ c_type_print_args (type, stream)
}
}
}
else if (current_language->la_language == language_cplus)
{
fprintf_filtered (stream, "void");
}
fprintf_filtered (stream, ")");
}
@ -365,7 +429,7 @@ c_type_print_args (type, stream)
needed after the variable name (to describe its type).
Args work like c_type_print_varspec_prefix. */
static void
void
c_type_print_varspec_suffix (type, stream, show, passed_a_ptr, demangled_args)
struct type *type;
GDB_FILE *stream;
@ -425,15 +489,20 @@ c_type_print_varspec_suffix (type, stream, show, passed_a_ptr, demangled_args)
if (!demangled_args)
{ int i, len = TYPE_NFIELDS (type);
fprintf_filtered (stream, "(");
for (i = 0; i < len; i++)
{
if (i > 0)
{
fputs_filtered (", ", stream);
wrap_here (" ");
}
c_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0);
}
if ((len == 0) && (current_language->la_language == language_cplus))
{
fprintf_filtered (stream, "void");
}
else
for (i = 0; i < len; i++)
{
if (i > 0)
{
fputs_filtered (", ", stream);
wrap_here (" ");
}
c_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0);
}
fprintf_filtered (stream, ")");
}
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
@ -490,7 +559,11 @@ c_type_print_base (type, stream, show, level)
register int lastval;
char *mangled_name;
char *demangled_name;
char *demangled_no_static;
enum {s_none, s_public, s_private, s_protected} section_type;
int need_access_label = 0;
int j, len2;
QUIT;
wrap_here (" ");
@ -509,6 +582,7 @@ c_type_print_base (type, stream, show, level)
if (show <= 0
&& TYPE_NAME (type) != NULL)
{
c_type_print_cv_qualifier (type, stream, 0, 1);
fputs_filtered (TYPE_NAME (type), stream);
return;
}
@ -528,21 +602,48 @@ c_type_print_base (type, stream, show, level)
break;
case TYPE_CODE_STRUCT:
if (HAVE_CPLUS_STRUCT (type))
{
fprintf_filtered (stream, "class ");
}
else
{
fprintf_filtered (stream, "struct ");
}
c_type_print_cv_qualifier (type, stream, 0, 1);
/* Note TYPE_CODE_STRUCT and TYPE_CODE_CLASS have the same value,
* so we use another means for distinguishing them.
*/
if (HAVE_CPLUS_STRUCT (type)) {
switch (TYPE_DECLARED_TYPE(type)) {
case DECLARED_TYPE_CLASS:
fprintf_filtered (stream, "class ");
break;
case DECLARED_TYPE_UNION:
fprintf_filtered (stream, "union ");
break;
case DECLARED_TYPE_STRUCT:
fprintf_filtered (stream, "struct ");
break;
default:
/* If there is a CPLUS_STRUCT, assume class if not
* otherwise specified in the declared_type field.
*/
fprintf_filtered (stream, "class ");
break;
} /* switch */
} else {
/* If not CPLUS_STRUCT, then assume it's a C struct */
fprintf_filtered (stream, "struct ");
}
goto struct_union;
case TYPE_CODE_UNION:
c_type_print_cv_qualifier (type, stream, 0, 1);
fprintf_filtered (stream, "union ");
struct_union:
if (TYPE_TAG_NAME (type) != NULL)
/* Print the tag if it exists.
* The HP aCC compiler emits
* a spurious "{unnamed struct}"/"{unnamed union}"/"{unnamed enum}"
* tag for unnamed struct/union/enum's, which we don't
* want to print.
*/
if (TYPE_TAG_NAME (type) != NULL &&
strncmp(TYPE_TAG_NAME(type), "{unnamed", 8))
{
fputs_filtered (TYPE_TAG_NAME (type), stream);
if (show > 0)
@ -574,6 +675,72 @@ c_type_print_base (type, stream, show, level)
section_type = s_none;
/* For a class, if all members are private, there's no need
for a "private:" label; similarly, for a struct or union
masquerading as a class, if all members are public, there's
no need for a "public:" label. */
if ((TYPE_DECLARED_TYPE (type) == DECLARED_TYPE_CLASS) ||
(TYPE_DECLARED_TYPE (type) == DECLARED_TYPE_TEMPLATE))
{
QUIT;
len = TYPE_NFIELDS (type);
for (i = TYPE_N_BASECLASSES (type); i < len; i++)
if (!TYPE_FIELD_PRIVATE (type, i))
{
need_access_label = 1;
break;
}
QUIT;
if (!need_access_label)
{
len2 = TYPE_NFN_FIELDS (type);
for (j = 0; j < len2; j++)
{
len = TYPE_FN_FIELDLIST_LENGTH (type, j);
for (i = 0; i < len; i++)
if (!TYPE_FN_FIELD_PRIVATE (TYPE_FN_FIELDLIST1 (type, j), i))
{
need_access_label = 1;
break;
}
if (need_access_label)
break;
}
}
}
else if ((TYPE_DECLARED_TYPE (type) == DECLARED_TYPE_STRUCT) ||
(TYPE_DECLARED_TYPE (type) == DECLARED_TYPE_UNION))
{
QUIT;
len = TYPE_NFIELDS (type);
for (i = TYPE_N_BASECLASSES (type); i < len; i++)
if (TYPE_FIELD_PRIVATE (type, i) || TYPE_FIELD_PROTECTED (type, i))
{
need_access_label = 1;
break;
}
QUIT;
if (!need_access_label)
{
len2 = TYPE_NFN_FIELDS (type);
for (j = 0; j < len2; j++)
{
QUIT;
len = TYPE_FN_FIELDLIST_LENGTH (type, j);
for (i = 0; i < len; i++)
if (TYPE_FN_FIELD_PRIVATE (TYPE_FN_FIELDLIST1 (type, j), i) ||
TYPE_FN_FIELD_PROTECTED (TYPE_FN_FIELDLIST1 (type, j), i))
{
need_access_label = 1;
break;
}
if (need_access_label)
break;
}
}
}
/* If there is a base class for this type,
do not print the field that it occupies. */
@ -582,6 +749,11 @@ c_type_print_base (type, stream, show, level)
{
QUIT;
/* Don't print out virtual function table. */
/* HP ANSI C++ case */
if (TYPE_HAS_VTABLE(type) && (STREQN (TYPE_FIELD_NAME (type, i), "__vfp", 5)))
continue;
/* Other compilers */
/* pai:: FIXME : check for has_vtable < 0 */
if (STREQN (TYPE_FIELD_NAME (type, i), "_vptr", 5)
&& is_cplus_marker ((TYPE_FIELD_NAME (type, i))[5]))
continue;
@ -589,7 +761,7 @@ c_type_print_base (type, stream, show, level)
/* If this is a C++ class we can print the various C++ section
labels. */
if (HAVE_CPLUS_STRUCT (type))
if (HAVE_CPLUS_STRUCT (type) && need_access_label)
{
if (TYPE_FIELD_PROTECTED (type, i))
{
@ -646,7 +818,6 @@ c_type_print_base (type, stream, show, level)
fprintf_filtered (stream, "\n");
/* C++: print out the methods */
for (i = 0; i < len; i++)
{
struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i);
@ -658,11 +829,11 @@ c_type_print_base (type, stream, show, level)
{
char *physname = TYPE_FN_FIELD_PHYSNAME (f, j);
int is_full_physname_constructor =
((physname[0]=='_' && physname[1]=='_' &&
(isdigit(physname[2])
|| physname[2]=='Q'
|| physname[2]=='t'))
|| (strncmp(physname, "__ct__", 6) == 0));
((physname[0] == '_' && physname[1] == '_'
&& strchr ("0123456789Qt", physname[2]))
|| STREQN (physname, "__ct__", 6)
|| DESTRUCTOR_PREFIX_P (physname)
|| STREQN (physname, "__dt__", 6));
QUIT;
if (TYPE_FN_FIELD_PROTECTED (f, j))
@ -699,64 +870,112 @@ c_type_print_base (type, stream, show, level)
if (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)) == 0)
{
/* Keep GDB from crashing here. */
fprintf_unfiltered (stream, "<undefined type> %s;\n",
fprintf_filtered (stream, "<undefined type> %s;\n",
TYPE_FN_FIELD_PHYSNAME (f, j));
break;
}
else if (!is_constructor && !is_full_physname_constructor)
else if (!is_constructor && /* constructors don't have declared types */
!is_full_physname_constructor && /* " " */
!strstr (method_name, "operator ")) /* Not a type conversion operator */
/* (note space -- other operators don't have it) */
{
type_print (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)),
"", stream, -1);
fputs_filtered (" ", stream);
}
if (TYPE_FN_FIELD_STUB (f, j))
{
/* Build something we can demangle. */
mangled_name = gdb_mangle_name (type, i, j);
demangled_name =
cplus_demangle (mangled_name,
DMGL_ANSI | DMGL_PARAMS);
if (demangled_name == NULL)
fprintf_filtered (stream, "<badly mangled name %s>",
mangled_name);
else
{
char *demangled_no_class =
strchr (demangled_name, ':');
if (demangled_no_class == NULL)
demangled_no_class = demangled_name;
else
{
if (*++demangled_no_class == ':')
++demangled_no_class;
}
fputs_filtered (demangled_no_class, stream);
free (demangled_name);
}
free (mangled_name);
}
else if (TYPE_FN_FIELD_PHYSNAME (f, j)[0] == '_'
&& is_cplus_marker (TYPE_FN_FIELD_PHYSNAME (f, j)[1]))
cp_type_print_method_args (TYPE_FN_FIELD_ARGS (f, j) + 1,
"~", method_name, 0, stream);
/* Build something we can demangle. */
mangled_name = gdb_mangle_name (type, i, j);
else
cp_type_print_method_args (TYPE_FN_FIELD_ARGS (f, j), "",
method_name,
TYPE_FN_FIELD_STATIC_P (f, j),
stream);
mangled_name = TYPE_FN_FIELD_PHYSNAME (f, j);
demangled_name =
cplus_demangle (mangled_name,
DMGL_ANSI | DMGL_PARAMS);
if (demangled_name == NULL)
{
/* in some cases (for instance with the HP demangling),
if a function has more than 10 arguments,
the demangling will fail.
Let's try to reconstruct the function signature from
the symbol information */
if (!TYPE_FN_FIELD_STUB (f, j))
cp_type_print_method_args (TYPE_FN_FIELD_ARGS (f, j), "",
method_name,
TYPE_FN_FIELD_STATIC_P (f, j),
stream);
else
fprintf_filtered (stream, "<badly mangled name '%s'>",
mangled_name);
}
else
{
char *p;
char *demangled_no_class = demangled_name;
while (p = strchr (demangled_no_class, ':'))
{
demangled_no_class = p;
if (*++demangled_no_class == ':')
++demangled_no_class;
}
/* get rid of the static word appended by the demangler */
p = strstr (demangled_no_class, " static");
if (p != NULL)
{
int length = p - demangled_no_class;
demangled_no_static = (char *) xmalloc (length + 1);
strncpy (demangled_no_static, demangled_no_class, length);
*(demangled_no_static + length) = '\0';
fputs_filtered (demangled_no_static, stream);
free (demangled_no_static);
}
else
fputs_filtered (demangled_no_class, stream);
free (demangled_name);
}
if (TYPE_FN_FIELD_STUB (f, j))
free (mangled_name);
fprintf_filtered (stream, ";\n");
}
}
if (TYPE_LOCALTYPE_PTR (type) && show >= 0)
fprintfi_filtered (level, stream, " (Local at %s:%d)\n",
TYPE_LOCALTYPE_FILE (type),
TYPE_LOCALTYPE_LINE (type));
fprintfi_filtered (level, stream, "}");
}
if (TYPE_CODE(type) == TYPE_CODE_TEMPLATE)
goto go_back;
break;
case TYPE_CODE_ENUM:
fprintf_filtered (stream, "enum ");
if (TYPE_TAG_NAME (type) != NULL)
c_type_print_cv_qualifier (type, stream, 0, 1);
/* HP C supports sized enums */
if (hp_som_som_object_present)
switch (TYPE_LENGTH (type))
{
case 1:
fputs_filtered ("char ", stream);
break;
case 2:
fputs_filtered ("short ", stream);
break;
default:
break;
}
fprintf_filtered (stream, "enum ");
/* Print the tag name if it exists.
The aCC compiler emits a spurious
"{unnamed struct}"/"{unnamed union}"/"{unnamed enum}"
tag for unnamed struct/union/enum's, which we don't
want to print. */
if (TYPE_TAG_NAME (type) != NULL &&
strncmp(TYPE_TAG_NAME(type), "{unnamed", 8))
{
fputs_filtered (TYPE_TAG_NAME (type), stream);
if (show > 0)
@ -809,6 +1028,36 @@ c_type_print_base (type, stream, show, level)
fprintf_filtered (stream, "<range type>");
break;
case TYPE_CODE_TEMPLATE:
/* Called on "ptype t" where "t" is a template.
Prints the template header (with args), e.g.:
template <class T1, class T2> class "
and then merges with the struct/union/class code to
print the rest of the definition. */
c_type_print_cv_qualifier (type, stream, 0, 1);
fprintf_filtered (stream, "template <");
for (i = 0; i < TYPE_NTEMPLATE_ARGS(type); i++) {
struct template_arg templ_arg;
templ_arg = TYPE_TEMPLATE_ARG(type, i);
fprintf_filtered (stream, "class %s", templ_arg.name);
if (i < TYPE_NTEMPLATE_ARGS(type)-1)
fprintf_filtered (stream, ", ");
}
fprintf_filtered (stream, "> class ");
/* Yuck, factor this out to a subroutine so we can call
it and return to the point marked with the "goback:" label... - RT */
goto struct_union;
go_back:
if (TYPE_NINSTANTIATIONS(type) > 0) {
fprintf_filtered (stream, "\ntemplate instantiations:\n");
for (i = 0; i < TYPE_NINSTANTIATIONS(type); i++) {
fprintf_filtered(stream, " ");
c_type_print_base (TYPE_INSTANTIATION(type, i), stream, 0, level);
if (i < TYPE_NINSTANTIATIONS(type)-1) fprintf_filtered(stream, "\n");
}
}
break;
default:
/* Handle types not explicitly handled by the other cases,
such as fundamental types. For these, just print whatever
@ -816,6 +1065,7 @@ c_type_print_base (type, stream, show, level)
is no type name, then complain. */
if (TYPE_NAME (type) != NULL)
{
c_type_print_cv_qualifier (type, stream, 0, 1);
fputs_filtered (TYPE_NAME (type), stream);
}
else
@ -829,3 +1079,11 @@ c_type_print_base (type, stream, show, level)
}
}

View File

@ -1,5 +1,5 @@
/* Support for printing C values for GDB, the GNU debugger.
Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1995
Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997
Free Software Foundation, Inc.
This file is part of GDB.
@ -43,10 +43,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
The PRETTY parameter controls prettyprinting. */
int
c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
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;
@ -65,9 +66,9 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
switch (TYPE_CODE (type))
{
case TYPE_CODE_ARRAY:
elttype = check_typedef (TYPE_TARGET_TYPE (type));
if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0)
{
elttype = check_typedef (TYPE_TARGET_TYPE (type));
eltlen = TYPE_LENGTH (elttype);
len = TYPE_LENGTH (type) / eltlen;
if (prettyprint_arrays)
@ -89,13 +90,13 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
/* Look for a NULL char. */
for (temp_len = 0;
valaddr[temp_len]
(valaddr + embedded_offset)[temp_len]
&& temp_len < len && temp_len < print_max;
temp_len++);
len = temp_len;
}
LA_PRINT_STRING (stream, valaddr, len, 0);
LA_PRINT_STRING (stream, valaddr + embedded_offset, len, eltlen, 0);
i = len;
}
else
@ -112,7 +113,7 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
{
i = 0;
}
val_print_array_elements (type, valaddr, address, stream,
val_print_array_elements (type, valaddr + embedded_offset, address, stream,
format, deref_ref, recurse, pretty, i);
fprintf_filtered (stream, "}");
}
@ -125,7 +126,7 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
case TYPE_CODE_PTR:
if (format && format != 's')
{
print_scalar_formatted (valaddr, type, format, 0, stream);
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
break;
}
if (vtblprint && cp_is_vtbl_ptr_type(type))
@ -133,25 +134,26 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
/* 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, TYPE_LENGTH (type)),
print_address_demangle(extract_address (valaddr + embedded_offset, TYPE_LENGTH (type)),
stream, demangle);
break;
}
elttype = check_typedef (TYPE_TARGET_TYPE (type));
if (TYPE_CODE (elttype) == TYPE_CODE_METHOD)
{
cp_print_class_method (valaddr, type, stream);
cp_print_class_method (valaddr + embedded_offset, type, stream);
}
else if (TYPE_CODE (elttype) == TYPE_CODE_MEMBER)
{
cp_print_class_member (valaddr,
cp_print_class_member (valaddr + embedded_offset,
TYPE_DOMAIN_TYPE (TYPE_TARGET_TYPE (type)),
stream, "&");
}
else
{
addr = unpack_pointer (type, valaddr);
addr = unpack_pointer (type, valaddr + embedded_offset);
print_unpacked_pointer:
elttype = check_typedef (TYPE_TARGET_TYPE (type));
if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
{
@ -168,17 +170,19 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
/* For a pointer to char or unsigned char, also print the string
pointed to, unless pointer is null. */
/* FIXME: need to handle wchar_t here... */
if (TYPE_LENGTH (elttype) == 1
&& TYPE_CODE (elttype) == TYPE_CODE_INT
&& (format == 0 || format == 's')
&& addr != 0)
{
i = val_print_string (addr, 0, stream);
i = val_print_string (addr, -1, TYPE_LENGTH (elttype), stream);
}
else if (cp_is_vtbl_member(type))
{
/* print vtbl's nicely */
CORE_ADDR vt_address = unpack_pointer (type, valaddr);
CORE_ADDR vt_address = unpack_pointer (type, valaddr + embedded_offset);
struct minimal_symbol *msymbol =
lookup_minimal_symbol_by_pc (vt_address);
@ -210,8 +214,8 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
{
wtype = TYPE_TARGET_TYPE(type);
}
vt_val = value_at (wtype, vt_address);
val_print (VALUE_TYPE (vt_val), VALUE_CONTENTS (vt_val),
vt_val = value_at (wtype, vt_address, NULL);
val_print (VALUE_TYPE (vt_val), VALUE_CONTENTS (vt_val), 0,
VALUE_ADDRESS (vt_val), stream, format,
deref_ref, recurse + 1, pretty);
if (pretty)
@ -237,7 +241,7 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
elttype = check_typedef (TYPE_TARGET_TYPE (type));
if (TYPE_CODE (elttype) == TYPE_CODE_MEMBER)
{
cp_print_class_member (valaddr,
cp_print_class_member (valaddr + embedded_offset,
TYPE_DOMAIN_TYPE (elttype),
stream, "");
break;
@ -246,7 +250,7 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
{
fprintf_filtered (stream, "@");
print_address_numeric
(extract_address (valaddr,
(extract_address (valaddr + embedded_offset,
TARGET_PTR_BIT / HOST_CHAR_BIT), 1, stream);
if (deref_ref)
fputs_filtered (": ", stream);
@ -260,11 +264,17 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
value_at
(TYPE_TARGET_TYPE (type),
unpack_pointer (lookup_pointer_type (builtin_type_void),
valaddr));
valaddr + embedded_offset),
NULL);
val_print (VALUE_TYPE (deref_val),
VALUE_CONTENTS (deref_val),
VALUE_ADDRESS (deref_val), stream, format,
deref_ref, recurse + 1, pretty);
VALUE_CONTENTS (deref_val),
0,
VALUE_ADDRESS (deref_val),
stream,
format,
deref_ref,
recurse,
pretty);
}
else
fputs_filtered ("???", stream);
@ -284,23 +294,25 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
/* 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(*((int *) (valaddr + /* FIXME bytesex */
TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8)),
stream, demangle);
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);
}
else
cp_print_value_fields (type, valaddr, address, stream, format,
cp_print_value_fields (type, type, valaddr, embedded_offset, address, stream, format,
recurse, pretty, NULL, 0);
break;
case TYPE_CODE_ENUM:
if (format)
{
print_scalar_formatted (valaddr, type, format, 0, stream);
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
break;
}
len = TYPE_NFIELDS (type);
val = unpack_long (type, valaddr);
val = unpack_long (type, valaddr + embedded_offset);
for (i = 0; i < len; i++)
{
QUIT;
@ -322,7 +334,7 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
case TYPE_CODE_FUNC:
if (format)
{
print_scalar_formatted (valaddr, type, format, 0, stream);
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
break;
}
/* FIXME, we should consider, at least for ANSI C language, eliminating
@ -337,10 +349,10 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
case TYPE_CODE_BOOL:
format = format ? format : output_format;
if (format)
print_scalar_formatted (valaddr, type, format, 0, stream);
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
else
{
val = unpack_long (type, valaddr);
val = unpack_long (type, valaddr + embedded_offset);
if (val == 0)
fputs_filtered ("false", stream);
else if (val == 1)
@ -364,11 +376,11 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
format = format ? format : output_format;
if (format)
{
print_scalar_formatted (valaddr, type, format, 0, stream);
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
}
else
{
val_print_type_code_int (type, valaddr, stream);
val_print_type_code_int (type, valaddr + embedded_offset, stream);
/* C and C++ has no single byte int type, char is used instead.
Since we don't know whether the value is really intended to
be used as an integer or a character, print the character
@ -376,7 +388,7 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
if (TYPE_LENGTH (type) == 1)
{
fputs_filtered (" ", stream);
LA_PRINT_CHAR ((unsigned char) unpack_long (type, valaddr),
LA_PRINT_CHAR ((unsigned char) unpack_long (type, valaddr + embedded_offset),
stream);
}
}
@ -386,28 +398,32 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
format = format ? format : output_format;
if (format)
{
print_scalar_formatted (valaddr, type, format, 0, stream);
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
}
else
{
fprintf_filtered (stream, TYPE_UNSIGNED (type) ? "%u" : "%d",
unpack_long (type, valaddr));
unpack_long (type, valaddr + embedded_offset));
fputs_filtered (" ", stream);
LA_PRINT_CHAR ((unsigned char) unpack_long (type, valaddr), stream);
LA_PRINT_CHAR ((unsigned char) unpack_long (type, valaddr + embedded_offset), stream);
}
break;
case TYPE_CODE_FLT:
if (format)
{
print_scalar_formatted (valaddr, type, format, 0, stream);
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
}
else
{
print_floating (valaddr, type, stream);
print_floating (valaddr + embedded_offset, type, stream);
}
break;
case TYPE_CODE_METHOD:
cp_print_class_method (valaddr + embedded_offset, lookup_pointer_type (type), stream);
break;
case TYPE_CODE_VOID:
fprintf_filtered (stream, "void");
break;
@ -438,7 +454,9 @@ c_value_print (val, stream, format, pretty)
enum val_prettyprint pretty;
{
struct type *type = VALUE_TYPE (val);
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.
@ -457,13 +475,61 @@ 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 */
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, " ?");
}
fprintf_filtered (stream, ") ");
}
else
{
/* normal case */
fprintf_filtered (stream, "(");
type_print (type, "", stream, -1);
fprintf_filtered (stream, ") ");
}
}
return (val_print (type, VALUE_CONTENTS (val),
VALUE_ADDRESS (val), stream, format, 1, 0, pretty));
if (objectprint && (TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_CLASS))
{
/* 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);
}
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);
}
/* Otherwise, we end up at the return outside this "if" */
}
return val_print (type, VALUE_CONTENTS_ALL (val), VALUE_EMBEDDED_OFFSET (val),
VALUE_ADDRESS (val),
stream, format, 1, 0, pretty);
}

View File

@ -55,11 +55,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "symfile.h" /* Required by objfiles.h. */
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
#ifdef __GNUC__
#define INLINE __inline__
#endif
typedef union
{
LONGEST lval;
unsigned LONGEST ulval;
ULONGEST ulval;
struct {
LONGEST val;
struct type *type;
@ -87,7 +91,7 @@ enum ch_terminal {
CHARACTER_STRING_LITERAL,
BIT_STRING_LITERAL,
TYPENAME,
FIELD_NAME,
DOT_FIELD_NAME, /* '.' followed by <field name> */
CASE,
OF,
ESAC,
@ -131,13 +135,55 @@ enum ch_terminal {
};
/* Forward declarations. */
static void parse_expr ();
static void parse_primval ();
static void parse_untyped_expr ();
static int parse_opt_untyped_expr ();
static void parse_if_expression_body PARAMS((void));
static void write_lower_upper_value PARAMS ((enum exp_opcode, struct type *));
static enum ch_terminal ch_lex ();
static enum ch_terminal match_bitstring_literal PARAMS ((void));
static enum ch_terminal match_integer_literal PARAMS ((void));
static enum ch_terminal match_character_literal PARAMS ((void));
static enum ch_terminal match_string_literal PARAMS ((void));
static enum ch_terminal match_float_literal PARAMS ((void));
static enum ch_terminal match_float_literal PARAMS ((void));
static int decode_integer_literal PARAMS ((LONGEST *, char **));
static int decode_integer_value PARAMS ((int, char **, LONGEST *));
static char *match_simple_name_string PARAMS ((void));
static void growbuf_by_size PARAMS ((int));
static void parse_untyped_expr PARAMS ((void));
static void parse_if_expression PARAMS ((void));
static void parse_else_alternative PARAMS ((void));
static void parse_then_alternative PARAMS ((void));
static void parse_expr PARAMS ((void));
static void parse_operand0 PARAMS ((void));
static void parse_operand1 PARAMS ((void));
static void parse_operand2 PARAMS ((void));
static void parse_operand3 PARAMS ((void));
static void parse_operand4 PARAMS ((void));
static void parse_operand5 PARAMS ((void));
static void parse_operand6 PARAMS ((void));
static void parse_primval PARAMS ((void));
static void parse_tuple PARAMS ((struct type *));
static void parse_opt_element_list PARAMS ((struct type *));
static void parse_tuple_element PARAMS ((struct type *));
static void parse_named_record_element PARAMS ((void));
static void parse_call PARAMS ((void));
static struct type *parse_mode_or_normal_call PARAMS ((void));
#if 0
static struct type *parse_mode_call PARAMS ((void));
#endif
static void parse_unary_call PARAMS ((void));
static int parse_opt_untyped_expr PARAMS ((void));
static void parse_case_label PARAMS ((void));
static int expect PARAMS ((enum ch_terminal, char *));
static void parse_expr PARAMS ((void));
static void parse_primval PARAMS ((void));
static void parse_untyped_expr PARAMS ((void));
static int parse_opt_untyped_expr PARAMS ((void));
static void parse_if_expression_body PARAMS((void));
static enum ch_terminal ch_lex PARAMS ((void));
INLINE static enum ch_terminal PEEK_TOKEN PARAMS ((void));
static enum ch_terminal peek_token_ PARAMS ((int));
static void forward_token_ PARAMS ((void));
static void require PARAMS ((enum ch_terminal));
static int check_token PARAMS ((enum ch_terminal));
#define MAX_LOOK_AHEAD 2
static enum ch_terminal terminal_buffer[MAX_LOOK_AHEAD+1] = {
@ -147,10 +193,7 @@ static YYSTYPE val_buffer[MAX_LOOK_AHEAD+1];
/*int current_token, lookahead_token;*/
#ifdef __GNUC__
__inline__
#endif
static enum ch_terminal
INLINE static enum ch_terminal
PEEK_TOKEN()
{
if (terminal_buffer[0] == TOKEN_NOT_READ)
@ -214,7 +257,7 @@ forward_token_()
/* Skip the next token.
if it isn't TOKEN, the parser is broken. */
void
static void
require(token)
enum ch_terminal token;
{
@ -227,7 +270,7 @@ require(token)
FORWARD_TOKEN();
}
int
static int
check_token (token)
enum ch_terminal token;
{
@ -240,8 +283,8 @@ check_token (token)
/* return 0 if expected token was not found,
else return 1.
*/
int
expect(token, message)
static int
expect (token, message)
enum ch_terminal token;
char *message;
{
@ -408,7 +451,9 @@ parse_unary_call ()
/* Parse NAME '(' MODENAME ')'. */
struct type *
#if 0
static struct type *
parse_mode_call ()
{
struct type *type;
@ -422,7 +467,9 @@ parse_mode_call ()
return type;
}
struct type *
#endif
static struct type *
parse_mode_or_normal_call ()
{
struct type *type;
@ -486,9 +533,11 @@ static void
parse_named_record_element ()
{
struct stoken label;
char buf[256];
label = PEEK_LVAL ().sval;
expect (FIELD_NAME, "expected a field name here `%s'", lexptr);
sprintf (buf, "expected a field name here `%s'", lexptr);
expect (DOT_FIELD_NAME, buf);
if (check_token (','))
parse_named_record_element ();
else if (check_token (':'))
@ -500,12 +549,13 @@ parse_named_record_element ()
write_exp_elt_opcode (OP_LABELED);
}
/* Returns one or nore TREE_LIST nodes, in reverse order. */
/* Returns one or more TREE_LIST nodes, in reverse order. */
static void
parse_tuple_element ()
parse_tuple_element (type)
struct type *type;
{
if (PEEK_TOKEN () == FIELD_NAME)
if (PEEK_TOKEN () == DOT_FIELD_NAME)
{
/* Parse a labelled structure tuple. */
parse_named_record_element ();
@ -517,7 +567,32 @@ parse_tuple_element ()
if (check_token ('*'))
{
expect (')', "missing ')' after '*' case label list");
error ("(*) not implemented in case label list");
if (type)
{
if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
{
/* do this as a range from low to high */
struct type *range_type = TYPE_FIELD_TYPE (type, 0);
LONGEST low_bound, high_bound;
if (get_discrete_bounds (range_type, &low_bound, &high_bound) < 0)
error ("cannot determine bounds for (*)");
/* lower bound */
write_exp_elt_opcode (OP_LONG);
write_exp_elt_type (range_type);
write_exp_elt_longcst (low_bound);
write_exp_elt_opcode (OP_LONG);
/* upper bound */
write_exp_elt_opcode (OP_LONG);
write_exp_elt_type (range_type);
write_exp_elt_longcst (high_bound);
write_exp_elt_opcode (OP_LONG);
write_exp_elt_opcode (BINOP_RANGE);
}
else
error ("(*) in invalid context");
}
else
error ("(*) only possible with modename in front of tuple (mode[..])");
}
else
{
@ -543,14 +618,15 @@ parse_tuple_element ()
/* Matches: a COMMA-separated list of tuple elements.
Returns a list (of TREE_LIST nodes). */
static void
parse_opt_element_list ()
parse_opt_element_list (type)
struct type *type;
{
arglist_len = 0;
if (PEEK_TOKEN () == ']')
return;
for (;;)
{
parse_tuple_element ();
parse_tuple_element (type);
arglist_len++;
if (PEEK_TOKEN () == ']')
break;
@ -566,17 +642,21 @@ static void
parse_tuple (mode)
struct type *mode;
{
struct type *type;
if (mode)
type = check_typedef (mode);
else
type = 0;
require ('[');
start_arglist ();
parse_opt_element_list ();
parse_opt_element_list (type);
expect (']', "missing ']' after tuple");
write_exp_elt_opcode (OP_ARRAY);
write_exp_elt_longcst ((LONGEST) 0);
write_exp_elt_longcst ((LONGEST) end_arglist () - 1);
write_exp_elt_opcode (OP_ARRAY);
if (mode)
if (type)
{
struct type *type = check_typedef (mode);
if (TYPE_CODE (type) != TYPE_CODE_ARRAY
&& TYPE_CODE (type) != TYPE_CODE_STRUCT
&& TYPE_CODE (type) != TYPE_CODE_SET)
@ -765,7 +845,7 @@ parse_primval ()
{
switch (PEEK_TOKEN ())
{
case FIELD_NAME:
case DOT_FIELD_NAME:
write_exp_elt_opcode (STRUCTOP_STRUCT);
write_exp_string (PEEK_LVAL ().sval);
write_exp_elt_opcode (STRUCTOP_STRUCT);
@ -2057,7 +2137,7 @@ ch_lex ()
inputname = match_simple_name_string ();
if (!inputname)
return '.';
return FIELD_NAME;
return DOT_FIELD_NAME;
}
return (ILLEGAL_TOKEN);
@ -2072,7 +2152,6 @@ write_lower_upper_value (opcode, type)
write_exp_elt_opcode (opcode);
else
{
extern LONGEST type_lower_upper ();
struct type *result_type;
LONGEST val = type_lower_upper (opcode, type, &result_type);
write_exp_elt_opcode (OP_LONG);

View File

@ -26,6 +26,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "language.h"
#include "ch-lang.h"
static value_ptr
evaluate_subexp_chill PARAMS ((struct type *, struct expression *, int *, enum noside));
static value_ptr
value_chill_max_min PARAMS ((enum exp_opcode, value_ptr));
static value_ptr
value_chill_card PARAMS ((value_ptr));
static value_ptr
value_chill_length PARAMS ((value_ptr));
static struct type *
chill_create_fundamental_type PARAMS ((struct objfile *, int));
static void
chill_printstr PARAMS ((GDB_FILE *stream, char *string, unsigned int length, int width, int force_ellipses));
static void
chill_printchar PARAMS ((int, GDB_FILE *));
/* For now, Chill uses a simple mangling algorithm whereby you simply
discard everything after the occurance of two successive CPLUS_MARKER
@ -91,10 +111,11 @@ chill_printchar (c, stream)
*/
static void
chill_printstr (stream, string, length, force_ellipses)
chill_printstr (stream, string, length, width, force_ellipses)
GDB_FILE *stream;
char *string;
unsigned int length;
int width;
int force_ellipses;
{
register unsigned int i;
@ -310,7 +331,7 @@ struct type *builtin_type_chill_long;
struct type *builtin_type_chill_ulong;
struct type *builtin_type_chill_real;
struct type ** const (chill_builtin_types[]) =
struct type ** CONST_PTR (chill_builtin_types[]) =
{
&builtin_type_chill_bool,
&builtin_type_chill_char,
@ -608,6 +629,7 @@ const struct language_defn chill_language_defn = {
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_print_type, /* Print a type using appropriate syntax */
chill_val_print, /* Print a value using appropriate syntax */

View File

@ -31,9 +31,12 @@ extern void /* Defined in ch-typeprint.c */
chill_print_type PARAMS ((struct type *, char *, GDB_FILE *, int, int));
extern int
chill_val_print PARAMS ((struct type *, char *, CORE_ADDR, GDB_FILE *, int, int,
chill_val_print PARAMS ((struct type *, char *, int, CORE_ADDR, GDB_FILE *, int, int,
int, enum val_prettyprint));
extern int
chill_value_print PARAMS ((struct value *, GDB_FILE *,
int, enum val_prettyprint));
extern LONGEST
type_lower_upper PARAMS ((enum exp_opcode, struct type *, struct type **));

View File

@ -36,6 +36,13 @@ static void
chill_print_value_fields PARAMS ((struct type *, char *, GDB_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));
/* 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,
@ -43,7 +50,7 @@ chill_print_value_fields PARAMS ((struct type *, char *, GDB_FILE *, int, int,
allows the ranges to be printed in their "natural" form rather than as
decimal integer values. */
void
static void
chill_print_type_scalar (type, val, stream)
struct type *type;
LONGEST val;
@ -154,7 +161,7 @@ chill_val_print_array_elements (type, valaddr, address, stream,
chill_print_type_scalar (index_type, low_bound + i + reps - 1,
stream);
fputs_filtered ("): ", stream);
val_print (elttype, valaddr + i * eltlen, 0, stream, format,
val_print (elttype, valaddr + i * eltlen, 0, 0, stream, format,
deref_ref, recurse + 1, pretty);
i = rep1 - 1;
@ -163,7 +170,7 @@ chill_val_print_array_elements (type, valaddr, address, stream,
else
{
fputs_filtered ("): ", stream);
val_print (elttype, valaddr + i * eltlen, 0, stream, format,
val_print (elttype, valaddr + i * eltlen, 0, 0, stream, format,
deref_ref, recurse + 1, pretty);
annotate_elt ();
things_printed++;
@ -176,49 +183,6 @@ chill_val_print_array_elements (type, valaddr, address, stream,
}
}
/* In certain cases it could happen, that an array type doesn't
have a length (this have to do with seizing). The reason is
shown in the following stabs:
.stabs "m_x:Tt81=s36i:1,0,32;ar:82=ar80;0;1;83=xsm_struct:,32,256;;",128,0,25,0
.stabs "m_struct:Tt83=s16f1:9,0,16;f2:85=*84,32,32;f3:84,64,64;;",128,0,10,0
When processing t81, the array ar80 doesn't have a length, cause
struct m_struct is specified extern at thse moment. Afterwards m_struct
gets specified and updated, but not the surrounding type.
So we walk through array's till we find a type with a length and
calculate the array length.
FIXME: Where may this happen too ?
*/
static void
calculate_array_length (type)
struct type *type;
{
struct type *target_type;
struct type *range_type;
LONGEST lower_bound, upper_bound;
if (TYPE_CODE (type) != TYPE_CODE_ARRAY)
/* not an array, stop processing */
return;
target_type = TYPE_TARGET_TYPE (type);
range_type = TYPE_FIELD_TYPE (type, 0);
lower_bound = TYPE_FIELD_BITPOS (range_type, 0);
upper_bound = TYPE_FIELD_BITPOS (range_type, 1);
if (TYPE_LENGTH (target_type) == 0 &&
TYPE_CODE (target_type) == TYPE_CODE_ARRAY)
/* we've got another array */
calculate_array_length (target_type);
TYPE_LENGTH (type) = (upper_bound - lower_bound + 1) * TYPE_LENGTH (target_type);
}
/* 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
@ -233,10 +197,11 @@ calculate_array_length (type)
The PRETTY parameter controls prettyprinting. */
int
chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
pretty)
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;
@ -254,10 +219,6 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
switch (TYPE_CODE (type))
{
case TYPE_CODE_ARRAY:
if (TYPE_LENGTH (type) == 0)
/* see comment function calculate_array_length */
calculate_array_length (type);
if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0)
{
if (prettyprint_arrays)
@ -369,9 +330,8 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
&& /* 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, 0, stream);
}
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". */
return (i + (print_max && i != print_max));
@ -379,7 +339,7 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
case TYPE_CODE_STRING:
i = TYPE_LENGTH (type);
LA_PRINT_STRING (stream, valaddr, i, 0);
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". */
return (i + (print_max && i != print_max));
@ -429,7 +389,7 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
{
if (need_comma)
fputs_filtered (", ", stream);
chill_print_type_scalar (range, i, stream);
chill_print_type_scalar (range, (LONGEST) i, stream);
need_comma = 1;
/* Look for a continuous range of true elements. */
@ -440,7 +400,7 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
while (i+1 <= high_bound
&& value_bit_index (type, valaddr, ++i))
j = i;
chill_print_type_scalar (range, j, stream);
chill_print_type_scalar (range, (LONGEST) j, stream);
}
}
}
@ -462,13 +422,17 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
switch (TYPE_CODE (inner))
{
case TYPE_CODE_STRING:
if (length > TYPE_LENGTH (type))
if (length > TYPE_LENGTH (type) - 2)
{
fprintf_filtered (stream,
"<dynamic length %ld > static length %d>",
"<dynamic length %ld > static length %d> *invalid*",
length, TYPE_LENGTH (type));
/* Don't print the string; doing so might produce a
segfault. */
return length;
}
LA_PRINT_STRING (stream, data_addr, length, 0);
LA_PRINT_STRING (stream, data_addr, length, 1, 0);
return length;
default:
break;
@ -499,9 +463,11 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
value_at
(TYPE_TARGET_TYPE (type),
unpack_pointer (lookup_pointer_type (builtin_type_void),
valaddr));
valaddr),
NULL);
val_print (VALUE_TYPE (deref_val),
VALUE_CONTENTS (deref_val),
0,
VALUE_ADDRESS (deref_val), stream, format,
deref_ref, recurse + 1, pretty);
}
@ -511,13 +477,13 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
break;
case TYPE_CODE_ENUM:
c_val_print (type, valaddr, address, stream, format,
c_val_print (type, valaddr, 0, address, stream, format,
deref_ref, recurse, pretty);
break;
case TYPE_CODE_RANGE:
if (TYPE_TARGET_TYPE (type))
chill_val_print (TYPE_TARGET_TYPE (type), valaddr, address, stream,
chill_val_print (TYPE_TARGET_TYPE (type), valaddr, 0, address, stream,
format, deref_ref, recurse, pretty);
break;
@ -529,7 +495,7 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
default:
/* Let's defer printing to the C printer, rather than
print an error message. FIXME! */
c_val_print (type, valaddr, address, stream, format,
c_val_print (type, valaddr, 0, address, stream, format,
deref_ref, recurse, pretty);
}
gdb_flush (stream);
@ -598,13 +564,13 @@ chill_print_value_fields (type, valaddr, stream, format, recurse, pretty,
v = value_from_longest (TYPE_FIELD_TYPE (type, i),
unpack_field_as_long (type, valaddr, i));
chill_val_print (TYPE_FIELD_TYPE (type, i), VALUE_CONTENTS (v), 0,
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),
valaddr + TYPE_FIELD_BITPOS (type, i) / 8,
valaddr + TYPE_FIELD_BITPOS (type, i) / 8, 0,
0, stream, format, 0, recurse + 1, pretty);
}
}
@ -651,13 +617,13 @@ chill_value_print (val, stream, format, pretty)
fprintf_filtered (stream, ")");
}
fprintf_filtered (stream, "(");
i = val_print (type, valaddr, VALUE_ADDRESS (val),
i = val_print (type, valaddr, 0, VALUE_ADDRESS (val),
stream, format, 1, 0, pretty);
fprintf_filtered (stream, ")");
return i;
}
}
return (val_print (type, VALUE_CONTENTS (val),
return (val_print (type, VALUE_CONTENTS (val), 0,
VALUE_ADDRESS (val), stream, format, 1, 0, pretty));
}

View File

@ -94,7 +94,10 @@ coff_solib_add (arg_string, from_tty, target)
0, /* addr */
0, /* not mainline */
0, /* not mapped */
0); /* Not readnow */
0, /* Not readnow */
0, /* Not user loaded */
1); /* Is a solib */
libsize -= len * 4;
lib += len * 4;
}

View File

@ -49,6 +49,136 @@ coff_solib_add PARAMS ((char *, int, struct target_ops *));
extern void
coff_solib_create_inferior_hook PARAMS((void)); /* solib.c */
/* Function to be called to remove the connection between debugger and
dynamic linker that was established by SOLIB_CREATE_INFERIOR_HOOK.
(This operation does not remove shared library information from
the debugger, as CLEAR_SOLIB does.)
This functionality is presently not implemented for this target.
*/
#define SOLIB_REMOVE_INFERIOR_HOOK(PID) (0)
/* This function is called by the "catch load" command. It allows
the debugger to be notified by the dynamic linker when a specified
library file (or any library file, if filename is NULL) is loaded.
Presently, this functionality is not implemented.
*/
#define SOLIB_CREATE_CATCH_LOAD_HOOK(pid,tempflag,filename,cond_string) \
error("catch of library loads/unloads not yet implemented on this platform")
/* This function is called by the "catch unload" command. It allows
the debugger to be notified by the dynamic linker when a specified
library file (or any library file, if filename is NULL) is unloaded.
Presently, this functionality is not implemented.
*/
#define SOLIB_CREATE_CATCH_UNLOAD_HOOK(pid,tempflag,filename,cond_string) \
error("catch of library loads/unloads not yet implemented on this platform")
/* This function returns TRUE if the dynamic linker has just reported
a load of a library.
This function must be used only when the inferior has stopped in
the dynamic linker hook, or undefined results are guaranteed.
Presently, this functionality is not implemented.
*/
/*
#define SOLIB_HAVE_LOAD_EVENT(pid) \
error("catch of library loads/unloads not yet implemented on this platform")
*/
#define SOLIB_HAVE_LOAD_EVENT(pid) \
(0)
/* This function returns a pointer to the string representation of the
pathname of the dynamically-linked library that has just been loaded.
This function must be used only when SOLIB_HAVE_LOAD_EVENT is TRUE,
or undefined results are guaranteed.
This string's contents are only valid immediately after the inferior
has stopped in the dynamic linker hook, and becomes invalid as soon
as the inferior is continued. Clients should make a copy of this
string if they wish to continue the inferior and then access the string.
Presently, this functionality is not implemented.
*/
/*
#define SOLIB_LOADED_LIBRARY_PATHNAME(pid) \
error("catch of library loads/unloads not yet implemented on this platform")
*/
#define SOLIB_LOADED_LIBRARY_PATHNAME(pid) \
(0)
/* This function returns TRUE if the dynamic linker has just reported
an unload of a library.
This function must be used only when the inferior has stopped in
the dynamic linker hook, or undefined results are guaranteed.
Presently, this functionality is not implemented.
*/
/*
#define SOLIB_HAVE_UNLOAD_EVENT(pid) \
error("catch of library loads/unloads not yet implemented on this platform")
*/
#define SOLIB_HAVE_UNLOAD_EVENT(pid) \
(0)
/* This function returns a pointer to the string representation of the
pathname of the dynamically-linked library that has just been unloaded.
This function must be used only when SOLIB_HAVE_UNLOAD_EVENT is TRUE,
or undefined results are guaranteed.
This string's contents are only valid immediately after the inferior
has stopped in the dynamic linker hook, and becomes invalid as soon
as the inferior is continued. Clients should make a copy of this
string if they wish to continue the inferior and then access the string.
Presently, this functionality is not implemented.
*/
/*
#define SOLIB_UNLOADED_LIBRARY_PATHNAME(pid) \
error("catch of library loads/unloads not yet implemented on this platform")
*/
#define SOLIB_UNLOADED_LIBRARY_PATHNAME(pid) \
(0)
/* This function returns TRUE if pc is the address of an instruction that
lies within the dynamic linker (such as the event hook, or the dld
itself).
This function must be used only when a dynamic linker event has been
caught, and the inferior is being stepped out of the hook, or undefined
results are guaranteed.
Presently, this functionality is not implemented.
*/
/*
#define SOLIB_IN_DYNAMIC_LINKER(pid,pc) \
error("catch of library loads/unloads not yet implemented on this platform")
*/
#define SOLIB_IN_DYNAMIC_LINKER(pid,pc) \
(0)
/* This function must be called when the inferior is killed, and the program
restarted. This is not the same as CLEAR_SOLIB, in that it doesn't discard
any symbol tables.
Presently, this functionality is not implemented.
*/
#define SOLIB_RESTART() \
(0)
/* If we can't set a breakpoint, and it's in a shared library, just
disable it. */

View File

@ -1,5 +1,5 @@
/* Read coff symbol tables and convert to internal format, for GDB.
Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996
Copyright 1987, 88, 89, 90, 91, 92, 93, 94, 96, 97, 1998
Free Software Foundation, Inc.
Contributed by David D. Johnson, Brown University (ddj@cs.brown.edu).
@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "defs.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "demangle.h"
#include "breakpoint.h"
#include "bfd.h"
@ -129,6 +130,10 @@ static unsigned local_linesz;
static unsigned local_symesz;
static unsigned local_auxesz;
/* This is set if this is a PE format file. */
static int pe_file;
/* Chain of typedefs of pointers to empty struct/union types.
They are chained thru the SYMBOL_VALUE_CHAIN. */
@ -245,7 +250,7 @@ static void coff_end_symtab PARAMS ((struct objfile *));
static void complete_symtab PARAMS ((char *, CORE_ADDR, unsigned int));
static void coff_start_symtab PARAMS ((void));
static void coff_start_symtab PARAMS ((char *));
static void coff_record_line PARAMS ((int, CORE_ADDR));
@ -323,7 +328,7 @@ static int cs_to_section PARAMS ((struct coff_symbol *, struct objfile *));
struct find_targ_sec_arg {
int targ_index;
int *resultp;
asection **resultp;
};
static void find_targ_sec PARAMS ((bfd *, asection *, void *));
@ -335,15 +340,7 @@ static void find_targ_sec (abfd, sect, obj)
{
struct find_targ_sec_arg *args = (struct find_targ_sec_arg *)obj;
if (sect->target_index == args->targ_index)
{
/* This is the section. Figure out what SECT_OFF_* code it is. */
if (bfd_get_section_flags (abfd, sect) & SEC_CODE)
*args->resultp = SECT_OFF_TEXT;
else if (bfd_get_section_flags (abfd, sect) & SEC_LOAD)
*args->resultp = SECT_OFF_DATA;
else
*args->resultp = SECT_OFF_BSS;
}
*args->resultp = sect;
}
/* Return the section number (SECT_OFF_*) that CS points to. */
@ -352,14 +349,47 @@ cs_to_section (cs, objfile)
struct coff_symbol *cs;
struct objfile *objfile;
{
int off = SECT_OFF_TEXT;
asection *sect = NULL;
struct find_targ_sec_arg args;
int off = SECT_OFF_TEXT;
args.targ_index = cs->c_secnum;
args.resultp = &off;
args.resultp = &sect;
bfd_map_over_sections (objfile->obfd, find_targ_sec, &args);
if (sect != NULL)
{
/* This is the section. Figure out what SECT_OFF_* code it is. */
if (bfd_get_section_flags (abfd, sect) & SEC_CODE)
off = SECT_OFF_TEXT;
else if (bfd_get_section_flags (abfd, sect) & SEC_LOAD)
off = SECT_OFF_DATA;
else
off = SECT_OFF_BSS;
}
return off;
}
/* Return the address of the section of a COFF symbol. */
static CORE_ADDR cs_section_address PARAMS ((struct coff_symbol *, bfd *));
static CORE_ADDR
cs_section_address (cs, abfd)
struct coff_symbol *cs;
bfd *abfd;
{
asection *sect = NULL;
struct find_targ_sec_arg args;
CORE_ADDR addr = 0;
args.targ_index = cs->c_secnum;
args.resultp = &sect;
bfd_map_over_sections (abfd, find_targ_sec, &args);
if (sect != NULL)
addr = bfd_get_section_vma (objfile->obfd, sect);
return addr;
}
/* Look up a coff type-number index. Return the address of the slot
where the type for that index is stored.
The type-number is in INDEX.
@ -439,19 +469,21 @@ coff_record_line (line, pc)
it indicates the start of data for one original source file. */
static void
coff_start_symtab ()
coff_start_symtab (name)
char *name;
{
start_symtab (
/* We fill in the filename later. start_symtab puts
this pointer into last_source_file and we put it in
subfiles->name, which end_symtab frees; that's why
it must be malloc'd. */
savestring ("", 0),
savestring (name, strlen(name)),
/* We never know the directory name for COFF. */
NULL,
/* The start address is irrelevant, since we set
last_source_start_addr in coff_end_symtab. */
0);
record_debugformat ("COFF");
/* Initialize the source file line number information for this file. */
@ -514,7 +546,6 @@ coff_end_symtab (objfile)
before (or because doing it now is simply an artifact of how this
file used to be written). */
subfiles->line_vector = line_vector;
subfiles->name = last_source_file;
symtab = end_symtab (current_source_end_addr, objfile, 0);
@ -537,10 +568,7 @@ record_minimal_symbol (name, address, type, objfile)
/* We don't want TDESC entry points in the minimal symbol table */
if (name[0] == '@') return;
prim_record_minimal_symbol
(obsavestring (name, strlen (name), &objfile->symbol_obstack),
address, type,
objfile);
prim_record_minimal_symbol (name, address, type, objfile);
}
/* coff_symfile_init ()
@ -561,7 +589,7 @@ coff_symfile_init (objfile)
struct objfile *objfile;
{
/* Allocate struct to keep track of stab reading. */
objfile->sym_stab_info = (PTR)
objfile->sym_stab_info = (struct dbx_symfile_info *)
xmmalloc (objfile->md, sizeof (struct dbx_symfile_info));
memset ((PTR) objfile->sym_stab_info, 0, sizeof (struct dbx_symfile_info));
@ -644,7 +672,7 @@ coff_symfile_read (objfile, section_offsets, mainline)
int stabstrsize;
info = (struct coff_symfile_info *) objfile -> sym_private;
dbxinfo = (struct dbx_symfile_info *) objfile->sym_stab_info;
dbxinfo = objfile->sym_stab_info;
symfile_bfd = abfd; /* Kludge for swap routines */
/* WARNING WILL ROBINSON! ACCESSING BFD-PRIVATE DATA HERE! FIXME! */
@ -669,7 +697,15 @@ coff_symfile_read (objfile, section_offsets, mainline)
temp_sym = (char *) xmalloc
(cdata->local_symesz + cdata->local_auxesz);
temp_aux = temp_sym + cdata->local_symesz;
back_to = make_cleanup (free_current_contents, &temp_sym);
back_to = make_cleanup ((make_cleanup_func) free_current_contents, &temp_sym);
/* We need to know whether this is a PE file, because in PE files,
unlike standard COFF files, symbol values are stored as offsets
from the section address, rather than as absolute addresses.
FIXME: We should use BFD to read the symbol table, and thus avoid
this problem. */
pe_file = strncmp (bfd_get_target (objfile->obfd), "pe", 2) == 0;
/* End of warning */
/* Read the line number table, all at once. */
@ -677,7 +713,7 @@ coff_symfile_read (objfile, section_offsets, mainline)
info->max_lineno_offset = 0;
bfd_map_over_sections (abfd, find_linenos, (PTR) info);
make_cleanup (free_linetab, 0);
make_cleanup ((make_cleanup_func) free_linetab, 0);
val = init_lineno (abfd, info->min_lineno_offset,
info->max_lineno_offset - info->min_lineno_offset);
if (val < 0)
@ -685,13 +721,13 @@ coff_symfile_read (objfile, section_offsets, mainline)
/* Now read the string table, all at once. */
make_cleanup (free_stringtab, 0);
make_cleanup ((make_cleanup_func) free_stringtab, 0);
val = init_stringtab (abfd, stringtab_offset);
if (val < 0)
error ("\"%s\": can't get string table", name);
init_minimal_symbol_collection ();
make_cleanup (discard_minimal_symbols, 0);
make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
/* Now that the executable file is positioned at symbol table,
process it and define symbols accordingly. */
@ -824,7 +860,7 @@ coff_symtab_read (symtab_offset, nsyms, section_offsets, objfile)
xmalloc (type_vector_length * sizeof (struct type *));
memset (type_vector, 0, type_vector_length * sizeof (struct type *));
coff_start_symtab ();
coff_start_symtab ("");
symnum = 0;
while (symnum < nsyms)
@ -833,19 +869,12 @@ coff_symtab_read (symtab_offset, nsyms, section_offsets, objfile)
read_one_sym (cs, &main_sym, &main_aux);
#ifdef SEM
temp_sem_val = cs->c_name[0] << 24 | cs->c_name[1] << 16 |
cs->c_name[2] << 8 | cs->c_name[3];
if (int_sem_val == temp_sem_val)
last_coffsem = (int) strtol (cs->c_name+4, (char **) NULL, 10);
#endif
if (cs->c_symnum == next_file_symnum && cs->c_sclass != C_FILE)
{
if (last_source_file)
coff_end_symtab (objfile);
coff_start_symtab ();
coff_start_symtab ("_globals_");
complete_symtab ("_globals_", 0, 0);
/* done with all files, everything from here on out is globals */
}
@ -896,12 +925,23 @@ coff_symtab_read (symtab_offset, nsyms, section_offsets, objfile)
if (last_source_file)
{
coff_end_symtab (objfile);
coff_start_symtab ();
coff_start_symtab (filestring);
}
in_source_file = 1;
break;
/* C_LABEL is used for labels and static functions. Including
it here allows gdb to see static functions when no debug
info is available. */
case C_LABEL:
/* However, labels within a function can make weird backtraces,
so filter them out (from phdm@macqel.be). */
if (within_function)
break;
case C_STAT:
case C_THUMBLABEL:
case C_THUMBSTAT:
case C_THUMBSTATFUNC:
if (cs->c_name[0] == '.')
{
if (STREQ (cs->c_name, ".text")) {
@ -933,6 +973,8 @@ coff_symtab_read (symtab_offset, nsyms, section_offsets, objfile)
that look like this. Ignore them. */
break;
/* fall in for static symbols that don't start with '.' */
case C_THUMBEXT:
case C_THUMBEXTFUNC:
case C_EXT:
{
/* Record it in the minimal symbols regardless of
@ -959,13 +1001,16 @@ coff_symtab_read (symtab_offset, nsyms, section_offsets, objfile)
/* The address has already been relocated; make sure that
objfile_relocate doesn't relocate it again. */
sec = -2;
ms_type = cs->c_sclass == C_STAT ? mst_file_bss : mst_bss;
ms_type = cs->c_sclass == C_EXT
|| cs->c_sclass == C_THUMBEXT ?
mst_bss : mst_file_bss;
}
else
{
sec = cs_to_section (cs, objfile);
tmpaddr = cs->c_value;
if (cs->c_sclass != C_STAT)
if (cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXTFUNC
|| cs->c_sclass == C_THUMBEXT)
tmpaddr += ANOFFSET (section_offsets, sec);
switch (sec)
@ -973,15 +1018,23 @@ coff_symtab_read (symtab_offset, nsyms, section_offsets, objfile)
case SECT_OFF_TEXT:
case SECT_OFF_RODATA:
ms_type =
cs->c_sclass == C_STAT ? mst_file_text : mst_text;
cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXTFUNC
|| cs->c_sclass == C_THUMBEXT ?
mst_text : mst_file_text;
#ifdef SMASH_TEXT_ADDRESS
if (tmpaddr & 1) /* FIXME: delete this line */
SMASH_TEXT_ADDRESS (tmpaddr);
#endif
break;
case SECT_OFF_DATA:
ms_type =
cs->c_sclass == C_STAT ? mst_file_data : mst_data;
cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT ?
mst_data : mst_file_data;
break;
case SECT_OFF_BSS:
ms_type =
cs->c_sclass == C_STAT ? mst_file_bss : mst_bss;
cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT ?
mst_data : mst_file_data;
break;
default:
ms_type = mst_unknown;
@ -990,15 +1043,17 @@ coff_symtab_read (symtab_offset, nsyms, section_offsets, objfile)
}
if (cs->c_name[0] != '@' /* Skip tdesc symbols */)
prim_record_minimal_symbol_and_info
(obsavestring (cs->c_name, strlen (cs->c_name),
&objfile->symbol_obstack),
tmpaddr,
ms_type,
NULL,
sec,
objfile);
{
struct minimal_symbol *msym;
msym = prim_record_minimal_symbol_and_info
(cs->c_name, tmpaddr, ms_type, (char *)cs->c_sclass, sec,
NULL, objfile);
#ifdef COFF_MAKE_MSYMBOL_SPECIAL
if(msym)
COFF_MAKE_MSYMBOL_SPECIAL(cs->c_sclass, msym);
#endif
}
if (SDB_TYPE (cs->c_type))
{
struct symbol *sym;
@ -1177,7 +1232,40 @@ read_one_sym (cs, sym, aux)
if (!SDB_TYPE (cs->c_type))
cs->c_type = 0;
#if 0
if (cs->c_sclass & 128)
printf("thumb symbol %s, class 0x%x\n", cs->c_name, cs->c_sclass);
#endif
symnum += 1 + cs->c_naux;
/* The PE file format stores symbol values as offsets within the
section, rather than as absolute addresses. We correct that
here, if the symbol has an appropriate storage class. FIXME: We
should use BFD to read the symbols, rather than duplicating the
work here. */
if (pe_file)
{
switch (cs->c_sclass)
{
case C_EXT:
case C_THUMBEXT:
case C_THUMBEXTFUNC:
case C_SECTION:
case C_NT_WEAK:
case C_STAT:
case C_THUMBSTAT:
case C_THUMBSTATFUNC:
case C_LABEL:
case C_THUMBLABEL:
case C_BLOCK:
case C_FCN:
case C_EFCN:
if (cs->c_secnum != 0)
cs->c_value += cs_section_address (cs, symfile_bfd);
break;
}
}
}
/* Support for string table handling */
@ -1481,8 +1569,10 @@ process_coff_symbol (cs, aux, section_offsets, objfile)
memset (sym, 0, sizeof (struct symbol));
name = cs->c_name;
name = EXTERNAL_NAME (name, objfile->obfd);
SYMBOL_NAME (sym) = obstack_copy0 (&objfile->symbol_obstack, name,
strlen (name));
SYMBOL_NAME (sym) = obsavestring (name, strlen (name),
&objfile->symbol_obstack);
SYMBOL_LANGUAGE (sym) = language_auto;
SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->symbol_obstack);
/* default assumptions */
SYMBOL_VALUE (sym) = cs->c_value;
@ -1496,9 +1586,11 @@ process_coff_symbol (cs, aux, section_offsets, objfile)
lookup_function_type (decode_function_type (cs, cs->c_type, aux));
SYMBOL_CLASS (sym) = LOC_BLOCK;
if (cs->c_sclass == C_STAT)
if (cs->c_sclass == C_STAT || cs->c_sclass == C_THUMBSTAT
|| cs->c_sclass == C_THUMBSTATFUNC)
add_symbol_to_list (sym, &file_symbols);
else if (cs->c_sclass == C_EXT)
else if (cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT
|| cs->c_sclass == C_THUMBEXTFUNC)
add_symbol_to_list (sym, &global_symbols);
}
else
@ -1514,6 +1606,8 @@ process_coff_symbol (cs, aux, section_offsets, objfile)
add_symbol_to_list (sym, &local_symbols);
break;
case C_THUMBEXT:
case C_THUMBEXTFUNC:
case C_EXT:
SYMBOL_CLASS (sym) = LOC_STATIC;
SYMBOL_VALUE_ADDRESS (sym) = (CORE_ADDR) cs->c_value;
@ -1521,6 +1615,8 @@ process_coff_symbol (cs, aux, section_offsets, objfile)
add_symbol_to_list (sym, &global_symbols);
break;
case C_THUMBSTAT:
case C_THUMBSTATFUNC:
case C_STAT:
SYMBOL_CLASS (sym) = LOC_STATIC;
SYMBOL_VALUE_ADDRESS (sym) = (CORE_ADDR) cs->c_value;
@ -1544,6 +1640,7 @@ process_coff_symbol (cs, aux, section_offsets, objfile)
add_symbol_to_list (sym, &local_symbols);
break;
case C_THUMBLABEL:
case C_LABEL:
break;
@ -1817,7 +1914,11 @@ decode_base_type (cs, c_type, aux)
return lookup_fundamental_type (current_objfile, FT_INTEGER);
case T_LONG:
return lookup_fundamental_type (current_objfile, FT_LONG);
if (cs->c_sclass == C_FIELD
&& aux->x_sym.x_misc.x_lnsz.x_size > TARGET_LONG_BIT)
return lookup_fundamental_type (current_objfile, FT_LONG_LONG);
else
return lookup_fundamental_type (current_objfile, FT_LONG);
case T_FLOAT:
return lookup_fundamental_type (current_objfile, FT_FLOAT);
@ -1913,7 +2014,11 @@ decode_base_type (cs, c_type, aux)
return lookup_fundamental_type (current_objfile, FT_UNSIGNED_INTEGER);
case T_ULONG:
return lookup_fundamental_type (current_objfile, FT_UNSIGNED_LONG);
if (cs->c_sclass == C_FIELD
&& aux->x_sym.x_misc.x_lnsz.x_size > TARGET_LONG_BIT)
return lookup_fundamental_type (current_objfile, FT_UNSIGNED_LONG_LONG);
else
return lookup_fundamental_type (current_objfile, FT_UNSIGNED_LONG);
}
complain (&unexpected_type_complaint, cs->c_name);
return lookup_fundamental_type (current_objfile, FT_VOID);
@ -1974,9 +2079,9 @@ coff_read_struct_type (index, length, lastsym)
obsavestring (name,
strlen (name),
&current_objfile->symbol_obstack);
list->field.type = decode_type (ms, ms->c_type, &sub_aux);
list->field.bitpos = 8 * ms->c_value;
list->field.bitsize = 0;
FIELD_TYPE (list->field) = decode_type (ms, ms->c_type, &sub_aux);
FIELD_BITPOS (list->field) = 8 * ms->c_value;
FIELD_BITSIZE (list->field) = 0;
nfields++;
break;
@ -1992,9 +2097,9 @@ coff_read_struct_type (index, length, lastsym)
obsavestring (name,
strlen (name),
&current_objfile->symbol_obstack);
list->field.type = decode_type (ms, ms->c_type, &sub_aux);
list->field.bitpos = ms->c_value;
list->field.bitsize = sub_aux.x_sym.x_misc.x_lnsz.x_size;
FIELD_TYPE (list->field) = decode_type (ms, ms->c_type, &sub_aux);
FIELD_BITPOS (list->field) = ms->c_value;
FIELD_BITSIZE (list->field) = sub_aux.x_sym.x_misc.x_lnsz.x_size;
nfields++;
break;
@ -2041,6 +2146,7 @@ coff_read_enum_type (index, length, lastsym)
int o_nsyms;
register int n;
char *name;
int unsigned_enum = 1;
type = coff_alloc_type (index);
if (within_function)
@ -2113,37 +2219,21 @@ coff_read_enum_type (index, length, lastsym)
struct symbol *xsym = syms->symbol[j];
SYMBOL_TYPE (xsym) = type;
TYPE_FIELD_NAME (type, n) = SYMBOL_NAME (xsym);
TYPE_FIELD_VALUE (type, n) = 0;
TYPE_FIELD_BITPOS (type, n) = SYMBOL_VALUE (xsym);
if (SYMBOL_VALUE (xsym) < 0)
unsigned_enum = 0;
TYPE_FIELD_BITSIZE (type, n) = 0;
}
if (syms == osyms)
break;
}
if (unsigned_enum)
TYPE_FLAGS (type) |= TYPE_FLAG_UNSIGNED;
return type;
}
struct section_offsets *
coff_symfile_offsets (objfile, addr)
struct objfile *objfile;
CORE_ADDR addr;
{
struct section_offsets *section_offsets;
int i;
objfile->num_sections = SECT_OFF_MAX;
section_offsets = (struct section_offsets *)
obstack_alloc (&objfile -> psymbol_obstack,
sizeof (struct section_offsets)
+ sizeof (section_offsets->offsets) * SECT_OFF_MAX);
for (i = 0; i < SECT_OFF_MAX; i++)
ANOFFSET (section_offsets, i) = addr;
return section_offsets;
}
/* Register our ability to parse symbols for coff BFD files. */
static struct sym_fns coff_sym_fns =
@ -2153,7 +2243,8 @@ static struct sym_fns coff_sym_fns =
coff_symfile_init, /* sym_init: read initial info, setup for sym_read() */
coff_symfile_read, /* sym_read: read a symbol file into symtab */
coff_symfile_finish, /* sym_finish: finished with file, cleanup */
coff_symfile_offsets, /* sym_offsets: xlate external to internal form */
default_symfile_offsets,
/* sym_offsets: xlate external to internal form */
NULL /* next: pointer to next struct sym_fns */
};

View File

@ -1,5 +1,5 @@
/* Handle lists of commands, their decoding and documentation, for GDB.
Copyright 1986, 1989, 1990, 1991 Free Software Foundation, Inc.
Copyright 1986, 1989, 1990, 1991, 1998 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
@ -19,35 +19,39 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "gdbcmd.h"
#include "symtab.h"
#include "value.h"
#include "wait.h"
#include <ctype.h>
#include "gdb_string.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_WAIT_H
# include <wait.h>
#else
# ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h>
# endif
#endif
#include "wait.h"
/* Prototypes for local functions */
static void
undef_cmd_error PARAMS ((char *, char *));
static void undef_cmd_error PARAMS ((char *, char *));
static void
show_user PARAMS ((char *, int));
static void show_user PARAMS ((char *, int));
static void
show_user_1 PARAMS ((struct cmd_list_element *, GDB_FILE *));
static void show_user_1 PARAMS ((struct cmd_list_element *, GDB_FILE *));
static void
make_command PARAMS ((char *, int));
static void make_command PARAMS ((char *, int));
static void
shell_escape PARAMS ((char *, int));
static void shell_escape PARAMS ((char *, int));
static int
parse_binary_operation PARAMS ((char *));
static int parse_binary_operation PARAMS ((char *));
static void
print_doc_line PARAMS ((GDB_FILE *, char *));
static void print_doc_line PARAMS ((GDB_FILE *, char *));
void _initialize_command PARAMS ((void));
/* Add element named NAME.
CLASS is the top level category into which commands are broken down
@ -61,7 +65,10 @@ print_doc_line PARAMS ((GDB_FILE *, char *));
It should start with ? for a command that is an abbreviation
or with * for a command that most users don't need to know about.
Add this command to command list *LIST. */
Add this command to command list *LIST.
Returns a pointer to the added command (not necessarily the head
of *LIST). */
struct cmd_list_element *
add_cmd (name, class, fun, doc, list)
@ -73,9 +80,26 @@ add_cmd (name, class, fun, doc, list)
{
register struct cmd_list_element *c
= (struct cmd_list_element *) xmalloc (sizeof (struct cmd_list_element));
struct cmd_list_element *p;
delete_cmd (name, list);
c->next = *list;
if (*list == NULL || STRCMP ((*list)->name, name) >= 0)
{
c->next = *list;
*list = c;
}
else
{
p = *list;
while (p->next && STRCMP (p->next->name, name) <= 0)
{
p = p->next;
}
c->next = p->next;
p->next = c;
}
c->name = name;
c->class = class;
c->function.cfunc = fun;
@ -93,7 +117,7 @@ add_cmd (name, class, fun, doc, list)
c->user_commands = NULL;
c->hookee = NULL;
c->cmd_pointer = NULL;
*list = c;
return c;
}
@ -261,14 +285,14 @@ add_set_enum_cmd (name, class, enumlist, var, doc, list)
{
struct cmd_list_element *c
= add_set_cmd (name, class, var_enum, var, doc, list);
c->enums = enumlist;
return c;
}
/* Where SETCMD has already been added, add the corresponding show
command to LIST and return a pointer to it. */
command to LIST and return a pointer to the added command (not
necessarily the head of LIST). */
struct cmd_list_element *
add_show_from_set (setcmd, list)
struct cmd_list_element *setcmd;
@ -276,6 +300,7 @@ add_show_from_set (setcmd, list)
{
struct cmd_list_element *showcmd =
(struct cmd_list_element *) xmalloc (sizeof (struct cmd_list_element));
struct cmd_list_element *p;
memcpy (showcmd, setcmd, sizeof (struct cmd_list_element));
delete_cmd (showcmd->name, list);
@ -288,8 +313,22 @@ add_show_from_set (setcmd, list)
else
fprintf_unfiltered (gdb_stderr, "GDB internal error: Bad docstring for set command\n");
showcmd->next = *list;
*list = showcmd;
if (*list == NULL || STRCMP ((*list)->name, showcmd->name) >= 0)
{
showcmd->next = *list;
*list = showcmd;
}
else
{
p = *list;
while (p->next && STRCMP (p->next->name, showcmd->name) <= 0)
{
p = p->next;
}
showcmd->next = p->next;
p->next = showcmd;
}
return showcmd;
}
@ -520,7 +559,38 @@ help_cmd_list (list, class, prefix, recurse, stream)
help_cmd_list (*c->prefixlist, class, c->prefixname, 1, stream);
}
}
/* Search the input clist for 'command'. Return the command if
found (or NULL if not), and return the number of commands
found in nfound */
static struct cmd_list_element *
find_cmd(command, len, clist, ignore_help_classes, nfound)
char *command;
struct cmd_list_element *clist;
int ignore_help_classes;
int *nfound;
{
struct cmd_list_element *found, *c;
found = (struct cmd_list_element *)NULL;
*nfound = 0;
for (c = clist; c; c = c->next)
if (!strncmp (command, c->name, len)
&& (!ignore_help_classes || c->function.cfunc))
{
found = c;
(*nfound)++;
if (c->name[len] == '\0')
{
*nfound = 1;
break;
}
}
return found;
}
/* This routine takes a line of TEXT and a CLIST in which to start the
lookup. When it returns it will have incremented the text pointer past
the section of text it matched, set *RESULT_LIST to point to the list in
@ -574,7 +644,10 @@ lookup_cmd_1 (text, clist, result_list, ignore_help_classes)
so that "set args_foo()" doesn't get interpreted as
"set args _foo()". */
for (p = *text;
*p && (isalnum(*p) || *p == '-' || *p == '_');
*p && (isalnum(*p) || *p == '-' || *p == '_' ||
(tui_version &&
(*p == '+' || *p == '<' || *p == '>' || *p == '$')) ||
(xdb_commands && (*p == '!' || *p == '/' || *p == '?')));
p++)
;
@ -585,32 +658,35 @@ lookup_cmd_1 (text, clist, result_list, ignore_help_classes)
len = p - *text;
/* *text and p now bracket the first command word to lookup (and
it's length is len). We copy this into a local temporary,
converting to lower case as we go. */
it's length is len). We copy this into a local temporary */
command = (char *) alloca (len + 1);
for (tmp = 0; tmp < len; tmp++)
{
char x = (*text)[tmp];
command[tmp] = isupper(x) ? tolower(x) : x;
command[tmp] = x;
}
command[len] = '\0';
/* Look it up. */
found = 0;
nfound = 0;
for (c = clist; c; c = c->next)
if (!strncmp (command, c->name, len)
&& (!ignore_help_classes || c->function.cfunc))
{
found = c;
nfound++;
if (c->name[len] == '\0')
{
nfound = 1;
break;
}
}
found = find_cmd(command, len, clist, ignore_help_classes, &nfound);
/*
** We didn't find the command in the entered case, so lower case it
** and search again.
*/
if (!found || nfound == 0)
{
for (tmp = 0; tmp < len; tmp++)
{
char x = command[tmp];
command[tmp] = isupper(x) ? tolower(x) : x;
}
found = find_cmd(command, len, clist, ignore_help_classes, &nfound);
}
/* If nothing matches, we have a simple failure. */
if (nfound == 0)
@ -649,7 +725,7 @@ lookup_cmd_1 (text, clist, result_list, ignore_help_classes)
}
else if (c == (struct cmd_list_element *) -1)
{
/* We've gotten this far properley, but the next step
/* We've gotten this far properly, but the next step
is ambiguous. We need to set the result list to the best
we've found (if an inferior hasn't already set it). */
if (result_list != NULL)
@ -739,7 +815,7 @@ lookup_cmd (line, list, cmdtype, allow_unknown, ignore_help_classes)
q = (char *) alloca (p - *line + 1);
strncpy (q, *line, p - *line);
q[p-*line] = '\0';
q[p - *line] = '\0';
undef_cmd_error (cmdtype, q);
}
}
@ -1230,11 +1306,26 @@ do_setshow_command (arg, from_tty, c)
int i;
int len;
int nmatches;
char *match;
char *match = NULL;
char *p;
p = strchr (arg, ' ');
/* 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
@ -1273,9 +1364,11 @@ do_setshow_command (arg, from_tty, c)
case var_string:
{
unsigned char *p;
fputs_filtered ("\"", gdb_stdout);
for (p = *(unsigned char **) c->var; *p != '\0'; p++)
gdb_printchar (*p, gdb_stdout, '"');
if (*(unsigned char **)c->var)
for (p = *(unsigned char **) c->var; *p != '\0'; p++)
gdb_printchar (*p, gdb_stdout, '"');
fputs_filtered ("\"", gdb_stdout);
}
break;
@ -1283,7 +1376,8 @@ do_setshow_command (arg, from_tty, c)
case var_filename:
case var_enum:
fputs_filtered ("\"", gdb_stdout);
fputs_filtered (*(char **) c->var, gdb_stdout);
if (*(char **)c->var)
fputs_filtered (*(char **) c->var, gdb_stdout);
fputs_filtered ("\"", gdb_stdout);
break;
case var_boolean:
@ -1457,6 +1551,10 @@ _initialize_command ()
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.");
if (xdb_commands)
add_com_alias("!", "shell", class_support, 0);
add_com ("make", class_support, make_command,
"Run the ``make'' program using the rest of the line as arguments.");
add_cmd ("user", no_class, show_user,

View File

@ -20,11 +20,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "defs.h"
#include "complaints.h"
#include "gdbcmd.h"
#ifdef ANSI_PROTOTYPES
#include <stdarg.h>
#else
#include <varargs.h>
#endif
/* Structure to manage complaints about symbol file contents. */

View File

@ -18,6 +18,10 @@ 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)
#define COMPLAINTS_H
/* Support for complaining about things in the symbol file that aren't
catastrophic.
@ -44,3 +48,6 @@ complain PARAMS ((struct complaint *, ...));
extern void
clear_complaints PARAMS ((int, int));
#endif /* !defined (COMPLAINTS_H) */

View File

@ -1,5 +1,17 @@
/* 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. */
@ -7,48 +19,180 @@
#undef _ALL_SOURCE
#endif
/* Define if using alloca.c. */
#undef C_ALLOCA
/* Define to empty if the keyword does not work. */
#undef const
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
This function is required for alloca.c support on those systems. */
#undef CRAY_STACKSEG_END
/* Define if you have alloca, as a function or macro. */
#undef HAVE_ALLOCA
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
#undef HAVE_ALLOCA_H
/* Define if the `long double' type works. */
#undef HAVE_LONG_DOUBLE
/* Define if you have a working `mmap' system call. */
#undef HAVE_MMAP
/* Define if on MINIX. */
#undef _MINIX
/* Define as __inline if that's what the C compiler calls it. */
#undef inline
/* Define if the system does not provide POSIX.1 features except
with this defined. */
#undef _POSIX_1_SOURCE
/* 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 as the return type of signal handlers (int or void). */
#undef RETSIGTYPE
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown
*/
#undef STACK_DIRECTION
/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
#undef STAT_MACROS_BROKEN
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if fpregset_t type is available. */
#undef HAVE_FPREGSET_T
/* Define if ioctl argument PIOCSET is available. */
#undef HAVE_PROCFS_PIOCSET
/* Define if gregset_t type is available. */
#undef HAVE_GREGSET_T
/* /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
/* Define if the "ll" format works to print long long ints. */
#undef PRINTF_HAS_LONG_LONG
/* Define if the "%Lg" format works to print long doubles. */
#undef PRINTF_HAS_LONG_DOUBLE
/* Define if the "%Lg" format works to scan long doubles. */
#undef SCANF_HAS_LONG_DOUBLE
/* Define if using Solaris thread debugging. */
#undef HAVE_THREAD_DB_LIB
/* Define on a GNU/Linux system to work around problems in sys/procfs.h. */
#undef START_INFERIOR_TRAPS_EXPECTED
#undef sys_quotactl
/* Define if you have HPUX threads */
#undef HAVE_HPUX_THREAD_SUPPORT
/* Define if you want to use the memory mapped malloc package (mmalloc). */
#undef USE_MMALLOC
/* Define if the runtime uses a routine from mmalloc before gdb has a chance
to initialize mmalloc, and we want to force checking to be used anyway.
This may cause spurious memory corruption messages if the runtime tries
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
/* Set to true if the save_state_t structure is present */
#define HAVE_STRUCT_SAVE_STATE_T 0
/* Set to true if the save_state_t structure has the ss_wide member */
#define HAVE_STRUCT_MEMBER_SS_WIDE 0
/* Define if you have the __argz_count function. */
#undef HAVE___ARGZ_COUNT
/* Define if you have the __argz_next function. */
#undef HAVE___ARGZ_NEXT
/* Define if you have the __argz_stringify function. */
#undef HAVE___ARGZ_STRINGIFY
/* Define if you have the bcopy function. */
#undef HAVE_BCOPY
/* Define if you have the btowc function. */
#undef HAVE_BTOWC
/* Define if you have the bzero function. */
#undef HAVE_BZERO
/* Define if you have the dcgettext function. */
#undef HAVE_DCGETTEXT
/* Define if you have the getcwd function. */
#undef HAVE_GETCWD
/* Define if you have the getpagesize function. */
#undef HAVE_GETPAGESIZE
/* Define if you have the isascii function. */
#undef HAVE_ISASCII
/* Define if you have the munmap function. */
#undef HAVE_MUNMAP
/* Define if you have the putenv function. */
#undef HAVE_PUTENV
/* Define if you have the sbrk function. */
#undef HAVE_SBRK
/* Define if you have the setenv function. */
#undef HAVE_SETENV
/* Define if you have the setlocale function. */
#undef HAVE_SETLOCALE
/* Define if you have the setpgid function. */
#undef HAVE_SETPGID
/* Define if you have the valloc function. */
#undef HAVE_VALLOC
/* Define if you have the sigaction function. */
#undef HAVE_SIGACTION
/* Define if you have the stpcpy function. */
#undef HAVE_STPCPY
/* Define if you have the strcasecmp function. */
#undef HAVE_STRCASECMP
/* Define if you have the strchr function. */
#undef HAVE_STRCHR
/* Define if you have the <argz.h> header file. */
#undef HAVE_ARGZ_H
/* Define if you have the <asm/debugreg.h> header file. */
#undef HAVE_ASM_DEBUGREG_H
/* Define if you have the <ctype.h> header file. */
#undef HAVE_CTYPE_H
/* 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
@ -59,24 +203,57 @@
/* Define if you have the <link.h> header file. */
#undef HAVE_LINK_H
/* Define if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
/* Define if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define if you have the <nl_types.h> header file. */
#undef HAVE_NL_TYPES_H
/* Define if you have the <objlist.h> header file. */
#undef HAVE_OBJLIST_H
/* Define if you have the <ptrace.h> header file. */
#undef HAVE_PTRACE_H
/* Define if you have the <sgtty.h> header file. */
#undef HAVE_SGTTY_H
/* Define if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_H
/* Define if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define if you have the <sys/debugreg.h> header file. */
#undef HAVE_SYS_DEBUGREG_H
/* Define if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define if you have the <sys/procfs.h> header file. */
#undef HAVE_SYS_PROCFS_H
/* Define if you have the <sys/ptrace.h> header file. */
#undef HAVE_SYS_PTRACE_H
/* Define if you have the <sys/reg.h> header file. */
#undef HAVE_SYS_REG_H
/* Define if you have the <sys/wait.h> header file. */
#undef HAVE_SYS_WAIT_H
/* Define if you have the <term.h> header file. */
#undef HAVE_TERM_H
/* Define if you have the <termio.h> header file. */
#undef HAVE_TERMIO_H
@ -86,5 +263,63 @@
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if you have the <values.h> header file. */
#undef HAVE_VALUES_H
/* Define if you have the <wait.h> header file. */
#undef HAVE_WAIT_H
/* Define if you have the <wchar.h> header file. */
#undef HAVE_WCHAR_H
/* Define if you have the <wctype.h> header file. */
#undef HAVE_WCTYPE_H
/* Define if you have the dl library (-ldl). */
#undef HAVE_LIBDL
/* Define if you have the m library (-lm). */
#undef HAVE_LIBM
/* Define if you have the w library (-lw). */
#undef HAVE_LIBW
/* Define if you have the stpcpy function */
#undef HAVE_STPCPY
/* Define if your locale.h file contains LC_MESSAGES. */
#undef HAVE_LC_MESSAGES
/* Define to 1 if NLS is requested */
#undef ENABLE_NLS
/* Define as 1 if you have gettext and don't want to use GNU gettext. */
#undef HAVE_GETTEXT
/* Define if malloc is not declared in system header files. */
#undef NEED_DECLARATION_MALLOC
/* Define if realloc is not declared in system header files. */
#undef NEED_DECLARATION_REALLOC
/* Define if free is not declared in system header files. */
#undef NEED_DECLARATION_FREE
/* Define if strerror is not declared in system header files. */
#undef NEED_DECLARATION_STRERROR
/* Define if strdup is not declared in system header files. */
#undef NEED_DECLARATION_STRDUP
/* Define if <sys/procfs.h> has pstatus_t. */
#undef HAVE_PSTATUS_T
/* Define if <sys/procfs.h> has prrun_t. */
#undef HAVE_PRRUN_T
/* Define if <sys/procfs.h> has gregset_t. */
#undef HAVE_GREGSET_T
/* Define if <sys/procfs.h> has fpregset_t. */
#undef HAVE_FPREGSET_T

View File

@ -0,0 +1,9 @@
# 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
MMALLOC =
MMALLOC_CFLAGS = -DNO_MMALLOC

View File

@ -0,0 +1,3 @@
# Target: Little-endian Alpha
TDEPFILES= alpha-tdep.o
TM_FILE= tm-alphalinux.h

View File

@ -0,0 +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

View File

@ -0,0 +1,3 @@
# Target: Little-endian Alpha
TDEPFILES= alpha-tdep.o
TM_FILE= tm-alpha.h

View File

@ -0,0 +1,5 @@
# 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

View File

@ -0,0 +1,5 @@
# 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

View File

@ -0,0 +1,66 @@
/* Native definitions for alpha running Linux.
Copyright (C) 1993, 1994 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., 675 Mass Ave, Cambridge, MA 02139, 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
argument regs. A0_REGNUM points at the jmp_buf structure from which we
extract the pc (JB_PC) that we will land at. The pc is copied into ADDR.
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
/* ptrace register ``addresses'' are absolute. */
#define U_REGS_OFFSET 0
#define PTRACE_ARG3_TYPE long
/* ptrace transfers longs, the ptrace man page is lying. */
#define PTRACE_XFER_TYPE long
/* The alpha does not step over a breakpoint, the manpage is lying again. */
#define CANNOT_STEP_BREAKPOINT
/* 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))

View File

@ -0,0 +1,56 @@
/* Native definitions for alpha running OSF/1.
Copyright (C) 1993, 1994 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. */
/* 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
argument regs. A0_REGNUM points at the jmp_buf structure from which we
extract the pc (JB_PC) that we will land at. The pc is copied into ADDR.
This routine returns true on success */
#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR)
extern int
get_longjmp_target PARAMS ((CORE_ADDR *));
/* ptrace register ``addresses'' are absolute. */
#define U_REGS_OFFSET 0
/* FIXME: Shouldn't the default definition in inferior.h be int* ? */
#define PTRACE_ARG3_TYPE int*
/* ptrace transfers longs, the ptrace man page is lying. */
#define PTRACE_XFER_TYPE long
/* The alpha does not step over a breakpoint, the manpage is lying again. */
#define CANNOT_STEP_BREAKPOINT
/* OSF/1 has shared libraries. */
#define GDB_TARGET_HAS_SHARED_LIBS
/* Support for shared libraries. */
#include "solib.h"
/* Given a pointer to either a gregset_t or fpregset_t, return a
pointer to the first register. */
#define ALPHA_REGSET_BASE(regsetp) ((regsetp)->regs)

View File

@ -0,0 +1,54 @@
/* Native definitions for alpha running OSF/1-2.x, using procfs.
Copyright (C) 1995 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. */
/* Get generic OSF/1 definitions. */
#include "alpha/nm-osf.h"
/* OSF/1-2.x has optional /proc support, try to use it instead of ptrace. */
#define USE_PROC_FS
#define HAVE_OPTIONAL_PROC_FS
/* OSF/1 doesn't provide the standard fault definitions, so don't use them. */
#define FAULTED_USE_SIGINFO
/* Don't trace faults under OSF/1, rely on the posting of the appropriate
signal if fault tracing is disabled.
Tracing T_IFAULT under Alpha OSF/1 causes a `floating point enable'
fault from which we cannot continue (except by disabling the
tracing).
And as OSF/1 doesn't provide the standard fault definitions, the
mapping of faults to appropriate signals in procfs_wait is difficult. */
#define PROCFS_DONT_TRACE_FAULTS
/* Work around some peculiarities in the OSF/1 procfs implementation. */
#define PROCFS_SIGPEND_OFFSET
#define PROCFS_NEED_PIOCSSIG_FOR_KILL
#define PROCFS_DONT_PIOCSSIG_CURSIG
/* 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));
/* 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
POLLOUT, but that always returns POLLNVAL!!! Also, POLLOUT causes problems
on other OSes. */
#define LOSING_POLL

View File

@ -0,0 +1,26 @@
/* Native definitions for alpha running OSF/1-3.x and higher, using procfs.
Copyright (C) 1995 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. */
/* OSF/1-3.x fixes some OSF/1-2.x procfs peculiarities and adds
a new one. */
#include "alpha/nm-osf2.h"
#undef PROCFS_NEED_PIOCSSIG_FOR_KILL
#undef PROCFS_DONT_PIOCSSIG_CURSIG
#define PROCFS_NEED_CLEAR_CURSIG_FOR_KILL

View File

@ -0,0 +1,479 @@
/* Definitions to make GDB run on an Alpha box under OSF1. This is
also used by the Alpha/Netware and Alpha/Linux targets.
Copyright 1993, 1994, 1995, 1996 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_ALPHA_H
#define TM_ALPHA_H
#include "bfd.h"
#include "coff/sym.h" /* Needed for PDR below. */
#include "coff/symconst.h"
#ifdef __STDC__
struct frame_info;
struct type;
struct value;
struct symbol;
#endif
#if !defined (TARGET_BYTE_ORDER)
#define TARGET_BYTE_ORDER LITTLE_ENDIAN
#endif
/* Redefine some target bit sizes from the default. */
#define TARGET_LONG_BIT 64
#define TARGET_LONG_LONG_BIT 64
#define TARGET_PTR_BIT 64
/* Floating point is IEEE compliant */
#define IEEE_FLOAT
/* 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 most implementations.
*/
#define START_INFERIOR_TRAPS_EXPECTED 3
/* Offset from address of function to start of its code.
Zero on most machines. */
#define FUNCTION_START_OFFSET 0
/* Advance PC across any function entry prologue instructions
to reach some "real" code. */
#define SKIP_PROLOGUE(pc) pc = alpha_skip_prologue(pc, 0)
extern CORE_ADDR alpha_skip_prologue PARAMS ((CORE_ADDR addr, int lenient));
/* Immediately after a function call, return the saved pc.
Can't always go through the frames for this because on some machines
the new frame is not set up until the new function executes
some instructions. */
#define SAVED_PC_AFTER_CALL(frame) alpha_saved_pc_after_call(frame)
extern CORE_ADDR
alpha_saved_pc_after_call PARAMS ((struct frame_info *));
/* Are we currently handling a signal ? */
#define IN_SIGTRAMP(pc, name) ((name) && STREQ ("__sigtramp", (name)))
/* Stack grows downward. */
#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
#define BREAKPOINT {0x80, 0, 0, 0} /* call_pal bpt */
/* Amount PC must be decremented by after a breakpoint.
This is often the number of bytes in BREAKPOINT
but not always. */
#ifndef DECR_PC_AFTER_BREAK
#define DECR_PC_AFTER_BREAK 4
#endif
/* Say how long (ordinary) registers are. This is a piece of bogosity
used in push_word and a few other places; REGISTER_RAW_SIZE is the
real way to know how big a register is. */
#define REGISTER_SIZE 8
/* Number of machine registers */
#define NUM_REGS 66
/* Initializer for an array of names of registers.
There should be NUM_REGS strings in this initializer. */
#define REGISTER_NAMES \
{ "v0", "t0", "t1", "t2", "t3", "t4", "t5", "t6", \
"t7", "s0", "s1", "s2", "s3", "s4", "s5", "fp", \
"a0", "a1", "a2", "a3", "a4", "a5", "t8", "t9", \
"t10", "t11", "ra", "t12", "at", "gp", "sp", "zero", \
"f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
"f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \
"f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",\
"f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",\
"pc", "vfp", \
}
/* Register numbers of various important registers.
Note that most of these values are "real" register numbers,
and correspond to the general registers of the machine,
and FP_REGNUM is a "phony" register number which is too large
to be an actual register number as far as the user is concerned
but serves to get the desired value when passed to read_register. */
#define V0_REGNUM 0 /* Function integer return value */
#define T7_REGNUM 8 /* Return address register for OSF/1 __add* */
#define GCC_FP_REGNUM 15 /* Used by gcc as frame register */
#define A0_REGNUM 16 /* Loc of first arg during a subr call */
#define T9_REGNUM 23 /* Return address register for OSF/1 __div* */
#define T12_REGNUM 27 /* Contains start addr of current proc */
#define SP_REGNUM 30 /* Contains address of top of stack */
#define RA_REGNUM 26 /* Contains return address value */
#define ZERO_REGNUM 31 /* Read-only register, always 0 */
#define FP0_REGNUM 32 /* Floating point register 0 */
#define FPA0_REGNUM 48 /* First float arg during a subr call */
#define PC_REGNUM 64 /* Contains program counter */
#define FP_REGNUM 65 /* Virtual frame pointer */
#define CANNOT_FETCH_REGISTER(regno) \
((regno) == FP_REGNUM || (regno) == ZERO_REGNUM)
#define CANNOT_STORE_REGISTER(regno) \
((regno) == FP_REGNUM || (regno) == ZERO_REGNUM)
/* Total amount of space needed to store our copies of the machine's
register state, the array `registers'. */
#define REGISTER_BYTES (NUM_REGS * 8)
/* Index within `registers' of the first byte of the space for
register N. */
#define REGISTER_BYTE(N) ((N) * 8)
/* Number of bytes of storage in the actual machine representation
for register N. On Alphas, all regs are 8 bytes. */
#define REGISTER_RAW_SIZE(N) 8
/* Number of bytes of storage in the program's representation
for register N. On Alphas, all regs are 8 bytes. */
#define REGISTER_VIRTUAL_SIZE(N) 8
/* Largest value REGISTER_RAW_SIZE can have. */
#define MAX_REGISTER_RAW_SIZE 8
/* Largest value REGISTER_VIRTUAL_SIZE can have. */
#define MAX_REGISTER_VIRTUAL_SIZE 8
/* Nonzero if register N requires conversion
from raw format to virtual format.
The alpha needs a conversion between register and memory format if
the register is a floating point register and
memory format is float, as the register format must be double
or
memory format is an integer with 4 bytes or less, as the representation
of integers in floating point registers is different. */
#define REGISTER_CONVERTIBLE(N) ((N) >= FP0_REGNUM && (N) < FP0_REGNUM + 32)
/* Convert data from raw format for register REGNUM in buffer FROM
to virtual format with type TYPE in buffer TO. */
#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM, TYPE, FROM, TO) \
alpha_register_convert_to_virtual (REGNUM, TYPE, FROM, TO)
extern void
alpha_register_convert_to_virtual PARAMS ((int, struct type *, char *, char *));
/* Convert data from virtual format with type TYPE in buffer FROM
to raw format for register REGNUM in buffer TO. */
#define REGISTER_CONVERT_TO_RAW(TYPE, REGNUM, FROM, TO) \
alpha_register_convert_to_raw (TYPE, REGNUM, FROM, TO)
extern void
alpha_register_convert_to_raw PARAMS ((struct type *, int, char *, char *));
/* Return the GDB type object for the "standard" data type
of data in register N. */
#define REGISTER_VIRTUAL_TYPE(N) \
(((N) >= FP0_REGNUM && (N) < FP0_REGNUM+32) \
? builtin_type_double : builtin_type_long) \
/* Store the address of the place in which to copy the structure the
subroutine will return. Handled by alpha_push_arguments. */
#define STORE_STRUCT_RETURN(addr, sp) /**/
/* 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. */
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
alpha_extract_return_value(TYPE, REGBUF, VALBUF)
extern void
alpha_extract_return_value PARAMS ((struct type *, char *, char *));
/* Write into appropriate registers a function return value
of type TYPE, given in virtual format. */
#define STORE_RETURN_VALUE(TYPE,VALBUF) \
alpha_store_return_value(TYPE, VALBUF)
extern void
alpha_store_return_value PARAMS ((struct type *, char *));
/* Extract from an array REGBUF containing the (raw) register state
the address in which a function should return its structure value,
as a CORE_ADDR (or an expression that can be used as one). */
/* The address is passed in a0 upon entry to the function, but when
the function exits, the compiler has copied the value to v0. This
convention is specified by the System V ABI, so I think we can rely
on it. */
#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
(extract_address (REGBUF + REGISTER_BYTE (V0_REGNUM), \
REGISTER_RAW_SIZE (V0_REGNUM)))
/* Structures are returned by ref in extra arg0 */
#define USE_STRUCT_CONVENTION(gcc_p, type) 1
/* Describe the pointer in each stack frame to the previous stack frame
(its caller). */
/* FRAME_CHAIN takes a frame's nominal address
and produces the frame's chain-pointer. */
#define FRAME_CHAIN(thisframe) (CORE_ADDR) alpha_frame_chain (thisframe)
extern CORE_ADDR alpha_frame_chain PARAMS ((struct frame_info *));
/* Define other aspects of the stack frame. */
/* A macro that tells us whether the function invocation represented
by FI does not have a frame on the stack associated with it. If it
does not, FRAMELESS is set to 1, else 0. */
/* We handle this differently for alpha, and maybe we should not */
#define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) {(FRAMELESS) = 0;}
/* Saved Pc. */
#define FRAME_SAVED_PC(FRAME) (alpha_frame_saved_pc(FRAME))
extern CORE_ADDR
alpha_frame_saved_pc PARAMS ((struct frame_info *));
/* The alpha has two different virtual pointers for arguments and locals.
The virtual argument pointer is pointing to the bottom of the argument
transfer area, which is located immediately below the virtual frame
pointer. Its size is fixed for the native compiler, it is either zero
(for the no arguments case) or large enough to hold all argument registers.
gcc uses a variable sized argument transfer area. As it has
to stay compatible with the native debugging tools it has to use the same
virtual argument pointer and adjust the argument offsets accordingly.
The virtual local pointer is localoff bytes below the virtual frame
pointer, the value of localoff is obtained from the PDR. */
#define ALPHA_NUM_ARG_REGS 6
#define FRAME_ARGS_ADDRESS(fi) ((fi)->frame - (ALPHA_NUM_ARG_REGS * 8))
#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame - (fi)->localoff)
/* Return number of args passed to a frame.
Can return -1, meaning no way to tell. */
#define FRAME_NUM_ARGS(num, fi) ((num) = -1)
/* Return number of bytes at start of arglist that are not really args. */
#define FRAME_ARGS_SKIP 0
/* Put here the code to store, into a struct frame_saved_regs,
the addresses of the saved registers of frame described by FRAME_INFO.
This includes special registers such as pc and fp saved in special
ways in the stack frame. sp is even more special:
the address we return for it IS the sp for the next frame. */
extern void alpha_find_saved_regs PARAMS ((struct frame_info *));
#define FRAME_INIT_SAVED_REGS(frame_info) \
do { \
if ((frame_info)->saved_regs == NULL) \
alpha_find_saved_regs (frame_info); \
(frame_info)->saved_regs[SP_REGNUM] = (frame_info)->frame; \
} while (0)
/* Things needed for making the inferior call functions. */
#define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \
sp = alpha_push_arguments((nargs), (args), (sp), (struct_return), (struct_addr))
extern CORE_ADDR
alpha_push_arguments PARAMS ((int, struct value **, CORE_ADDR, int, CORE_ADDR));
/* Push an empty stack frame, to record the current PC, etc. */
#define PUSH_DUMMY_FRAME alpha_push_dummy_frame()
extern void
alpha_push_dummy_frame PARAMS ((void));
/* Discard from the stack the innermost frame, restoring all registers. */
#define POP_FRAME alpha_pop_frame()
extern void
alpha_pop_frame PARAMS ((void));
/* Alpha OSF/1 inhibits execution of code on the stack.
But there is no need for a dummy on the alpha. PUSH_ARGUMENTS
takes care of all argument handling and bp_call_dummy takes care
of stopping the dummy. */
#define CALL_DUMMY_LOCATION AT_ENTRY_POINT
/* On the Alpha the call dummy code is never copied to user space,
stopping the user call is achieved via a bp_call_dummy breakpoint.
But we need a fake CALL_DUMMY definition to enable the proper
call_function_by_hand and to avoid zero length array warnings
in valops.c */
#define CALL_DUMMY { 0 } /* Content doesn't matter. */
#define CALL_DUMMY_START_OFFSET (0)
#define CALL_DUMMY_BREAKPOINT_OFFSET (0)
extern CORE_ADDR alpha_call_dummy_address PARAMS ((void));
#define CALL_DUMMY_ADDRESS() alpha_call_dummy_address()
/* Insert the specified number of args and function address
into a call sequence of the above form stored at DUMMYNAME.
We only have to set RA_REGNUM to the dummy breakpoint address
and T12_REGNUM (the `procedure value register') to the function address. */
#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \
{ \
CORE_ADDR bp_address = CALL_DUMMY_ADDRESS (); \
if (bp_address == 0) \
error ("no place to put call"); \
write_register (RA_REGNUM, bp_address); \
write_register (T12_REGNUM, fun); \
}
/* There's a mess in stack frame creation. See comments in blockframe.c
near reference to INIT_FRAME_PC_FIRST. */
#define INIT_FRAME_PC(fromleaf, prev) /* nada */
#define INIT_FRAME_PC_FIRST(fromleaf, prev) \
(prev)->pc = ((fromleaf) ? SAVED_PC_AFTER_CALL ((prev)->next) : \
(prev)->next ? FRAME_SAVED_PC ((prev)->next) : read_pc ());
/* Special symbol found in blocks associated with routines. We can hang
alpha_extra_func_info_t's off of this. */
#define MIPS_EFI_SYMBOL_NAME "__GDB_EFI_INFO__"
extern void ecoff_relocate_efi PARAMS ((struct symbol *, CORE_ADDR));
/* Specific information about a procedure.
This overlays the ALPHA's PDR records,
alpharead.c (ab)uses this to save memory */
typedef struct alpha_extra_func_info {
long numargs; /* number of args to procedure (was iopt) */
PDR pdr; /* Procedure descriptor record */
} *alpha_extra_func_info_t;
/* Define the extra_func_info that mipsread.c needs.
FIXME: We should define our own PDR interface, perhaps in a separate
header file. This would get rid of the <bfd.h> inclusion in all sources
and would abstract the mips/alpha interface from ecoff. */
#define mips_extra_func_info alpha_extra_func_info
#define mips_extra_func_info_t alpha_extra_func_info_t
#define EXTRA_FRAME_INFO \
int localoff; \
int pc_reg; \
alpha_extra_func_info_t proc_desc;
#define INIT_EXTRA_FRAME_INFO(fromleaf, fci) init_extra_frame_info(fci)
extern void
init_extra_frame_info PARAMS ((struct frame_info *));
#define PRINT_EXTRA_FRAME_INFO(fi) \
{ \
if (fi && fi->proc_desc && fi->proc_desc->pdr.framereg < NUM_REGS) \
printf_filtered (" frame pointer is at %s+%d\n", \
REGISTER_NAME (fi->proc_desc->pdr.framereg), \
fi->proc_desc->pdr.frameoffset); \
}
/* It takes two values to specify a frame on the ALPHA. Sigh.
In fact, at the moment, the *PC* is the primary value that sets up
a frame. The PC is looked up to see what function it's in; symbol
information from that function tells us which register is the frame
pointer base, and what offset from there is the "virtual frame pointer".
(This is usually an offset from SP.) FIXME -- this should be cleaned
up so that the primary value is the SP, and the PC is used to disambiguate
multiple functions with the same SP that are at different stack levels. */
#define SETUP_ARBITRARY_FRAME(argc, argv) setup_arbitrary_frame (argc, argv)
extern struct frame_info *setup_arbitrary_frame PARAMS ((int, CORE_ADDR *));
/* This is used by heuristic_proc_start. It should be shot it the head. */
#ifndef VM_MIN_ADDRESS
#define VM_MIN_ADDRESS (CORE_ADDR)0x120000000
#endif
/* If PC is in a shared library trampoline code, return the PC
where the function itself actually starts. If not, return 0. */
#define SKIP_TRAMPOLINE_CODE(pc) find_solib_trampoline_target (pc)
/* If the current gcc for for this target does not produce correct debugging
information for float parameters, both prototyped and unprototyped, then
define this macro. This forces gdb to always assume that floats are
passed as doubles and then converted in the callee.
For the alpha, it appears that the debug info marks the parameters as
floats regardless of whether the function is prototyped, but the actual
values are always passed in as doubles. Thus by setting this to 1, both
types of calls will work. */
#define COERCE_FLOAT_TO_DOUBLE 1
/* Return TRUE if procedure descriptor PROC is a procedure descriptor
that refers to a dynamically generated sigtramp function.
OSF/1 doesn't use dynamic sigtramp functions, so this is always
FALSE. */
#define PROC_DESC_IS_DYN_SIGTRAMP(proc) (0)
#define SET_PROC_DESC_IS_DYN_SIGTRAMP(proc)
/* If PC is inside a dynamically generated sigtramp function, return
how many bytes the program counter is beyond the start of that
function. Otherwise, return a negative value.
OSF/1 doesn't use dynamic sigtramp functions, so this always
returns -1. */
#define DYNAMIC_SIGTRAMP_OFFSET(pc) (-1)
/* Translate a signal handler frame into the address of the sigcontext
structure. */
#define SIGCONTEXT_ADDR(frame) \
(read_memory_integer ((frame)->next ? frame->next->frame : frame->frame, 8))
/* If FRAME refers to a sigtramp frame, return the address of the next
frame. */
#define FRAME_PAST_SIGTRAMP_FRAME(frame, pc) \
(alpha_osf_skip_sigtramp_frame (frame, pc))
extern CORE_ADDR alpha_osf_skip_sigtramp_frame PARAMS ((struct frame_info *, CORE_ADDR));
#endif /* TM_ALPHA_H */

View File

@ -0,0 +1,80 @@
/* 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.
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_LINUXALPHA_H
#define TM_LINUXALPHA_H
#include "alpha/tm-alpha.h"
/* Are we currently handling a signal ? */
extern long alpha_linux_sigtramp_offset PARAMS ((CORE_ADDR));
#undef IN_SIGTRAMP
#define IN_SIGTRAMP(pc, name) (alpha_linux_sigtramp_offset (pc) >= 0)
/* Get start and end address of sigtramp handler. */
#define SIGTRAMP_START(pc) (pc - alpha_linux_sigtramp_offset (pc))
#define SIGTRAMP_END(pc) (SIGTRAMP_START(pc) + 3*4)
/* 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. */
#undef START_INFERIOR_TRAPS_EXPECTED
#define START_INFERIOR_TRAPS_EXPECTED 2
/* Return TRUE if procedure descriptor PROC is a procedure descriptor
that refers to a dynamically generated sigtramp function. */
#undef PROC_DESC_IS_DYN_SIGTRAMP
#define PROC_SIGTRAMP_MAGIC 0x0e0f0f0f
#define PROC_DESC_IS_DYN_SIGTRAMP(proc) ((proc)->pdr.isym \
== PROC_SIGTRAMP_MAGIC)
#undef SET_PROC_DESC_IS_DYN_SIGTRAMP
#define SET_PROC_DESC_IS_DYN_SIGTRAMP(proc) ((proc)->pdr.isym \
= PROC_SIGTRAMP_MAGIC)
/* If PC is inside a dynamically generated sigtramp function, return
how many bytes the program counter is beyond the start of that
function. Otherwise, return a negative value. */
#undef DYNAMIC_SIGTRAMP_OFFSET
#define DYNAMIC_SIGTRAMP_OFFSET(pc) (alpha_linux_sigtramp_offset (pc))
/* Translate a signal handler frame into the address of the sigcontext
structure. */
#undef SIGCONTEXT_ADDR
#define SIGCONTEXT_ADDR(frame) ((frame)->frame - 0x298)
/* 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. */
#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"
#endif /* TM_LINUXALPHA_H */

View File

@ -0,0 +1,29 @@
/* Host definitions for GDB running on an Alpha under Linux
Copyright (C) 1996 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
#if !defined (HOST_BYTE_ORDER)
#define HOST_BYTE_ORDER LITTLE_ENDIAN
#endif
/* The alpha has no siginterrupt routine. */
#define NO_SIGINTERRUPT
#define HAVE_TERMIOS
#define HAVE_SIGSETMASK 1
#define USG

View File

@ -0,0 +1,27 @@
/* Host definitions for GDB running on an alpha under OSF/1
Copyright (C) 1992, 1993 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
#if !defined (HOST_BYTE_ORDER)
#define HOST_BYTE_ORDER LITTLE_ENDIAN
#endif
/* The alpha has no siginterrupt routine. */
#define NO_SIGINTERRUPT
#define HAVE_TERMIOS

View File

@ -0,0 +1,6 @@
MH_CFLAGS=
XM_FILE=xm-cygwin.h
XDEPFILES=ser-tcp.o
NATDEPFILES= win32-nat.o
NAT_FILE=../nm-empty.h
XM_CLIBS=

View File

@ -0,0 +1,6 @@
# Target: Intel 386 run win32
TDEPFILES= i386-tdep.o i387-tdep.o
TM_FILE= tm-cygwin.h

View File

@ -1,5 +1,5 @@
# Host: Intel 386 running FreeBSD
XDEPFILES=
XDEPFILES= ser-tcp.o
NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o core-aout.o i386b-nat.o
XM_FILE= xm-i386bsd.h
NAT_FILE= nm-fbsd.h

View File

@ -1,3 +1,3 @@
# Target: Intel 386 running FreeBSD
TDEPFILES= i386-tdep.o i387-tdep.o solib.o
TM_FILE= tm-i386bsd.h
TM_FILE= tm-fbsd.h

View File

@ -1,7 +1,6 @@
MH_CFLAGS=-D__GO32__ -D__MSDOS__
XDEPFILES= go32-xdep.o
XM_FILE= xm-go32.h
TERMCAP=
HOST_IPC=-DDOS_IPC
SER_HARDWIRE= ser-go32.o
CC=i386-go32-gcc -O2 -fno-omit-frame-pointer

View File

@ -6,7 +6,5 @@ XDEPFILES=
NAT_FILE= nm-i386aix.h
NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o i386aix-nat.o
TERMCAP=-lcurses
# Use gcc. Only coff output can be debugged
CC=gcc

View File

@ -7,8 +7,3 @@ XM_CLIBS= -lsocket -lnsl
NAT_FILE= nm-i386v4.h
NATDEPFILES= corelow.o core-regset.o solib.o procfs.o fork-child.o i386v4-nat.o
# SVR4 comes standard with terminfo, and in some implementations, the
# old termcap descriptions are incomplete. So ensure that we use the
# new terminfo interface and latest terminal descriptions.
TERMCAP=-lcurses

View File

@ -1,8 +1,11 @@
# Host: Intel 386 running the GNU Hurd
XDEPFILES= i387-tdep.o
NATDEPFILES= i386gnu-nat.o gnu-nat.o fork-child.o solib.o notify_S.o process_reply_S.o msg_reply_S.o msg_U.o exc_request_U.o exc_request_S.o
NATDEPFILES= i386gnu-nat.o gnu-nat.o fork-child.o solib.o corelow.o notify_S.o process_reply_S.o msg_reply_S.o msg_U.o exc_request_U.o exc_request_S.o
XM_FILE= xm-i386gnu.h
NAT_FILE= nm-gnu.h
MH_CFLAGS = -D_GNU_SOURCE
XM_CLIBS = -lshouldbeinlibc
# Use our own user stubs for the msg rpcs, so we can make them time out, in
# case the program is fucked, or we guess the wrong signal thread.
@ -26,11 +29,3 @@ MIGCOM = $(MIG) -cc cat - /dev/null
%_U.h %_U.c: %.defs
$(CPP) $(CPPFLAGS) $($*-MIGUFLAGS) -x c $< \
| $(MIGCOM) -sheader /dev/null -server /dev/null -user $*_U.c -header $*_U.h
gnu-nat.o: process_reply_S.h exc_request_S.h notify_S.h msg_reply_S.h exc_request_U.h msg_U.h
gnu-nat.o i386gnu-nat.o: gnu-nat.h
# Don't use the mmalloc library in Mach 3.
MMALLOC =
MMALLOC_DISABLE = -DNO_MMALLOC

View File

@ -5,7 +5,3 @@ NATDEPFILES= i386m3-nat.o m3-nat.o fork-child.o
NAT_CLIBS= -lmachid -lnetname -lmach
XM_FILE= xm-i386m3.h
NAT_FILE= nm-m3.h
# Don't use the mmalloc library in Mach 3.
MMALLOC =
MMALLOC_DISABLE = -DNO_MMALLOC

View File

@ -2,7 +2,3 @@
XDEPFILES= os-mach3.o i386mach3-xdep.o i387-tdep.o
XM_FILE= xm-i386osf1mk.h
# Don't use the mmalloc library in Mach 3.
MMALLOC =
MMALLOC_DISABLE = -DNO_MMALLOC

View File

@ -1,6 +1,6 @@
# Target: Intel 386 with a.out in osf 1/mk
TDEPFILES= i386-tdep.o
TM_FILE= tm-i386osf1mk.h
TM_CFLAGS= -I/usr/mach3/include
TM_CLIBS= /usr/mach3/ccs/lib/libmachid.a /usr/mach3/ccs/lib/libnetname.a /usr/mach3/ccs/lib/libmach.a
OBJFORMATS= dbxread.o

View File

@ -12,6 +12,6 @@ XDEPFILES= ser-tcp.o
XM_CLIBS= -lPW -lsocket
NAT_FILE= nm-i386sco5.h
NATDEPFILES= infptrace.o inftarg.o fork-child.o corefile.o core-aout.o corelow.o \
i386v-nat.o solib.o
NATDEPFILES= infptrace.o inftarg.o fork-child.o corefile.o core-aout.o \
corelow.o i386v-nat.o solib.o

View File

@ -0,0 +1,3 @@
# Target: Intel 386 running SCO Open Server 5
TDEPFILES= i386-tdep.o i387-tdep.o
TM_FILE= tm-i386sco5.h

View File

@ -3,10 +3,5 @@
XM_FILE= xm-i386v4.h
XDEPFILES=
NAT_FILE= nm-i386v4.h
NAT_FILE= nm-i386sol2.h
NATDEPFILES= core-regset.o procfs.o fork-child.o i386v4-nat.o corelow.o
# SVR4 comes standard with terminfo, and in some implementations, the
# old termcap descriptions are incomplete. So ensure that we use the
# new terminfo interface and latest terminal descriptions.
TERMCAP=-ltermlib

View File

@ -1,3 +1,3 @@
# Target: Intel 386 running SVR4
TDEPFILES= i386-tdep.o i387-tdep.o solib.o
TM_FILE= tm-i386v4.h
TM_FILE= tm-i386sol2.h

View File

@ -7,8 +7,3 @@ XM_CLIBS= -lsocket -lnsl
NAT_FILE= nm-i386v4.h
NATDEPFILES= corelow.o core-regset.o solib.o procfs.o fork-child.o i386v4-nat.o
# SVR4 comes standard with terminfo, and in some implementations, the
# old termcap descriptions are incomplete. So ensure that we use the
# new terminfo interface and latest terminal descriptions.
TERMCAP=-ltermlib

View File

@ -0,0 +1,11 @@
# Host: Intel 386 running SVR4
XM_FILE= xm-i386v4.h
XDEPFILES=
# for network communication
XM_CLIBS= -lsocket -lnsl
# we don't want nm-i386v4.h since that defines LOSING_POLL which isn't
# appropriate for i386v42mp
NAT_FILE= nm-i386v42mp.h
NATDEPFILES= corelow.o core-regset.o solib.o procfs.o fork-child.o i386v4-nat.o

View File

@ -0,0 +1,3 @@
# Target: Intel 386 running SVR4.2MP
TDEPFILES= i386-tdep.o i387-tdep.o
TM_FILE= tm-i386v42mp.h

View File

@ -1,13 +1,7 @@
# Host: Intel 386 running Linux
# Host: Intel 386 running GNU/Linux
XM_FILE= xm-linux.h
XDEPFILES= ser-tcp.o
# Needed for frexp() in libiberty for older a.out based systems and should be
# harmless to include for newer linux systems.
XM_CLIBS= -lm
NAT_FILE= nm-linux.h
NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o corelow.o core-aout.o core-regset.o i386v-nat.o i386v4-nat.o
GDBSERVER_DEPFILES= low-linux.o

View File

@ -1,3 +1,5 @@
# Target: Intel 386 with a.out and ELF
# Target: Intel 386 running GNU/Linux
TDEPFILES= i386-tdep.o i387-tdep.o
TM_FILE= tm-linux.h
GDBSERVER_DEPFILES= low-linux.o

View File

@ -1,5 +1,5 @@
# Host: Intel 386 running NetBSD
XDEPFILES=
XDEPFILES= ser-tcp.o
NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o i386b-nat.o
XM_FILE= xm-nbsd.h
NAT_FILE= nm-nbsd.h

View File

@ -14,8 +14,3 @@ XDEPFILES=
NAT_FILE= nm-i386v4.h
NATDEPFILES= corelow.o core-regset.o procfs.o fork-child.o i386v4-nat.o
# SVR4 comes standard with terminfo, and in some implementations, the
# old termcap descriptions are incomplete. So ensure that we use the
# new terminfo interface and latest terminal descriptions.
TERMCAP=-ltermlib

View File

@ -29,9 +29,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <machine/vmparam.h>
#define KERNEL_U_ADDR USRSTACK
#define FLOAT_INFO extern i386_float_info (); \
i386_float_info ()
#define REGISTER_U_ADDR(addr, blockend, regno) \
(addr) = i386_register_u_addr ((blockend),(regno));

View File

@ -35,12 +35,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
extern int
i386_register_u_addr PARAMS ((int, int));
/*
* SysV doesn't always have a <ptrace.h> or <sys/ptrace.h> file
* (why, I don't know), and we don't need it.
*/
#define NO_PTRACE_H
/* When calling functions on SCO, sometimes we get an error writing some
of the segment registers. This would appear to be a kernel
bug/non-feature. */

View File

@ -1,7 +1,8 @@
/* Native support for SCO OpenServer 5
Copyright 1996 Free Software Foundation, Inc.
By Robert Lipe <robertl@dgii.com>. Based on
work by Ian Lance Taylor <ian@cygnus.com. and
Copyright 1996, 1998 Free Software Foundation, Inc.
Re-written by J. Kean Johnston <jkj@sco.com>.
Originally written by Robert Lipe <robertl@dgii.com>, based on
work by Ian Lance Taylor <ian@cygnus.com> and
Martin Walker <maw@netcom.com>.
This file is part of GDB.
@ -20,22 +21,19 @@ 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. */
/* SCO OpenServer 5 is a superset of 3.2v4. It is actually quite
close to SVR4 [ elf, dynamic libes, mmap ] but misses a few things
like /proc. */
/* Basically, its a lot like the older versions ... */
#include "i386/nm-i386sco.h"
/* Since the native compilers [ and linkers ] are licensed from USL,
we'll try convincing GDB of this... */
#include "solib.h" /* Pick up shared library support */
/* ... but it can do a lot of SVR4 type stuff too. */
#define SVR4_SHARED_LIBS
#include "solib.h" /* Pick up shared library support */
#define ATTACH_DETACH
/* SCO, does not provide <sys/ptrace.h>. infptrace.c does not
/* SCO does not provide <sys/ptrace.h>. infptrace.c does not
have defaults for these values. */
#define PTRACE_ATTACH 10
#define PTRACE_DETACH 11

View File

@ -0,0 +1,35 @@
/* Native support for i386 running Solaris 2.
Copyright 1998 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 "nm-sysv4.h"
#ifdef HAVE_THREAD_DB_LIB
#ifdef __STDC__
struct objfile;
#endif
#define target_new_objfile(OBJFILE) sol_thread_new_objfile (OBJFILE)
void sol_thread_new_objfile PARAMS ((struct objfile *objfile));
#define FIND_NEW_THREADS sol_find_new_threads
void sol_find_new_threads PARAMS ((void));
#endif

View File

@ -34,5 +34,3 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
extern int
i386_register_u_addr PARAMS ((int, int));
#define NO_PTRACE_H

Some files were not shown because too many files have changed in this diff Show More