diff options
author | Jason Molenda <jsm@bugshack.cygnus.com> | 2000-02-07 00:19:30 +0000 |
---|---|---|
committer | Jason Molenda <jsm@bugshack.cygnus.com> | 2000-02-07 00:19:30 +0000 |
commit | 8dabd7496a9eeaca2a7180c0a176059ba9229bb2 (patch) | |
tree | 6854c261d85b62ce50fe70d47a0f696df8d54bd6 | |
parent | e647e4bddf3a76dbd5e59322b2f57aa1ebebcb77 (diff) | |
download | gdb-8dabd7496a9eeaca2a7180c0a176059ba9229bb2.tar.gz |
import insight-2000-02-04 snapshot (2nd try)insight-2000-02-04
38 files changed, 10933 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c2c53f21290..4d68fd71b92 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -22,6 +22,11 @@ Fri Feb 4 22:42:36 2000 Andrew Cagney <cagney@b1.cygnus.com> * Makefile.in (INIT_FILES): Append CONFIG_INITS * configure.in (CONFIG_INIT): Initialize. + (links): Link srcdir/gdbtk/library to gdbtcl2. + * gdbtcl2: Moved to gdbtk/library. + ChangeLog-gdbtk, gdbtk-cmds.c, gdbtk-hooks.c, gdbtk-variable.c, + gdbtk-varobj.c, gdbtk-wrapper.c, gdbtk-wrapper.h, gdbtk.c, + gdbtk.h: Moved to gdbtk/generic. 2000-02-03 Elena Zannoni <ezannoni@kwikemart.cygnus.com> diff --git a/gdb/ChangeLog-99 b/gdb/ChangeLog-99 index 2fc778b652a..b82a88d5521 100644 --- a/gdb/ChangeLog-99 +++ b/gdb/ChangeLog-99 @@ -3209,6 +3209,9 @@ Sat Sep 18 07:13:03 1999 Jeffrey A Law (law@cygnus.com) 1999-09-17 Fernando Nasser <fnasser@totem.to.cygnus.com> * Makefile.in: Add entries for varobj.[cho] and wrapper.[cho]. + gdbtk-varobj.[co]. gdbtk-varobj.o is not yet on the COMMON_OBS + list because it conflicts with the older gdbtk-variable.o which + is still the default. 1999-09-17 Fernando Nasser <fnasser@totem.to.cygnus.com> @@ -3368,6 +3371,8 @@ Tue Sep 14 14:34:28 1999 Andrew Cagney <cagney@b1.cygnus.com> * defs.h (continuation): Make this a typedef. + * Makefile.in (gdbtk.o, gdbtk-cmds.o): Depend on $(top_h). + * Makefile.in (i386-linux-nat.o): Depend on symfile.h, not $(symfile_h); the latter has no definition. @@ -3411,6 +3416,8 @@ Tue Sep 14 14:34:28 1999 Andrew Cagney <cagney@b1.cygnus.com> __dld_break, which contains the permanent breakpoint, when interesting things happen. Tell GDB that the breakpoint in __dld_break is permanent. + * gdbtk-cmds.c (gdb_get_breakpoint_info): Report a permanent + breakpoint as enabled. * infrun.c (SKIP_PERMANENT_BREAKPOINT): Provide default definition. (default_skip_permanent_breakpoint): New function. (resume): If we're trying to resume at a permanent breakpoint, use diff --git a/gdb/MAINTAINERS b/gdb/MAINTAINERS index ef02b907400..7da82dd9124 100644 --- a/gdb/MAINTAINERS +++ b/gdb/MAINTAINERS @@ -20,6 +20,8 @@ x86 linux native Jim Blandy jimb@cygnus.com Scheme support Jim Blandy jimb@cygnus.com svr4 shlibs (solib.c) Jim Blandy jimb@cygnus.com arm target Jim Ingham jingham@cygnus.com +gdbtk (c & tcl) Jim Ingham jingham@cygnus.com +libgui (w/foundry, sn) Jim Ingham jingham@cygnus.com hurd native Mark Kettenis kettenis@wins.va.nl hpux, hp pa native Jeff Law law@cygnus.com m32r target Michael Snyder msnyder@cygnus.com diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 775067c760e..034cafa69d8 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -158,6 +158,47 @@ SIM = WIN32LIBS = @WIN32LIBS@ +# Where is the TCL library? Typically in ../tcl. +LIB_INSTALL_DIR = $(libdir) +# This variable is needed when doing dynamic linking. +LIB_RUNTIME_DIR = $(libdir) +TCL = @TCL_LD_SEARCH_FLAGS@ @TCL_BUILD_LIB_SPEC@ +TCL_CFLAGS = @TCLHDIR@ +TCL_DEPS = +GDBTKLIBS = @GDBTKLIBS@ +# Extra flags that the GDBTK files need: +GDBTK_CFLAGS = @GDBTK_CFLAGS@ + +# Where is the TK library? Typically in ../tk. +TK = @TK_BUILD_LIB_SPEC@ +TK_CFLAGS = @TKHDIR@ @TK_BUILD_INCLUDES@ +TK_DEPS = + +# Where is Itcl? Typically in ../itcl/itcl. +ITCL_CFLAGS = @ITCLHDIR@ +ITCL = @ITCLLIB@ +ITCL_DEPS = @ITCL_DEPS@ + +# Where is Itk? Typically in ../itcl/itk. +ITK_CFLAGS = @ITKHDIR@ +ITK = @ITKLIB@ +ITK_DEPS = @ITK_DEPS@ + +# Where is Tix? Typically in ../tix. +TIX_CFLAGS = @TIXHDIR@ +TIX = @TIXLIB@ +TIX_DEPS = @TIX_DEPS@ + +X11_CFLAGS = @TK_XINCLUDES@ +X11_LDFLAGS = +X11_LIBS = + +WIN32LDAPP = @WIN32LDAPP@ + +ENABLE_GDBTK= @ENABLE_GDBTK@ +LIBGUI = @LIBGUI@ +GUI_CFLAGS_X = @GUI_CFLAGS_X@ +IDE_CFLAGS=$(GUI_CFLAGS_X) $(IDE_CFLAGS_X) ENABLE_CFLAGS= @ENABLE_CFLAGS@ @@ -390,6 +431,7 @@ SFILES = ax-general.c ax-gdb.c bcache.c blockframe.c breakpoint.c \ kod.c kod-cisco.c \ ui-out.c cli-out.c \ varobj.c wrapper.c \ + gdbtk-varobj.c \ jv-exp.y jv-lang.c jv-valprint.c jv-typeprint.c \ m2-exp.y m2-lang.c m2-typeprint.c m2-valprint.c main.c maint.c \ mem-break.c minsyms.c mipsread.c nlmread.c objfiles.c parse.c \ @@ -609,6 +651,18 @@ install-only: fi ; \ $(INSTALL_PROGRAM) gdb$(EXEEXT) $(bindir)/$$transformed_name$(EXEEXT) ; \ $(INSTALL_DATA) $(srcdir)/gdb.1 $(man1dir)/$$transformed_name.1 + $(SHELL) $(srcdir)/../mkinstalldirs $(datadir)/gdbtcl ; \ + $(SHELL) $(srcdir)/../mkinstalldirs \ + $(datadir)/gdbtcl/images \ + $(datadir)/gdbtcl/images2 ; \ + $(SHELL) $(srcdir)/../mkinstalldirs $(datadir)/gdbtcl/help \ + $(datadir)/gdbtcl/help/images \ + $(datadir)/gdbtcl/help/trace ; \ + cd $(srcdir)/gdbtk/library ; \ + for i in *.tcl *.ith *.itb images/*.gif images2/*.gif images/icons.txt images2/icons.txt tclIndex help/*.html help/trace/*.html help/trace/index.toc help/images/*.gif; \ + do \ + $(INSTALL_DATA) $$i $(datadir)/gdbtcl/$$i ; \ + done ; @$(MAKE) DO=install "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do uninstall: force @@ -620,6 +674,7 @@ uninstall: force true ; \ fi ; \ rm -f $(bindir)/$$transformed_name$(EXEEXT) $(man1dir)/$$transformed_name.1 + rm -rf $(datadir)/gdbtcl @$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do # We do this by grepping through sources. If that turns out to be too slow, @@ -1170,6 +1225,62 @@ findvar.o: findvar.c $(defs_h) $(gdbcore_h) $(inferior_h) target.h \ fork-child.o: fork-child.c $(wait_h) $(defs_h) $(gdbcore_h) \ $(inferior_h) target.h terminal.h gdbthread.h gdb_string.h +gdbres.o: $(srcdir)/gdbtk/gdb.rc $(srcdir)/gdbtk/gdbtool.ico + $(WINDRES) --include $(srcdir)/gdbtk $(srcdir)/gdbtk/gdb.rc gdbres.o + +gdbtk.o: $(srcdir)/gdbtk/generic/gdbtk.c \ + $(srcdir)/gdbtk/generic/gdbtk.h $(defs_h) \ + $(symtab_h) $(inferior_h) $(command_h) \ + $(bfd_h) symfile.h objfiles.h target.h gdb_string.h $(tracepoint_h) \ + $(top_h) + $(CC) -c $(INTERNAL_CFLAGS) $(IDE_CFLAGS) $(ITCL_CFLAGS) \ + $(ITK_CFLAGS) $(TIX_CFLAGS) \ + $(TCL_CFLAGS) $(TK_CFLAGS) $(X11_CFLAGS) $(GDBTK_CFLAGS)\ + $(srcdir)/gdbtk/generic/gdbtk.c -DGDBTK_LIBRARY=\"$(datadir)/gdbtcl\" + +gdbtk-cmds.o: $(srcdir)/gdbtk/generic/gdbtk-cmds.c \ + $(srcdir)/gdbtk/generic/gdbtk.h \ + $(defs_h) $(symtab_h) $(inferior_h) \ + $(command_h) $(bfd_h) $(top_h) symfile.h objfiles.h target.h \ + gdb_string.h $(tracepoint_h) $(frame_h) source.h + $(CC) -c $(INTERNAL_CFLAGS) $(IDE_CFLAGS) $(ITCL_CFLAGS) \ + $(TIX_CFLAGS) $(TCL_CFLAGS) $(TK_CFLAGS) $(X11_CFLAGS) \ + $(GDBTK_CFLAGS) $(srcdir)/gdbtk/generic/gdbtk-cmds.c \ + -DGDBTK_LIBRARY=\"$(datadir)/gdbtcl\" + +gdbtk-hooks.o: $(srcdir)/gdbtk/generic/gdbtk-hooks.c \ + $(srcdir)/gdbtk/generic/gdbtk.h $(defs_h) \ + $(symtab_h) $(inferior_h) $(command_h) \ + $(bfd_h) symfile.h objfiles.h target.h gdb_string.h $(tracepoint_h) + $(CC) -c $(INTERNAL_CFLAGS) $(IDE_CFLAGS) $(ITCL_CFLAGS) $(TIX_CFLAGS) \ + $(TCL_CFLAGS) $(TK_CFLAGS) $(X11_CFLAGS) $(GDBTK_CFLAGS)\ + $(srcdir)/gdbtk/generic/gdbtk-hooks.c -DGDBTK_LIBRARY=\"$(datadir)/gdbtcl\" + +gdbtk-variable.o: $(srcdir)/gdbtk/generic/gdbtk-variable.c \ + $(srcdir)/gdbtk/generic/gdbtk.h $(srcdir)/gdbtk/generic/gdbtk-wrapper.h + $(CC) -c $(INTERNAL_CFLAGS) $(IDE_CFLAGS) $(ITCL_CFLAGS) $(TIX_CFLAGS) \ + $(TCL_CFLAGS) $(TK_CFLAGS) $(X11_CFLAGS) $(GDBTK_CFLAGS)\ + $(srcdir)/gdbtk/generic/gdbtk-variable.c + +gdbtk-varobj.o: $(srcdir)/gdbtk/generic/gdbtk-varobj.c \ + $(srcdir)/gdbtk/generic/gdbtk.h \ + $(defs_h) $(value_h) varobj.h + $(CC) -c $(INTERNAL_CFLAGS) $(IDE_CFLAGS) $(ITCL_CFLAGS) $(TIX_CFLAGS) \ + $(TCL_CFLAGS) $(TK_CFLAGS) $(X11_CFLAGS) $(GDBTK_CFLAGS)\ + $(srcdir)/gdbtk/generic/gdbtk-varobj.c + +gdbtk-wrapper.o: $(srcdir)/gdbtk/generic/gdbtk-wrapper.c \ + $(srcdir)/gdbtk/generic/gdbtk-wrapper.h + $(CC) -c $(INTERNAL_CFLAGS) $(IDE_CFLAGS) $(GDBTK_CFLAGS)\ + $(srcdir)/gdbtk/generic/gdbtk-wrapper.c + +v850ice.o: v850ice.c $(defs_h) $(symtab_h) $(inferior_h) $(command_h) \ + $(frame_h) $(breakpoint_h) $(gdbcore_h) $(value_h) symfile.h \ + gdb_string.h target.h objfiles.h + $(CC) -c $(INTERNAL_CFLAGS) $(IDE_CFLAGS) $(ITCL_CFLAGS) $(TIX_CFLAGS) \ + $(TCL_CFLAGS) $(TK_CFLAGS) $(X11_CFLAGS) $(GDBTK_CFLAGS)\ + $(srcdir)/v850ice.c + tracepoint.o: tracepoint.c $(defs_h) $(symtab_h) $(frame_h) $(tracepoint_h) \ $(gdbtypes_h) $(expression_h) $(gdbcmd_h) $(value_h) target.h \ language.h gdb_string.h $(readline_headers) $(remote_h) diff --git a/gdb/configure b/gdb/configure index 441911a096e..a53879c6529 100755 --- a/gdb/configure +++ b/gdb/configure @@ -5554,6 +5554,10 @@ if test x$gdb_cv_os_cygwin = xyes; then fi +LIBGUI="../libgui/src/libgui.a" +GUI_CFLAGS_X="-I${srcdir}/../libgui/src" + + # Check whether --with-cpu or --without-cpu was given. if test "${with_cpu+set}" = set; then @@ -5596,6 +5600,968 @@ fi +ENABLE_GDBTK= + +# Check whether --enable-gdbtk or --disable-gdbtk was given. +if test "${enable_gdbtk+set}" = set; then + enableval="$enable_gdbtk" + case "${enableval}" in + yes) + case "$host" in + *go32*) + echo "configure: warning: GDB does not support GDBtk on host ${host}. GDBtk will be disabled." 1>&2 + enable_gdbtk=no ;; + *windows*) + echo "configure: warning: GDB does not support GDBtk on host ${host}. GDBtk will be disabled." 1>&2 + enable_gdbtk=no ;; + *) + enable_gdbtk=yes ;; + esac ;; + no) + enable_gdbtk=no ;; + *) + { echo "configure: error: bad value ${enableval} given for gdbtk option" 1>&2; exit 1; } ;; +esac +else + +# Default is on for everything but go32 and Cygwin +case "$host" in + *go32* | *windows*) + ;; + *) + enable_gdbtk=yes ;; + esac + +fi + + +WIN32LDAPP= + + + +configdir="unix" + +GDBTKLIBS= +if test "${enable_gdbtk}" = "yes"; then + + +# +# 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 + # Check whether --with-tclconfig or --without-tclconfig was given. +if test "${with_tclconfig+set}" = set; then + withval="$with_tclconfig" + with_tclconfig=${withval} +fi + + echo $ac_n "checking for Tcl configuration""... $ac_c" 1>&6 +echo "configure:5791: checking for Tcl configuration" >&5 + if eval "test \"`echo '$''{'ac_cv_c_tclconfig'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + + # 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 + { echo "configure: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" 1>&2; exit 1; } + 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 + +fi + + if test x"${ac_cv_c_tclconfig}" = x ; then + TCLCONFIG="# no Tcl configs found" + echo "configure: warning: Can't find Tcl configuration definitions" 1>&2 + else + no_tcl= + TCLCONFIG=${ac_cv_c_tclconfig}/tclConfig.sh + echo "$ac_t""found $TCLCONFIG" 1>&6 + fi +fi + + if test -z "${no_tcl}"; then + + . $TCLCONFIG + + + + + + + + + + + + + + + + + + + + + + + + + + +# +# 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 + # Check whether --with-tkconfig or --without-tkconfig was given. +if test "${with_tkconfig+set}" = set; then + withval="$with_tkconfig" + with_tkconfig=${withval} +fi + + echo $ac_n "checking for Tk configuration""... $ac_c" 1>&6 +echo "configure:5899: checking for Tk configuration" >&5 + if eval "test \"`echo '$''{'ac_cv_c_tkconfig'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + + # 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 + { echo "configure: error: ${with_tkconfig} directory doesn't contain tkConfig.sh" 1>&2; exit 1; } + 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 + +fi + + if test x"${ac_cv_c_tkconfig}" = x ; then + TKCONFIG="# no Tk configs found" + echo "configure: warning: Can't find Tk configuration definitions" 1>&2 + else + no_tk= + TKCONFIG=${ac_cv_c_tkconfig}/tkConfig.sh + echo "$ac_t""found $TKCONFIG" 1>&6 + fi +fi + + + + # If $no_tk is nonempty, then we can't do Tk, and there is no + # point to doing Tcl. + if test -z "${no_tk}"; then + + if test -f "$TKCONFIG" ; then + . $TKCONFIG + fi + + + + + + + + + + + + + + +# +# 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 +echo $ac_n "checking for Tcl private headers. dir=${configdir}""... $ac_c" 1>&6 +echo "configure:5995: checking for Tcl private headers. dir=${configdir}" >&5 +# Check whether --with-tclinclude or --without-tclinclude was given. +if test "${with_tclinclude+set}" = set; then + withval="$with_tclinclude" + with_tclinclude=${withval} +fi + +if eval "test \"`echo '$''{'ac_cv_c_tclh'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +# 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 + { echo "configure: error: ${with_tclinclude} directory doesn't contain private headers" 1>&2; exit 1; } + 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_safe=`echo "tclInt.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for tclInt.h""... $ac_c" 1>&6 +echo "configure:6061: checking for tclInt.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 6066 "configure" +#include "confdefs.h" +#include <tclInt.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:6071: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_cv_c_tclh=installed +else + echo "$ac_t""no" 1>&6 +ac_cv_c_tclh="" +fi + +fi + +fi + +if test x"${ac_cv_c_tclh}" = x ; then + TCLHDIR="# no Tcl private headers found" + { echo "configure: error: Can't find Tcl private headers" 1>&2; exit 1; } +fi +if test x"${ac_cv_c_tclh}" != x ; then + no_tcl="" + if test x"${ac_cv_c_tclh}" = x"installed" ; then + echo "$ac_t""is installed" 1>&6 + TCLHDIR="" + else + echo "$ac_t""found in ${ac_cv_c_tclh}" 1>&6 + # this hack is cause the TCLHDIR won't print if there is a "-I" in it. + TCLHDIR="-I${ac_cv_c_tclh}" + fi +fi + + + + +# +# 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 +echo $ac_n "checking for Tk private headers""... $ac_c" 1>&6 +echo "configure:6131: checking for Tk private headers" >&5 +# Check whether --with-tkinclude or --without-tkinclude was given. +if test "${with_tkinclude+set}" = set; then + withval="$with_tkinclude" + with_tkinclude=${withval} +fi + +if eval "test \"`echo '$''{'ac_cv_c_tkh'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +# 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 + { echo "configure: error: ${with_tkinclude} directory doesn't contain private headers" 1>&2; exit 1; } + 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_safe=`echo "tk.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for tk.h""... $ac_c" 1>&6 +echo "configure:6197: checking for tk.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 6202 "configure" +#include "confdefs.h" +#include <tk.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:6207: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_cv_c_tkh=installed +else + echo "$ac_t""no" 1>&6 +ac_cv_c_tkh="" +fi + +fi + +fi + +if test x"${ac_cv_c_tkh}" != x ; then + no_tk="" + if test x"${ac_cv_c_tkh}" = x"installed" ; then + echo "$ac_t""is installed" 1>&6 + TKHDIR="" + else + echo "$ac_t""found in ${ac_cv_c_tkh}" 1>&6 + # 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" + echo "configure: warning: Can't find Tk private headers" 1>&2 + no_tk=true +fi + + + + +echo $ac_n "checking for Itcl private headers. srcdir=${srcdir}""... $ac_c" 1>&6 +echo "configure:6253: checking for Itcl private headers. srcdir=${srcdir}" >&5 +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" + { echo "configure: error: Can't find Itcl private headers" 1>&2; exit 1; } +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(ITCLLIB) + + +echo $ac_n "checking for Itk private headers. srcdir=${srcdir}""... $ac_c" 1>&6 +echo "configure:6276: checking for Itk private headers. srcdir=${srcdir}" >&5 +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" + { echo "configure: error: Can't find Itk private headers" 1>&2; exit 1; } +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(ITKLIB) + + +echo $ac_n "checking for Tix private headers. srcdir=${srcdir}""... $ac_c" 1>&6 +echo "configure:6299: checking for Tix private headers. srcdir=${srcdir}" >&5 +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" + { echo "configure: error: Can't find Tix private headers" 1>&2; exit 1; } +fi +if test x"${ac_cv_c_tixh}" != x ; then + TIXHDIR="-I${ac_cv_c_tixh}" +fi + + + + # now look for Itcl library stuff + + +# +# 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 + # Check whether --with-itclconfig or --without-itclconfig was given. +if test "${with_itclconfig+set}" = set; then + withval="$with_itclconfig" + with_itclconfig=${withval} +fi + + echo $ac_n "checking for Itcl configuration""... $ac_c" 1>&6 +echo "configure:6337: checking for Itcl configuration" >&5 + if eval "test \"`echo '$''{'ac_cv_c_itclconfig'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + + # 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 + { echo "configure: error: ${with_itclconfig} directory doesn't contain itclConfig.sh" 1>&2; exit 1; } + 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 + +fi + + if test x"${ac_cv_c_itclconfig}" = x ; then + ITCLCONFIG="# no Itcl configs found" + echo "configure: warning: Can't find Itcl configuration definitions" 1>&2 + else + no_itcl= + ITCLCONFIG=${ac_cv_c_itclconfig}/itclConfig.sh + echo "$ac_t""found $ITCLCONFIG" 1>&6 + fi +fi + + if test -z "${no_itcl}"; then + + if test -f "$ITCLCONFIG" ; then + . $ITCLCONFIG + fi + + + + + + + + + + + + case "${host}" in + *-*-cygwin*) + itcldir=../itcl/itcl/win/ + ;; + *) + itcldir=../itcl/itcl/unix/ + ;; + esac + + + ITCLLIB="${ITCL_BUILD_LIB_SPEC}" + ITCL_DEPS="${itcldir}${ITCL_LIB_FILE}" + fi + + + # now look for Itk library stuff + +# +# 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 + # Check whether --with-itkconfig or --without-itkconfig was given. +if test "${with_itkconfig+set}" = set; then + withval="$with_itkconfig" + with_itkconfig=${withval} +fi + + echo $ac_n "checking for Itk configuration""... $ac_c" 1>&6 +echo "configure:6449: checking for Itk configuration" >&5 + if eval "test \"`echo '$''{'ac_cv_c_itkconfig'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + + # 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 + { echo "configure: error: ${with_itkconfig} directory doesn't contain itkConfig.sh" 1>&2; exit 1; } + 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 + +fi + + if test x"${ac_cv_c_itkconfig}" = x ; then + ITKCONFIG="# no Itk configs found" + echo "configure: warning: Can't find Itk configuration definitions" 1>&2 + else + no_itk= + ITKCONFIG=${ac_cv_c_itkconfig}/itkConfig.sh + echo "$ac_t""found $ITKCONFIG" 1>&6 + fi +fi + + + if test -z "${no_itcl}"; then + + if test -f "$ITKCONFIG" ; then + . $ITKCONFIG + fi + + + + + + + + + + + + + case "${host}" in + *-*-cygwin*) + itkdir=../itcl/itk/win/ + ;; + *) + itkdir=../itcl/itk/unix/ + ;; + esac + + ITKLIB="${ITK_BUILD_LIB_SPEC}" + ITK_DEPS="${itkdir}${ITK_LIB_FILE}" + fi + + # now look for Tix library stuff + +# +# 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 + # Check whether --with-tixconfig or --without-tixconfig was given. +if test "${with_tixconfig+set}" = set; then + withval="$with_tixconfig" + with_tixconfig=${withval} +fi + + echo $ac_n "checking for Tix configuration""... $ac_c" 1>&6 +echo "configure:6561: checking for Tix configuration" >&5 + if eval "test \"`echo '$''{'ac_cv_c_tixconfig'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + + # 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 + { echo "configure: error: ${with_tixconfig} directory doesn't contain tixConfig.sh" 1>&2; exit 1; } + 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 + +fi + + if test x"${ac_cv_c_tixconfig}" = x ; then + TIXCONFIG="# no Tix configs found" + echo "configure: warning: Can't find Tix configuration definitions" 1>&2 + else + no_tix= + TIXCONFIG=${ac_cv_c_tixconfig}/tixConfig.sh + echo "$ac_t""found $TIXCONFIG" 1>&6 + fi +fi + + + if test -z "${no_tix}"; then + + if test -f "$TIXCONFIG" ; then + . $TIXCONFIG + fi + + + + + + + + + TIXLIB="${TIX_BUILD_LIB_SPEC}" + TIX_DEPS="${TIX_BUILD_LOCATION}/${TIX_LIB_FILE}" + fi + + ENABLE_GDBTK=1 + ENABLE_CFLAGS="$ENABLE_CFLAGS -DGDBTK" + # Tcl/Tk 8.1 require -fwritable strings. I don't + # know whether 8.2 will or not, but I bet it will. + # I don't have to worry about 7.x since we don't support it. + GDBTK_CFLAGS="" + if test "$GCC" = "yes"; then + if test "$TCL_VERSION" != "8.0" ; then + GDBTK_CFLAGS="-fwritable-strings" + fi + fi + + # Include some libraries that Tcl and Tk want. + TCL_LIBS='$(LIBGUI) $(ITCL) $(ITK) $(TIX) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)' + CONFIG_DEPS='$(LIBGUI) $(ITCL_DEPS) $(ITK_DEPS) $(TIX_DEPS) $(TK_DEPS) $(TCL_DEPS)' + # Yes, the ordering seems wrong here. But it isn't. + # TK_LIBS is the list of libraries that need to be linked + # after Tcl/Tk. Note that this isn't put into LIBS. If it + # were in LIBS then any link tests after this point would + # try to include things like `$(LIBGUI)', which wouldn't work. + GDBTKLIBS="${TCL_LIBS} ${TK_LIBS}" + CONFIG_SRCS="${CONFIG_SRCS} gdbtk/generic/gdbtk.c gdbtk/generic/gdbtk-cmds.c gdbtk/generic/gdbtk-hooks.c gdbtk/generic/gdbtk-variable.c gdbtk/generic/gdbtk-wrapper.c" + CONFIG_OBS="${CONFIG_OBS} gdbtk.o gdbtk-cmds.o gdbtk-hooks.o gdbtk-variable.o gdbtk-wrapper.o" + CONFIG_INITS="${CONFIG_INITS} gdbtk/generic/gdbtk.c gdbtk/generic/gdbtk-cmds.c gdbtk/generic/gdbtk-hooks.c gdbtk/generic/gdbtk-variable.c gdbtk/generic/gdbtk-wrapper.c" + + if test x$gdb_cv_os_cygwin = xyes; then + WIN32LIBS="${WIN32LIBS} -lshell32 -lgdi32 -lcomdlg32 -ladvapi32" + WIN32LDAPP="-Wl,--subsystem,console" + CONFIG_OBS="${CONFIG_OBS} gdbres.o" + fi + fi + fi +fi + + + + + + + + + + + + + # If we find X, set shell vars x_includes and x_libraries to the # paths, otherwise set no_x=yes. @@ -6022,6 +6988,37 @@ else files="${files} config/nm-empty.h" links="${links} nm.h" fi +echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 +echo "configure:7159: checking whether ln -s works" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + rm -f conftestdata +if ln -s X conftestdata 2>/dev/null +then + rm -f conftestdata + ac_cv_prog_LN_S="ln -s" +else + ac_cv_prog_LN_S=ln +fi +fi +LN_S="$ac_cv_prog_LN_S" +if test "$ac_cv_prog_LN_S" = "ln -s"; then + echo "$ac_t""yes" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Make it possible to use the GUI without doing a full install +if test "${enable_gdbtk}" = "yes" ; then + if test "$LN_S" = "ln -s" -a ! -f gdbtcl ; then + echo linking $srcdir/gdbtk/library to gdbtcl + $LN_S $srcdir/gdbtk/library gdbtcl + else + echo Warning: Unable to link $srcdir/gdbtk/library to gdbtcl. You will need to do a + echo " " make install before you are able to run the GUI. + fi +fi diff --git a/gdb/configure.in b/gdb/configure.in index e85f6367a84..8c5ba2fbe95 100644 --- a/gdb/configure.in +++ b/gdb/configure.in @@ -500,6 +500,10 @@ if test x$gdb_cv_os_cygwin = xyes; then fi AC_SUBST(WIN32LIBS) +LIBGUI="../libgui/src/libgui.a" +GUI_CFLAGS_X="-I${srcdir}/../libgui/src" +AC_SUBST(LIBGUI) +AC_SUBST(GUI_CFLAGS_X) AC_ARG_WITH(cpu, [ --with-cpu=CPU Set the default CPU variant to debug], @@ -536,6 +540,153 @@ AC_DEFINE_UNQUOTED(TARGET_CPU_DEFAULT, "${with_cpu}") ],) +ENABLE_GDBTK= + +AC_ARG_ENABLE(gdbtk, +[ --enable-gdbtk Enable GDBTK GUI front end], +[case "${enableval}" in + yes) + case "$host" in + *go32*) + AC_MSG_WARN([GDB does not support GDBtk on host ${host}. GDBtk will be disabled.]) + enable_gdbtk=no ;; + *windows*) + AC_MSG_WARN([GDB does not support GDBtk on host ${host}. GDBtk will be disabled.]) + enable_gdbtk=no ;; + *) + enable_gdbtk=yes ;; + esac ;; + no) + enable_gdbtk=no ;; + *) + AC_MSG_ERROR(bad value ${enableval} given for gdbtk option) ;; +esac], +[ +# Default is on for everything but go32 and Cygwin +case "$host" in + *go32* | *windows*) + ;; + *) + enable_gdbtk=yes ;; + esac +]) + +WIN32LDAPP= +AC_SUBST(WIN32LIBS) +AC_SUBST(WIN32LDAPP) + +configdir="unix" + +GDBTKLIBS= +if test "${enable_gdbtk}" = "yes"; then + + CY_AC_PATH_TCLCONFIG + if test -z "${no_tcl}"; then + CY_AC_LOAD_TCLCONFIG + CY_AC_PATH_TKCONFIG + + # If $no_tk is nonempty, then we can't do Tk, and there is no + # point to doing Tcl. + if test -z "${no_tk}"; then + CY_AC_LOAD_TKCONFIG + CY_AC_PATH_TCLH + CY_AC_PATH_TKH + CY_AC_PATH_ITCLH + CY_AC_PATH_ITKH + CY_AC_PATH_TIXH + + # now look for Itcl library stuff + + CY_AC_PATH_ITCLCONFIG + if test -z "${no_itcl}"; then + CY_AC_LOAD_ITCLCONFIG + case "${host}" in + *-*-cygwin*) + itcldir=../itcl/itcl/win/ + ;; + *) + itcldir=../itcl/itcl/unix/ + ;; + esac + + + ITCLLIB="${ITCL_BUILD_LIB_SPEC}" + ITCL_DEPS="${itcldir}${ITCL_LIB_FILE}" + fi + + + # now look for Itk library stuff + CY_AC_PATH_ITKCONFIG + if test -z "${no_itcl}"; then + CY_AC_LOAD_ITKCONFIG + + case "${host}" in + *-*-cygwin*) + itkdir=../itcl/itk/win/ + ;; + *) + itkdir=../itcl/itk/unix/ + ;; + esac + + ITKLIB="${ITK_BUILD_LIB_SPEC}" + ITK_DEPS="${itkdir}${ITK_LIB_FILE}" + fi + + # now look for Tix library stuff + CY_AC_PATH_TIXCONFIG + if test -z "${no_tix}"; then + CY_AC_LOAD_TIXCONFIG + TIXLIB="${TIX_BUILD_LIB_SPEC}" + TIX_DEPS="${TIX_BUILD_LOCATION}/${TIX_LIB_FILE}" + fi + + ENABLE_GDBTK=1 + ENABLE_CFLAGS="$ENABLE_CFLAGS -DGDBTK" + # Tcl/Tk 8.1 require -fwritable strings. I don't + # know whether 8.2 will or not, but I bet it will. + # I don't have to worry about 7.x since we don't support it. + GDBTK_CFLAGS="" + if test "$GCC" = "yes"; then + if test "$TCL_VERSION" != "8.0" ; then + GDBTK_CFLAGS="-fwritable-strings" + fi + fi + + # Include some libraries that Tcl and Tk want. + TCL_LIBS='$(LIBGUI) $(ITCL) $(ITK) $(TIX) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)' + CONFIG_DEPS='$(LIBGUI) $(ITCL_DEPS) $(ITK_DEPS) $(TIX_DEPS) $(TK_DEPS) $(TCL_DEPS)' + # Yes, the ordering seems wrong here. But it isn't. + # TK_LIBS is the list of libraries that need to be linked + # after Tcl/Tk. Note that this isn't put into LIBS. If it + # were in LIBS then any link tests after this point would + # try to include things like `$(LIBGUI)', which wouldn't work. + GDBTKLIBS="${TCL_LIBS} ${TK_LIBS}" + CONFIG_SRCS="${CONFIG_SRCS} gdbtk/generic/gdbtk.c gdbtk/generic/gdbtk-cmds.c gdbtk/generic/gdbtk-hooks.c gdbtk/generic/gdbtk-variable.c gdbtk/generic/gdbtk-wrapper.c" + CONFIG_OBS="${CONFIG_OBS} gdbtk.o gdbtk-cmds.o gdbtk-hooks.o gdbtk-variable.o gdbtk-wrapper.o" + CONFIG_INITS="${CONFIG_INITS} gdbtk/generic/gdbtk.c gdbtk/generic/gdbtk-cmds.c gdbtk/generic/gdbtk-hooks.c gdbtk/generic/gdbtk-variable.c gdbtk/generic/gdbtk-wrapper.c" + + if test x$gdb_cv_os_cygwin = xyes; then + WIN32LIBS="${WIN32LIBS} -lshell32 -lgdi32 -lcomdlg32 -ladvapi32" + WIN32LDAPP="-Wl,--subsystem,console" + CONFIG_OBS="${CONFIG_OBS} gdbres.o" + fi + fi + fi +fi + +AC_SUBST(ENABLE_GDBTK) +AC_SUBST(X_CFLAGS) +AC_SUBST(X_LDFLAGS) +AC_SUBST(X_LIBS) +AC_SUBST(ITCLLIB) +AC_SUBST(ITCL_DEPS) +AC_SUBST(ITKLIB) +AC_SUBST(ITK_DEPS) +AC_SUBST(TIXLIB) +AC_SUBST(TIX_DEPS) +AC_SUBST(GDBTKLIBS) +AC_SUBST(GDBTK_CFLAGS) AC_PATH_X @@ -721,6 +872,17 @@ else files="${files} config/nm-empty.h" links="${links} nm.h" fi +AC_PROG_LN_S +# Make it possible to use the GUI without doing a full install +if test "${enable_gdbtk}" = "yes" ; then + if test "$LN_S" = "ln -s" -a ! -f gdbtcl ; then + echo linking $srcdir/gdbtk/library to gdbtcl + $LN_S $srcdir/gdbtk/library gdbtcl + else + echo Warning: Unable to link $srcdir/gdbtk/library to gdbtcl. You will need to do a + echo " " make install before you are able to run the GUI. + fi +fi AC_LINK_FILES($files, $links) diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index d6aedaa57f1..e2422d58255 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -646,6 +646,10 @@ Tue Jan 17 14:09:03 1995 Ian Lance Taylor <ian@sanguine.cygnus.com> * remote.texi: Update documentation of set/show mipsfpu. +Fri Jan 6 17:17:28 1995 Stan Shebs <shebs@andros.cygnus.com> + + * gdbgui.texinfo: New file, manual for GUI (gdbtk) users. + * Makefile.in (gdbgui.dvi, gdbgui.info): New actions. Sun Sep 4 16:47:21 1994 Stan Shebs (shebs@andros.cygnus.com) diff --git a/gdb/doc/Makefile.in b/gdb/doc/Makefile.in index 9cbacbb29bb..1280ed7be0f 100644 --- a/gdb/doc/Makefile.in +++ b/gdb/doc/Makefile.in @@ -318,6 +318,19 @@ gdb.mm: $(SFILES_LOCAL) links2roff rluser.texinfo inc-hist.texinfo gdb_toc.html: ${SFILES_DOC} $(MAKEHTML) $(MAKEHTMLFLAGS) -I ${READLINE_DIR} -I $(srcdir) $(srcdir)/gdb.texinfo +# GDB GUI MANUAL: TeX dvi file +gdbgui.dvi : gdbgui.texinfo ${SFILES_DOC} + $(SET_TEXINPUTS) $(TEX) gdbgui.texinfo + $(TEXINDEX) gdbgui.?? + $(SET_TEXINPUTS) $(TEX) gdbgui.texinfo + rm -f gdbgui.aux gdbgui.cp* gdbgui.fn* gdbgui.ky* \ + gdbgui.log gdbgui.pg* gdbgui.toc gdbgui.tp* gdbgui.vr* + +# GDB GUI MANUAL: info file +gdb-gui: gdbgui.info + +gdbgui.info: gdbgui.texinfo ${SFILES_DOC} + $(MAKEINFO) -o gdbgui.info $(srcdir)/gdbgui.texinfo # GDB INTERNALS MANUAL: TeX dvi file gdbint.dvi : gdbint.texinfo diff --git a/gdb/doc/gdbgui.texinfo b/gdb/doc/gdbgui.texinfo new file mode 100644 index 00000000000..6618f73a30a --- /dev/null +++ b/gdb/doc/gdbgui.texinfo @@ -0,0 +1,411 @@ +\input texinfo @c -*-texinfo-*- +@c Copyright 1988 1989 1990 1991 1992 1993 1994 Free Software Foundation, Inc. +@c +@c %**start of header +@c makeinfo ignores cmds prev to setfilename, so its arg cannot make use +@c of @set vars. However, you can override filename with makeinfo -o. +@setfilename gdb.info +@c +@include gdb-cfg.texi +@c +@ifset GENERIC +@settitle Using the Graphical Interface to @value{GDBN} +@end ifset +@ifclear GENERIC +@settitle Using the Graphical Interface to @value{GDBN} (@value{TARGET}) +@end ifclear +@setchapternewpage odd +@c %**end of header + +@c Since this interface is so new, there is much missing still. +@c Desired but unimplemented features are commented out. + +@iftex +@c @smallbook +@c @cropmarks +@end iftex + +@finalout +@syncodeindex ky cp + +@c readline appendices use @vindex +@syncodeindex vr cp + +@c !!set GDB manual's edition---not the same as GDB version! +@set EDITION 4.13 + +@c !!set GDB manual's revision date +@set DATE January 1995 + +@c THIS MANUAL REQUIRES TEXINFO-2 macros and info-makers to format properly. + +@ifinfo +@c This is a dir.info fragment to support semi-automated addition of +@c manuals to an info tree. zoo@cygnus.com is developing this facility. +@format +START-INFO-DIR-ENTRY +* Gdb: (gdb). The GNU debugger. +END-INFO-DIR-ENTRY +@end format +@end ifinfo +@c +@c +@ifinfo +This file documents the graphical interface to the GNU debugger @value{GDBN}. + + +This is Edition @value{EDITION}, @value{DATE}, +of @cite{Using the Graphical Interface to @value{GDBN}} +for GDB Version @value{GDBVN}. + +Copyright (C) 1994, 1995 Free Software Foundation, Inc. + +Permission is granted to make and distribute verbatim copies of +this manual provided the copyright notice and this permission notice +are preserved on all copies. + +@ignore +Permission is granted to process this file through TeX and print the +results, provided the printed document carries copying permission +notice identical to this one except for the removal of this paragraph +(this paragraph not being relevant to the printed manual). + +@end ignore +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided also that the +entire resulting derived work is distributed under the terms of a +permission notice identical to this one. + +Permission is granted to copy and distribute translations of this manual +into another language, under the above conditions for modified versions. +@end ifinfo + +@titlepage +@title Using the Graphical Interface to @value{GDBN} +@subtitle The GNU Source-Level Debugger +@ifclear GENERIC +@subtitle (@value{TARGET}) +@end ifclear +@sp 1 +@subtitle Edition @value{EDITION}, for @value{GDBN} version @value{GDBVN} +@subtitle @value{DATE} +@author Stanley T. Shebs +@page +@tex +{\parskip=0pt +\hfill (Send bugs and comments on @value{GDBN} to bug-gdb\@prep.ai.mit.edu.)\par +\hfill {\it Debugging with @value{GDBN}}\par +\hfill \TeX{}info \texinfoversion\par +\hfill doc\@cygnus.com\par +} +@end tex + +@vskip 0pt plus 1filll +Copyright @copyright{} 1994, 1995 Free Software Foundation, Inc. +@sp 2 + +Permission is granted to make and distribute verbatim copies of +this manual provided the copyright notice and this permission notice +are preserved on all copies. + +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided also that the +entire resulting derived work is distributed under the terms of a +permission notice identical to this one. + +Permission is granted to copy and distribute translations of this manual +into another language, under the above conditions for modified versions. +@end titlepage +@page + +@ifinfo +@node Top +@top Using the Graphical Interface to @value{GDBN} +@end ifinfo + +This file describes a graphical interface to @value{GDBN}, +the GNU symbolic debugger. + +@node Invocation +@chapter Starting up GUI @value{GDBN} + +If @value{GDBN} has been configured to use the graphical interface, +then you will get the interface automatically upon startup. + +When running as a Unix program and using the X11-based interface, +you must of course be using an X server and/or workstation, +and your @code{DISPLAY} environment variable must be set correctly. +If either of these is not true, then @value{GDBN} will still start up, +but will use only the traditional command interface. + +The exact layout and appearance of the windows will depend on the host +system type. For instance, GDB under Windows will display its windows +inside a larger window, while under Unix/X, each window is a separate +toplevel window. However, general behavior and layout is consistent +across all platforms; omissions or restrictions on particular platforms, +if not documented as unavoidable, should be considered bugs and +reported. + +All GDB windows have a common structure. Each window has an associated +menu bar, which may be at the top of the window or perhaps elsewhere. +Some of the menus and menu items in the menu bar are common to all GDB +windows, while others are specific to particular types of windows. +Below the menu bar is the working data area of the window. If the data +is too large to display all at once, the data area will have scroll bars +on its right and bottom sides. Below the data area are two optional +features; a status/data line, and a button box. + +@section Menus + +@subsection File Menu + +The standard file menu provides operations that affect the overall state +of GDB, mainly file operations, but other things as well. + +About GDB... + +Displays the startup window for GDB. + +File... + +Lets you set the combined executable and symbol file that GDB will use. +(Like "file".) + +Target... + +Brings up a dialog that you can use to connect GDB to a target program. +The dialog is described in more depth later. +(Like "target".) + +Edit... + +Starts up an editor to modify the source file being displayed. + +Exec File... + +Lets you set the executable file that GDB will use. +(Like "exec-file".) + +Symbol File... + +Lets you set the symbol file that GDB will use. +(Like "symbol-file".) + +Add Symbol File... + +Lets you add additional symbol files. +(Like "add-symbol-file".) + +Core File... + +Lets you set the core file that GDB will use. +(Like "core-file".) + +Shared Libraries... + +(Like "sharedlibrary".) + +Quit + +quits GDB. +(Like @samp{quit}.) + + +@c @subsection Commands Menu + +@c The commands menu consists of items that let you run and control the program being +@c debugged. +@c +@c Run +@c +@c Step +@c +@c Next +@c +@c Finish +@c +@c Stepi +@c +@c Nexti + +@subsection Windows Menu + +The windows menu allows access to all the windows available in GDB. +The first part of the menu lists all of the predefined individual windows. +If the window exists already, its item will be marked as such; +selecting the item will cause the window to be put in front if it is +obscured. If it does not exist, then it will be created. + +The second part of the menu lists additional windows that you may have +created, such as source windows or variable displays. + +Command +--- +Source +Assembly +--- +Registers +Variables +--- +Files +@c --- +@c <extra windows> + +@subsection View Menu + +All windows have a view menu, but its contents are highly specific to +window type. For instance, a source window will have a view menu item +to control the display of line numbers, but a register window will instead +have an option to choose the radix in which to display register contents. +You can find the full description of view options with each window type. + +@subsection Help Menu + +The help menu includes access to GDB's online help. + +@section Windows + +@subsection Command Window + +The command window provides access to the standard GDB command +interpreter. In nearly all cases, commands typed into this window +will behave exactly as for a non-windowing GDB. + +Note that not all changes to GDB will be reflected in this window. For instance, +if you were to type a "step" command, then click on the "step" menu item in +the source window, then go back, and type another "step" command, the command +buffer will only show two steps, when you have actually done three. GDB will +put a "..." into the command buffer when operations in other windows are done, +as a reminder that the command buffer is incomplete. + +@c Also note that as a side effect of having the interface and possibly an +@c associated scripting language built in, additional commands may be +@c available. For instance, if tcl is in GDB, the command ``tcl <tcl code>'' +@c will be available. + +The command window has no status line or button box. + +@subsection Files Window + +The files window lists all of the files that were used to build the +executable. + +Clicking on the xxx in the left margin expands/contracts the display of +included files and symbols defined by the file. + +The View menu for this window includes the following items: +Name/Full Pathname +@c Sort by Name +@c Sort by Section&Offset +@c Show All Included Files +@c Included File Indentation... + +@subsection Source Window + +A source window displays a single file of source code. + +The left margin includes an indicator for the current PC, breakpoints and potential breakpoints, +and (optionally) line numbers. + +The View menu for this window includes the following items: +Show Line Numbers +Show Breakdots +@c Jump to PC (if pc changes, scroll back so PC is centered) +@c Tab... (set tabbing) + +@section Extensions + +[description of gdbtk details] + +@c +@c GDBTK Interface Design +@c +@c This is the working document describing the design of the GDBTK +@c interface. Note that overall layout applies only to the default setup; +@c it is expected that debugger users will be able to customize extensively. +@c +@c Default Startup +@c +@c One source window, shows source as in "list main", does *not* set a +@c break at main or run or anything. No current PC indicator, only put +@c in when something runs. +@c +@c Source Window +@c +@c For native, "run" button is always the same, for cross, it's actually +@c a "target" button that pops up appropriate dialog to get connected. +@c Once remote target is active, change button to "run". +@c +@c Be able to toggle assembly interleaved between source. +@c +@c Command Window +@c +@c Is an *optional* window. +@c +@c Behavior mimics command-line GDB running in an Emacs buffer as much +@c as possible. +@c +@c Assembly Window +@c +@c Be able to toggle source interleaved between assembly. +@c +@c Target Info Window +@c +@c Contents similar to "info target". +@c +@c Should expand into process and thread info also. +@c +@c File Info Window +@c +@c Contents similar to "info files". +@c +@c Include data shown in "info sources" as well as "info files". +@c +@c Register Info Window +@c +@c Contents similar to "info registers". +@c +@c Add view option(s) for classes of registers. +@c +@c Stack Info Window +@c +@c Combines backtrace, frame, and local var displays. +@c +@c Signals Dialog +@c +@c Includes all signals whose handling may be controlled, plus +@c checkboxes for what to do with each. +@c +@c Settings Dialog(s) +@c +@c Include all variables that can be "set" and "show"n. +@c +@c General Principles +@c +@c All windows should have a menu that allows access to other windows. +@c Selection of item either brings up for first time or brings to front. +@c +@c All windows should have a "view" menu that controls formatting +@c options for that window. +@c +@c Windows should usually be scrollable. Windows that display largish +@c horizontal things should be horizontal and vertical scrollbars. +@c +@c To do standard modification, add commands or tcl code to .gdbtkinit. +@c +@c Be able to record window positions so they come up in the same way +@c the next time. Could scribble on .gdbtkinit perhaps, or else an +@c aux file that can be sourced by .gdbtkinit. + +@section How to Build + +If GDB is configured with --enable-gdbtk, then upon startup, it will +open windows. + +@node Index +@unnumbered Index + +@printindex cp + +@contents +@bye diff --git a/gdb/main.c b/gdb/main.c index 6c9baa34c21..eb058bb1a27 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -255,6 +255,11 @@ captured_main (void *data) {"command", required_argument, 0, 'x'}, {"version", no_argument, &print_version, 1}, {"x", required_argument, 0, 'x'}, +#ifdef GDBTK + {"tclcommand", required_argument, 0, 'z'}, + {"enable-external-editor", no_argument, 0, 'y'}, + {"editor-command", required_argument, 0, 'w'}, +#endif {"ui", required_argument, 0, 'i'}, {"interpreter", required_argument, 0, 'i'}, {"i", required_argument, 0, 'i'}, @@ -334,6 +339,40 @@ captured_main (void *data) cmdsize * sizeof (*cmdarg)); } break; +#ifdef GDBTK + case 'z': + { + extern int gdbtk_test PARAMS ((char *)); + if (!gdbtk_test (optarg)) + { + fprintf_unfiltered (gdb_stderr, "%s: unable to load tclcommand file \"%s\"", + argv[0], optarg); + exit (1); + } + break; + } + case 'y': + { + /* + * This enables the edit/button in the main window, even + * when IDE_ENABLED is set to false. In this case you must + * use --tclcommand to specify a tcl/script to be called, + * Tcl/Variable to store the edit/command is: + * external_editor + */ + enable_external_editor = 1; + break; + } + case 'w': + { + /* + * if editor command is enabled, both flags are set + */ + enable_external_editor = 1; + external_editor_command = xstrdup (optarg); + break; + } +#endif /* GDBTK */ case 'd': dirarg[ndir++] = optarg; if (ndir >= dirsize) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index cfc2c906886..a48ff61c539 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -991,6 +991,80 @@ Fri Mar 12 18:06:21 1999 Stan Shebs <shebs@andros.cygnus.com> commands. They're not germane to this test, and they don't work that way on remote targets. +1999-03-03 James Ingham <jingham@cygnus.com> + + * browser.test: Fixed up to match the new function browser. + This is not done yet... + + * srcwin.test: Check for errors when the bbox is called for a text + item that is not on screen (so bbox is ""). Return something more + useful. + +1999-03-01 James Ingham <jingham@cygnus.com> + + * Changelog entries merged over from gdb development branch. + + 1999-01-12 Martin Hunt <hunt@cygnus.com> + + * gdb.gdbtk/srcwin.test: Add a bunch of tests for the source + window filename and function comboboxes. Add in stack tests. + + 1999-01-11 Martin Hunt <hunt@cygnus.com> + + * gdb.gdbtk/srcwin.test: New file. Source Window tests. + * gdb.gdbtk/srcwin.exp: New file. Source Window tests. + + Wed Jan 6 09:22:52 1999 Keith Seitz <keiths@cygnus.com> + + * gdb.gdbtk/c_variable.test (c_variable-1.9): Add new + test to check for creation of a variable that is really a type. + (c_variable-7.81): Use "output" instead of "print" to get PC. + Include missing bits of test. + + * gdb.gdbtk/cpp_variable.test (cpp_variable-1.6): Default format + is now "natural", not "hexadecimal" + (cpp_variable-2.22): Ditto. + (cpp_variable-2.24): Force format to hex before getting value. + + * gdb.gdbtk/cpp_variable.exp: Supply missing arg to gdbtk_analyze_results. + + Tue Jan 5 12:40:52 1999 Keith Seitz <keiths@cygnus.com> + + * gdb.gdbtk/c_variable.c, c_variable.test, c_variable.exp: New C + language tests for variable object interface. + + * gdb.gdbtk/cpp_variable.h, cpp_variable.cc, cpp_variable.test, + cpp_variable.exp: New C++ language tests for variable object + interface. + + * gdb.gdbtk/Makefile.in (EXECUTABLES): Add c_variable and cpp_variable. + + Tue Jan 5 12:33:47 1999 Keith Seitz <keiths@cygnus.com> + + * lib/gdb.exp (gdbtk_analyze_results): Generic function + for outputting results of test run. + + * gdb.gdbtk/defs (gdbtk_test): Handle xpass and xfail. + (gdbtk_test_error): New proc which handles error aborts. + + * gdb.gdbtk/console.exp: Use gdbtk_analyze_results. + Check if we have a valid DISPLAY before running. + * gdb.gdbtk/browser.exp: Ditto. + + 1998-12-07 Martin M. Hunt <hunt@cygnus.com> + + * lib/gdb.exp (gdbtk_start): Fix path for itcl library. + * gdb.gdbtk/browser.test: Change "manage open" to ManagedWin::open. + * gdb.gdbtk/console.test: Same. + * gdb.gdbtk/*: Update from devo. + + Fri Jul 24 14:57:19 1998 Keith Seitz <keiths@cygnus.com> + + * gdb.gdbtk/Makefile.in: Add new example program "stack". + * gdb.gdbtk/browser.test,browser.exp: Add browser window + tests. + * gdb.gdbtk/stack1.c,stack2.c: Test case for browser window. + 1999-02-25 Felix Lee <flee@cygnus.com> * lib/gdb.exp (debug_format): initialize @@ -1519,6 +1593,23 @@ Thurs Jul 9 11:08:31 1998 Dawn Perchik <dawn@cygnus.com> * gdb.base/commands.exp: Break up infrun_breakpoint_command_test into two parts to get around a synchronization problem in expect. +Sun Jun 28 22:34:34 1998 Martin M. Hunt <hunt@cygnus.com> + + * gdb.gdbtk/simple.c (main): Make main return an + int so compiler will stop complaining. + +Fri Jun 26 14:27:13 1998 Keith Seitz <keiths@cygnus.com> + + * lib/gdb.exp (gdbtk_start): Add startup for gdbtk. + + * configure.in: Add options for gdbtk testsuite. + + * configure: Regenerate. + + * gdb.gdbtk: New directory to hold gdbtk tests. + + * gdb.gdbtk/console.{exp, test}: New console window tests. + Fri Jun 26 14:52:47 1998 Peter Schauer <pes@regent.e-technik.tu-muenchen.de> diff --git a/gdb/testsuite/configure b/gdb/testsuite/configure index 19ddd895ac2..a64d42ee0e8 100755 --- a/gdb/testsuite/configure +++ b/gdb/testsuite/configure @@ -709,6 +709,42 @@ if test "${shared}" = "true"; then fi # End stuff to support --enable-shared +# Start stuff to support --enable-gdbtk +# Check whether --enable-gdbtk or --disable-gdbtk was given. +if test "${enable_gdbtk+set}" = set; then + enableval="$enable_gdbtk" + case "${enableval}" in + yes) + case "$host" in + *go32*) + enable_gdbtk=no ;; + *windows*) + enable_gdbtk=no ;; + *) + enable_gdbtk=yes ;; + esac ;; + no) + enable_gdbtk=no ;; + *) + { echo "configure: error: bad value ${enableval} given for gdbtk option" 1>&2; exit 1; } ;; +esac +else + +# Default is on for everything but go32 and windows +case "$host" in + *go32* | *windows*) + ;; + *) + enable_gdbtk=yes ;; + esac + +fi + + +if test "${enable_gdbtk}" = "yes"; then + configdirs="${configdirs} gdb.gdbtk" +fi +# End stuff to support --enable-shared # configure the subdirectories too subdirs="$configdirs" diff --git a/gdb/testsuite/configure.in b/gdb/testsuite/configure.in index 96e9de727ca..b69c05120dd 100644 --- a/gdb/testsuite/configure.in +++ b/gdb/testsuite/configure.in @@ -71,6 +71,38 @@ if test "${shared}" = "true"; then fi AC_SUBST(RPATH_ENVVAR) # End stuff to support --enable-shared +# Start stuff to support --enable-gdbtk +AC_ARG_ENABLE(gdbtk, +[ --enable-gdbtk ], +[case "${enableval}" in + yes) + case "$host" in + *go32*) + enable_gdbtk=no ;; + *windows*) + enable_gdbtk=no ;; + *) + enable_gdbtk=yes ;; + esac ;; + no) + enable_gdbtk=no ;; + *) + AC_MSG_ERROR(bad value ${enableval} given for gdbtk option) ;; +esac], +[ +# Default is on for everything but go32 and windows +case "$host" in + *go32* | *windows*) + ;; + *) + enable_gdbtk=yes ;; + esac +]) + +if test "${enable_gdbtk}" = "yes"; then + configdirs="${configdirs} gdb.gdbtk" +fi +# End stuff to support --enable-shared # configure the subdirectories too AC_CONFIG_SUBDIRS($configdirs) diff --git a/gdb/testsuite/gdb.gdbtk/ChangeLog-gdbtk b/gdb/testsuite/gdb.gdbtk/ChangeLog-gdbtk new file mode 100644 index 00000000000..298d90e6f8a --- /dev/null +++ b/gdb/testsuite/gdb.gdbtk/ChangeLog-gdbtk @@ -0,0 +1,83 @@ +1999-09-17 Fernando Nasser <fnasser@totem.to.cygnus.com> + + * testsuite/gdb.gdbtk/cpp_variable.test: Add test (2.75) to verify + that a baseclass member value was effectively changed. + +1999-09-17 Fernando Nasser <fnasser@totem.to.cygnus.com> + + * testsuite/gdb.gdbtk/cpp_variable.test: Update for new variable + code. + +1999-09-17 Fernando Nasser <fnasser@totem.to.cygnus.com> + + * testsuite/gdb.gdbtk/c_variable.test: Update for new variable + code. + +1999-09-17 Fernando Nasser <fnasser@totem.to.cygnus.com> + + * testsuite/gdb.gdbtk/cpp_variable.h (class V): Add type to + virtual function declaration. + +1999-06-08 Fernando Nasser <fnasser@totem.to.cygnus.com> + + * browser.exp: Use untested and not warning when DISPLAY is not found. + * c_variable.exp: Same. + * console.exp: Same. + * cpp_variable.exp: Same. + * srcwin.exp: Same. + + +1999-04-12 Keith Seitz <keiths@cygnus.com> + + * cpp_variable.exp: Pass the "c++" flag to gdb_compile so + that it can grab the right compiler. + +1999-03-16 Martin Hunt <hunt@cygnus.com> + + * srcwin.test (srcwin-4.5): Change variable name + to $b so test will run again. + +1999-02-22 Martin Hunt <hunt@cygnus.com> + + * srcwin.test (move_mouse_to): Fix typo. + +1999-02-03 Martin Hunt <hunt@cygnus.com> + + * console.test (clear_command_line): Add tests 1.5 - 1.8, + which test the new Shift-Up and Shift-Down bindings. + +1999-02-01 Martin Hunt <hunt@cygnus.com> + + * srcwin.test (srcwin-4.3): Fix bp test. + +1999-01-29 Martin Hunt <hunt@cygnus.com> + + * srcwin.test (click): New function that generates an event + at a location. + (srcwin-4.4): New test. Simulate a click on a line and + check for breakpoint set. + (srcwin-4.5): New test. Right-click on a line and select "Continue + to Here" from popup. + + * srcwin.exp: Source srcwin3.test, which will test source window + assembly debugging on executables built without "-g". + +1999-01-29 Martin Hunt <hunt@cygnus.com> + + * srcwin.exp: Add srcwin2.test, which are basically the same + tests as srcwin.test, but run with a missing source file. + + * srcwin2.test: New file. + + * srcwin.test: Add tests for setting breakpoints in the source window, + testing BP balloons, variable balloons, and mixed-mode disassembly + of include files. + + +Local Variables: +mode: change-log +left-margin: 8 +fill-column: 74 +version-control: never +End: + diff --git a/gdb/testsuite/gdb.gdbtk/Makefile.in b/gdb/testsuite/gdb.gdbtk/Makefile.in new file mode 100644 index 00000000000..09fed6d2694 --- /dev/null +++ b/gdb/testsuite/gdb.gdbtk/Makefile.in @@ -0,0 +1,33 @@ +VPATH = @srcdir@ +srcdir = @srcdir@ + +EXECUTABLES = simple stack c_variable cpp_variable + +# uuencoded format to avoid SCCS/RCS problems with binary files. +CROSS_EXECUTABLES = + +all: + @echo "Nothing to be done for all..." + +info: +install-info: +dvi: +install: +uninstall: force +installcheck: +check: + +clean mostlyclean: + -rm -f *~ *.o a.out xgdb *.x $(CROSS_EXECUTABLES) *.ci *.tmp + -rm -f core core.coremaker coremaker.core corefile $(EXECUTABLES) + -rm -f twice-tmp.c + +distclean maintainer-clean realclean: clean + -rm -f *~ core + -rm -f Makefile config.status config.log + -rm -f arch.inc + -rm -f *-init.exp + -rm -fr *.log summary detail *.plog *.sum *.psum site.* + +Makefile : $(srcdir)/Makefile.in $(srcdir)/configure.in + $(SHELL) ./config.status --recheck diff --git a/gdb/testsuite/gdb.gdbtk/browser.exp b/gdb/testsuite/gdb.gdbtk/browser.exp new file mode 100644 index 00000000000..649fc7bb42c --- /dev/null +++ b/gdb/testsuite/gdb.gdbtk/browser.exp @@ -0,0 +1,33 @@ +# +# Check if we have a display +# +if {![info exists ::env(DISPLAY)]} { + untested "No DISPLAY -- skipping test" +} else { + + if {$tracelevel} { + strace $tracelevel + } + + # + # test console window + # + set prms_id 0 + set bug_id 0 + + set testfile "stack" + set binfile ${objdir}/${subdir}/${testfile} + set r [gdb_compile "${srcdir}/${subdir}/stack1.c ${srcdir}/${subdir}/stack2.c" "${binfile}" executable {debug}] + if { $r != "" } { + gdb_suppress_entire_file \ + "Testcase compile failed, so some tests in this file will automatically fail." + } + + # Start with a fresh gdbtk + gdb_exit + set results [gdbtk_start [file join $srcdir $subdir browser.test]] + set results [split $results \n] + + # Analyze results + gdbtk_analyze_results $results +} diff --git a/gdb/testsuite/gdb.gdbtk/browser.test b/gdb/testsuite/gdb.gdbtk/browser.test new file mode 100644 index 00000000000..832ad3633df --- /dev/null +++ b/gdb/testsuite/gdb.gdbtk/browser.test @@ -0,0 +1,683 @@ +# Copyright (C) 1998 Cygnus Solutions +# +# 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. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# This file was written by Keith Seitz (keiths@cygnus.com) + +# Read in the standard defs file + +if {![gdbtk_read_defs]} { + break +} + +global objdir test_ran +set _files(stupid_initializer) -100 + +##### ##### +# # +# Helper functions for this module # +# # +##### ##### + +# Set the search expression +proc set_regexp {exp} { + global browser + + $browser component filt_entry delete 0 end + $browser component filt_entry insert 0 $exp +} + +# Do the search +proc do_search {} { + global browser + $browser search + set m [$browser component func_box get 0 end] + + return $m +} + +# Set search to use regular expressions. +proc set_search_mode {val} { + global browser + pref set gdb/search/filter_mode $val + $browser component filt_type entryset $val +} + +# Highlight a file +proc select {filename} { + global browser _files + + if {[info exists _files($filename)]} { + $browser component file_box selection set $_files($filename) + } else { + set files [$browser component file_box get 0 end] + set i [lsearch $files $filename] + set _files($filename) $i + $browser component file_box selection set $i + } + $browser search +} + +proc select_all {} { + global browser + + $browser component file_all invoke + +} + +# clear all files +proc clear {} { + global browser + + $browser component file_box selection clear 0 end + $browser search +} + +##### ##### +# # +# BROWSER TESTS # +# # +##### ##### + +# Load the test executable +set file [file join $objdir stack] +gdb_cmd "file $file" + +# Open a browser +set browser [ManagedWin::open BrowserWin] + +# Test: browser-1.1 +# Desc: Check file listbox contents +gdbtk_test browser-1.1 {file listbox contents} { + set m [$browser component file_box get 0 end] + set f {} + if {[lsearch $m stack1.c] == -1} { + lappend f 0 + } else { + lappend f 1 + } + if {[lsearch $m stack2.c] == -1} { + lappend f 0 + } else { + lappend f 1 + } + + join $f \ +} {1 1} + +# Tests 2.* test starts with search mode. +# Test: browser-2.1 +# Desc: Check all files/all funcs +gdbtk_test browser-2.1 {all files/all funcs} { + set_search_mode "starts with" + set_regexp "" + select_all + set m [do_search] + set r 0 + foreach f {extern_func1_1 extern_func1_10 extern_func1_11 extern_func1_12 \ + extern_func1_13 extern_func1_14 extern_func1_15 extern_func1_2 \ + extern_func1_3 extern_func1_4 extern_func1_5 extern_func1_6 \ + extern_func1_7 extern_func1_8 extern_func1_9 func_1 \ + func_10 func_11 func_12 func_13 \ + func_14 func_15 func_2 func_3 \ + func_4 func_5 func_6 func_7 \ + func_8 func_9 main static_func_1 \ + static_func_10 static_func_11 static_func_12 static_func_13 \ + static_func_14 static_func_15 static_func_2 static_func_3 \ + static_func_4 static_func_5 static_func_6 static_func_7 \ + static_func_8 static_func_9} { + if {[lsearch $m $f] != -1} { + incr r + } + } + + set r +} {46} + +# Test: browser-2.2 +# Desc: Check all functions in stack1.c +gdbtk_test browser-2.2 {all functions in stack1.c} { + set_regexp "" + clear + select stack1.c + set m [do_search] + + set r 0 + foreach f {func_1 func_10 func_11 func_12 \ + func_13 func_14 func_15 func_2 \ + func_3 func_4 func_5 func_6 \ + func_7 func_8 func_9 main \ + static_func_1 static_func_10 static_func_11 static_func_12 \ + static_func_13 static_func_14 static_func_15 static_func_2 \ + static_func_3 static_func_4 static_func_5 static_func_6 \ + static_func_7 static_func_8 static_func_9} { + if {[lsearch $m $f] != -1} { + incr r + } + } + + set r +} {31} +if {$test_ran} { + clear +} + +# Test: browser-2.3 +# Desc: Check all functions in stack2.c +gdbtk_test browser-2.3 {all functions in stack2.c} { + set_regexp "" + clear + select stack2.c + set m [do_search] + + set r 0 + foreach f {extern_func1_1 extern_func1_10 extern_func1_11 \ + extern_func1_12 extern_func1_13 extern_func1_14 extern_func1_15 \ + extern_func1_2 extern_func1_3 extern_func1_4 extern_func1_5 \ + extern_func1_6 extern_func1_7 extern_func1_8 extern_func1_9} { + if {[lsearch $m $f] != -1} { + incr r + } + } + + set r +} {15} +if {$test_ran} { + clear +} + +# Test: browser-2.4 +# Desc: Check for all functions matching "func" - mode starts with +gdbtk_test browser-2.4 {all functions matching "func" - "mode starts with"} { + set_search_mode "starts with" + select_all + set_regexp func + do_search +} {func_1 func_10 func_11 func_12 func_13 func_14 func_15 func_2 func_3 func_4 func_5 func_6 func_7 func_8 func_9} + +# Test: browser-2.5 +# Desc: Check all functions matching "func" in stack1.c - mode starts with +gdbtk_test browser-2.5 {all functions matching "func" in stack1.c - "mode starts with"} { + set_search_mode "starts with" + set_regexp func + clear + select stack1.c + do_search +} {func_1 func_10 func_11 func_12 func_13 func_14 func_15 func_2 func_3 func_4 func_5 func_6 func_7 func_8 func_9} + +# Test: browser-2.6 +# Desc: Check all functions matching "funcs" in stack2.c - mode starts with +gdbtk_test browser-2.6 {all functions matching "func" in stack2.c - mode "starts with"} { + set_search_mode "starts with" + set_regexp func + clear + select stack2.c + do_search +} {} +if {$test_ran} { + clear +} + +# Test: browser-2.7 +# Desc: Check all functions matching "foobar" +gdbtk_test browser-2.7 {all functions matching "foobar"} { + set_search_mode "starts with" + select_all + set_regexp foobar + do_search +} {} + +# Test: browser-2.8 +# Desc: Check all functions matching "foobar" in stack1.c +gdbtk_test browser-2.8 {functions matching "foobar" in stack1.c} { + set_search_mode "starts with" + set_regexp foobar + clear + select stack1.c + do_search +} {} + +# Tests 3.* test "contains" search mode. +# Test: browser-3.1 +# Desc: Check all files/all funcs +gdbtk_test browser-3.1 {all files/all funcs} { + set_search_mode "contains" + set_regexp "" + select_all + set m [do_search] + set r 0 + foreach f {extern_func1_1 extern_func1_10 extern_func1_11 extern_func1_12 \ + extern_func1_13 extern_func1_14 extern_func1_15 extern_func1_2 \ + extern_func1_3 extern_func1_4 extern_func1_5 extern_func1_6 \ + extern_func1_7 extern_func1_8 extern_func1_9 func_1 \ + func_10 func_11 func_12 func_13 \ + func_14 func_15 func_2 func_3 \ + func_4 func_5 func_6 func_7 \ + func_8 func_9 main static_func_1 \ + static_func_10 static_func_11 static_func_12 static_func_13 \ + static_func_14 static_func_15 static_func_2 static_func_3 \ + static_func_4 static_func_5 static_func_6 static_func_7 \ + static_func_8 static_func_9} { + if {[lsearch $m $f] != -1} { + incr r + } + } + + set r +} {46} + +# Test: browser-3.2 +# Desc: Check all functions in stack1.c +gdbtk_test browser-3.2 {all functions in stack1.c} { + set_regexp "" + set_search_mode "contains" + clear + select stack1.c + set m [do_search] + + set r 0 + foreach f {func_1 func_10 func_11 func_12 \ + func_13 func_14 func_15 func_2 \ + func_3 func_4 func_5 func_6 \ + func_7 func_8 func_9 main \ + static_func_1 static_func_10 static_func_11 static_func_12 \ + static_func_13 static_func_14 static_func_15 static_func_2 \ + static_func_3 static_func_4 static_func_5 static_func_6 \ + static_func_7 static_func_8 static_func_9} { + if {[lsearch $m $f] != -1} { + incr r + } + } + + set r +} {31} + +if {$test_ran} { + clear +} + +# Test: browser-3.3 +# Desc: Check all functions in stack2.c +gdbtk_test browser-3.3 {all functions in stack2.c} { + set_regexp "" + set_search_mode "contains" + clear + select stack2.c + set m [do_search] + + set r 0 + foreach f {extern_func1_1 extern_func1_10 extern_func1_11 \ + extern_func1_12 extern_func1_13 extern_func1_14 extern_func1_15 \ + extern_func1_2 extern_func1_3 extern_func1_4 extern_func1_5 \ + extern_func1_6 extern_func1_7 extern_func1_8 extern_func1_9} { + if {[lsearch $m $f] != -1} { + incr r + } + } + + set r +} {15} +if {$test_ran} { + clear +} + +# Test: browser-3.4 +# Desc: Check for all functions matching "func" - mode contains +gdbtk_test browser-3.4 {all functions matching "func_1" - "mode contains"} { + set_search_mode "contains" + set_regexp "func_1" + select_all + do_search +} {func_1 func_10 func_11 func_12 func_13 func_14 func_15 static_func_1 static_func_10 static_func_11 static_func_12 static_func_13 static_func_14 static_func_15} + +# Test: browser-3.5 +# Desc: Check all functions matching "func_1" in stack1.c - mode contains +gdbtk_test browser-3.5 {all functions matching "func_1" in stack1.c - "mode contains"} { + set_search_mode "contains" + set_regexp "func_1" + clear + select stack1.c + do_search +} {func_1 func_10 func_11 func_12 func_13 func_14 func_15 static_func_1 static_func_10 static_func_11 static_func_12 static_func_13 static_func_14 static_func_15 } + +# Test: browser-3.6 +# Desc: Check all functions matching "func_1" in stack2.c - mode contains +gdbtk_test browser-3.6 {all functions matching "func" in stack2.c - mode "contains"} { + set_search_mode "contains" + set_regexp func_1 + clear + select stack2.c + do_search +} {} + +# Test: browser-3.7 +# Desc: Check all functions matching "foobar" +gdbtk_test browser-3.7 {all functions matching "foobar"} { + set_search_mode "contains" + select_all + set_regexp foobar + do_search +} {} + +# Test: browser-3.8 +# Desc: Check all functions matching "foobar" in stack1.c +gdbtk_test browser-3.8 {functions matching "foobar" in stack1.c} { + set_search_mode "contains" + set_regexp foobar + clear + select stack1.c + do_search +} {} + +# Tests 4.* test "ends with" search mode. +# Test: browser-4.1 +# Desc: Check all files/all funcs +gdbtk_test browser-4.1 {all files/all funcs} { + set_search_mode "ends with" + set_regexp "" + select_all + set m [do_search] + set r 0 + foreach f {extern_func1_1 extern_func1_10 extern_func1_11 extern_func1_12 \ + extern_func1_13 extern_func1_14 extern_func1_15 extern_func1_2 \ + extern_func1_3 extern_func1_4 extern_func1_5 extern_func1_6 \ + extern_func1_7 extern_func1_8 extern_func1_9 func_1 \ + func_10 func_11 func_12 func_13 \ + func_14 func_15 func_2 func_3 \ + func_4 func_5 func_6 func_7 \ + func_8 func_9 main static_func_1 \ + static_func_10 static_func_11 static_func_12 static_func_13 \ + static_func_14 static_func_15 static_func_2 static_func_3 \ + static_func_4 static_func_5 static_func_6 static_func_7 \ + static_func_8 static_func_9} { + if {[lsearch $m $f] > -1} { + incr r + } + } + + set r +} {46} + +# Test: browser-4.2 +# Desc: Check all functions in stack1.c +gdbtk_test browser-4.2 {all functions in stack1.c} { + set_regexp "" + set_search_mode "ends with" + clear + select stack1.c + set m [do_search] + + set r 0 + foreach f {func_1 func_10 func_11 func_12 \ + func_13 func_14 func_15 func_2 \ + func_3 func_4 func_5 func_6 \ + func_7 func_8 func_9 main \ + static_func_1 static_func_10 static_func_11 static_func_12 \ + static_func_13 static_func_14 static_func_15 static_func_2 \ + static_func_3 static_func_4 static_func_5 static_func_6 \ + static_func_7 static_func_8 static_func_9} { + if {[lsearch $m $f] != -1} { + incr r + } + } + + set r +} {31} + +if {$test_ran} { + clear +} + +# Test: browser-4.3 +# Desc: Check all functions in stack2.c +gdbtk_test browser-4.3 {all functions in stack2.c} { + set_regexp "" + set_search_mode "ends with" + clear + select stack2.c + set m [do_search] + + set r 0 + foreach f {extern_func1_1 extern_func1_10 extern_func1_11 \ + extern_func1_12 extern_func1_13 extern_func1_14 extern_func1_15 \ + extern_func1_2 extern_func1_3 extern_func1_4 extern_func1_5 \ + extern_func1_6 extern_func1_7 extern_func1_8 extern_func1_9} { + if {[lsearch $m $f] != -1} { + incr r + } + } + + set r +} {15} +if {$test_ran} { + clear +} + +# Test: browser-4.4 +# Desc: Check for all functions matching "func" - mode ends with +gdbtk_test browser-4.4 {all functions matching "func_1" - "mode ends with"} { + set_search_mode "ends with" + set_regexp "func_1" + select_all + do_search +} {func_1 func_10 func_11 func_12 func_13 func_14 func_15 static_func_1 static_func_10 static_func_11 static_func_12 static_func_13 static_func_14 static_func_15} + +# Test: browser-4.5 +# Desc: Check all functions matching "func_1" in stack1.c - mode ends with +gdbtk_test browser-4.5 {all functions matching "func_1" in stack1.c - "mode ends with"} { + set_search_mode "ends with" + set_regexp "func_1" + clear + select stack1.c + do_search +} {func_1 func_10 func_11 func_12 func_13 func_14 func_15 static_func_1 static_func_10 static_func_11 static_func_12 static_func_13 static_func_14 static_func_15 } +if {$test_ran} { + clear +} + +# Test: browser-4.6 +# Desc: Check all functions matching "func_1" in stack2.c - mode ends with +gdbtk_test browser-4.6 {all functions matching "func" in stack2.c - mode "ends with"} { + set_search_mode "ends with" + set_regexp func_1 + clear + select stack2.c + do_search +} {} + +# Test: browser-4.7 +# Desc: Check all functions matching "foobar" +gdbtk_test browser-4.7 {all functions matching "foobar"} { + set_search_mode "ends with" + select_all + set_regexp foobar + do_search +} {} + +# Test: browser-4.8 +# Desc: Check all functions matching "foobar" in stack1.c +gdbtk_test browser-4.8 {functions matching "foobar" in stack1.c} { + set_search_mode "ends with" + set_regexp foobar + clear + select stack1.c + do_search +} {} +if {$test_ran} { + clear +} + +# Test: browser-5.10 +# Desc: Check all functions matching regexp "func" +gdbtk_test browser-5.10 {all functions matching regexp "func"} { + set_search_mode "matches regexp" + set_regexp func + select_all + do_search +} {extern_func1_1 extern_func1_10 extern_func1_11 extern_func1_12 extern_func1_13 extern_func1_14 extern_func1_15 extern_func1_2 extern_func1_3 extern_func1_4 extern_func1_5 extern_func1_6 extern_func1_7 extern_func1_8 extern_func1_9 func_1 func_10 func_11 func_12 func_13 func_14 func_15 func_2 func_3 func_4 func_5 func_6 func_7 func_8 func_9 static_func_1 static_func_10 static_func_11 static_func_12 static_func_13 static_func_14 static_func_15 static_func_2 static_func_3 static_func_4 static_func_5 static_func_6 static_func_7 static_func_8 static_func_9} + +# Test: browser-5.11 +# Desc: Check all functions matching regexp "func" in stack1.c +gdbtk_test browser-5.11 {all functions matching regexp "func" in stack1.c} { + set_search_mode "matches regexp" + set_regexp func + clear + select stack1.c + do_search +} {func_1 func_10 func_11 func_12 func_13 func_14 func_15 func_2 func_3 func_4 func_5 func_6 func_7 func_8 func_9 static_func_1 static_func_10 static_func_11 static_func_12 static_func_13 static_func_14 static_func_15 static_func_2 static_func_3 static_func_4 static_func_5 static_func_6 static_func_7 static_func_8 static_func_9} + +# Test: browser-5.12 +# Desc: Check all functions matching regexp "func" in stack2.c +gdbtk_test browser-5.12 {all functions matching regexp "func" in stack2.c} { + set_regexp func + clear + select stack2.c + do_search +} {extern_func1_1 extern_func1_10 extern_func1_11 extern_func1_12 extern_func1_13 extern_func1_14 extern_func1_15 extern_func1_2 extern_func1_3 extern_func1_4 extern_func1_5 extern_func1_6 extern_func1_7 extern_func1_8 extern_func1_9} + +# Test: browser-5.13 +# Desc: Check all functions matching regexp "\_1$" +gdbtk_test browser-5.13 {all functions matching regexp "\_1$"} { + set_search_mode "matches regexp" + set_regexp {\_1$} + do_search +} {extern_func1_1 func_1 static_func_1} + +# Test: browser-5.14 +# Desc: Check all functions matching regexp "\_1$" in stack1.c +gdbtk_test browser-5.14 {all functions matching regexp "\_1$" in stack1.c} { + set_search_mode "matches regexp" + set_regexp {\_1$} + clear + select stack1.c + do_search +} {func_1 static_func_1} + +# Test: browser-5.15 +# Desc: Check all functions matching regexp "\_1$" in stack2.c +gdbtk_test browser-5.15 {all functions matching regexp "\_1$" in stack2.c} { + set_search_mode "matches regexp" + set_regexp {\_1$} + clear + select stack2.c + do_search +} {extern_func1_1} + +# Test: browser-5.16 +# Desc: Check all functions matching regexp "foobar" +gdbtk_test browser-5.16 {all functions matching regexp "foobar"} { + set_search_mode "matches regexp" + set_regexp foobar + select_all + do_search +} {} + +# Test: browser-5.17 +# Desc: Check all functions matching regexp "foobar" in stack1.c +gdbtk_test browser-5.17 {all functions matching regexp "foobar" in stack1.c} { + set_search_mode "matches regexp" + set_regexp foobar + clear + select stack1.c + do_search +} {} + + +# Test: browser-6.1 +# Desc: Check select button function +gdbtk_test browser-6.1 {select button - select all} { + clear + select_all + set m [$browser component file_box curselection] + + expr {[llength $m] >= 2} +} {1} + +# Test: browser-7.1 +# Desc: Toggle all bps on +gdbtk_test browser-7.1 {toggle_all_bp on} { + set_regexp {\_1$} + set_search_mode "matches regexp" + select_all + do_search + $browser component func_add_bp invoke + + set_regexp .* + set funcs [do_search] + + set bps {} + foreach f $funcs { + if {![catch {gdb_loc $f} ls]} { + if {[bp_exists $ls] != -1} { + lappend bps $f + } + } + } + + for {set i 0} {$i < 20} {incr i} { + catch {gdb_cmd "delete $i"} + } + + join [lsort $bps] +} {extern_func1_1 func_1 static_func_1} + +# Test: browser-7.2 +# Desc: Toggle all bps off +gdbtk_test browser-7.2 {toggle_all_bp off} { + set_regexp {\_1$} + set_search_mode "matches regexp" + select_all + do_search + $browser component func_add_bp invoke + + set_regexp .* + set funcs [do_search] + + # Turn off all static bps + set_regexp {\_1$} + do_search + $browser component func_remove_bp + set bps {} + foreach f $funcs { + if {![catch {gdb_loc $f} ls]} { + if {[bp_exists $ls] != -1} { + lappend bps $f + } + } + } + + for {set i 0} {$i < 20} {incr i} { + catch {gdb_cmd "delete $i"} + } + + join [lsort $bps] +} {extern_func1_1 func_1} + +# Test: browser-6.1 +# Desc: Check that search expressions are saved +gdbtk_test browser-6.1 {save last search expression} { + set_regexp hello + select_all + do_search + pref get gdb/search/last_symbol +} {hello} + +# +# Exit +# +gdbtk_test_done diff --git a/gdb/testsuite/gdb.gdbtk/c_variable.c b/gdb/testsuite/gdb.gdbtk/c_variable.c new file mode 100644 index 00000000000..461d5cee2fa --- /dev/null +++ b/gdb/testsuite/gdb.gdbtk/c_variable.c @@ -0,0 +1,296 @@ +struct _simple_struct { + int integer; + unsigned int unsigned_integer; + char character; + signed char signed_character; + char *char_ptr; + int array_of_10[10]; +}; + +typedef struct _simple_struct simpleton; + +simpleton global_simple; + +enum foo { + bar = 1, + baz +}; + +typedef enum foo efoo; + +union named_union +{ + int integer; + char *char_ptr; +}; + +typedef struct _struct_decl { + int integer; + char character; + char *char_ptr; + long long_int; + int **int_ptr_ptr; + long long_array[10]; + + void (*func_ptr) (void); + struct _struct_decl (*func_ptr_struct) (int, char *, long); + struct _struct_decl *(*func_ptr_ptr) (int, char *, long); + union { + int a; + char *b; + long c; + enum foo d; + } u1; + + struct { + union { + struct { + int d; + char e[10]; + int *(*func) (void); + efoo foo; + } u1s1; + + long f; + struct { + char array_ptr[2]; + int (*func) (int, char *); + } u1s2; + } u2; + + int g; + char h; + long i[10]; + } s2; +} weird_struct; + +struct _struct_n_pointer { + char ****char_ptr; + long ****long_ptr; + struct _struct_n_pointer *ptrs[3]; + struct _struct_n_pointer *next; +}; + +void do_locals_tests (void); +void do_block_tests (void); +void subroutine1 (int, long *); +void nothing (void); +void do_children_tests (void); +void do_special_tests (void); +void incr_a (int); + +void incr_a (int a) +{ + int b; + b = a; +} + +void +do_locals_tests () +{ + int linteger; + int *lpinteger; + char lcharacter; + char *lpcharacter; + long llong; + long *lplong; + float lfloat; + float *lpfloat; + double ldouble; + double *lpdouble; + struct _simple_struct lsimple; + struct _simple_struct *lpsimple; + void (*func) (void); + + /* Simple assignments */ + linteger = 1234; + lpinteger = &linteger; + lcharacter = 'a'; + lpcharacter = &lcharacter; + llong = 2121L; + lplong = &llong; + lfloat = 2.1; + lpfloat = &lfloat; + ldouble = 2.718281828459045; + lpdouble = &ldouble; + lsimple.integer = 1234; + lsimple.unsigned_integer = 255; + lsimple.character = 'a'; + lsimple.signed_character = 21; + lsimple.char_ptr = &lcharacter; + lpsimple = &lsimple; + func = nothing; + + /* Check pointers */ + linteger = 4321; + lcharacter = 'b'; + llong = 1212L; + lfloat = 1.2; + ldouble = 5.498548281828172; + lsimple.integer = 255; + lsimple.unsigned_integer = 4321; + lsimple.character = 'b'; + lsimple.signed_character = 0; + + subroutine1 (linteger, &llong); +} + +void +nothing () +{ +} + +void +subroutine1 (int i, long *l) +{ + global_simple.integer = i + 3; + i = 212; + *l = 12; +} + +void +do_block_tests () +{ + int cb = 12; + + { + int foo; + foo = 123; + { + int foo2; + foo2 = 123; + { + int foo; + foo = 321; + } + foo2 = 0; + } + foo = 0; + } + + cb = 21; +} + +void +do_children_tests (void) +{ + weird_struct *weird; + struct _struct_n_pointer *psnp; + struct _struct_n_pointer snp0, snp1, snp2; + char a0, *a1, **a2, ***a3; + char b0, *b1, **b2, ***b3; + char c0, *c1, **c2, ***c3; + long z0, *z1, **z2, ***z3; + long y0, *y1, **y2, ***y3; + long x0, *x1, **x2, ***x3; + int *foo; + int bar; + + struct _struct_decl struct_declarations; + weird = &struct_declarations; + + struct_declarations.integer = 123; + weird->char_ptr = "hello"; + bar = 2121; + foo = &bar; + struct_declarations.int_ptr_ptr = &foo; + weird->long_array[0] = 1234; + struct_declarations.long_array[1] = 2345; + weird->long_array[2] = 3456; + struct_declarations.long_array[3] = 4567; + weird->long_array[4] = 5678; + struct_declarations.long_array[5] = 6789; + weird->long_array[6] = 7890; + struct_declarations.long_array[7] = 8901; + weird->long_array[8] = 9012; + struct_declarations.long_array[9] = 1234; + + weird->func_ptr = nothing; + + /* Struct/pointer/array tests */ + a0 = '0'; + a1 = &a0; + a2 = &a1; + a3 = &a2; + b0 = '1'; + b1 = &b0; + b2 = &b1; + b3 = &b2; + c0 = '2'; + c1 = &c0; + c2 = &c1; + c3 = &c2; + z0 = 0xdead + 0; + z1 = &z0; + z2 = &z1; + z3 = &z2; + y0 = 0xdead + 1; + y1 = &y0; + y2 = &y1; + y3 = &y2; + x0 = 0xdead + 2; + x1 = &x0; + x2 = &x1; + x3 = &x2; + snp0.char_ptr = &a3; + snp0.long_ptr = &z3; + snp0.ptrs[0] = &snp0; + snp0.ptrs[1] = &snp1; + snp0.ptrs[2] = &snp2; + snp0.next = &snp1; + snp1.char_ptr = &b3; + snp1.long_ptr = &y3; + snp1.ptrs[0] = &snp0; + snp1.ptrs[1] = &snp1; + snp1.ptrs[2] = &snp2; + snp1.next = &snp2; + snp2.char_ptr = &c3; + snp2.long_ptr = &x3; + snp2.ptrs[0] = &snp0; + snp2.ptrs[1] = &snp1; + snp2.ptrs[2] = &snp2; + snp2.next = 0x0; + psnp = &snp0; + snp0.char_ptr = &b3; + snp1.char_ptr = &c3; + snp2.char_ptr = &a3; + snp0.long_ptr = &y3; + snp1.long_ptr = &x3; + snp2.long_ptr = &z3; +} + +void +do_special_tests (void) +{ + union named_union u; + union { + int a; + char b; + long c; + } anonu; + struct _simple_struct s; + struct { + int a; + char b; + long c; + } anons; + enum foo e; + enum { A, B, C } anone; + int array[21]; + int a; + + a = 1; + incr_a(2); +} + +int +main (int argc, char *argv []) +{ + do_locals_tests (); + do_block_tests (); + do_children_tests (); + do_special_tests (); + exit (0); +} + + diff --git a/gdb/testsuite/gdb.gdbtk/c_variable.exp b/gdb/testsuite/gdb.gdbtk/c_variable.exp new file mode 100644 index 00000000000..8452034fe83 --- /dev/null +++ b/gdb/testsuite/gdb.gdbtk/c_variable.exp @@ -0,0 +1,34 @@ +# +# Check if we have a display +# +if {![info exists ::env(DISPLAY)]} { + untested "No DISPLAY -- skipping test" +} else { + + if {$tracelevel} { + strace $tracelevel + } + + # + # test variable API + # + set prms_id 0 + set bug_id 0 + + set testfile "c_variable" + set srcfile ${testfile}.c + set binfile ${objdir}/${subdir}/${testfile} + set r [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] + if { $r != "" } { + gdb_suppress_entire_file \ + "Testcase compile failed, so some tests in this file will automatically fail." + } + + # Start with a fresh gdbtk + gdb_exit + set results [gdbtk_start [file join $srcdir $subdir ${testfile}.test]] + set results [split $results \n] + + # Analyze results + gdbtk_analyze_results $results +} diff --git a/gdb/testsuite/gdb.gdbtk/c_variable.test b/gdb/testsuite/gdb.gdbtk/c_variable.test new file mode 100644 index 00000000000..098c9240ea4 --- /dev/null +++ b/gdb/testsuite/gdb.gdbtk/c_variable.test @@ -0,0 +1,2066 @@ +# Copyright (C) 1998 Cygnus Solutions +# +# 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. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# This file was written by Keith Seitz (keiths@cygnus.com) + +# Read in the standard defs file +if {![gdbtk_read_defs]} { + break +} + +global objdir test_ran +global tcl_platform + +# Load in a file +if {$tcl_platform(platform) == "windows"} { + set program [file join $objdir c_variable.exe] +} else { + set program [file join $objdir c_variable] +} + +# This isn't a test case, since if this fails, we're hosed. +if {[catch {gdb_cmd "file $program"} t]} { + # an error occured loading the file + gdbtk_test_error "loading \"$program\": $t" +} + +# The variables that are created are stored in an array called "var". + +# proc to tell us which of the variables are changed/out of scope +proc check_update {} { + global var + + set changed {} + set unchanged {} + set out {} + #FIXME: Should get a list of root variables instead of using the array + foreach ind [array names var] { + set changed [concat $changed [$var($ind) update]] + } + + foreach ind [array names var] { + set ix [lsearch -exact $changed $var($ind)] + if {$ix < 0} { + lappend unchanged $var($ind) + } + } + + return [list $changed $unchanged $out] +} + +# proc to create a variable +proc create_variable {expr} { + global var + + set err [catch {gdb_variable create "$expr" -expr $expr} v] + if {!$err} { + set var($expr) $v + } + + return $err +} + +# proc to get the children +# Children are stored in the global "var" as +# PARENT.child. So for struct _foo {int a; int b} bar;, +# the children returned are {a b} and var(bar.a) and var(bar.b) +# map the actual objects to their names. +proc get_children {parent} { + global var + + set kiddies [$var($parent) children] + set children {} + foreach child $kiddies { + set name [lindex [split $child .] end] + lappend children $name + set var($parent.$name) $child + } + + return $children +} + +proc delete_variable {varname} { + global var + + if {[info exists var($varname)]} { + # This has to be caught, since deleting a parent + # will erase all children. + $var($varname) delete + set vars [array names var $varname*] + foreach v $vars { + if {[info exists var($v)]} { + unset var($v) + } + } + } +} + +# Compare the values of variable V in format FMT +# with gdb's value. +proc value {v fmt} { + global var + global _test + + set value [$var($v) value] + set gdb [gdb_cmd "output/$fmt $v"] + if {$value == $gdb} { + set result ok + } else { + set result $v + puts $_test(logfile) "output/$fmt $v" + puts $_test(logfile) "gdbtk: $value <> gdb: $gdb" + } + + return $result +} + +proc delete_all_variables {} { + global var + + foreach variable [array names var] { + delete_variable $variable + } +} + +proc editable_variables {} { + global var + + set yes {} + set no {} + foreach name [array names var] { + if {[$var($name) editable]} { + lappend yes $name + } else { + lappend no $name + } + } + + return [list $yes $no] +} + + +##### ##### +# # +# Variable Creation tests # +# # +##### ##### + +# Test: c_variable-1.1 +# Desc: Create global variable +gdbtk_test c_variable-1.1 {create global variable} { + create_variable global_simple +} {0} + +# Test: c_variable-1.2 +# Desc: Create non-existent variable +gdbtk_test c_variable-1.2 {create non-existent variable} { + create_variable bogus_unknown_variable +} {1} + +# Test: c_variable-1.3 +# Desc: Create out of scope variable +gdbtk_test c_variable-1.3 {create out of scope variable} { + create_variable argc +} {1} + +## FIXME: natives only +# Break in main and run +gdb_cmd "break do_locals_tests" +gdb_cmd "run" + +# Test: c_variable-1.4 +# Desc: create local variables +gdbtk_test c_variable-1.4 {create local variables} { + set results {} + foreach v {linteger lpinteger lcharacter lpcharacter llong lplong lfloat lpfloat ldouble lpdouble lsimple lpsimple func} { + lappend results [create_variable $v] + } + set results +} {0 0 0 0 0 0 0 0 0 0 0 0 0} + +# Test: c_variable-1.5 +# Desc: create lsimple.character +gdbtk_test c_variable-1.5 {create lsimple.character} { + create_variable lsimple.character +} {0} + +# Test: c_variable-1.6 +# Desc: create lpsimple->integer +gdbtk_test c_variable-1.6 {create lpsimple->integer} { + create_variable lpsimple->integer +} {0} + +# Test: c_variable-1.7 +# Desc: ceate lsimple.integer +gdbtk_test c_variable-1.7 {create lsimple.integer} { + create_variable lsimple.integer +} {0} + +# Test: c_variable-1.8 +# Desc: names of editable variables +gdbtk_test c_variable-1.8 {names of editable variables} { + editable_variables +} {{lsimple.character lsimple.integer lpsimple lcharacter lpcharacter linteger lpinteger lfloat lpfloat func llong lplong lpsimple->integer ldouble lpdouble} {lsimple global_simple}} + +# Test: c_variable-1.9 +# Desc: create type name +# Type names (like int, long, etc..) are all proper expressions to gdb. +# make sure variable code does not allow users to create variables, though. +gdbtk_test c_variable-1.9 {create type name} { + create_variable int +} {1} + +##### ##### +# # +# Value changed tests # +# # +##### ##### + +# Test: c_variable-2.1 +# Desc: check whether values changed at do_block_tests +gdbtk_test c_variable-2.1 {check whether values changed at do_block_tests} { + check_update +} {{} {lsimple.character lsimple.integer lpsimple lsimple lcharacter lpcharacter global_simple linteger lpinteger lfloat lpfloat func llong lplong lpsimple->integer ldouble lpdouble} {}} + +# Step over "linteger = 1234;" +gdb_cmd "step" + +# Test: c_variable-2.2 +# Desc: check whether only linteger changed values +gdbtk_test c_variable-2.2 {check whether only linteger changed values} { + check_update +} {linteger {lsimple.character lsimple.integer lpsimple lsimple lcharacter lpcharacter global_simple lpinteger lfloat lpfloat func llong lplong lpsimple->integer ldouble lpdouble} {}} + +# Step over "lpinteger = &linteger;" +gdb_cmd "step" + +# Test: c_variable-2.3 +# Desc: check whether only lpinteger changed +gdbtk_test c_variable-2.3 {check whether only lpinteger changed} { + check_update +} {lpinteger {lsimple.character lsimple.integer lpsimple lsimple lcharacter lpcharacter global_simple linteger lfloat lpfloat func llong lplong lpsimple->integer ldouble lpdouble} {}} + +# Step over "lcharacter = 'a';" +gdb_cmd "step" + +# Test: c_variable-2.4 +# Desc: check whether only lcharacter changed +gdbtk_test c_variable-2.4 {check whether only lcharacter changed} { + check_update +} {lcharacter {lsimple.character lsimple.integer lpsimple lsimple lpcharacter global_simple linteger lpinteger lfloat lpfloat func llong lplong lpsimple->integer ldouble lpdouble} {}} + +# Step over "lpcharacter = &lcharacter;" +gdb_cmd "step" + +# Test: c_variable-2.5 +# Desc: check whether only lpcharacter changed +gdbtk_test c_variable-2.5 {check whether only lpcharacter changed} { + check_update +} {lpcharacter {lsimple.character lsimple.integer lpsimple lsimple lcharacter global_simple linteger lpinteger lfloat lpfloat func llong lplong lpsimple->integer ldouble lpdouble} {}} + +# Step over: +# llong = 2121L; +# lplong = &llong; +# lfloat = 2.1; +# lpfloat = &lfloat; +# ldouble = 2.718281828459045; +# lpdouble = &ldouble; +# lsimple.integer = 1234; +# lsimple.unsigned_integer = 255; +# lsimple.character = 'a'; +for {set i 0} {$i < 9} {incr i} { + gdb_cmd "step" +} + +# Test: c_variable-2.6 +# Desc: check whether llong, lplong, lfloat, lpfloat, ldouble, lpdouble, lsimple.integer, +# lsimple.unsigned_character lsimple.integer lsimple.character changed +gdbtk_test c_variable-2.6 {check whether llong -- lsimple.character changed} { + check_update +} {{lsimple.character lsimple.integer lfloat lpfloat llong lplong ldouble lpdouble} {lpsimple lsimple lcharacter lpcharacter global_simple linteger lpinteger func lpsimple->integer} {}} + +# Step over: +# lsimple.signed_character = 21; +# lsimple.char_ptr = &lcharacter; +# lpsimple = &lsimple; +# func = nothing; +for {set i 0} {$i < 4} {incr i} { + gdb_cmd "step" +} + +# Test: c_variable-2.7 +# Desc: check whether lsimple.signed_character, lsimple.char_ptr, lpsimple, func changed +gdbtk_test c_variable-2.7 {check whether lsimple.signed_character, lsimple.char_ptr, lpsimple, func changed} { + check_update +} {{lpsimple func lpsimple->integer} {lsimple.character lsimple.integer lsimple lcharacter lpcharacter global_simple linteger lpinteger lfloat lpfloat llong lplong ldouble lpdouble} {}} + +# Step over +# linteger = 4321; +# lcharacter = 'b'; +# llong = 1212L; +# lfloat = 1.2; +# ldouble = 5.498548281828172; +# lsimple.integer = 255; +# lsimple.unsigned_integer = 4321; +# lsimple.character = 'b'; +for {set i 0} {$i < 8} {incr i} { + gdb_cmd "step" +} + +# Test: c_variable-2.8 +# Desc: check whether linteger, lcharacter, llong, lfoat, ldouble, lsimple.integer, +# lpsimple.integer lsimple.character changed +# Note: this test also checks that lpsimple->integer and lsimple.integer have +# changed (they are the same) +gdbtk_test c_variable-2.8 {check whether linteger -- lsimple.integer changed} { + check_update +} {{lsimple.character lsimple.integer lcharacter linteger lfloat llong lpsimple->integer ldouble} {lpsimple lsimple lpcharacter global_simple lpinteger lpfloat func lplong lpdouble} {}} + +gdb_cmd "break subroutine1" +gdb_cmd "continue" + +# Test: c_variable-2.9 +# Desc: stop in subroutine1 +gdbtk_test c_variable-2.9 {stop in subroutine1} { + lindex [gdb_loc] 1 +} {subroutine1} + +# Test: c_variable-2.10 +# Desc: create variable for locals i,l in subroutine1 +gdbtk_test c_variable-2.10 {create variable for locals i,l in subroutine1} { + set r [create_variable i] + lappend r [create_variable l] +} {0 0} + +# Test: c_variable-2.11 +# Desc: create do_locals_tests local in subroutine1 +gdbtk_test c_variable-2.11 {create do_locals_tests local in subroutine1} { + create_variable linteger +} {1} + +gdb_cmd "step" + +# Test: c_variable-2.12 +# Desc: change global_simple.integer +# Note: This also tests whether we are reporting changes in structs properly. +# gdb normally would say that global_simple has changed, but we +# special case that, since it is not what a human expects to see. +gdbtk_test c_variable-2.12 {change global_simple.integer} { + check_update +} {{} {lsimple.character lsimple.integer lpsimple lsimple i lcharacter lpcharacter global_simple linteger lpinteger lfloat lpfloat l func llong lplong lpsimple->integer ldouble lpdouble} {}} + +gdb_cmd "step" + +# Test: c_variable-2.13 +# Desc: change subroutine1 local i +gdbtk_test c_variable-2.13 {change subroutine1 local i} { + check_update +} {i {lsimple.character lsimple.integer lpsimple lsimple lcharacter lpcharacter global_simple linteger lpinteger lfloat lpfloat l func llong lplong lpsimple->integer ldouble lpdouble} {}} + +gdb_cmd "step" + +# Test: c_variable-2.14 +# Desc: change do_locals_tests local llong +gdbtk_test c_variable-2.14 {change do_locals_tests local llong} { + check_update +} {llong {lsimple.character lsimple.integer lpsimple lsimple i lcharacter lpcharacter global_simple linteger lpinteger lfloat lpfloat l func lplong lpsimple->integer ldouble lpdouble} {}} + +gdb_cmd "next" + +# Test: c_variable-2.15 +# Desc: check for out of scope subroutine1 locals +gdbtk_test *c_variable-2.15 {check for out of scope subroutine1 locals (ops, we don't have a out-of-scope list yet)} { + check_update +} {{} {lsimple.character lsimple.integer lpsimple lsimple lcharacter lpcharacter global_simple linteger lpinteger lfloat lpfloat func llong lplong lpsimple->integer ldouble lpdouble} {i l}} + +# Test: c_variable-2.16 +# Desc: names of all editable variables +gdbtk_test c_variable-2.16 {names of all editable variables} { + editable_variables +} {{lsimple.character lsimple.integer lpsimple i lcharacter lpcharacter linteger lpinteger lfloat lpfloat l func llong lplong lpsimple->integer ldouble lpdouble} {lsimple global_simple}} + +# Done with locals/globals tests. Erase all variables +delete_all_variables + +##### ##### +# # +# Block tests # +# # +##### ##### +gdb_cmd "break do_block_tests" +gdb_cmd "continue" + +# Test: c_variable-3.1 +# Desc: stop in do_block_tests +gdbtk_test c_variable-3.1 {stop in do_block_tests} { + lindex [gdb_loc] 1 +} {do_block_tests} + +# Test: c_variable-3.2 +# Desc: create cb and foo +gdbtk_test c_variable-3.2 {create cb and foo} { + set r [create_variable cb] + lappend r [create_variable foo] +} {0 1} + +# step to "foo = 123;" +gdb_cmd "step" + +# Be paranoid and assume 3.2 created foo +delete_variable foo + +# Test: c_variable-3.3 +# Desc: create foo +gdbtk_test c_variable-3.3 {create foo} { + create_variable foo +} {0} + +# step to "foo2 = 123;" +gdb_cmd "step" + +# Test: c_variable-3.4 +# Desc: check foo, cb changed +gdbtk_test c_variable-3.4 {check foo,cb changed} { + check_update +} {{foo cb} {} {}} + +# step to "foo = 321;" +gdb_cmd "step" + +# Test: c_variable-3.5 +# Desc: create inner block foo +gdbtk_test c_variable-3.5 {create inner block foo} { + global var + set err [catch {gdb_variable create inner_foo -expr foo} v] + if {!$err} { + set var(inner_foo) $v + } + + set err +} {0} + +# step to "foo2 = 0;" +gdb_cmd "step" + +# Test: c_variable-3.6 +# Desc: create foo2 +gdbtk_test c_variable-3.6 {create foo2} { + create_variable foo2 +} {0} + +# Test: c_variable-3.7 +# Desc: check that outer foo in scope and inner foo out of scope +# Note: also a known gdb problem +gdbtk_test *c_variable-3.7 {check that outer foo in scope and inner foo out of scope (known gdb problem)} { + check_update +} {{} {foo2 foo cb} inner_foo} + +delete_variable inner_foo + +# step to "foo = 0;" +gdb_cmd "step" + +# Test: c_variable-3.8 +# Desc: check that foo2 out of scope +gdbtk_test *c_variable-3.8 {check that foo2 out of scope (known gdb problem} { + check_update +} {{} {foo cb} foo2} + +# step to "cb = 21;" +gdb_cmd "step" + +# Test: c_variable-3.9 +# Desc: check that only cb is in scope +gdbtk_test *c_variable-3.9 {check that only cb is in scope (known gdb problem)} { + check_update +} {{} cb {foo2 foo}} + +# Test: c_variable-3.10 +# Desc: names of editable variables +gdbtk_test c_variable-3.10 {names of editable variables} { + editable_variables +} {{foo cb foo2} {}} + +# Done with block tests +delete_all_variables + +##### ##### +# # +# children tests # +# # +##### ##### + +gdb_cmd "break do_children_tests" +gdb_cmd "continue" + +# Test: c_variable-4.1 +# Desc: stopped in do_children_tests +gdbtk_test c_variable-4.1 {stopped in do_children_tests} { + lindex [gdb_loc] 1 +} {do_children_tests} + +# Test: c_variable-4.2 +# Desc: create variable "struct_declarations" +gdbtk_test c_variable-4.2 {create variable "struct_declarations"} { + create_variable struct_declarations +} {0} + +# Test: c_variable-4.3 +# Desc: children of struct_declarations +gdbtk_test c_variable-4.3 {children of struct_declarations} { + get_children struct_declarations +} {integer character char_ptr long_int int_ptr_ptr long_array func_ptr func_ptr_struct func_ptr_ptr u1 s2} + +# Test: c_variable-4.4 +# Desc: number of children of struct_declarations +gdbtk_test c_variable-4.4 {number of children of struct_declarations} { + $var(struct_declarations) numChildren +} {11} + +# Test: c_variable-4.5 +# Desc: children of struct_declarations.integer +gdbtk_test c_variable-4.5 {children of struct_declarations.integer} { + get_children struct_declarations.integer +} {} + +# Test: c_variable-4.6 +# Desc: number of children of struct_declarations.integer +gdbtk_test c_variable-4.6 {number of children of struct_declarations.integer} { + $var(struct_declarations.integer) numChildren +} {0} + +# Test: c_variable-4.7 +# Desc: children of struct_declarations.character +gdbtk_test c_variable-4.7 {children of struct_declarations.character} { + get_children struct_declarations.character +} {} + +# Test: c_variable-4.8 +# Desc: number of children of struct_declarations.character +gdbtk_test c_variable-4.8 {number of children of struct_declarations.character} { + $var(struct_declarations.character) numChildren +} {0} + +# Test: c_variable-4.9 +# Desc: children of struct_declarations.char_ptr +gdbtk_test c_variable-4.9 {children of struct_declarations.char_ptr} { + get_children struct_declarations.char_ptr +} {} + +# Test: c_variable-4.10 +# Desc: number of children of struct_declarations.char_ptr +gdbtk_test c_variable-4.10 {number of children of struct_declarations.char_ptr} { + $var(struct_declarations.char_ptr) numChildren +} {0} + +# Test: c_variable-4.11 +# Desc: children of struct_declarations.long_int +gdbtk_test c_variable-4.11 {children of struct_declarations.long_int} { + + get_children struct_declarations.long_int +} {} + +# Test: c_variable-4.12 +# Desc: number of children of struct_declarations.long_int +gdbtk_test c_variable-4.12 {number of children of struct_declarations.long_int} { + $var(struct_declarations.long_int) numChildren +} {0} + +# Test: c_variable-4.13 +# Desc: children of int_ptr_ptr +gdbtk_test c_variable-4.13 {children of int_ptr_ptr} { + get_children struct_declarations.int_ptr_ptr +} {*int_ptr_ptr} + +# Test: c_variable-4.14 +# Desc: number of children of int_ptr_ptr +gdbtk_test c_variable-4.14 {number of children of int_ptr_ptr} { + $var(struct_declarations.int_ptr_ptr) numChildren +} {1} + +# Test: c_variable-4.15 +# Desc: children of struct_declarations.long_array +gdbtk_test c_variable-4.15 {children of struct_declarations.long_array} { + get_children struct_declarations.long_array +} {0 1 2 3 4 5 6 7 8 9} + +# Test: c_variable-4.16 +# Desc: number of children of struct_declarations.long_array +gdbtk_test c_variable-4.16 {number of children of struct_declarations.long_array} { + $var(struct_declarations.long_array) numChildren +} {10} + +# Test: c_variable-4.17 +# Desc: children of struct_declarations.func_ptr +gdbtk_test c_variable-4.17 {children of struct_declarations.func_ptr} { + get_children struct_declarations.func_ptr +} {} + +# Test: c_variable-4.18 +# Desc: number of children of struct_declarations.func_ptr +gdbtk_test c_variable-4.18 {number of children of struct_declarations.func_ptr} { + $var(struct_declarations.func_ptr) numChildren +} {0} + +# Test: c_variable-4.19 +# Desc: children of struct_declarations.func_ptr_struct +gdbtk_test c_variable-4.19 {children of struct_declarations.func_ptr_struct} { + get_children struct_declarations.func_ptr_struct +} {} + +# Test: c_variable-4.20 +# Desc: number of children of struct_declarations.func_ptr_struct +gdbtk_test c_variable-4.20 {number of children of struct_declarations.func_ptr_struct} { + $var(struct_declarations.func_ptr_struct) numChildren +} {0} + +# Test: c_variable-4.21 +# Desc: children of struct_declarations.func_ptr_ptr +gdbtk_test c_variable-4.21 {children of struct_declarations.func_ptr_ptr} { + get_children struct_declarations.func_ptr_ptr +} {} + +# Test: c_variable-4.22 +# Desc: number of children of struct_declarations.func_ptr_ptr +gdbtk_test c_variable-4.22 {number of children of struct_declarations.func_ptr_ptr} { + $var(struct_declarations.func_ptr_ptr) numChildren +} {0} + +# Test: c_variable-4.23 +# Desc: children of struct_declarations.u1 +gdbtk_test c_variable-4.23 {children of struct_declarations.u1} { + get_children struct_declarations.u1 +} {a b c d} + +# Test: c_variable-4.24 +# Desc: number of children of struct_declarations.u1 +gdbtk_test c_variable-4.24 {number of children of struct_declarations.u1} { + $var(struct_declarations.u1) numChildren +} {4} + +# Test: c_variable-4.25 +# Desc: children of struct_declarations.s2 +gdbtk_test c_variable-4.25 {children of struct_declarations.s2} { + get_children struct_declarations.s2 +} {u2 g h i} + +# Test: c_variable-4.26 +# Desc: number of children of struct_declarations.s2 +gdbtk_test c_variable-4.26 {number of children of struct_declarations.s2} { + $var(struct_declarations.s2) numChildren +} {4} + +# Test: c_variable-4.27 +# Desc: children of struct_declarations.long_array.1 +gdbtk_test c_variable-4.27 {children of struct_declarations.long_array.1} { + get_children struct_declarations.long_array.1 +} {} + +# Test: c_variable-4.28 +# Desc: number of children of struct_declarations.long_array.1 +gdbtk_test c_variable-4.28 {number of children of struct_declarations.long_array.1} { + $var(struct_declarations.long_array.1) numChildren +} {0} + +# Test: c_variable-4.29 +# Desc: children of struct_declarations.long_array.2 +gdbtk_test c_variable-4.29 {children of struct_declarations.long_array.2} { + get_children struct_declarations.long_array.2 +} {} + +# Test: c_variable-4.30 +# Desc: number of children of struct_declarations.long_array.2 +gdbtk_test c_variable-4.30 {number of children of struct_declarations.long_array.2} { + $var(struct_declarations.long_array.2) numChildren +} {0} + +# Test: c_variable-4.31 +# Desc: children of struct_declarations.long_array.3 +gdbtk_test c_variable-4.31 {children of struct_declarations.long_array.3} { + get_children struct_declarations.long_array.3 +} {} + +# Test: c_variable-4.32 +# Desc: number of children of struct_declarations.long_array.3 +gdbtk_test c_variable-4.32 {number of children of struct_declarations.long_array.3} { + $var(struct_declarations.long_array.3) numChildren +} {0} + +# Test: c_variable-4.33 +# Desc: children of struct_declarations.long_array.4 +gdbtk_test c_variable-4.33 {children of struct_declarations.long_array.4} { + get_children struct_declarations.long_array.4 +} {} + +# Test: c_variable-4.34 +# Desc: number of children of struct_declarations.long_array.4 +gdbtk_test c_variable-4.34 {number of children of struct_declarations.long_array.4} { + $var(struct_declarations.long_array.4) numChildren +} {0} + +# Test: c_variable-4.35 +# Desc: children of struct_declarations.long_array.5 +gdbtk_test c_variable-4.35 {children of struct_declarations.long_array.5} { + get_children struct_declarations.long_array.5 +} {} + +# Test: c_variable-4.36 +# Desc: number of children of struct_declarations.long_array.5 +gdbtk_test c_variable-4.36 {number of children of struct_declarations.long_array.5} { + $var(struct_declarations.long_array.5) numChildren +} {0} + +# Test: c_variable-4.37 +# Desc: children of struct_declarations.long_array.6 +gdbtk_test c_variable-4.37 {children of struct_declarations.long_array.6} { + get_children struct_declarations.long_array.6 +} {} + +# Test: c_variable-4.38 +# Desc: number of children of struct_declarations.long_array.6 +gdbtk_test c_variable-4.38 {number of children of struct_declarations.long_array.6} { + $var(struct_declarations.long_array.6) numChildren +} {0} + +# Test: c_variable-4.39 +# Desc: children of struct_declarations.long_array.7 +gdbtk_test c_variable-4.39 {children of struct_declarations.long_array.7} { + get_children struct_declarations.long_array.7 +} {} + +# Test: c_variable-4.40 +# Desc: number of children of struct_declarations.long_array.7 +gdbtk_test c_variable-4.40 {number of children of struct_declarations.long_array.7} { + $var(struct_declarations.long_array.7) numChildren +} {0} + +# Test: c_variable-4.41 +# Desc: children of struct_declarations.long_array.8 +gdbtk_test c_variable-4.41 {children of struct_declarations.long_array.8} { + get_children struct_declarations.long_array.8 +} {} + +# Test: c_variable-4.42 +# Desc: number of children of struct_declarations.long_array.8 +gdbtk_test c_variable-4.42 {number of children of struct_declarations.long_array.8} { + $var(struct_declarations.long_array.8) numChildren +} {0} + +# Test: c_variable-4.43 +# Desc: children of struct_declarations.long_array.9 +gdbtk_test c_variable-4.43 {children of struct_declarations.long_array.9} { + get_children struct_declarations.long_array.9 +} {} + +# Test: c_variable-4.44 +# Desc: number of children of struct_declarations.long_array.9 +gdbtk_test c_variable-4.44 {number of children of struct_declarations.long_array.9} { + $var(struct_declarations.long_array.9) numChildren +} {0} + +# Test: c_variable-4.45 +# Desc: children of struct_declarations.u1.a +gdbtk_test c_variable-4.45 {children of struct_declarations.u1.a} { + get_children struct_declarations.u1.a +} {} + +# Test: c_variable-4.46 +# Desc: number of children of struct_declarations.u1.a +gdbtk_test c_variable-4.46 {number of children of struct_declarations.u1.a} { + $var(struct_declarations.u1.a) numChildren +} {0} + +# Test: c_variable-4.47 +# Desc: children of struct_declarations.u1.b +gdbtk_test c_variable-4.47 {children of struct_declarations.u1.b} { + get_children struct_declarations.u1.b +} {} + +# Test: c_variable-4.48 +# Desc: number of children of struct_declarations.u1.b +gdbtk_test c_variable-4.48 {number of children of struct_declarations.u1.b} { + $var(struct_declarations.u1.b) numChildren +} {0} + +# Test: c_variable-4.49 +# Desc: children of struct_declarations.u1.c +gdbtk_test c_variable-4.49 {children of struct_declarations.u1.c} { + get_children struct_declarations.u1.c +} {} + +# Test: c_variable-4.50 +# Desc: number of children of struct_declarations.u1.c +gdbtk_test c_variable-4.50 {number of children of struct_declarations.u1.c} { + $var(struct_declarations.u1.c) numChildren +} {0} + +# Test: c_variable-4.51 +# Desc: children of struct_declarations.u1.d +gdbtk_test c_variable-4.51 {children of struct_declarations.u1.d} { + get_children struct_declarations.u1.d +} {} + +# Test: c_variable-4.52 +# Desc: number of children of struct_declarations.u1.d +gdbtk_test c_variable-4.52 {number of children of struct_declarations.u1.d} { + $var(struct_declarations.u1.d) numChildren +} {0} + +# Test: c_variable-4.53 +# Desc: children of struct_declarations.s2.u2 +gdbtk_test c_variable-4.53 {children of struct_declarations.s2.u2} { + get_children struct_declarations.s2.u2 +} {u1s1 f u1s2} + +# Test: c_variable-4.54 +# Desc: number of children of struct_declarations.s2.u2 +gdbtk_test c_variable-4.54 {number of children of struct_declarations.s2.u2} { + $var(struct_declarations.s2.u2) numChildren +} {3} + +# Test: c_variable-4.55 +# Desc: children of struct_declarations.s2.g +gdbtk_test c_variable-4.55 {children of struct_declarations.s2.g} { + get_children struct_declarations.s2.g +} {} + +# Test: c_variable-4.56 +# Desc: number of children of struct_declarations.s2.g +gdbtk_test c_variable-4.56 {number of children of struct_declarations.s2.g} { + $var(struct_declarations.s2.g) numChildren +} {0} + +# Test: c_variable-4.57 +# Desc: children of struct_declarations.s2.h +gdbtk_test c_variable-4.57 {children of struct_declarations.s2.h} { + get_children struct_declarations.s2.h +} {} + +# Test: c_variable-4.58 +# Desc: number of children of struct_declarations.s2.h +gdbtk_test c_variable-4.58 {number of children of struct_declarations.s2.h} { + $var(struct_declarations.s2.h) numChildren +} {0} + +# Test: c_variable-4.59 +# Desc: children of struct_declarations.s2.i +gdbtk_test c_variable-4.59 {children of struct_declarations.s2.i} { + get_children struct_declarations.s2.i +} {0 1 2 3 4 5 6 7 8 9} + +# Test: c_variable-4.60 +# Desc: number of children of struct_declarations.s2.i +gdbtk_test c_variable-4.60 {number of children of struct_declarations.s2.i} { + $var(struct_declarations.s2.i) numChildren +} {10} + +# Test: c_variable-4.61 +# Desc: children of struct_declarations.s2.u2.u1s1 +gdbtk_test c_variable-4.61 {children of struct_declarations.s2.u2.u1s1} { + get_children struct_declarations.s2.u2.u1s1 +} {d e func foo} + +# Test: c_variable-4.62 +# Desc: number of children of struct_declarations.s2.u2.u1s1 +gdbtk_test c_variable-4.62 {number of children of struct_declarations.s2.u2.u1s1} { + $var(struct_declarations.s2.u2.u1s1) numChildren +} {4} + +# Test: c_variable-4.63 +# Desc: children of struct_declarations.s2.u2.f +gdbtk_test c_variable-4.63 {children of struct_declarations.s2.u2.f} { + get_children struct_declarations.s2.u2.f +} {} + +# Test: c_variable-4.64 +# Desc: number of children of struct_declarations.s2.u2.f +gdbtk_test c_variable-4.64 {number of children of struct_declarations.s2.u2.f} { + $var(struct_declarations.s2.u2.f) numChildren +} {0} + +# Test: c_variable-4.65 +# Desc: children of struct_declarations.s2.u2.u1s2 +gdbtk_test c_variable-4.65 {children of struct_declarations.s2.u2.u1s2} { + get_children struct_declarations.s2.u2.u1s2 +} {array_ptr func} + +# Test: c_variable-4.66 +# Desc: number of children of struct_declarations.s2.u2.u1s2 +gdbtk_test c_variable-4.66 {number of children of struct_declarations.s2.u2.u1s2} { + $var(struct_declarations.s2.u2.u1s2) numChildren +} {2} + +# Test: c_variable-4.67 +# Desc: children of struct_declarations.s2.u2.u1s1.d +gdbtk_test c_variable-4.67 {children of struct_declarations.s2.u2.u1s1.d} { + get_children struct_declarations.s2.u2.u1s1.d +} {} + +# Test: c_variable-4.68 +# Desc: number of children of struct_declarations.s2.u2.u1s1.d +gdbtk_test c_variable-4.68 {number of children of struct_declarations.s2.u2.u1s1.d} { + $var(struct_declarations.s2.u2.u1s1.d) numChildren +} {0} + +# Test: c_variable-4.69 +# Desc: children of struct_declarations.s2.u2.u1s1.e +gdbtk_test c_variable-4.69 {children of struct_declarations.s2.u2.u1s1.e} { + get_children struct_declarations.s2.u2.u1s1.e +} {0 1 2 3 4 5 6 7 8 9} + +# Test: c_variable-4.70 +# Desc: number of children of struct_declarations.s2.u2.u1s1.e +gdbtk_test c_variable-4.70 {number of children of struct_declarations.s2.u2.u1s1.e} { + $var(struct_declarations.s2.u2.u1s1.e) numChildren +} {10} + +# Test: c_variable-4.71 +# Desc: children of struct_declarations.s2.u2.u1s1.func +gdbtk_test c_variable-4.71 {children of struct_declarations.s2.u2.u1s1.func} { + get_children struct_declarations.s2.u2.u1s1.func +} {} + +# Test: c_variable-4.72 +# Desc: number of children of struct_declarations.s2.u2.u1s1.func +gdbtk_test c_variable-4.72 {number of children of struct_declarations.s2.u2.u1s1.func} { + $var(struct_declarations.s2.u2.u1s1.func) numChildren +} {0} + +# Test: c_variable-4.73 +# Desc: children of struct_declarations.s2.u2.u1s1.foo +gdbtk_test c_variable-4.73 {children of struct_declarations.s2.u2.u1s1.foo} { + get_children struct_declarations.s2.u2.u1s1.foo +} {} + +# Test: c_variable-4.74 +# Desc: number of children of struct_declarations.s2.u2.u1s1.foo +gdbtk_test c_variable-4.74 {number of children of struct_declarations.s2.u2.u1s1.foo} { + $var(struct_declarations.s2.u2.u1s1.foo) numChildren +} {0} + +# Test: c_variable-4.75 +# Desc: children of struct_declarations.s2.u2.u1s2.array_ptr +gdbtk_test c_variable-4.75 {children of struct_declarations.s2.u2.u1s2.array_ptr} { + get_children struct_declarations.s2.u2.u1s2.array_ptr +} {0 1} + +# Test: c_variable-4.76 +# Desc: number of children of struct_declarations.s2.u2.u1s2.array_ptr +gdbtk_test c_variable-4.76 {number of children of struct_declarations.s2.u2.u1s2.array_ptr} { + $var(struct_declarations.s2.u2.u1s2.array_ptr) numChildren +} {2} + +# Test: c_variable-4.77 +# Desc: children of struct_declarations.s2.u2.u1s2.func +gdbtk_test c_variable-4.77 {children of struct_declarations.s2.u2.u1s2.func} { + get_children struct_declarations.s2.u2.u1s2.func +} {} + +# Test: c_variable-4.78 +# Desc: number of children of struct_declarations.s2.u2.u1s2.func +gdbtk_test c_variable-4.78 {number of children of struct_declarations.s2.u2.u1s2.func} { + $var(struct_declarations.s2.u2.u1s2.func) numChildren +} {0} + +# Test: c_variable-4.79 +# Desc: children of struct_declarations.*int_ptr_ptr +gdbtk_test c_variable-4.79 {children of struct_declarations.*int_ptr_ptr} { + get_children struct_declarations.int_ptr_ptr.*int_ptr_ptr +} {**int_ptr_ptr} + +# Test: c_variable-4.80 +# Desc: Number of children of struct_declarations.*int_ptr_ptr +gdbtk_test c_variable-4.80 {Number of children of struct_declarations.*int_ptr_ptr} { + $var(struct_declarations.int_ptr_ptr.*int_ptr_ptr) numChildren +} {1} + +# Step to "struct_declarations.integer = 123;" +gdb_cmd "step" + +# Test: c_variable-4.81 +# Desc: create local variable "weird" +gdbtk_test c_variable-4.81 {create local variable "weird"} { + create_variable weird +} {0} + +# Test: c_variable-4.82 +# Desc: children of weird +gdbtk_test c_variable-4.82 {children of weird} { + get_children weird +} {integer character char_ptr long_int int_ptr_ptr long_array func_ptr func_ptr_struct func_ptr_ptr u1 s2} + +# Test: c_variable-4.83 +# Desc: number of children of weird +gdbtk_test c_variable-4.83 {number of children of weird} { + $var(weird) numChildren +} {11} + +# Test: c_variable-4.84 +# Desc: children of weird->long_array +gdbtk_test c_variable-4.84 {children of weird->long_array} { + get_children weird.long_array +} {0 1 2 3 4 5 6 7 8 9} + +# Test: c_variable-4.85 +# Desc: number of children of weird->long_array +gdbtk_test c_variable-4.85 {number of children of weird->long_array} { + $var(weird.long_array) numChildren +} {10} + +# Test: c_variable-4.86 +# Desc: children of weird->int_ptr_ptr +gdbtk_test c_variable-4.86 {children of weird->int_ptr_ptr} { + get_children weird.int_ptr_ptr +} {*int_ptr_ptr} + +# Test: c_variable-4.87 +# Desc: number of children of weird->int_ptr_ptr +gdbtk_test c_variable-4.87 {number of children of weird->int_ptr_ptr} { + $var(weird.int_ptr_ptr) numChildren +} {1} + +# Test: c_variable-4.88 +# Desc: children of *weird->int_ptr_ptr +gdbtk_test c_variable-4.88 {children of *weird->int_ptr_ptr} { + get_children weird.int_ptr_ptr.*int_ptr_ptr +} {**int_ptr_ptr} + +# Test: c_variable-4.89 +# Desc: number of children *weird->int_ptr_ptr +gdbtk_test c_variable-4.89 {number of children *weird->int_ptr_ptr} { + $var(weird.int_ptr_ptr.*int_ptr_ptr) numChildren +} {1} + +# Test: c_variable-4.90 +# Desc: create weird->int_ptr_ptr +gdbtk_test c_variable-4.90 {create weird->int_ptr_ptr} { + create_variable weird->int_ptr_ptr +} {0} + +# Test: c_variable-4.91 +# Desc: children of weird->int_ptr_ptr +gdbtk_test c_variable-4.91 {children of weird->int_ptr_ptr} { + get_children weird->int_ptr_ptr +} {*weird->int_ptr_ptr} + +# Test: c_variable-4.92 +# Desc: number of children of (weird->int_ptr_ptr) +gdbtk_test c_variable-4.92 {number of children of (weird->int_ptr_ptr)} { + $var(weird->int_ptr_ptr) numChildren +} {1} + +# Test: c_variable-4.93 +# Desc: children of *(weird->int_ptr_ptr) +gdbtk_test c_variable-4.93 {children of *(weird->int_ptr_ptr)} { + get_children weird->int_ptr_ptr.*weird->int_ptr_ptr +} {**weird->int_ptr_ptr} + +# Test: c_variable-4.94 +# Desc: number of children of *(weird->int_ptr_ptr) +gdbtk_test c_variable-4.94 {number of children of *(weird->int_ptr_ptr)} { + $var(weird->int_ptr_ptr.*weird->int_ptr_ptr) numChildren +} {1} + +# Test: c_variable-4.95 +# Desc: children of *(*(weird->int_ptr_ptr)) +gdbtk_test c_variable-4.95 {children of *(*(weird->int_ptr_ptr))} { + get_children weird->int_ptr_ptr.*weird->int_ptr_ptr.**weird->int_ptr_ptr +} {} + +# Test: c_variable-4.96 +# Desc: number of children of *(*(weird->int_ptr_ptr)) +gdbtk_test c_variable-4.96 {number of children of **weird->int_ptr_ptr} { + $var(weird->int_ptr_ptr.*weird->int_ptr_ptr.**weird->int_ptr_ptr) numChildren +} {0} + +# Test: c_variable-4.97 +# Desc: is weird editable +gdbtk_test c_variable-4.97 {is weird editable} { + $var(weird) editable +} {1} + +# Test: c_variable-4.98 +# Desc: is weird->int_ptr_ptr editable +gdbtk_test c_variable-4.98 {is weird->int_ptr_ptr editable} { + $var(weird.int_ptr_ptr) editable +} {1} + +# Test: c_variable-4.99 +# Desc: is *(weird->int_ptr_ptr) editable +gdbtk_test c_variable-4.99 {is *(weird->int_ptr_ptr) editable} { + $var(weird.int_ptr_ptr.*int_ptr_ptr) editable +} {1} + +# Test: c_variable-4.100 +# Desc: is *(*(weird->int_ptr_ptr)) editable +gdbtk_test c_variable-4.100 {is *(*(weird->int_ptr_ptr)) editable} { + $var(weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr) editable +} {1} + +# Test: c_variable-4.101 +# Desc: is weird->u1 editable +gdbtk_test c_variable-4.101 {is weird->u1 editable} { + $var(weird.u1) editable +} {0} + +# Test: c_variable-4.102 +# Desc: is weird->s2 editable +gdbtk_test c_variable-4.102 {is weird->s2 editable} { + $var(weird.s2) editable +} {0} + +# Test: c_variable-4.103 +# Desc: is struct_declarations.u1.a editable +gdbtk_test c_variable-4.103 {is struct_declarations.u1.a editable} { + $var(struct_declarations.u1.a) editable +} {1} + +# Test: c_variable-4.104 +# Desc: is struct_declarations.u1.b editable +gdbtk_test c_variable-4.104 {is struct_declarations.u1.b editable} { + $var(struct_declarations.u1.b) editable +} {1} + +# Test: c_variable-4.105 +# Desc: is struct_declarations.u1.c editable +gdbtk_test c_variable-4.105 {is struct_declarations.u1.c editable} { + $var(struct_declarations.u1.c) editable +} {1} + +# Test: c_variable-4.106 +# Desc: is struct_declarations.long_array editable +gdbtk_test c_variable-4.106 {is struct_declarations.long_array editable} { + $var(struct_declarations.long_array) editable +} {0} + +# Test: c_variable-4.107 +# Desc: is struct_declarations.long_array[0] editable +gdbtk_test c_variable-4.107 {is struct_declarations.long_array[0] editable} { + $var(struct_declarations.long_array.0) editable +} {1} + +# Test: c_variable-4.108 +# Desc: is struct_declarations editable +gdbtk_test c_variable-4.108 {is struct_declarations editable} { + $var(struct_declarations) editable +} {0} + +delete_variable weird + +##### ##### +# # +# children and update tests # +# # +##### ##### + +# Test: c_variable-5.1 +# Desc: check that nothing changed +gdbtk_test c_variable-5.1 {check that nothing changed} { + check_update +} {{} {struct_declarations.s2.i.3 struct_declarations.func_ptr_ptr struct_declarations.s2.i.4 struct_declarations.s2.i.5 struct_declarations.s2.i.6 struct_declarations.func_ptr struct_declarations.s2.i.7 struct_declarations.s2.i.8 struct_declarations.s2.i.9 struct_declarations.s2.u2.u1s1.d struct_declarations.func_ptr_struct struct_declarations.s2.u2.u1s1.e struct_declarations.u1 struct_declarations.long_int struct_declarations.s2.u2.u1s2.func struct_declarations.integer struct_declarations.s2.u2 struct_declarations.s2.u2.u1s1.e.0 struct_declarations.s2.u2.u1s1.e.1 struct_declarations.long_array.0 struct_declarations.s2.u2.u1s1.e.2 struct_declarations.long_array.1 struct_declarations.u1.a struct_declarations.s2.u2.u1s1.e.3 struct_declarations.long_array.2 struct_declarations.u1.b struct_declarations.s2.u2.u1s1.e.4 struct_declarations.long_array.3 struct_declarations.u1.c struct_declarations.s2.u2.u1s1.e.5 struct_declarations.long_array.4 struct_declarations.u1.d struct_declarations.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr struct_declarations.s2.u2.u1s1.e.6 struct_declarations.long_array.5 struct_declarations.s2.u2.u1s1.e.7 struct_declarations.long_array.6 struct_declarations.s2.u2.u1s1.e.8 struct_declarations.long_array.7 struct_declarations.s2.u2.u1s1.e.9 struct_declarations.long_array.8 struct_declarations.character struct_declarations.long_array.9 struct_declarations.int_ptr_ptr.*int_ptr_ptr struct_declarations.s2.u2.u1s1.func struct_declarations.s2.u2.u1s2.array_ptr struct_declarations.s2.u2.f struct_declarations.s2.u2.u1s1.foo struct_declarations struct_declarations.s2.u2.u1s1 struct_declarations.s2.u2.u1s2.array_ptr.0 struct_declarations.char_ptr struct_declarations.s2.u2.u1s2 struct_declarations.s2.u2.u1s2.array_ptr.1 struct_declarations.int_ptr_ptr struct_declarations.s2 struct_declarations.long_array struct_declarations.s2.g struct_declarations.s2.i.0 struct_declarations.s2.h struct_declarations.s2.i.1 struct_declarations.s2.i struct_declarations.s2.i.2} {}} + +# Step over "struct_declarations.integer = 123;" +gdb_cmd "step" + +# Test: c_variable-5.2 +# Desc: check that integer changed +gdbtk_test c_variable-5.2 {check that integer changed} { + check_update +} {struct_declarations.integer {struct_declarations.s2.i.3 struct_declarations.func_ptr_ptr struct_declarations.s2.i.4 struct_declarations.s2.i.5 struct_declarations.s2.i.6 struct_declarations.func_ptr struct_declarations.s2.i.7 struct_declarations.s2.i.8 struct_declarations.s2.i.9 struct_declarations.s2.u2.u1s1.d struct_declarations.func_ptr_struct struct_declarations.s2.u2.u1s1.e struct_declarations.u1 struct_declarations.long_int struct_declarations.s2.u2.u1s2.func struct_declarations.s2.u2 struct_declarations.s2.u2.u1s1.e.0 struct_declarations.s2.u2.u1s1.e.1 struct_declarations.long_array.0 struct_declarations.s2.u2.u1s1.e.2 struct_declarations.long_array.1 struct_declarations.u1.a struct_declarations.s2.u2.u1s1.e.3 struct_declarations.long_array.2 struct_declarations.u1.b struct_declarations.s2.u2.u1s1.e.4 struct_declarations.long_array.3 struct_declarations.u1.c struct_declarations.s2.u2.u1s1.e.5 struct_declarations.long_array.4 struct_declarations.u1.d struct_declarations.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr struct_declarations.s2.u2.u1s1.e.6 struct_declarations.long_array.5 struct_declarations.s2.u2.u1s1.e.7 struct_declarations.long_array.6 struct_declarations.s2.u2.u1s1.e.8 struct_declarations.long_array.7 struct_declarations.s2.u2.u1s1.e.9 struct_declarations.long_array.8 struct_declarations.character struct_declarations.long_array.9 struct_declarations.int_ptr_ptr.*int_ptr_ptr struct_declarations.s2.u2.u1s1.func struct_declarations.s2.u2.u1s2.array_ptr struct_declarations.s2.u2.f struct_declarations.s2.u2.u1s1.foo struct_declarations struct_declarations.s2.u2.u1s1 struct_declarations.s2.u2.u1s2.array_ptr.0 struct_declarations.char_ptr struct_declarations.s2.u2.u1s2 struct_declarations.s2.u2.u1s2.array_ptr.1 struct_declarations.int_ptr_ptr struct_declarations.s2 struct_declarations.long_array struct_declarations.s2.g struct_declarations.s2.i.0 struct_declarations.s2.h struct_declarations.s2.i.1 struct_declarations.s2.i struct_declarations.s2.i.2} {}} + +# Step over: +# weird->char_ptr = "hello"; +# bar = 2121; +# foo = &bar; +for {set i 0} {$i < 3} {incr i} { + gdb_cmd "step" +} + +# Test: c_variable-5.3 +# Desc: check that char_ptr changed +gdbtk_test c_variable-5.3 {check that char_ptr changed} { + check_update +} {struct_declarations.char_ptr {struct_declarations.s2.i.3 struct_declarations.func_ptr_ptr struct_declarations.s2.i.4 struct_declarations.s2.i.5 struct_declarations.s2.i.6 struct_declarations.func_ptr struct_declarations.s2.i.7 struct_declarations.s2.i.8 struct_declarations.s2.i.9 struct_declarations.s2.u2.u1s1.d struct_declarations.func_ptr_struct struct_declarations.s2.u2.u1s1.e struct_declarations.u1 struct_declarations.long_int struct_declarations.s2.u2.u1s2.func struct_declarations.integer struct_declarations.s2.u2 struct_declarations.s2.u2.u1s1.e.0 struct_declarations.s2.u2.u1s1.e.1 struct_declarations.long_array.0 struct_declarations.s2.u2.u1s1.e.2 struct_declarations.long_array.1 struct_declarations.u1.a struct_declarations.s2.u2.u1s1.e.3 struct_declarations.long_array.2 struct_declarations.u1.b struct_declarations.s2.u2.u1s1.e.4 struct_declarations.long_array.3 struct_declarations.u1.c struct_declarations.s2.u2.u1s1.e.5 struct_declarations.long_array.4 struct_declarations.u1.d struct_declarations.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr struct_declarations.s2.u2.u1s1.e.6 struct_declarations.long_array.5 struct_declarations.s2.u2.u1s1.e.7 struct_declarations.long_array.6 struct_declarations.s2.u2.u1s1.e.8 struct_declarations.long_array.7 struct_declarations.s2.u2.u1s1.e.9 struct_declarations.long_array.8 struct_declarations.character struct_declarations.long_array.9 struct_declarations.int_ptr_ptr.*int_ptr_ptr struct_declarations.s2.u2.u1s1.func struct_declarations.s2.u2.u1s2.array_ptr struct_declarations.s2.u2.f struct_declarations.s2.u2.u1s1.foo struct_declarations struct_declarations.s2.u2.u1s1 struct_declarations.s2.u2.u1s2.array_ptr.0 struct_declarations.s2.u2.u1s2 struct_declarations.s2.u2.u1s2.array_ptr.1 struct_declarations.int_ptr_ptr struct_declarations.s2 struct_declarations.long_array struct_declarations.s2.g struct_declarations.s2.i.0 struct_declarations.s2.h struct_declarations.s2.i.1 struct_declarations.s2.i struct_declarations.s2.i.2} {}} + +# Step over "struct_declarations.int_ptr_ptr = &foo;" +gdb_cmd "step" + +# Test: c_variable-5.4 +# Desc: check that int_ptr_ptr and children changed +gdbtk_test c_variable-5.4 {check that int_ptr_ptr and children changed} { + check_update +} {{struct_declarations.int_ptr_ptr struct_declarations.int_ptr_ptr.*int_ptr_ptr struct_declarations.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr} {struct_declarations.s2.i.3 struct_declarations.func_ptr_ptr struct_declarations.s2.i.4 struct_declarations.s2.i.5 struct_declarations.s2.i.6 struct_declarations.func_ptr struct_declarations.s2.i.7 struct_declarations.s2.i.8 struct_declarations.s2.i.9 struct_declarations.s2.u2.u1s1.d struct_declarations.func_ptr_struct struct_declarations.s2.u2.u1s1.e struct_declarations.u1 struct_declarations.long_int struct_declarations.s2.u2.u1s2.func struct_declarations.integer struct_declarations.s2.u2 struct_declarations.s2.u2.u1s1.e.0 struct_declarations.s2.u2.u1s1.e.1 struct_declarations.long_array.0 struct_declarations.s2.u2.u1s1.e.2 struct_declarations.long_array.1 struct_declarations.u1.a struct_declarations.s2.u2.u1s1.e.3 struct_declarations.long_array.2 struct_declarations.u1.b struct_declarations.s2.u2.u1s1.e.4 struct_declarations.long_array.3 struct_declarations.u1.c struct_declarations.s2.u2.u1s1.e.5 struct_declarations.long_array.4 struct_declarations.u1.d struct_declarations.s2.u2.u1s1.e.6 struct_declarations.long_array.5 struct_declarations.s2.u2.u1s1.e.7 struct_declarations.long_array.6 struct_declarations.s2.u2.u1s1.e.8 struct_declarations.long_array.7 struct_declarations.s2.u2.u1s1.e.9 struct_declarations.long_array.8 struct_declarations.character struct_declarations.long_array.9 struct_declarations.s2.u2.u1s1.func struct_declarations.s2.u2.u1s2.array_ptr struct_declarations.s2.u2.f struct_declarations.s2.u2.u1s1.foo struct_declarations struct_declarations.s2.u2.u1s1 struct_declarations.s2.u2.u1s2.array_ptr.0 struct_declarations.char_ptr struct_declarations.s2.u2.u1s2 struct_declarations.s2.u2.u1s2.array_ptr.1 struct_declarations.s2 struct_declarations.long_array struct_declarations.s2.g struct_declarations.s2.i.0 struct_declarations.s2.h struct_declarations.s2.i.1 struct_declarations.s2.i struct_declarations.s2.i.2} {}} + +# Step over "weird->long_array[0] = 1234;" +gdb_cmd "step" + +# Test: c_variable-5.5 +# Desc: check that long_array[0] changed +gdbtk_test c_variable-5.5 {check that long_array[0] changed} { + check_update +} {struct_declarations.long_array.0 {struct_declarations.s2.i.3 struct_declarations.func_ptr_ptr struct_declarations.s2.i.4 struct_declarations.s2.i.5 struct_declarations.s2.i.6 struct_declarations.func_ptr struct_declarations.s2.i.7 struct_declarations.s2.i.8 struct_declarations.s2.i.9 struct_declarations.s2.u2.u1s1.d struct_declarations.func_ptr_struct struct_declarations.s2.u2.u1s1.e struct_declarations.u1 struct_declarations.long_int struct_declarations.s2.u2.u1s2.func struct_declarations.integer struct_declarations.s2.u2 struct_declarations.s2.u2.u1s1.e.0 struct_declarations.s2.u2.u1s1.e.1 struct_declarations.s2.u2.u1s1.e.2 struct_declarations.long_array.1 struct_declarations.u1.a struct_declarations.s2.u2.u1s1.e.3 struct_declarations.long_array.2 struct_declarations.u1.b struct_declarations.s2.u2.u1s1.e.4 struct_declarations.long_array.3 struct_declarations.u1.c struct_declarations.s2.u2.u1s1.e.5 struct_declarations.long_array.4 struct_declarations.u1.d struct_declarations.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr struct_declarations.s2.u2.u1s1.e.6 struct_declarations.long_array.5 struct_declarations.s2.u2.u1s1.e.7 struct_declarations.long_array.6 struct_declarations.s2.u2.u1s1.e.8 struct_declarations.long_array.7 struct_declarations.s2.u2.u1s1.e.9 struct_declarations.long_array.8 struct_declarations.character struct_declarations.long_array.9 struct_declarations.int_ptr_ptr.*int_ptr_ptr struct_declarations.s2.u2.u1s1.func struct_declarations.s2.u2.u1s2.array_ptr struct_declarations.s2.u2.f struct_declarations.s2.u2.u1s1.foo struct_declarations struct_declarations.s2.u2.u1s1 struct_declarations.s2.u2.u1s2.array_ptr.0 struct_declarations.char_ptr struct_declarations.s2.u2.u1s2 struct_declarations.s2.u2.u1s2.array_ptr.1 struct_declarations.int_ptr_ptr struct_declarations.s2 struct_declarations.long_array struct_declarations.s2.g struct_declarations.s2.i.0 struct_declarations.s2.h struct_declarations.s2.i.1 struct_declarations.s2.i struct_declarations.s2.i.2} {}} + +# Step over "struct_declarations.long_array[1] = 2345;" +gdb_cmd "step" + +# Test: c_variable-5.6 +# Desc: check that long_array[1] changed +gdbtk_test c_variable-5.6 {check that long_array[1] changed} { + check_update +} {struct_declarations.long_array.1 {struct_declarations.s2.i.3 struct_declarations.func_ptr_ptr struct_declarations.s2.i.4 struct_declarations.s2.i.5 struct_declarations.s2.i.6 struct_declarations.func_ptr struct_declarations.s2.i.7 struct_declarations.s2.i.8 struct_declarations.s2.i.9 struct_declarations.s2.u2.u1s1.d struct_declarations.func_ptr_struct struct_declarations.s2.u2.u1s1.e struct_declarations.u1 struct_declarations.long_int struct_declarations.s2.u2.u1s2.func struct_declarations.integer struct_declarations.s2.u2 struct_declarations.s2.u2.u1s1.e.0 struct_declarations.s2.u2.u1s1.e.1 struct_declarations.long_array.0 struct_declarations.s2.u2.u1s1.e.2 struct_declarations.u1.a struct_declarations.s2.u2.u1s1.e.3 struct_declarations.long_array.2 struct_declarations.u1.b struct_declarations.s2.u2.u1s1.e.4 struct_declarations.long_array.3 struct_declarations.u1.c struct_declarations.s2.u2.u1s1.e.5 struct_declarations.long_array.4 struct_declarations.u1.d struct_declarations.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr struct_declarations.s2.u2.u1s1.e.6 struct_declarations.long_array.5 struct_declarations.s2.u2.u1s1.e.7 struct_declarations.long_array.6 struct_declarations.s2.u2.u1s1.e.8 struct_declarations.long_array.7 struct_declarations.s2.u2.u1s1.e.9 struct_declarations.long_array.8 struct_declarations.character struct_declarations.long_array.9 struct_declarations.int_ptr_ptr.*int_ptr_ptr struct_declarations.s2.u2.u1s1.func struct_declarations.s2.u2.u1s2.array_ptr struct_declarations.s2.u2.f struct_declarations.s2.u2.u1s1.foo struct_declarations struct_declarations.s2.u2.u1s1 struct_declarations.s2.u2.u1s2.array_ptr.0 struct_declarations.char_ptr struct_declarations.s2.u2.u1s2 struct_declarations.s2.u2.u1s2.array_ptr.1 struct_declarations.int_ptr_ptr struct_declarations.s2 struct_declarations.long_array struct_declarations.s2.g struct_declarations.s2.i.0 struct_declarations.s2.h struct_declarations.s2.i.1 struct_declarations.s2.i struct_declarations.s2.i.2} {}} + +# Step over "weird->long_array[2] = 3456;" +gdb_cmd "step" + +# Test: c_variable-5.7 +# Desc: check that long_array[2] changed +gdbtk_test c_variable-5.7 {check that long_array[2] changed} { + check_update +} {struct_declarations.long_array.2 {struct_declarations.s2.i.3 struct_declarations.func_ptr_ptr struct_declarations.s2.i.4 struct_declarations.s2.i.5 struct_declarations.s2.i.6 struct_declarations.func_ptr struct_declarations.s2.i.7 struct_declarations.s2.i.8 struct_declarations.s2.i.9 struct_declarations.s2.u2.u1s1.d struct_declarations.func_ptr_struct struct_declarations.s2.u2.u1s1.e struct_declarations.u1 struct_declarations.long_int struct_declarations.s2.u2.u1s2.func struct_declarations.integer struct_declarations.s2.u2 struct_declarations.s2.u2.u1s1.e.0 struct_declarations.s2.u2.u1s1.e.1 struct_declarations.long_array.0 struct_declarations.s2.u2.u1s1.e.2 struct_declarations.long_array.1 struct_declarations.u1.a struct_declarations.s2.u2.u1s1.e.3 struct_declarations.u1.b struct_declarations.s2.u2.u1s1.e.4 struct_declarations.long_array.3 struct_declarations.u1.c struct_declarations.s2.u2.u1s1.e.5 struct_declarations.long_array.4 struct_declarations.u1.d struct_declarations.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr struct_declarations.s2.u2.u1s1.e.6 struct_declarations.long_array.5 struct_declarations.s2.u2.u1s1.e.7 struct_declarations.long_array.6 struct_declarations.s2.u2.u1s1.e.8 struct_declarations.long_array.7 struct_declarations.s2.u2.u1s1.e.9 struct_declarations.long_array.8 struct_declarations.character struct_declarations.long_array.9 struct_declarations.int_ptr_ptr.*int_ptr_ptr struct_declarations.s2.u2.u1s1.func struct_declarations.s2.u2.u1s2.array_ptr struct_declarations.s2.u2.f struct_declarations.s2.u2.u1s1.foo struct_declarations struct_declarations.s2.u2.u1s1 struct_declarations.s2.u2.u1s2.array_ptr.0 struct_declarations.char_ptr struct_declarations.s2.u2.u1s2 struct_declarations.s2.u2.u1s2.array_ptr.1 struct_declarations.int_ptr_ptr struct_declarations.s2 struct_declarations.long_array struct_declarations.s2.g struct_declarations.s2.i.0 struct_declarations.s2.h struct_declarations.s2.i.1 struct_declarations.s2.i struct_declarations.s2.i.2} {}} + +# Step over: +# struct_declarations.long_array[3] = 4567; +# weird->long_array[4] = 5678; +# struct_declarations.long_array[5] = 6789; +# weird->long_array[6] = 7890; +# struct_declarations.long_array[7] = 8901; +# weird->long_array[8] = 9012; +# struct_declarations.long_array[9] = 1234; +for {set i 0} {$i < 7} {incr i} { + gdb_cmd "step" +} + +# Test: c_variable-5.8 +# Desc: check that long_array[3-9] changed +gdbtk_test c_variable-5.8 {check that long_array[3-9] changed} { + check_update +} {{struct_declarations.long_array.3 struct_declarations.long_array.4 struct_declarations.long_array.5 struct_declarations.long_array.6 struct_declarations.long_array.7 struct_declarations.long_array.8 struct_declarations.long_array.9} {struct_declarations.s2.i.3 struct_declarations.func_ptr_ptr struct_declarations.s2.i.4 struct_declarations.s2.i.5 struct_declarations.s2.i.6 struct_declarations.func_ptr struct_declarations.s2.i.7 struct_declarations.s2.i.8 struct_declarations.s2.i.9 struct_declarations.s2.u2.u1s1.d struct_declarations.func_ptr_struct struct_declarations.s2.u2.u1s1.e struct_declarations.u1 struct_declarations.long_int struct_declarations.s2.u2.u1s2.func struct_declarations.integer struct_declarations.s2.u2 struct_declarations.s2.u2.u1s1.e.0 struct_declarations.s2.u2.u1s1.e.1 struct_declarations.long_array.0 struct_declarations.s2.u2.u1s1.e.2 struct_declarations.long_array.1 struct_declarations.u1.a struct_declarations.s2.u2.u1s1.e.3 struct_declarations.long_array.2 struct_declarations.u1.b struct_declarations.s2.u2.u1s1.e.4 struct_declarations.u1.c struct_declarations.s2.u2.u1s1.e.5 struct_declarations.u1.d struct_declarations.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr struct_declarations.s2.u2.u1s1.e.6 struct_declarations.s2.u2.u1s1.e.7 struct_declarations.s2.u2.u1s1.e.8 struct_declarations.s2.u2.u1s1.e.9 struct_declarations.character struct_declarations.int_ptr_ptr.*int_ptr_ptr struct_declarations.s2.u2.u1s1.func struct_declarations.s2.u2.u1s2.array_ptr struct_declarations.s2.u2.f struct_declarations.s2.u2.u1s1.foo struct_declarations struct_declarations.s2.u2.u1s1 struct_declarations.s2.u2.u1s2.array_ptr.0 struct_declarations.char_ptr struct_declarations.s2.u2.u1s2 struct_declarations.s2.u2.u1s2.array_ptr.1 struct_declarations.int_ptr_ptr struct_declarations.s2 struct_declarations.long_array struct_declarations.s2.g struct_declarations.s2.i.0 struct_declarations.s2.h struct_declarations.s2.i.1 struct_declarations.s2.i struct_declarations.s2.i.2} {}} + +# Step over "weird->func_ptr = nothing;" +gdb_cmd "step" + +# Test: c_variable-5.9 +# Desc: check that func_ptr changed +gdbtk_test c_variable-5.9 {check that func_ptr changed} { + check_update +} {struct_declarations.func_ptr {struct_declarations.s2.i.3 struct_declarations.func_ptr_ptr struct_declarations.s2.i.4 struct_declarations.s2.i.5 struct_declarations.s2.i.6 struct_declarations.s2.i.7 struct_declarations.s2.i.8 struct_declarations.s2.i.9 struct_declarations.s2.u2.u1s1.d struct_declarations.func_ptr_struct struct_declarations.s2.u2.u1s1.e struct_declarations.u1 struct_declarations.long_int struct_declarations.s2.u2.u1s2.func struct_declarations.integer struct_declarations.s2.u2 struct_declarations.s2.u2.u1s1.e.0 struct_declarations.s2.u2.u1s1.e.1 struct_declarations.long_array.0 struct_declarations.s2.u2.u1s1.e.2 struct_declarations.long_array.1 struct_declarations.u1.a struct_declarations.s2.u2.u1s1.e.3 struct_declarations.long_array.2 struct_declarations.u1.b struct_declarations.s2.u2.u1s1.e.4 struct_declarations.long_array.3 struct_declarations.u1.c struct_declarations.s2.u2.u1s1.e.5 struct_declarations.long_array.4 struct_declarations.u1.d struct_declarations.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr struct_declarations.s2.u2.u1s1.e.6 struct_declarations.long_array.5 struct_declarations.s2.u2.u1s1.e.7 struct_declarations.long_array.6 struct_declarations.s2.u2.u1s1.e.8 struct_declarations.long_array.7 struct_declarations.s2.u2.u1s1.e.9 struct_declarations.long_array.8 struct_declarations.character struct_declarations.long_array.9 struct_declarations.int_ptr_ptr.*int_ptr_ptr struct_declarations.s2.u2.u1s1.func struct_declarations.s2.u2.u1s2.array_ptr struct_declarations.s2.u2.f struct_declarations.s2.u2.u1s1.foo struct_declarations struct_declarations.s2.u2.u1s1 struct_declarations.s2.u2.u1s2.array_ptr.0 struct_declarations.char_ptr struct_declarations.s2.u2.u1s2 struct_declarations.s2.u2.u1s2.array_ptr.1 struct_declarations.int_ptr_ptr struct_declarations.s2 struct_declarations.long_array struct_declarations.s2.g struct_declarations.s2.i.0 struct_declarations.s2.h struct_declarations.s2.i.1 struct_declarations.s2.i struct_declarations.s2.i.2} {}} + +# Delete all variables +delete_all_variables + +# Step over all lines: +# ... +# psnp = &snp0; +for {set i 0} {$i < 43} {incr i} { + gdb_cmd "step" +} + +# Test: c_variable-5.10 +# Desc: create psnp->char_ptr +gdbtk_test c_variable-5.10 {create psnp->char_ptr} { + create_variable psnp->char_ptr +} {0} + +# Test: c_variable-5.11 +# Desc: children of psnp->char_ptr +gdbtk_test c_variable-5.11 {children of psnp->char_ptr} { + get_children psnp->char_ptr +} {*psnp->char_ptr} + +# Test: c_variable-5.12 +# Desc: number of children of psnp->char_ptr +gdbtk_test c_variable-5.12 {number of children of psnp->char_ptr} { + $var(psnp->char_ptr) numChildren +} {1} + +# Test: c_variable-5.13 +# Desc: children of *(psnp->char_ptr) +gdbtk_test c_variable-5.13 {children of *(psnp->char_ptr)} { + get_children psnp->char_ptr.*psnp->char_ptr +} {**psnp->char_ptr} + +# Test: c_variable-5.14 +# Desc: number of children of *(psnp->char_ptr) +gdbtk_test c_variable-5.14 {number of children of *(psnp->char_ptr)} { + $var(psnp->char_ptr.*psnp->char_ptr) numChildren +} {1} + +# Test: c_variable-5.15 +# Desc: children of *(*(psnp->char_ptr)) +gdbtk_test c_variable-5.15 {children of *(*(psnp->char_ptr))} { + get_children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr +} {***psnp->char_ptr} + +# Test: c_variable-5.16 +# Desc: number of children of *(*(psnp->char_ptr)) +gdbtk_test c_variable-5.16 {number of children of *(*(psnp->char_ptr))} { + $var(psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr) numChildren +} {1} + +# Test: c_variable-5.17 +# Desc: children of *(*(*(psnp->char_ptr))) +gdbtk_test c_variable-5.17 {children of *(*(*(psnp->char_ptr)))} { + get_children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr +} {} + +# Test: c_variable-5.18 +# Desc: number of children of *(*(*(psnp->char_ptr))) +gdbtk_test c_variable-5.18 {number of children of *(*(*(psnp->char_ptr)))} { + $var(psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr) numChildren +} {0} + +# Test: c_variable-5.19 +# Desc: create psnp->long_ptr +gdbtk_test c_variable-5.19 {create psnp->long_ptr} { + create_variable psnp->long_ptr +} {0} + +# Test: c_variable-5.20 +# Desc: children of psnp->long_ptr +gdbtk_test c_variable-5.20 {children of psnp->long_ptr} { + get_children psnp->long_ptr +} {*psnp->long_ptr} + +# Test: c_variable-5.21 +# Desc: number of children of psnp->long_ptr +gdbtk_test c_variable-5.21 {number of children of psnp->long_ptr} { + $var(psnp->long_ptr) numChildren +} {1} + +# Test: c_variable-5.22 +# Desc: children of *(psnp->long_ptr) +gdbtk_test c_variable-5.22 {children of *(psnp->long_ptr)} { + get_children psnp->long_ptr.*psnp->long_ptr +} {**psnp->long_ptr} + +# Test: c_variable-5.23 +# Desc: number of children of *(psnp->long_ptr) +gdbtk_test c_variable-5.23 {number of children of *(psnp->long_ptr)} { + $var(psnp->long_ptr.*psnp->long_ptr) numChildren +} {1} + +# Test: c_variable-5.24 +# Desc: children of *(*(psnp->long_ptr)) +gdbtk_test c_variable-5.24 {children of *(*(psnp->long_ptr))} { + get_children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr +} {***psnp->long_ptr} + +# Test: c_variable-5.25 +# Desc: number of children of *(*(psnp->long_ptr)) +gdbtk_test c_variable-5.25 {number of children of *(*(psnp->long_ptr))} { + $var(psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr) numChildren +} {1} + +# Test: c_variable-5.26 +# Desc: children of *(*(*(psnp->long_ptr))) +gdbtk_test c_variable-5.26 {children of *(*(*(psnp->long_ptr)))} { + get_children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr +} {****psnp->long_ptr} + +# Test: c_variable-5.27 +# Desc: number of children of *(*(*(psnp->long_ptr))) +gdbtk_test c_variable-5.27 {number of children of *(*(*(psnp->long_ptr)))} { + $var(psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr) numChildren +} {1} + +# Test: c_variable-5.28 +# Desc: children of *(*(*(*(psnp->long_ptr)))) +gdbtk_test c_variable-5.29 {children of *(*(*(*(psnp->long_ptr))))} { + get_children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr +} {} + +# Test: c_variable-5.29 +# Desc: number of children of *(*(*(*(psnp->long_ptr)))) +gdbtk_test c_variable-5.29 {number of children of *(*(*(*(psnp->long_ptr))))} { + $var(psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr) numChildren +} {0} + +# Test: c_variable-5.30 +# Desc: create psnp->ptrs +gdbtk_test c_variable-5.30 {create psnp->ptrs} { + create_variable psnp->ptrs +} {0} + +# Test: c_variable-5.31 +# Desc: children of psnp->ptrs +gdbtk_test c_variable-5.31 {children of psnp->ptrs} { + get_children psnp->ptrs +} {0 1 2} + +# Test: c_variable-5.32 +# Desc: number of children of psnp->ptrs +gdbtk_test c_variable-5.32 {number of children of psnp->ptrs} { + $var(psnp->ptrs) numChildren +} {3} + +# Test: c_variable-5.33 +# Desc: children of psnp->ptrs[0] +gdbtk_test c_variable-5.33 {children of psnp->ptrs[0]} { + get_children psnp->ptrs.0 +} {char_ptr long_ptr ptrs next} + +# Test: c_variable-5.34 +# Desc: number of children of psnp->ptrs[0] +gdbtk_test c_variable-5.34 {number of children of psnp->ptrs[0]} { + $var(psnp->ptrs.0) numChildren +} {4} + +# Test: c_variable-5.35 +# Desc: children of psnp->ptrs[0]->next +gdbtk_test c_variable-5.35 {children of psnp->ptrs.0.next} { + get_children psnp->ptrs.0.next +} {char_ptr long_ptr ptrs next} + +# Test: c_variable-5.36 +# Desc: number of children of psnp->ptrs[0]->next +gdbtk_test c_variable-5.36 {number of children of psnp->ptrs[0]->next} { + $var(psnp->ptrs.0.next) numChildren +} {4} + +# Test: c_variable-5.37 +# Desc: children of psnp->ptrs[0]->next->char_ptr +gdbtk_test c_variable-5.37 {children of psnp->ptrs[0]->next->char_ptr} { + get_children psnp->ptrs.0.next.char_ptr +} {*char_ptr} + +# Test: c_variable-5.38 +# Desc: number of children of psnp->ptrs[0]->next->char_ptr +gdbtk_test c_variable-5.38 {number of children of psnp->ptrs[0]->next->char_ptr} { + $var(psnp->ptrs.0.next.char_ptr) numChildren +} {1} + +# Test: c_variable-5.39 +# Desc: children of *psnp->ptrs[0]->next->char_ptr +gdbtk_test c_variable-5.39 {children of *psnp->ptrs[0]->next->char_ptr} { + get_children psnp->ptrs.0.next.char_ptr.*char_ptr +} {**char_ptr} + +# Test: c_variable-5.40 +# Desc: number of children of *psnp->ptrs[0]->next->char_ptr +gdbtk_test c_variable-5.40 {number of children of *psnp->ptrs[0]->next->char_ptr} { + $var(psnp->ptrs.0.next.char_ptr.*char_ptr) numChildren +} {1} + +# Test: c_variable-5.41 +# Desc: children of **psnp->ptrs[0]->next->char_ptr +gdbtk_test c_variable-5.41 {children of **psnp->ptrs[0]->next->char_ptr} { + get_children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr +} {***char_ptr} + +# Test: c_variable-5.42 +# Desc: number of children of **psnp->ptrs[0]->next->char_ptr +gdbtk_test c_variable-5.42 {number of children of **psnp->ptrs[0]->next->char_ptr} { + $var(psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr) numChildren +} {1} + +# Test: c_variable-5.43 +# Desc: children of ***psnp->ptrs[0]->next->char_ptr +gdbtk_test c_variable-5.43 {children of ***psnp->ptrs[0]->next->char_ptr} { + get_children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr +} {} + +# Test: c_variable-5.44 +# Desc: number of children of ***psnp->ptrs[0]->next->char_ptr +gdbtk_test c_variable-5.44 {number of children of ***psnp->ptrs[0]->next->char_ptr} { + $var(psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr) numChildren +} {0} + +# Test: c_variable-5.45 +# Desc: children of psnp->ptrs[0]->next->next +gdbtk_test c_variable-5.45 {children of psnp->ptrs[0]->next->next} { + get_children psnp->ptrs.0.next.next +} {char_ptr long_ptr ptrs next} + +# Test: c_variable-5.46 +# Desc: children of psnp->ptrs[0]->next->next->ptrs +gdbtk_test c_variable-5.46 {children of psnp->ptrs[0]->next->next->ptrs} { + get_children psnp->ptrs.0.next.next.ptrs +} {0 1 2} + +# Step over "snp0.char_ptr = &b3;" +gdb_cmd "step" + +# Test: c_variable-5.47 +# Desc: check that psnp->char_ptr (and [0].char_ptr) changed +gdbtk_test c_variable-5.47 {check that psnp->char_ptr (and [0].char_ptr) changed} { + check_update +} {{psnp->ptrs.0.char_ptr psnp->char_ptr psnp->char_ptr.*psnp->char_ptr psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr} {psnp->ptrs.0.next psnp->ptrs.0.next.ptrs psnp->ptrs.0.next.next psnp->ptrs.0.next.next.char_ptr psnp->ptrs.0.next.next.long_ptr psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr psnp->ptrs.0.next.char_ptr psnp->ptrs.0.next.long_ptr psnp->ptrs.0.next.next.ptrs psnp->ptrs.0.next.char_ptr.*char_ptr psnp->ptrs psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr psnp->ptrs.0.next.next.next psnp->ptrs.0.next.next.ptrs.0 psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr psnp->long_ptr.*psnp->long_ptr psnp->ptrs.0.next.next.ptrs.1 psnp->ptrs.0.next.next.ptrs.2 psnp->ptrs.0.long_ptr psnp->long_ptr psnp->ptrs.0.ptrs psnp->ptrs.0 psnp->ptrs.1 psnp->ptrs.2 psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr} {}} + +# Step over "snp1.char_ptr = &c3;" +gdb_cmd "step" + +# Test: c_variable-5.48 +# Desc: check that psnp->next->char_ptr (and [1].char_ptr) changed +gdbtk_test c_variable-5.48 {check that psnp->next->char_ptr (and [1].char_ptr) changed} { + check_update +} {{psnp->ptrs.0.next.char_ptr psnp->ptrs.0.next.char_ptr.*char_ptr psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr} {psnp->ptrs.0.next psnp->ptrs.0.next.ptrs psnp->ptrs.0.next.next psnp->ptrs.0.next.next.char_ptr psnp->ptrs.0.next.next.long_ptr psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr psnp->ptrs.0.next.long_ptr psnp->ptrs.0.next.next.ptrs psnp->ptrs psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr psnp->ptrs.0.next.next.next psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr psnp->char_ptr.*psnp->char_ptr psnp->ptrs.0.next.next.ptrs.0 psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr psnp->long_ptr.*psnp->long_ptr psnp->ptrs.0.next.next.ptrs.1 psnp->ptrs.0.next.next.ptrs.2 psnp->ptrs.0.char_ptr psnp->ptrs.0.long_ptr psnp->char_ptr psnp->long_ptr psnp->ptrs.0.ptrs psnp->ptrs.0 psnp->ptrs.1 psnp->ptrs.2 psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr} {}} + +# Step over "snp2.char_ptr = &a3;" +gdb_cmd "step" + +# Test: c_variable-5.49 +# Desc: check that psnp->next->next->char_ptr (and [2].char_ptr) changed +gdbtk_test c_variable-5.49 {heck that psnp->next->next->char_ptr (and [2].char_ptr) changed} { + check_update +} {psnp->ptrs.0.next.next.char_ptr {psnp->ptrs.0.next psnp->ptrs.0.next.ptrs psnp->ptrs.0.next.next psnp->ptrs.0.next.next.long_ptr psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr psnp->ptrs.0.next.char_ptr psnp->ptrs.0.next.long_ptr psnp->ptrs.0.next.next.ptrs psnp->ptrs.0.next.char_ptr.*char_ptr psnp->ptrs psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr psnp->ptrs.0.next.next.next psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr psnp->char_ptr.*psnp->char_ptr psnp->ptrs.0.next.next.ptrs.0 psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr psnp->long_ptr.*psnp->long_ptr psnp->ptrs.0.next.next.ptrs.1 psnp->ptrs.0.next.next.ptrs.2 psnp->ptrs.0.char_ptr psnp->ptrs.0.long_ptr psnp->char_ptr psnp->long_ptr psnp->ptrs.0.ptrs psnp->ptrs.0 psnp->ptrs.1 psnp->ptrs.2 psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr} {}} + +# Step over "snp0.long_ptr = &y3;" +gdb_cmd "step" + +# Test: c_variable-5.50 +# Desc: check that psnp->long_ptr (and [0].long_ptr) changed +gdbtk_test c_variable-5.50 {check that psnp->long_ptr (and [0].long_ptr) changed} { + check_update +} {{psnp->ptrs.0.long_ptr psnp->long_ptr psnp->long_ptr.*psnp->long_ptr psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr} {psnp->ptrs.0.next psnp->ptrs.0.next.ptrs psnp->ptrs.0.next.next psnp->ptrs.0.next.next.char_ptr psnp->ptrs.0.next.next.long_ptr psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr psnp->ptrs.0.next.char_ptr psnp->ptrs.0.next.long_ptr psnp->ptrs.0.next.next.ptrs psnp->ptrs.0.next.char_ptr.*char_ptr psnp->ptrs psnp->ptrs.0.next.next.next psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr psnp->char_ptr.*psnp->char_ptr psnp->ptrs.0.next.next.ptrs.0 psnp->ptrs.0.next.next.ptrs.1 psnp->ptrs.0.next.next.ptrs.2 psnp->ptrs.0.char_ptr psnp->char_ptr psnp->ptrs.0.ptrs psnp->ptrs.0 psnp->ptrs.1 psnp->ptrs.2} {}} + +# Step over "snp1.long_ptr = &x3;" +gdb_cmd "step" + +# Test: c_variable-5.51 +# Desc: check that psnp->next->long_ptr (and [1].long_ptr) changed +gdbtk_test c_variable-5.51 {check that psnp->next->long_ptr (and [1].long_ptr) changed} { + check_update +} {psnp->ptrs.0.next.long_ptr {psnp->ptrs.0.next psnp->ptrs.0.next.ptrs psnp->ptrs.0.next.next psnp->ptrs.0.next.next.char_ptr psnp->ptrs.0.next.next.long_ptr psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr psnp->ptrs.0.next.char_ptr psnp->ptrs.0.next.next.ptrs psnp->ptrs.0.next.char_ptr.*char_ptr psnp->ptrs psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr psnp->ptrs.0.next.next.next psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr psnp->char_ptr.*psnp->char_ptr psnp->ptrs.0.next.next.ptrs.0 psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr psnp->long_ptr.*psnp->long_ptr psnp->ptrs.0.next.next.ptrs.1 psnp->ptrs.0.next.next.ptrs.2 psnp->ptrs.0.char_ptr psnp->ptrs.0.long_ptr psnp->char_ptr psnp->long_ptr psnp->ptrs.0.ptrs psnp->ptrs.0 psnp->ptrs.1 psnp->ptrs.2 psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr} {}} + +# Step over "snp2.long_ptr = &z3;" +gdb_cmd "step" + +# Test: c_variable-5.52 +# Desc: check that psnp->next->next->long_ptr (and [2].long_ptr) changed +gdbtk_test c_variable-5.52 {check that psnp->next->next->long_ptr (and [2].long_ptr) changed} { + check_update +} {psnp->ptrs.0.next.next.long_ptr {psnp->ptrs.0.next psnp->ptrs.0.next.ptrs psnp->ptrs.0.next.next psnp->ptrs.0.next.next.char_ptr psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr psnp->ptrs.0.next.char_ptr psnp->ptrs.0.next.long_ptr psnp->ptrs.0.next.next.ptrs psnp->ptrs.0.next.char_ptr.*char_ptr psnp->ptrs psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr psnp->ptrs.0.next.next.next psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr psnp->char_ptr.*psnp->char_ptr psnp->ptrs.0.next.next.ptrs.0 psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr psnp->long_ptr.*psnp->long_ptr psnp->ptrs.0.next.next.ptrs.1 psnp->ptrs.0.next.next.ptrs.2 psnp->ptrs.0.char_ptr psnp->ptrs.0.long_ptr psnp->char_ptr psnp->long_ptr psnp->ptrs.0.ptrs psnp->ptrs.0 psnp->ptrs.1 psnp->ptrs.2 psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr} {}} + +# Test: c_variable-5.53 +# Desc: names of editable variables +gdbtk_test c_variable-5.53 {names of editable variables} { + editable_variables +} {{psnp->ptrs.0.next psnp->ptrs.0.next.next psnp->ptrs.0.next.next.char_ptr psnp->ptrs.0.next.next.long_ptr psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr psnp->ptrs.0.next.char_ptr psnp->ptrs.0.next.long_ptr psnp->ptrs.0.next.char_ptr.*char_ptr psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr psnp->ptrs.0.next.next.next psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr psnp->char_ptr.*psnp->char_ptr psnp->ptrs.0.next.next.ptrs.0 psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr psnp->long_ptr.*psnp->long_ptr psnp->ptrs.0.next.next.ptrs.1 psnp->ptrs.0.next.next.ptrs.2 psnp->ptrs.0.char_ptr psnp->ptrs.0.long_ptr psnp->char_ptr psnp->long_ptr psnp->ptrs.0 psnp->ptrs.1 psnp->ptrs.2 psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr} {psnp->ptrs.0.next.ptrs psnp->ptrs.0.next.next.ptrs psnp->ptrs psnp->ptrs.0.ptrs}} + +##### ##### +# # +# Display tests # +# # +##### ##### + +delete_all_variables + +# Test: c_variable-6.1 +# Desc: create variable bar +gdbtk_test c_variable-6.1 {create variable bar} { + create_variable bar +} {0} + +# Test: c_variable-6.2 +# Desc: type of variable bar +gdbtk_test c_variable-6.2 {type of variable bar} { + $var(bar) type +} {int} + +# Test: c_variable-6.3 +# Desc: format of variable bar +gdbtk_test c_variable-6.3 {format of variable bar} { + $var(bar) format +} {natural} + +# Test: c_variable-6.4 +# Desc: value of variable bar +gdbtk_test c_variable-6.4 {value of variable bar} { + value bar d +} {ok} + +# Test: c_variable-6.5 +# Desc: change format of bar to hex +gdbtk_test c_variable-6.5 {change format of bar to hex} { + $var(bar) format hex + $var(bar) format +} {hexadecimal} + +# Test: c_variable-6.6 +# Desc: value of bar with new format +gdbtk_test c_variable-6.6 {value of bar with new format} { + value bar x +} {ok} + +# Test: c_variable-6.7 +# Desc: change value of bar +gdbtk_test c_variable-6.7 {change value of bar} { + $var(bar) value 3 + value bar x +} {ok} + +# Test: c_variable-6.8 +# Desc: check new value of bar +gdbtk_test c_variable-6.8 {change value of bar} { + $var(bar) format decimal + $var(bar) value +} {3} + +delete_variable bar + +# Test: c_variable-6.11 +# Desc: create variable foo +gdbtk_test c_variable-6.11 {create variable foo} { + create_variable foo +} {0} + +# Test: c_variable-6.12 +# Desc: type of variable foo +gdbtk_test c_variable-6.12 {type of variable foo} { + $var(foo) type +} {int *} + +# Test: c_variable-6.13 +# Desc: format of variable foo +gdbtk_test c_variable-6.13 {format of variable foo} { + $var(foo) format +} {natural} + +# Test: c_variable-6.14 +# Desc: value of variable foo +gdbtk_test c_variable-6.14 {value of variable foo} { + value foo x +} {ok} + +# Test: c_variable-6.15 +# Desc: change format of var to octal +gdbtk_test c_variable-6.15 {change format of foo to octal} { + $var(foo) format octal + $var(foo) format +} {octal} + +# Test: c_variable-6.16 +# Desc: value of foo with new format +gdbtk_test c_variable-6.16 {value of foo with new format} { + value foo o +} {ok} + +# Test: c_variable-6.17 +# Desc: change value of foo +gdbtk_test c_variable-6.17 {change value of foo} { + $var(foo) value 3 + value foo o +} {ok} + +# Test: c_variable-6.18 +# Desc: check new value of foo +gdbtk_test c_variable-6.18 {check new value of foo} { + $var(foo) format decimal + $var(foo) value +} {3} + +delete_variable foo + +# Test: c_variable-6.21 +# Desc: create variable weird and children +gdbtk_test c_variable-6.21 {create variable foo} { + if {![create_variable weird]} { + lsort [get_children weird] + } +} {char_ptr character func_ptr func_ptr_ptr func_ptr_struct int_ptr_ptr integer long_array long_int s2 u1} + +# Test: c_variable-6.22 +# Desc: type of weird and children +gdbtk_test c_variable-6.22 {type of weird and children} { + set types {} + foreach v [lsort [array names var]] { + lappend types [$var($v) type] + } + + set types +} {{weird_struct *} {char *} char {void (*)()} {struct _struct_decl *(*)()} {struct _struct_decl (*)()} {int **} int {long int [10]} {long int} struct union} + +# Test: c_variable-6.23 +# Desc: change format of weird.func_ptr and weird.func_ptr_ptr +gdbtk_test c_variable-6.23 {change format of weird.func_ptr and weird.func_ptr_ptr} { + $var(weird.func_ptr) format hexadecimal + $var(weird.func_ptr_ptr) format hexadecimal + set result {} + lappend result [$var(weird.func_ptr) format] + lappend result [$var(weird.func_ptr_ptr) format] + set result +} {hexadecimal hexadecimal} + +# Test: c_variable-6.24 +# Desc: format of weird and children +gdbtk_test c_variable-6.24 {format of weird and children} { + set formats {} + foreach v [lsort [array names var]] { + lappend formats [$var($v) format] + } + + set formats +} {natural natural natural hexadecimal hexadecimal natural natural natural natural natural natural natural} + +# Test: c_variable-6.25 +# Desc: value of weird and children +gdbtk_test c_variable-6.25 {value of weird and children} { + set values {} + foreach v [lsort [array names var]] f [list x "" "" x x x x d d d d d] { + lappend values [value $v $f] + } + + set values +} {ok ok ok ok ok ok ok ok weird.long_array ok weird.s2 weird.u1} + +# Test: c_variable-6.26 +# Desc: change format of weird and children to octal +gdbtk_test c_variable-6.26 {change format of weird and children to octal} { + set formats {} + foreach v [lsort [array names var]] { + $var($v) format octal + lappend formats [$var($v) format] + } + + set formats +} {octal octal octal octal octal octal octal octal octal octal octal octal} + +# Test: c_variable-6.27 +# Desc: value of weird and children with new format +gdbtk_test c_variable-6.27 {value of foo with new format} { + set values {} + foreach v [lsort [array names var]] { + lappend values [value $v o] + } + + set values +} {ok ok ok ok ok ok ok ok weird.long_array ok weird.s2 weird.u1} + +# Test: c_variable-6.30 +# Desc: create more children of weird +gdbtk_test c_variable-6.30 {create more children of weird} { + foreach v [array names var] { + get_children $v + } + + # Do it twice to get more children + foreach v [array names var] { + get_children $v + } + + lsort [array names var] +} {weird weird.char_ptr weird.character weird.func_ptr weird.func_ptr_ptr weird.func_ptr_struct weird.int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr weird.integer weird.long_array weird.long_array.0 weird.long_array.1 weird.long_array.2 weird.long_array.3 weird.long_array.4 weird.long_array.5 weird.long_array.6 weird.long_array.7 weird.long_array.8 weird.long_array.9 weird.long_int weird.s2 weird.s2.g weird.s2.h weird.s2.i weird.s2.i.0 weird.s2.i.1 weird.s2.i.2 weird.s2.i.3 weird.s2.i.4 weird.s2.i.5 weird.s2.i.6 weird.s2.i.7 weird.s2.i.8 weird.s2.i.9 weird.s2.u2 weird.s2.u2.f weird.s2.u2.u1s1 weird.s2.u2.u1s2 weird.u1 weird.u1.a weird.u1.b weird.u1.c weird.u1.d} + +# Test: c_variable-6.31 +# Desc: check that all children of weird change +# Ok, obviously things like weird.s2 and weird.u1 will not change! +gdbtk_test *c_variable-6.31 {check that all children of weird change (ops, we are now reporting array names as changed in this case - seems harmless though)} { + $var(weird) value 0x2121 + check_update +} {{weird.integer weird.character weird.char_ptr weird.long_int weird.int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr weird.long_array.0 weird.long_array.1 weird.long_array.2 weird.long_array.3 weird.long_array.4 weird.long_array.5 weird.long_array.6 weird.long_array.7 weird.long_array.8 weird.long_array.9 weird.func_ptr weird.func_ptr_struct weird.func_ptr_ptr weird.u1.a weird.u1.b weird.u1.c weird.u1.d weird.s2.u2.f weird.s2.g weird.s2.h weird.s2.i.0 weird.s2.i.1 weird.s2.i.2 weird.s2.i.3 weird.s2.i.4 weird.s2.i.5 weird.s2.i.6 weird.s2.i.7 weird.s2.i.8 weird.s2.i.9} {weird.s2.i weird.s2.u2 weird weird.s2.u2.u1s1 weird.s2.u2.u1s2 weird.s2 weird.long_array weird.u1} {}} + +delete_variable weird + +##### ##### +# # +# Special Display Tests # +# # +##### ##### + +# Stop in "do_special_tests" +gdb_cmd "break do_special_tests" +gdb_cmd "continue" + +# Test: c_variable-7.1 +# Desc: stop in do_special_tests +gdbtk_test c_variable-7.1 {stop in do_special_tests} { + lindex [gdb_loc] 1 +} {do_special_tests} + +# Test: c_variable-7.10 +# Desc: create union u +gdbtk_test c_variable-7.10 {create union u} { + create_variable u +} {0} + +# Test: c_variable-7.11 +# Desc: value of u +gdbtk_test c_variable-7.11 {value of u} { + $var(u) value +} {{...}} + +# Test: c_variable-7.12 +# Desc: type of u +gdbtk_test c_variable-7.12 {type of u} { + $var(u) type +} {union named_union} + +# Test: c_variable-7.13 +# Desc: is u editable +gdbtk_test c_variable-7.13 {is u editable} { + $var(u) editable +} {0} + +# Test: c_variable-7.14 +# Desc: number of children of u +gdbtk_test c_variable-7.14 {number of children of u} { + $var(u) numChildren +} {2} + +# Test: c_variable-7.15 +# Desc: children of u +gdbtk_test c_variable-7.15 {children of u} { + get_children u +} {integer char_ptr} + +# Test: c_variable-7.20 +# Desc: create anonu +gdbtk_test c_variable-7.20 {create anonu} { + create_variable anonu +} {0} + +# Test: c_variable-7.21 +# Desc: value of anonu +gdbtk_test c_variable-7.21 {value of anonu} { + $var(anonu) value +} {{...}} + +# Test: c_variable-7.22 +# Desc: type of anonu +gdbtk_test c_variable-7.22 {type of anonu} { + $var(anonu) type +} {union} + +# Test: c_variable-7.23 +# Desc: is anonu editable +gdbtk_test c_variable-7.23 {is anonu editable} { + $var(anonu) editable +} {0} + +# Test: c_variable-7.24 +# Desc: number of children of anonu +gdbtk_test c_variable-7.24 {number of children of anonu} { + $var(anonu) numChildren +} {3} + +# Test: c_variable-7.25 +# Desc: children of anonu +gdbtk_test c_variable-7.25 {children of anonu} { + get_children anonu +} {a b c} + +# Test: c_variable-7.30 +# Desc: create struct s +gdbtk_test c_variable-7.30 {create struct s} { + create_variable s +} {0} + +# Test: c_variable-7.31 +# Desc: value of s +gdbtk_test c_variable-7.31 {value of s} { + $var(s) value +} {{...}} + +# Test: c_variable-7.32 +# Desc: type of s +gdbtk_test c_variable-7.32 {type of s} { + $var(s) type +} {struct _simple_struct} + +# Test: c_variable-7.33 +# Desc: is s editable +gdbtk_test c_variable-7.33 {is s editable} { + $var(s) editable +} {0} + +# Test: c_variable-7.34 +# Desc: number of children of s +gdbtk_test c_variable-7.34 {number of children of s} { + $var(s) numChildren +} {6} + +# Test: c_variable-7.35 +# Desc: children of s +gdbtk_test c_variable-7.35 {children of s} { + get_children s +} {integer unsigned_integer character signed_character char_ptr array_of_10} + +# Test: c_variable-7.40 +# Desc: create anons +gdbtk_test c_variable-7.40 {create anons} { + create_variable anons +} {0} + +# Test: c_variable-7.41 +# Desc: value of anons +gdbtk_test c_variable-7.41 {value of anons} { + $var(anons) value +} {{...}} + +# Test: c_variable-7.42 +# Desc: type of anons +gdbtk_test c_variable-7.42 {type of anons} { + $var(anons) type +} {struct} + +# Test: c_variable-7.43 +# Desc: is anons editable +gdbtk_test c_variable-7.43 {is anons editable} { + $var(anons) editable +} {0} + +# Test: c_variable-7.44 +# Desc: number of children of anons +gdbtk_test c_variable-7.44 {number of children of anons} { + $var(anons) numChildren +} {3} + +# Test: c_variable-7.45 +# Desc: children of anons +gdbtk_test c_variable-7.45 {children of anons} { + get_children anons +} {a b c} + +# Test: c_variable-7.50 +# Desc: create enum e +gdbtk_test c_variable-7.50 {create enum e} { + create_variable e +} {0} + +# Test: c_variable-7.51 +# Desc: value of e +gdbtk_test c_variable-7.51 {value of e} { + $var(e) value bar + $var(e) value +} {bar} + +# Test: c_variable-7.52 +# Desc: type of e +gdbtk_test c_variable-7.52 {type of e} { + $var(e) type +} {enum foo} + +# Test: c_variable-7.53 +# Desc: is e editable +gdbtk_test c_variable-7.53 {is e editable} { + $var(e) editable +} {1} + +# Test: c_variable-7.54 +# Desc: number of children of e +gdbtk_test c_variable-7.54 {number of children of e} { + $var(e) numChildren +} {0} + +# Test: c_variable-7.55 +# Desc: children of e +gdbtk_test c_variable-7.55 {children of e} { + get_children e +} {} + +# Test: c_variable-7.60 +# Desc: create anone +gdbtk_test c_variable-7.60 {create anone} { + create_variable anone +} {0} + +# Test: c_variable-7.61 +# Desc: value of anone +gdbtk_test c_variable-7.61 {value of e} { + $var(e) value bar + $var(e) value +} {bar} + +# Test: c_variable-7.62 +# Desc: type of e +gdbtk_test c_variable-7.62 {type of e} { + $var(e) type +} {enum foo} + +# Test: c_variable-7.63 +# Desc: is e editable +gdbtk_test c_variable-7.63 {is e editable} { + $var(e) editable +} {1} + +# Test: c_variable-7.64 +# Desc: number of children of e +gdbtk_test c_variable-7.64 {number of children of e} { + $var(e) numChildren +} {0} + +# Test: c_variable-7.65 +# Desc: children of e +gdbtk_test c_variable-7.65 {children of e} { + get_children e +} {} + +# Test: c_variable-7.70 +# Desc: create anone +gdbtk_test c_variable-7.70 {try to create anone again (duplicate obj name} { + create_variable anone +} {1} + +# Test: c_variable-7.71 +# Desc: value of anone +gdbtk_test c_variable-7.71 {value of anone} { + $var(anone) value A + $var(anone) value +} {A} + +# Test: c_variable-7.72 +# Desc: type of anone +gdbtk_test c_variable-7.72 {type of anone} { + $var(anone) type +} {enum} + +# Test: c_variable-7.73 +# Desc: is anone editable +gdbtk_test c_variable-7.73 {is anone editable} { + $var(anone) editable +} {1} + +# Test: c_variable-7.74 +# Desc: number of children of anone +gdbtk_test c_variable-7.74 {number of children of anone} { + $var(anone) numChildren +} {0} + +# Test: c_variable-7.75 +# Desc: children of anone +gdbtk_test c_variable-7.75 {children of anone} { + get_children anone +} {} + +# Record fp +set fp [gdb_cmd "output/x \$fp"] +gdb_cmd {break incr_a} +gdb_cmd {continue} + +# Test: c_variable-7.80 +# Desc: stop in incr_a +gdbtk_test c_variable-7.80 {stop in incr_a} { + lindex [gdb_loc] 1 +} {incr_a} + +# Test: c_variable-7.81 +# Desc: Create variables in different scopes +gdbtk_test c_variable-7.81 {create variables in different scopes} { + set a1 [gdb_variable create -expr a] + set a2 [gdb_variable create -expr a -frame $fp] + + set vals {} + lappend vals [$a1 value] + lappend vals [$a2 value] + set vals +} {2 1} + +# Exit +# +gdbtk_test_done diff --git a/gdb/testsuite/gdb.gdbtk/configure b/gdb/testsuite/gdb.gdbtk/configure new file mode 100644 index 00000000000..c65cbd9d2a5 --- /dev/null +++ b/gdb/testsuite/gdb.gdbtk/configure @@ -0,0 +1,900 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.12.2 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +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' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.12.2" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=defs + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +CC=${CC-cc} + +ac_aux_dir= +for ac_dir in `cd $srcdir;pwd`/../../.. $srcdir/`cd $srcdir;pwd`/../../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in `cd $srcdir;pwd`/../../.. $srcdir/`cd $srcdir;pwd`/../../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; +esac + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:575: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +echo $ac_n "checking target system type""... $ac_c" 1>&6 +echo "configure:596: checking target system type" >&5 + +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$target" 1>&6 + +echo $ac_n "checking build system type""... $ac_c" 1>&6 +echo "configure:614: checking build system type" >&5 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set) 2>&1 | grep ac_space` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.12.2" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@CC@%$CC%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@target@%$target%g +s%@target_alias@%$target_alias%g +s%@target_cpu@%$target_cpu%g +s%@target_vendor@%$target_vendor%g +s%@target_os@%$target_os%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"Makefile"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <<EOF + +EOF +cat >> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/gdb/testsuite/gdb.gdbtk/configure.in b/gdb/testsuite/gdb.gdbtk/configure.in new file mode 100644 index 00000000000..4c408e8c828 --- /dev/null +++ b/gdb/testsuite/gdb.gdbtk/configure.in @@ -0,0 +1,14 @@ +dnl Process this file file with autoconf to produce a configure script. +dnl This file is a shell script fragment that supplies the information +dnl necessary to tailor a template configure script into the configure +dnl script appropriate for this directory. For more information, check +dnl any existing configure script. + +AC_PREREQ(2.5) +AC_INIT(defs) + +CC=${CC-cc} +AC_SUBST(CC) +AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/../../..) +AC_CANONICAL_SYSTEM +AC_OUTPUT(Makefile) diff --git a/gdb/testsuite/gdb.gdbtk/console.exp b/gdb/testsuite/gdb.gdbtk/console.exp new file mode 100644 index 00000000000..1d50c661ab6 --- /dev/null +++ b/gdb/testsuite/gdb.gdbtk/console.exp @@ -0,0 +1,34 @@ +# +# Check if we have a display +# +if {![info exists ::env(DISPLAY)]} { + untested "No DISPLAY -- skipping test" +} else { + + if {$tracelevel} { + strace $tracelevel + } + + # + # test console window + # + set prms_id 0 + set bug_id 0 + + set testfile "simple" + set srcfile ${testfile}.c + set binfile ${objdir}/${subdir}/${testfile} + set r [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] + if { $r != "" } { + gdb_suppress_entire_file \ + "Testcase compile failed, so some tests in this file will automatically fail." + } + + # Start with a fresh gdbtk + gdb_exit + set results [gdbtk_start [file join $srcdir $subdir console.test]] + set results [split $results \n] + + # Analyze results + gdbtk_analyze_results $results +} diff --git a/gdb/testsuite/gdb.gdbtk/console.test b/gdb/testsuite/gdb.gdbtk/console.test new file mode 100644 index 00000000000..d24dd6b51eb --- /dev/null +++ b/gdb/testsuite/gdb.gdbtk/console.test @@ -0,0 +1,474 @@ +# Copyright (C) 1998, 1999 Cygnus Solutions +# +# 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. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# This file was written by Keith Seitz (keiths@cygnus.com) + +# Read in the standard defs file + +if {![gdbtk_read_defs]} { + break +} + +global objdir test_ran +global console text +set console [ManagedWin::open Console] +set text [$console get_text] + +##### ##### +# # +# Helper functions for this module # +# # +##### ##### + +# console_command -- +# Invoke STRING as a command in the console window and +# return the result +proc console_command {string} { + global console text + + # Save current position + set line [lindex [split [$text index cmdmark] .] 0] + incr line 1 + + # Insert and invoke command + $text insert end $string + $console invoke + update + + # Get the result + set end [lindex [split [$text index cmdmark] .] 0] + incr end -1 + return [$text get $line.0 [list $end.0 lineend]] +} + +# get_cmd_line -- +# Return the command line +proc get_cmd_line {} { + global text + + update + set index [$text index cmdmark] + return [$text get [list $index linestart] [list $index lineend]] +} + +# clear_command_line -- +# Clear the command line +proc clear_command_line {} { + global text + $text delete {cmdmark + 1 char} insert +} + +##### ##### +# # +# CONSOLE TESTS # +# # +##### ##### + +# +# Miscellaneous tests +# + +# Test: console-misc-1 +# Desc: Change console prompt +gdbtk_test console-misc-1 {change console prompt} { + # Insert the "set prompt" command into the text widget + console_command {set prompt (test) } + + $text get {cmdmark linestart} {cmdmark lineend} +} {(test) } +if {$test_ran} { + console_command {set prompt (gdb) } +} + +# +# Paste tests +# + +# Test: console-paste-1 +# Desc: Paste the X selection into console window +gdbtk_test console-paste-1 {paste X text} { + # This is cheesy, but it works... Create a text widget + # which holds the current selection... + text .test_text + .test_text insert end "this is some pasted text" + .test_text tag add sel 1.0 {1.0 lineend} + + event generate $text <<Paste>> + get_cmd_line +} {(gdb) this is some pasted text} +if {$test_ran} { + destroy .test_text + clear_command_line +} + +# +# Test for errors +# + +# Test: console-error-1 +# Desc: Check if console window reports internal gdb errors +gdbtk_test console-error-1 {invoke unknown command} { + console_command {this_command_doesn't_exist} +} {Error: Undefined command: "this". Try "help". +} + +# +# History tests +# + +# Test: console-history-1.1 +# Desc: Exercise the up-history functionality +gdbtk_test console-history-1.1 {up history once} { + # Add some commands into the command buffer + console_command {show annotate} + console_command {show complaints} + console_command {show confirm} + console_command {show height} + console_command {show language} + console_command {show print demangle} + console_command {show remotebaud} + console_command {show remotebreak} + console_command {show remotecache} + console_command {show remotedebug} + console_command {show remotedevice} + console_command {show remotelogbase} + console_command {help quit} + console_command {help si} + event generate $text <Up> + get_cmd_line +} {(gdb) help si} +if {$test_ran} { + clear_command_line +} + +# Test: console-history-1.2 +# Desc: Exercise the up-history functionality +gdbtk_test console-history-1.2 {up history twice} { + # Add some commands into the command buffer + console_command {show annotate} + console_command {show complaints} + console_command {show confirm} + console_command {show height} + console_command {show language} + console_command {show print demangle} + console_command {show remotebaud} + console_command {show remotebreak} + console_command {show remotecache} + console_command {show remotedebug} + console_command {show remotedevice} + console_command {show remotelogbase} + console_command {help quit} + console_command {help si} + event generate $text <Up> + event generate $text <Up> + get_cmd_line +} {(gdb) help quit} +if {$test_ran} { + clear_command_line +} + +# Test: console-history-1.3 +# Desc: Exercise the up-history functionality +gdbtk_test console-history-1.3 {up history four times} { + # Add some commands into the command buffer + console_command {show annotate} + console_command {show complaints} + console_command {show confirm} + console_command {show height} + console_command {show language} + console_command {show print demangle} + console_command {show remotebaud} + console_command {show remotebreak} + console_command {show remotecache} + console_command {show remotedebug} + console_command {show remotedevice} + console_command {show remotelogbase} + console_command {help quit} + console_command {help si} + + for {set i 0} {$i < 4} {incr i} { + event generate $text <Up> + } + get_cmd_line +} {(gdb) show remotedevice} +if {$test_ran} { + clear_command_line +} + +# Test: console-history-1.4 +# Desc: Exercise the up-history functionality +gdbtk_test console-history-1.4 {up fourteen times} { + # Add some commands into the command buffer + console_command {show annotate} + console_command {show complaints} + console_command {show confirm} + console_command {show height} + console_command {show language} + console_command {show print demangle} + console_command {show remotebaud} + console_command {show remotebreak} + console_command {show remotecache} + console_command {show remotedebug} + console_command {show remotedevice} + console_command {show remotelogbase} + console_command {help quit} + console_command {help si} + for {set i 0} {$i < 14} {incr i} { + event generate $text <Up> + } + get_cmd_line +} {(gdb) show annotate} +if {$test_ran} { + clear_command_line +} + +# Test: console-history-1.5 +# Desc: Exercise the up-history search functionality +gdbtk_test console-history-1.5 {up search} { + # Add some commands into the command buffer + console_command {show height} + console_command {show annotate} + console_command {show complaints} + console_command {print main} + console_command {show remotelogbase} + console_command {help quit} + console_command {help si} + + $text insert end "sh" + event generate $text <Shift-Up> + event generate $text <Shift-Up> + event generate $text <Shift-Up> + get_cmd_line +} {(gdb) show annotate} + + +# Test: console-history-1.6 +# Desc: Exercise the down-history search functionality +gdbtk_test console-history-1.6 {down search} { + event generate $text <Shift-Down> + event generate $text <Shift-Down> + get_cmd_line +} {(gdb) show remotelogbase} + +# Test: console-history-1.7 +# Desc: Down-history search to bottom +# We go back down until the original partialcommand is displayed +gdbtk_test console-history-1.7 {down search to bottom} { + event generate $text <Shift-Down> + event generate $text <Shift-Down> + get_cmd_line +} {(gdb) sh} + +# Test: console-history-1.8 +# Desc: Up-history search to top +# We go up until there are no matches +gdbtk_test console-history-1.8 {up search to top} { + for {set i 0} {$i < 100} {incr i} { + event generate $text <Shift-Up> + } + get_cmd_line +} {(gdb) show annotate} + +if {$test_ran} { + clear_command_line +} + +# Test: console-history-2.1 +# Desc: Exercise the down-history functionality +gdbtk_test console-history-2.1 {down once} { + # Add some commands into the command buffer + console_command {show annotate} + console_command {show complaints} + console_command {show confirm} + console_command {show height} + console_command {show language} + console_command {show print demangle} + console_command {show remotebaud} + console_command {show remotebreak} + console_command {show remotecache} + console_command {show remotedebug} + console_command {show remotedevice} + console_command {show remotelogbase} + console_command {help quit} + console_command {help si} + + for {set i 0} {$i < 14} {incr i} { + event generate $text <Up> + } + event generate $text <Down> + get_cmd_line +} {(gdb) show complaints} +if {$test_ran} { + clear_command_line +} + +# Test: console-history-2.2 +# Desc: Exercise the down-history functionality +gdbtk_test console-history-2.2 {down twice} { + # Add some commands into the command buffer + console_command {show annotate} + console_command {show complaints} + console_command {show confirm} + console_command {show height} + console_command {show language} + console_command {show print demangle} + console_command {show remotebaud} + console_command {show remotebreak} + console_command {show remotecache} + console_command {show remotedebug} + console_command {show remotedevice} + console_command {show remotelogbase} + console_command {help quit} + console_command {help si} + + for {set i 0} {$i < 14} {incr i} { + event generate $text <Up> + } + + event generate $text <Down> + event generate $text <Down> + get_cmd_line +} {(gdb) show confirm} +if {$test_ran} { + clear_command_line +} + +# Test: console-history-2.3 +# Desc: Exercise the down-history functionality +gdbtk_test console-history-2.3 {down four times} { + # Add some commands into the command buffer + console_command {show annotate} + console_command {show complaints} + console_command {show confirm} + console_command {show height} + console_command {show language} + console_command {show print demangle} + console_command {show remotebaud} + console_command {show remotebreak} + console_command {show remotecache} + console_command {show remotedebug} + console_command {show remotedevice} + console_command {show remotelogbase} + console_command {help quit} + console_command {help si} + + for {set i 0} {$i < 14} {incr i} { + event generate $text <Up> + } + + for {set i 0} {$i < 4} {incr i} { + event generate $text <Down> + } + get_cmd_line +} {(gdb) show language} +if {$test_ran} { + clear_command_line +} + +# Test: console-history-2.4 +# Desc: Exercise the down-history functionality +gdbtk_test console-history-2.4 {down infinitely} { + # Add some commands into the command buffer + console_command {show annotate} + console_command {show complaints} + console_command {show confirm} + console_command {show height} + console_command {show language} + console_command {show print demangle} + console_command {show remotebaud} + console_command {show remotebreak} + console_command {show remotecache} + console_command {show remotedebug} + console_command {show remotedevice} + console_command {show remotelogbase} + console_command {help quit} + console_command {help si} + for {set i 0} {$i < 14} {incr i} { + event generate $text <Up> + } + + for {set i 0} {$i < 20} {incr i} { + event generate $text <Down> + } + get_cmd_line +} {(gdb) } +if {$test_ran} { + clear_command_line +} + +# +# gdb - gdbtk Interface Tests +# + +# Test: console-interface-1.1 +# Desc: Verify that a "file" command in the console window causes +# gdb to invoke the pre-/post-add-symbol hooks +set file_loaded 0 +gdbtk_test console-interface-1.1 {file command goes through hooks} { + global TEST1_RESULT TEST2_RESULT + + # This is really ugly, but its the only way to do this... + rename gdbtk_tcl_pre_add_symbol pre_add + rename gdbtk_tcl_post_add_symbol post_add + + proc gdbtk_tcl_pre_add_symbol {file} { + global TEST1_RESULT + + set TEST1_RESULT $file + pre_add $file + } + proc gdbtk_tcl_post_add_symbol {} { + global TEST2_RESULT + + set TEST2_RESULT ok + post_add + } + + # load a file and make sure we went through the pre/post_add_symbol hooks + set TEST1_RESULT {} + set TEST2_RESULT {} + set file [file join $objdir simple] + console_command "file $file" + if {$TEST1_RESULT != $file} { + set result "did not go through gdbtk_tcl_pre_add_symbol ($TEST1_RESULT)" + } elseif {$TEST2_RESULT != "ok"} { + set result "did not go through gdbtk_tcl_post_add_symbol" + } else { + set result {} + set file_loaded 1 + } + + set result +} {} +if {$test_ran} { + rename gdbtk_tcl_pre_add_symbol {} + rename gdbtk_tcl_post_add_symbol {} + rename pre_add gdbtk_tcl_pre_add_symbol + rename post_add gdbtk_tcl_post_add_symbol +} + +# +# Exit +# +gdbtk_test_done + +# Local variables: +# mode: tcl +# change-log-default-name: "ChangeLog-gdbtk" +# End: diff --git a/gdb/testsuite/gdb.gdbtk/cpp_variable.cc b/gdb/testsuite/gdb.gdbtk/cpp_variable.cc new file mode 100644 index 00000000000..deecc295a7f --- /dev/null +++ b/gdb/testsuite/gdb.gdbtk/cpp_variable.cc @@ -0,0 +1,33 @@ +#include "cpp_variable.h" + +static void do_simple_class_tests (void); + +int +VB::fvb_pub () {return 300 + vb_pub_int;} + +int +VB::vvb_pub () {return 400 + vb_pub_int;} + +int +V::f () {return 600 + v_pub_int;} + +int +V::vv () {return 400 + v_pub_int;} + +int +VC::fvc () {return 300 + vc_pub_int;} + +int +VC::vfvc () {return 100 + vc_pub_int;} + +main () +{ + do_simple_class_tests (); +} + +static void +do_simple_class_tests (void) +{ + V *v = new V; + V vv; +} diff --git a/gdb/testsuite/gdb.gdbtk/cpp_variable.exp b/gdb/testsuite/gdb.gdbtk/cpp_variable.exp new file mode 100644 index 00000000000..ed5ca35dc67 --- /dev/null +++ b/gdb/testsuite/gdb.gdbtk/cpp_variable.exp @@ -0,0 +1,34 @@ +# +# Check if we have a display +# +if {![info exists ::env(DISPLAY)]} { + untested "No DISPLAY -- skipping test" +} else { + + if {$tracelevel} { + strace $tracelevel + } + + # + # test variable API + # + set prms_id 0 + set bug_id 0 + + set testfile "cpp_variable" + set srcfile ${testfile}.cc + set binfile ${objdir}/${subdir}/${testfile} + set r [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] + if { $r != "" } { + gdb_suppress_entire_file \ + "Testcase compile failed, so some tests in this file will automatically fail." + } + + # Start with a fresh gdbtk + gdb_exit + set results [gdbtk_start [file join $srcdir $subdir ${testfile}.test]] + set results [split $results \n] + + # Analyze results + gdbtk_analyze_results $results +} diff --git a/gdb/testsuite/gdb.gdbtk/cpp_variable.h b/gdb/testsuite/gdb.gdbtk/cpp_variable.h new file mode 100644 index 00000000000..40fda99a4dd --- /dev/null +++ b/gdb/testsuite/gdb.gdbtk/cpp_variable.h @@ -0,0 +1,54 @@ +struct _foo +{ + int a[10]; + char *p; +}; + +class VA +{ + public: + int va_pub_int; + char *va_pub_charp; + + private: + int va_priv_int; + char *va_priv_charp; + + protected: + struct _foo bar; +}; + +class VB +{ + public: + int vb_pub_int; + + int fvb_pub (); + virtual int vvb_pub (); + + private: + int vb_priv_int; + char *vb_priv_charp; +}; + +class VC +{ + public: + int vc_pub_int; + + int fvc (); + virtual int vfvc (); +}; + +class V : public VA, public VB, public VC +{ + public: + int f (); + virtual int vv (); + int v_pub_int; + char *v_pub_charp; + + private: + int v_priv_int; + char *v_priv_charp; +}; diff --git a/gdb/testsuite/gdb.gdbtk/cpp_variable.test b/gdb/testsuite/gdb.gdbtk/cpp_variable.test new file mode 100644 index 00000000000..5f9c2732fd2 --- /dev/null +++ b/gdb/testsuite/gdb.gdbtk/cpp_variable.test @@ -0,0 +1,562 @@ +# Copyright (C) 1998 Cygnus Solutions +# +# 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. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# This file was written by Keith Seitz (keiths@cygnus.com) + +# Read in the standard defs file +if {![gdbtk_read_defs]} { + break +} + +global objdir test_ran +global tcl_platform + +# Load in a file +if {$tcl_platform(platform) == "windows"} { + set program [file join $objdir cpp_variable.exe] +} else { + set program [file join $objdir cpp_variable] +} + +# This isn't a test case, since if this fails, we're hosed. +if {[catch {gdb_cmd "file $program"} t]} { + # an error occured loading the file + gdbtk_test_error "loading \"$program\": $t" +} + +# The variables that are created are stored in an array called "var". + +# proc to tell us which of the variables are changed/out of scope +proc check_update {} { + global var + + set changed {} + set unchanged {} + set out {} + #FIXME: Should get a list of root variables instead of using the array + foreach ind [array names var] { + set changed [concat $changed [$var($ind) update]] + } + + foreach ind [array names var] { + set ix [lsearch -exact $changed $var($ind)] + if {$ix < 0} { + lappend unchanged $var($ind) + } + } + + return [list $changed $unchanged $out] +} + +# proc to create a variable +proc create_variable {expr} { + global var + + set err [catch {gdb_variable create "$expr" -expr $expr} v] + if {!$err} { + set var($expr) $v + } + + return $err +} + +# proc to get the children +# Children are stored in the global "var" as +# PARENT.child. So for struct _foo {int a; int b} bar;, +# the children returned are {a b} and var(bar.a) and var(bar.b) +# map the actual objects to their names. +proc get_children {parent} { + global var + + set kiddies [$var($parent) children] + set children {} + foreach child $kiddies { + set name [lindex [split $child .] end] + lappend children $name + set var($parent.$name) $child + } + + return $children +} + +proc delete_variable {varname} { + global var + + if {[info exists var($varname)]} { + # This has to be caught, since deleting a parent + # will erase all children. + $var($varname) delete + set vars [array names var $varname*] + foreach v $vars { + if {[info exists var($v)]} { + unset var($v) + } + } + } +} + +# Compare the values of variable V in format FMT with value of OBJ +# with gdb's value. +proc cppvalue {obj v fmt} { + global var + global _test + + puts $_test(logfile) "obj=$obj v=$v fmt=$fmt" + puts $_test(logfile) "var(\$obj)=$var($obj)" + + set value [$var($obj) value] + set gdb [gdb_cmd "output/$fmt $v"] + puts $_test(logfile) "output/$fmt $v" + if {$value == $gdb} { + puts $_test(logfile) "gdbtk: $value == gdb: $gdb" + set result ok + } else { + set result $v + puts $_test(logfile) "gdbtk: $value <> gdb: $gdb" + } + + return $result +} + +proc delete_all_variables {} { + global var + + foreach variable [array names var] { + delete_variable $variable + } +} + +##### ##### +# # +# Simple Class Tests # +# # +##### ##### + +# run to "do_simple_class_tests" +gdb_cmd "break do_simple_class_tests" +gdb_cmd "run" + +# Test: cpp_variable-1.1 +# Desc: stopped in do_simple_class_tests +gdbtk_test cpp_variable-1.1 {stopped in do_simple_class_tests} { + lindex [gdb_loc] 1 +} {do_simple_class_tests(void)} + +# Test: cpp_variable-1.2 +# Desc: create variable v +gdbtk_test cpp_variable-1.2 {create variable v} { + create_variable v +} {0} + +# Test: cpp_variable-1.3 +# Desc: number of children of v +gdbtk_test cpp_variable-1.3 {number of children of v} { + $var(v) numChildren +} {5} + +# Test: cpp_variable-1.4a +# Desc: children of v +gdbtk_test cpp_variable-1.4a {children of v} { + get_children v +} {VA VB VC public private} + +# Test: cpp_variable-1.4b +# Desc: public children of v +gdbtk_test cpp_variable-1.4b {public children of v} { + get_children v.public +} {v_pub_int v_pub_charp} + +# Test: cpp_variable-1.4c +# Desc: private children of v +gdbtk_test cpp_variable-1.4c {private children of v} { + get_children v.private +} {v_priv_int v_priv_charp} + +# Test: cpp_variable-1.5 +# Desc: type of v +gdbtk_test cpp_variable-1.5 {type of v} { + $var(v) type +} {V *} + +# Test: cpp_variable-1.6 +# Desc: format of v +gdbtk_test cpp_variable-1.6 {format of v} { + $var(v) format +} {natural} + +set value [$var(v) value] + +# Step over "V *v = new V;" +gdb_cmd "next" + +# Test: cpp_variable-1.7 +# Desc: check value of v changed +gdbtk_test cpp_variable-1.7 {check value of v changed} { + check_update +} {{v v.public.v_pub_int v.public.v_pub_charp v.private.v_priv_int v.private.v_priv_charp} {v.VB v.VC v.private v.public v.VA} {}} + +# Test: cpp_variable-1.8 +# Desc: check values of v +gdbtk_test cpp_variable-1.8 {check values of v} { + set new [$var(v) value] + expr {$new != $value} +} {1} + +# Test: cpp_variable-1.9 +# Desc: v editable +gdbtk_test cpp_variable-1.9 {v editable} { + $var(v) editable +} {1} + +##### ##### +# # +# Children of v tests # +# # +##### ##### + +# Test: cpp_variable-2.1 +# Desc: type of v.v_pub_int +gdbtk_test cpp_variable-2.1 {type of v.v_pub_int} { + $var(v.public.v_pub_int) type +} {int} + +# Test: cpp_variable-2.2 +# Desc: format of v.v_pub_int +gdbtk_test cpp_variable-2.2 {format of v.v_pub_int} { + $var(v.public.v_pub_int) format +} {natural} + +gdb_cmd "set variable v.v_pub_int=2112" + +# Test: cpp_variable-2.3 +# Desc: value of v.v_pub_int changed +gdbtk_test cpp_variable-2.3 {value of v.v_pub_int changed} { + check_update +} {v.public.v_pub_int {v.private.v_priv_charp v.VB v.private.v_priv_int v.VC v.public.v_pub_charp v v.private v.public v.VA} {}} + +# Test: cpp_variable-2.4 +# Desc: value of v.v_pub_int +gdbtk_test cpp_variable-2.4 {value of v.v_pub_int} { + $var(v.public.v_pub_int) value +} {2112} + +# Test: cpp_variable-2.5 +# Desc: changed format of v.v_pub_int +gdbtk_test cpp_variable-2.5 {changed format of v.v_pub_int} { + $var(v.public.v_pub_int) format octal + $var(v.public.v_pub_int) format +} {octal} + +# Test: cpp_variable-2.6 +# Desc: value of v.v_pub_int with new format +gdbtk_test cpp_variable-2.6 {value of v.v_pub_int with new format} { + $var(v.public.v_pub_int) value +} {04100} + +# Test: cpp_variable-2.7 +# Desc: change value of v.v_pub_int (decimal) +gdbtk_test cpp_variable-2.7 {change value of v.v_pub_int (decimal)} { + $var(v.public.v_pub_int) value 3 + cppvalue v.public.v_pub_int v.v_pub_int o +} {ok} + +# Test: cpp_variable-2.8 +# Desc: change value of v.v_pub_int (hexadecimal) +gdbtk_test cpp_variable-2.8 {change value of v.v_pub_int (hexadecimal)} { + $var(v.public.v_pub_int) value 0x21 + cppvalue v.public.v_pub_int v.v_pub_int o +} {ok} + +# Test: cpp_variable-2.9 +# Desc: number of children of v_pub_int +gdbtk_test cpp_variable-2.9 {number of children of v_pub_int} { + $var(v.public.v_pub_int) numChildren +} {0} + +# Test: cpp_variable-2.10 +# Desc: children of v.v_pub_int +gdbtk_test cpp_variable-2.10 {children of v.v_pub_int} { + get_children v.public.v_pub_int +} {} + +# Test: cpp_variable-2.11 +# Desc: v.v_pub_int editable +gdbtk_test cpp_variable-2.11 {v.v_pub_int editable} { + $var(v.public.v_pub_int) editable +} {1} + +# Test: cpp_variable-2.21 +# Desc: type of v.v_priv_charp +gdbtk_test cpp_variable-2.21 {type of v.v_priv_charp} { + $var(v.private.v_priv_charp) type +} {char *} + +# Test: cpp_variable-2.22 +# Desc: format of v.v_priv_charp +gdbtk_test cpp_variable-2.22 {format of v.v_priv_charp} { + $var(v.private.v_priv_charp) format +} {natural} + +gdb_cmd "set variable v.v_priv_charp=2112" + +# Test: cpp_variable-2.23 +# Desc: value of v.v_priv_charp changed +gdbtk_test cpp_variable-2.23 {value of v.v_priv_charp changed} { + check_update +} {v.private.v_priv_charp {v.VB v.private.v_priv_int v.VC v.public.v_pub_charp v v.public.v_pub_int v.private v.public v.VA} {}} + +# Test: cpp_variable-2.24 +# Desc: value of v.v_priv_charp +gdbtk_test cpp_variable-2.24 {value of v.v_priv_charp} { + $var(v.private.v_priv_charp) format hexadecimal + $var(v.private.v_priv_charp) value +} {0x840} + +# Test: cpp_variable-2.25 +# Desc: changed format of v.v_priv_charp +gdbtk_test cpp_variable-2.25 {changed format of v.v_priv_charp} { + $var(v.private.v_priv_charp) format octal + $var(v.private.v_priv_charp) format +} {octal} + +# Test: cpp_variable-2.26 +# Desc: value of v.v_priv_charp with new format +gdbtk_test cpp_variable-2.26 {value of v.v_priv_charp with new format} { + $var(v.private.v_priv_charp) value +} {04100} + +# Test: cpp_variable-2.27 +# Desc: change value of v.v_priv_charp (decimal) +gdbtk_test cpp_variable-2.27 {change value of v.v_priv_charp (decimal)} { + $var(v.private.v_priv_charp) value 3 + cppvalue v.private.v_priv_charp v.v_priv_charp o +} {ok} + +# Test: cpp_variable-2.28 +# Desc: change value of v.v_priv_charp (hexadecimal) +gdbtk_test cpp_variable-2.28 {change value of v.v_priv_charp (hexadecimal)} { + $var(v.private.v_priv_charp) value 0x21 + cppvalue v.private.v_priv_charp v.v_priv_charp o +} {ok} + +# Test: cpp_variable-2.29 +# Desc: number of children of v_priv_charp +gdbtk_test cpp_variable-2.29 {number of children of v_priv_charp} { + $var(v.private.v_priv_charp) numChildren +} {0} + +# Test: cpp_variable-2.30 +# Desc: children of v.v_priv_charp +gdbtk_test cpp_variable-2.30 {children of v.v_priv_charp} { + get_children v.private.v_priv_charp +} {} + +# Test: cpp_variable-2.31 +# Desc: v.v_priv_int editable +gdbtk_test cpp_variable-2.31 {v.v_priv_int editable} { + $var(v.private.v_priv_int) editable +} {1} + +# Test: cpp_variable-2.41 +# Desc: type of v.VA +gdbtk_test cpp_variable-2.41 {type of v.VA} { + $var(v.VA) type +} {VA} + +# Test: cpp_variable-2.42 +# Desc: format of v.VA +gdbtk_test cpp_variable-2.42 {format of v.VA} { + $var(v.VA) format +} {natural} + +# Test: cpp_variable-2.43 +# Desc: value of v.VA changed +gdbtk_test cpp_variable-2.43 {value of v.VA changed} { + check_update +} {{} {v.private.v_priv_charp v.VB v.private.v_priv_int v.VC v.public.v_pub_charp v v.public.v_pub_int v.private v.public v.VA} {}} + +# Test: cpp_variable-2.44 +# Desc: value of v.VA +gdbtk_test cpp_variable-2.44 {value of v.VA} { + $var(v.VA) value +} {{...}} + +# Test: cpp_variable-2.45 +# Desc: changed format of v.VA +gdbtk_test cpp_variable-2.45 {changed format of v.VA} { + $var(v.VA) format octal + $var(v.VA) format +} {octal} + +# Test: cpp_variable-2.46 +# Desc: value of v.VA with new format +gdbtk_test cpp_variable-2.46 {value of v.VA with new format} { + $var(v.VA) value +} {{...}} + +# Test: cpp_variable-2.47 +# Desc: number of children of VA +gdbtk_test cpp_variable-2.47 {number of children of VA} { + $var(v.VA) numChildren +} {3} + +# Test: cpp_variable-2.48a +# Desc: children of v.VA +gdbtk_test cpp_variable-2.48a {children of v.VA} { + get_children v.VA +} {public private protected} + +# Test: cpp_variable-2.48b +# Desc: public children of v.VA +gdbtk_test cpp_variable-2.48b {children of v.VA} { + get_children v.VA.public +} {va_pub_int va_pub_charp} + +# Test: cpp_variable-2.48c +# Desc: private children of v.VA +gdbtk_test cpp_variable-2.48c {children of v.VA} { + get_children v.VA.private +} {va_priv_int va_priv_charp} + +# Test: cpp_variable-2.48d +# Desc: protected children of v.VA +gdbtk_test cpp_variable-2.48d {children of v.VA} { + get_children v.VA.protected +} {bar} + +# Test: cpp_variable-2.49 +# Desc: v.VA editable +gdbtk_test cpp_variable-2.49 {v.VA editable} { + $var(v.VA) editable +} {0} + +# Test: cpp_variable-2.61 +# Desc: type of v.VB +gdbtk_test cpp_variable-2.61 {type of v.VB} { + $var(v.VB) type +} {VB} + +# Test: cpp_variable-2.62 +# Desc: format of v.VB +gdbtk_test cpp_variable-2.62 {format of v.VB} { + $var(v.VB) format +} {natural} + +# Test: cpp_variable-2.63 +# Desc: value of v.VB changed +gdbtk_test cpp_variable-2.63 {value of v.VB changed} { + check_update +} {{} {v.VA.protected v.VA.private v.VA.public.va_pub_int v.private.v_priv_int v v.public.v_pub_int v.VA.public.va_pub_charp v.private.v_priv_charp v.VA.public v.public.v_pub_charp v.VA.private.va_priv_int v.VA v.public v.VB v.VC v.VA.protected.bar v.VA.private.va_priv_charp v.private} {}} + +# Test: cpp_variable-2.64 + # Desc: value of v.VB +gdbtk_test cpp_variable-2.64 {value of v.VB} { + $var(v.VB) value +} {{...}} + +# Test: cpp_variable-2.65 +# Desc: changed format of v.VB +gdbtk_test cpp_variable-2.65 {changed format of v.VB} { + $var(v.VB) format octal + $var(v.VB) format +} {octal} + +# Test: cpp_variable-2.66 +# Desc: value of v.VB with new format +gdbtk_test cpp_variable-2.66 {value of v.VB with new format} { + $var(v.VB) value +} {{...}} + +# Note: The next two tests show whether or not the logic +# concerning vptr tables is working. +# Test: cpp_variable-2.67 +# Desc: number of children of VB +gdbtk_test cpp_variable-2.67 {number of children of VB} { + $var(v.VB) numChildren +} {2} + +# Test: cpp_variable-2.68a +# Desc: children of v.VB +gdbtk_test cpp_variable-2.68a {children of v.VB} { + get_children v.VB +} {public private} + +# Test: cpp_variable-2.68b +# Desc: public children of v.VB +gdbtk_test cpp_variable-2.68b {children of v.VB} { + get_children v.VB.public +} {vb_pub_int} + +# Test: cpp_variable-2.68c +# Desc: private children of v.VB +gdbtk_test cpp_variable-2.68c {children of v.VB} { + get_children v.VB.private +} {vb_priv_int vb_priv_charp} + +# Test: cpp_variable-2.69 +# Desc: v.VB editable +gdbtk_test cpp_variable-2.69 {v.VB editable} { + $var(v.VB) editable +} {0} + +# Test: cpp_variable-2.70 +# Desc: v.VB.public editable +gdbtk_test cpp_variable-2.70 {v.VB.public editable} { + $var(v.VB.public) editable +} {0} + +# Test: cpp_variable-2.71 +# Desc: v.VB.vb_pub_int editable +gdbtk_test cpp_variable-2.71 {v.VB.vb_pub_int editable} { + $var(v.VB.public.vb_pub_int) editable +} {1} + +gdb_cmd "set variable v.vb_pub_int=2112" + +# Test: cpp_variable-2.72 +# Desc: value of v.vb_pub_int changed +gdbtk_test cpp_variable-2.72 {value of v.vb_pub_int changed} { + check_update +} {v.VB.public.vb_pub_int {v.VB.public v.VA.protected v.VA.private v.VB.private.vb_priv_int v.VB.private v.VA.public.va_pub_int v.private.v_priv_int v v.public.v_pub_int v.VB.private.vb_priv_charp v.VA.public.va_pub_charp v.private.v_priv_charp v.VA.public v.public.v_pub_charp v.VA.private.va_priv_int v.VA v.public v.VB v.VC v.VA.protected.bar v.VA.private.va_priv_charp v.private} {}} + +# Test: cpp_variable-2.73 +# Desc: value of v.VB.vb_pub_int +gdbtk_test cpp_variable-2.73 {changed value of v.vb_pub_int} { + $var(v.VB.public.vb_pub_int) value +} {2112} + +# Test: cpp_variable-2.74 +# Desc: change value of v.VB.vb_pub_int +gdbtk_test cpp_variable-2.74 {change value of v.VB.public.vb_pub_int} { + $var(v.VB.public.vb_pub_int) value 3 + cppvalue v.VB.public.vb_pub_int v.vb_pub_int d +} {ok} + +# Test: cpp_variable-2.75 +# Desc: value of v.VB.vb_pub_int +gdbtk_test cpp_variable-2.75 {changed value of v.VB.public.vb_pub_int} { + $var(v.VB.public.vb_pub_int) value +} {3} + + +# Exit +# +gdbtk_test_done + + diff --git a/gdb/testsuite/gdb.gdbtk/defs b/gdb/testsuite/gdb.gdbtk/defs new file mode 100644 index 00000000000..a4f20c60f81 --- /dev/null +++ b/gdb/testsuite/gdb.gdbtk/defs @@ -0,0 +1,218 @@ +# This file contains support code for the gdbtk test suite. +# +# Based on the Tcl testsuite support code, portions of this file +# are Copyright (c) 1990-1994 The Regents of the University of California and +# Copyright (c) 1994-1996 Sun Microsystems, Inc. +# +global srcdir _test env srcdir objdir + +if {![info exists srcdir]} { + if {[info exists env(SRCDIR)]} { + set srcdir $env(SRCDIR) + } else { + set srcdir . + } +} + +if {![info exists objdir]} { + if {[info exists env(OBJDIR)]} { + set objdir $env(OBJDIR) + } elseif {$_test(interactive)} { + # If running interactively, assume that the objdir is + # relative to the executable's location + set objdir [file join [file dirname [info nameofexecutable]] testsuite gdb.gdbtk] + } else { + set objdir . + } +} + +if {![info exists _test(verbose)]} { + if {[info exists env(GDBTK_VERBOSE)]} { + set _test(verbose) $env(GDBTK_VERBOSE) + } else { + set _test(verbose) + } +} +if {![info exists _test(tests)]} { + + if {[info exists env(GDBTK_TESTS)]} { + set _test(tests) $env(GDBTK_TESTS) + } else { + set _test(tests) {} + } +} + +if {[info exists env(GDBTK_LOGFILE)]} { + set _test(logfile) [open $env(GDBTK_LOGFILE) a+] + fconfigure $_test(logfile) -buffering none +} else { + set _test(logfile) {} +} + +# Informs gdbtk internals that testsuite is running. An example +# where this is needed is the window manager, which must place +# all windows at some place on the screen so that the system's +# window manager does not interfere. This is reset in gdbtk_test_done. +set env(GDBTK_TEST_RUNNING) 1 + +proc gdbtk_print_verbose {status name description script code answer} { + global _test + + switch $code { + 0 { + set code_words {} + } + 1 { + set code_words "Test generated error: $answer" + } + + 2 { + set code_words "Test generated return exception; result was: $answer" + } + + 3 { + set code_words "Test generated break exception" + } + + 4 { + set code_words "Test generated continue exception" + } + + 5 { + set code_words "Test generated exception $code; message was:$answer" + } + } + + if {$_test(verbose) > 1 \ + || ($_test(verbose) != 1 && ($status == "ERROR" || $status == "FAIL"))} { + # Printed when user verbose mode (verbose > 1) or an error/failure occurs + # not running the testsuite (dejagnu) + puts stdout "\n" + puts stdout "==== $name $description" + puts stdout "==== Contents of test case:" + puts stdout "$script" + if {$code_words != ""} { + puts stdout $code_words + } + puts stdout "==== Result was:" + puts stdout "$answer" + } elseif {$_test(verbose)} { + # Printed for the testsuite (verbose = 1) + puts stdout "[list $status $name $description $code_words]" + + if {$_test(logfile) != ""} { + puts $_test(logfile) "\n" + puts $_test(logfile) "==== $name $description" + puts $_test(logfile) "==== Contents of test case:" + puts $_test(logfile) "$script" + if {$code_words != ""} { + puts $_test(logfile) $code_words + } + puts $_test(logfile) "==== Result was:" + puts $_test(logfile) "$answer" + } + } +} + +# gdbtk_test +# +# This procedure runs a test and prints an error message if the +# test fails. +# +# Arguments: +# name - Name of test, in the form foo-1.2. +# description - Short textual description of the test, to +# help humans understand what it does. +# script - Script to run to carry out the test. It must +# return a result that can be checked for +# correctness. +# answer - Expected result from script. + +proc gdbtk_test {name description script answer} { + global _test test_ran + + set test_ran 0 + if {[string compare $_test(tests) ""] != 0} then { + set ok 0 + foreach test $_test(tests) { + if [string match $test $name] then { + set ok 1 + break + } + } + if !$ok then return + } + + set code [catch {uplevel $script} result] + set test_ran 1 + if {$code != 0} { + # Error + gdbtk_print_verbose ERROR $name $description $script \ + $code $result + } elseif {[string compare $result $answer] == 0} { + if {[string index $name 0] == "*"} { + # XPASS + set HOW XPASS + } else { + set HOW PASS + } + + if {$_test(verbose)} { + gdbtk_print_verbose $HOW $name $description $script \ + $code $result + if {$_test(verbose) != 1} { + puts stdout "++++ $name ${HOW}ED" + } + } + if {$_test(logfile) != ""} { + puts $_test(logfile) "++++ $name ${HOW}ED" + } + } else { + if {[string index $name 0] == "*"} { + # XFAIL + set HOW XFAIL + } else { + set HOW FAIL + } + + gdbtk_print_verbose $HOW $name $description $script \ + $code $result + if {$_test(verbose) != 1} { + puts stdout "---- Result should have been:" + puts stdout "$answer" + puts stdout "---- $name ${HOW}ED" + } + if {$_test(logfile) != ""} { + puts $_test(logfile) "---- Result should have been:" + puts $_test(logfile) "$answer" + puts $_test(logfile) "---- $name ${HOW}ED" + } + } +} + +proc gdbtk_dotests {file args} { + global _test + set savedTests $_test(tests) + set _test(tests) $args + source $file + set _test(tests) $savedTests +} + +proc gdbtk_test_done {} { + global _test env + + if {$_test(logfile) != ""} { + close $_test(logfile) + } + + set env(GDBTK_TEST_RUNNING) 0 + if {![info exists _test(interactive)] || !$_test(interactive)} { + gdb_force_quit + } +} + +proc gdbtk_test_error {desc} { + set desc [join [split $desc \n] |] + puts "ERROR \{$desc\} \{\} \{\}" + gdbtk_test_done +} diff --git a/gdb/testsuite/gdb.gdbtk/simple.c b/gdb/testsuite/gdb.gdbtk/simple.c new file mode 100644 index 00000000000..b35cd58851b --- /dev/null +++ b/gdb/testsuite/gdb.gdbtk/simple.c @@ -0,0 +1,20 @@ +int +main(int argc, char * argv[]) +{ + int i; + char *a; + char *b = "abc"; + long foo; + + a = (char *) malloc (300); + + for (i=0; i < 50; i++) + { + int j = i % 3; + int k = 3 - j; + strncpy (a[i], b[k], j); + foo = (long) j * k / i + 2 * k * k * k; + } + return 0; +} + diff --git a/gdb/testsuite/gdb.gdbtk/srcwin.exp b/gdb/testsuite/gdb.gdbtk/srcwin.exp new file mode 100644 index 00000000000..e3dc07dff87 --- /dev/null +++ b/gdb/testsuite/gdb.gdbtk/srcwin.exp @@ -0,0 +1,59 @@ +# +# Check if we have a display +# +if {![info exists ::env(DISPLAY)]} { + untested "No DISPLAY -- skipping test" +} else { + if {$tracelevel} { + strace $tracelevel + } + + # + # test source window + # + set prms_id 0 + set bug_id 0 + + set testfile "list" + set binfile $objdir/$subdir/$testfile + set r [gdb_compile "$srcdir/gdb.base/list0.c $srcdir/gdb.base/list1.c" "$binfile" executable debug] + if { $r != "" } { + gdb_suppress_entire_file \ + "Testcase compile failed, so some tests in this file will automatically fail." + } + + # Start with a fresh gdbtk + gdb_exit + set results [gdbtk_start [file join $srcdir $subdir srcwin.test]] + set results [split $results \n] + # Analyze results + gdbtk_analyze_results $results + + # move file with "main" out of the way + file rename $srcdir/gdb.base/list0.c $srcdir/gdb.base/list0.c.save + # run slightly different set of tests + gdb_exit + set results [gdbtk_start [file join $srcdir $subdir srcwin2.test]] + set results [split $results \n] + #restore file + file rename $srcdir/gdb.base/list0.c.save $srcdir/gdb.base/list0.c + # Analyze results + gdbtk_analyze_results $results + + set r [gdb_compile "$srcdir/gdb.base/list0.c $srcdir/gdb.base/list1.c" "$binfile" executable ""] + if { $r != "" } { + gdb_suppress_entire_file \ + "Testcase compile failed, so some tests in this file will automatically fail." + } + # run slightly different set of tests + gdb_exit + set results [gdbtk_start [file join $srcdir $subdir srcwin3.test]] + set results [split $results \n] + # Analyze results + gdbtk_analyze_results $results +} + +# Local variables: +# mode: tcl +# change-log-default-name: "ChangeLog-gdbtk" +# End: diff --git a/gdb/testsuite/gdb.gdbtk/srcwin.test b/gdb/testsuite/gdb.gdbtk/srcwin.test new file mode 100644 index 00000000000..bc1ec9d78a2 --- /dev/null +++ b/gdb/testsuite/gdb.gdbtk/srcwin.test @@ -0,0 +1,1221 @@ +# Copyright (C) 1999 Cygnus Solutions +# +# 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. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# This file was written by Martin Hunt (hunt@cygnus.com) + +# Read in the standard defs file + +if {![gdbtk_read_defs]} { + break +} + +global objdir srcdir + + +# move the pointer to the center of the bbox relative to $win +proc move_mouse_to {win bbox} { + if {[llength $bbox] != 4} { + return 0 + } + set x [expr [lindex $bbox 0] + [lindex $bbox 2] / 2] + set y [expr [lindex $bbox 1] + [lindex $bbox 3] / 2] + warp_pointer . [winfo rootx $win] [winfo rooty $win] + + set nx 0 + set ny 0 + + while {$nx != $x || $ny != $y} { + if {$nx < $x} {incr nx} + if {$ny < $y} {incr ny} + warp_pointer $win $nx $ny + } + return 1 +} + +proc click {win bbox event} { + if {![move_mouse_to $win $bbox]} { + return 0 + } + update + + set x [expr [lindex $bbox 0] + [lindex $bbox 2] / 2] + set y [expr [lindex $bbox 1] + [lindex $bbox 3] / 2] + + if {[catch {event generate $win $event -x $x -y $y} result]} { + return 0 + } + return 1 +} + + +##### ##### +# # +# SECTION 1: Mode Tests # +# # +##### ##### + +# Load the test executable +if {$tcl_platform(platform) == "windows"} { + set file [file join $objdir list.exe] +} else { + set file [file join $objdir list] +} + +# This isn't a test case, since if this fails, we're hosed. +if {[catch {gdb_cmd "file $file" 1} t]} { + # an error occured loading the file + gdbtk_test_error "loading \"$file\": $t" +} + +set srcwin [ManagedWin::open SrcWin] +set stw [$srcwin test_get twin] +set twin [$stw test_get twin] + +# get things started +gdb_cmd "break main" +run_executable + +# Test: srcwin-1.1 +# Desc: Check for something in source window +gdbtk_test srcwin-1.1 "source window has contents" { + set file1(source) [$twin get 1.0 end] + expr {![string compare $file1(source) ""]} +} {0} + + +# Test: srcwin-1.2 +# Desc: source->assembly mode change +gdbtk_test srcwin-1.2 "source->assembly mode change" { + $srcwin mode "" ASSEMBLY + set twin [$stw test_get twin] + set file1(assembly) [$twin get 1.0 end] + expr {![string compare $file1(source) $file1(assembly)]} +} {0} + +# Test: srcwin-1.3 +# Desc: assembly->mixed mode change +gdbtk_test srcwin-1.3 "assembly->mixed mode change" { + $srcwin mode "" MIXED + set twin [$stw test_get twin] + set file1(mixed) [$twin get 1.0 end] + expr {![string compare $file1(mixed) $file1(assembly)]} +} {0} + +# Test: srcwin-1.4 +# Desc: mixed->src+asm mode change +gdbtk_test srcwin-1.4 "mixed->src+asm mode change" { + $srcwin mode "" SRC+ASM + set twin [$stw test_get twin] + set bwin [$stw test_get bwin] + set s [$twin get 1.0 end] + set a [$bwin get 1.0 end] + list [string compare $a $file1(assembly)] [string compare $s $file1(source)] [winfo ismapped $bwin] +} {0 0 1} + +# Test: srcwin-1.5 +# Desc: src+asm->source mode change +gdbtk_test srcwin-1.5 "src+asm->source mode change" { + $srcwin mode "" SOURCE + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + set bwin [$stw test_get bwin] + list [string compare $file1(source) $a] [winfo ismapped $bwin] +} {0 0} + +# Test: srcwin-1.6 +# Desc: source->mixed mode change +gdbtk_test srcwin-1.6 "source->mixed mode change" { + $srcwin mode "" MIXED + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + string compare $file1(mixed) $a +} {0} + +# Test: srcwin-1.7 +# Desc: mixed->source mode change +gdbtk_test srcwin-1.7 "mixed->source mode change" { + $srcwin mode "" SOURCE + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + string compare $file1(source) $a +} {0} + +# Test: srcwin-1.8 +# Desc: source->src+asm mode change +gdbtk_test srcwin-1.8 "source->src+asm mode change" { + $srcwin mode "" SRC+ASM + set twin [$stw test_get twin] + set bwin [$stw test_get bwin] + set s [$twin get 1.0 end] + set a [$bwin get 1.0 end] + list [string compare $a $file1(assembly)] [string compare $s $file1(source)] [winfo ismapped $bwin] +} {0 0 1} + +# Test: srcwin-1.9 +# Desc: src+asm->assembly mode change +gdbtk_test srcwin-1.9 "src+asm->assembly mode change" { + $srcwin mode "" ASSEMBLY + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + string compare $file1(assembly) $a +} {0} + +# Test: srcwin-1.10 +# Desc: assembly->src+asm mode change +gdbtk_test srcwin-1.10 "assembly->src+asm mode change" { + $srcwin mode "" SRC+ASM + set twin [$stw test_get twin] + set bwin [$stw test_get bwin] + set s [$twin get 1.0 end] + set a [$bwin get 1.0 end] + list [string compare $a $file1(assembly)] [string compare $s $file1(source)] [winfo ismapped $bwin] +} {0 0 1} + +# Test: srcwin-1.11 +# Desc: src+asm->mixed mode change +gdbtk_test srcwin-1.11 "src+asm->mixed mode change" { + $srcwin mode "" MIXED + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + set bwin [$stw test_get bwin] + expr {[string compare $file1(mixed) $a] || + [winfo ismapped $bwin]} +} {0} + +# Test: srcwin-1.12 +# Desc: mixed->assembly mode change +gdbtk_test srcwin-1.12 "mixed->assembly mode change" { + $srcwin mode "" ASSEMBLY + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + string compare $file1(assembly) $a +} {0} + +# Test: srcwin-1.13 +# Desc: assembly->source mode change +gdbtk_test srcwin-1.13 "assembly->source mode change" { + $srcwin mode "" SOURCE + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + string compare $file1(source) $a +} {0} + + +##### ##### +# # +# SECTION 2: Basic Operations # +# # +##### ##### + +# Test: srcwin-2.1 +# Desc: check contents of filename combobox +gdbtk_test srcwin-2.1 "check contents of filename combobox" { + set statbar [$srcwin test_get _statbar] + set names [$statbar.name listget 0 end] + set r 0 + foreach f {list0.c list1.c list0.h} { + if {[lsearch $names $f] != -1} { + incr r + } + } + set r +} {3} + +# Test: srcwin-2.2 +# Desc: check contents of function combobox +gdbtk_test srcwin-2.2 "check contents of function combobox" { + set names [$statbar.func listget 0 end] + set r 0 + foreach f {main foo unused} { + if {[lsearch $names $f] != -1} { + incr r + } + } + set r +} {3} + +# Test: srcwin-2.3 +# Desc: goto filename +gdbtk_test srcwin-2.3 "goto filename" { + set func [$srcwin test_get _name 1] + $func "" list1.c + set twin [$stw test_get twin] + set file2(source) [$twin get 1.0 end] + expr {![string compare $file1(source) $file2(source)]} +} {0} + +# Test: srcwin-2.4 +# Desc: check contents of function combobox +gdbtk_test srcwin-2.4 "check contents of function combobox" { + set names [$statbar.func listget 0 end] + set r 0 + foreach f {bar long_line oof unused} { + if {[lsearch $names $f] != -1} { + incr r + } + } + set r +} {4} + +# Test: srcwin-2.5 +# Desc: function combobox entry field should be empty after switching to a new file +gdbtk_test srcwin-2.5 "function combobox entry field should be empty" { + set names [$statbar.func get] + string length $names +} {0} + +# Test: srcwin-2.6 +# Desc: goto function +gdbtk_test srcwin-2.6 "goto function bar" { + $srcwin goto_func "" bar + set r 0 + + # now get a dump of all tags and check that only one line is + # marked BROWSE_TAG and no lines are STACK_TAG or PC_TAG. + + # We know that list1.c should have BROWSE_TAG set at index 5.2 + # for function "bar". If list1.c is changed or the layout of the source + # window is changed, this must be updated. + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "BROWSE_TAG"} { + if {$i == "5.2"} { + incr r + } else { + incr r 5 + } + } + if {$v == "STACK_TAG"} { incr r 10} + if {$v == "PC_TAG"} { incr r 100} + } + } + } else { + set r -1 + } + + if {$r == 1} { + # things are OK so far, so just verify the function name is displayed + # in the combobox entry field. + set names [$statbar.func get] + if {[string compare $names "bar"]} {set r -2} + } + set r +} {1} + +# Test: srcwin-2.7 +# Desc: goto function "oof". This tests that the correct line is highlighted +# with BROWSE_TAG and no other lines are highlighted. It also checks that +# the combobox has the correct function name in it. Finally, list1.c +# has an extremely long line, line 32, that breaks some functions. We verify +# that the GDBtk has the correct line number. + +gdbtk_test srcwin-2.7 "goto function oof" { + $srcwin goto_func "" oof + set r 0 + + # now get a dump of all tags and check that only one line is + # marked BROWSE_TAG and no lines are STACK_TAG or PC_TAG. + + # We know that list1.c should have BROWSE_TAG set at index 32.2 + # for function "oof". If list1.c is changed or the layout of the source + # window is changed, this must be updated. + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "BROWSE_TAG"} { + if {$i == "32.2"} { + set line_number [$twin get "$i wordstart" "$i wordend"] + if {$line_number == "32"} { + incr r + } else { + incr r -100 + } + } else { + incr r 5 + } + } + if {$v == "STACK_TAG"} {incr r 10} + if {$v == "PC_TAG"} {incr r 100} + } + } + } else { + set r -1 + } + + if {$r == 1} { + # things are OK so far, so just verify the function name is displayed + # in the combobox entry field. + set names [$statbar.func get] + if {[string compare $names "oof"]} {set r -2} + } + set r +} {1} + +# Test: srcwin-2.8 +# Desc: This test issues a next command while browsing list1.c. +# It should display list0.c and highlight the correct line. +gdbtk_test srcwin-2.8 "step while browsing" { + gdb_immediate "next" 1 + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != "list0.c"} {set r -1} + if {$func != "main"} {set r -2} + + # check that correct file is displayed + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + if {[string compare $file1(source) $a]} {set r -3} + + # check for PC_TAG on correct line + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "PC_TAG"} { + if {$i == "11.2"} { + incr r + } else { + incr r 5 + } + } + if {$v == "STACK_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {1} + +# Test: srcwin-2.9 +# Desc: This test issues a next command while the current +# PC is ready to call a function. It should not go into the function and +# should update the PC highlight correctly. +gdbtk_test srcwin-2.9 "next" { + gdb_immediate "next" 1 + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != "list0.c"} {set r -1} + if {$func != "main"} {set r -2} + + # check that correct file is displayed + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + if {[string compare $file1(source) $a]} {set r -3} + + # check for PC_TAG on correct line + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "PC_TAG"} { + if {$i == "12.2"} { + incr r + } else { + incr r 5 + } + } + if {$v == "STACK_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {1} + +# Test: srcwin-2.10 +# Desc: This test issues a step command while the current +# PC is ready to call a function. It should step into the function. +gdbtk_test srcwin-2.10 "step" { + gdb_immediate "step" 1 + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != "list0.h"} {set r -1} + if {$func != "foo"} {set r -2} + + # check that a new file is displayed + set twin [$stw test_get twin] + set file3(source) [$twin get 1.0 end] + if {![string compare $file1(source) $file3(source)]} {set r -3} + + # check for PC_TAG on correct line + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "PC_TAG"} { + if {$i == "8.2"} { + incr r + } else { + incr r 5 + } + } + if {$v == "STACK_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {1} + +# Test: srcwin-2.11 +# Desc: This test issues a break and a continue +gdbtk_test srcwin-2.11 "set BP and continue" { + gdb_immediate "break oof" 1 + gdb_immediate "continue" 1 + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != "list1.c"} {set r -1} + if {$func != "oof"} {set r -2} + + # check that the correct file is displayed + # we must clear the breakpoint first so it doesn't mess up the + # comparison... + gdb_immediate "clear oof" 1 + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + if {[string compare $file2(source) $a]} {set r -3} + + # check for PC_TAG on correct line + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "PC_TAG"} { + if {$i == "32.2"} { + incr r + } else { + incr r 5 + } + } + if {$v == "STACK_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {1} + +##### ##### +# # +# SECTION 3: Stack Operations # +# # +##### ##### + +# Test: srcwin-3.1 +# Desc: This tests "stack up" +gdbtk_test srcwin-3.1 "stack up (1)" { + $srcwin stack up + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != "list1.c"} {set r -1} + if {$func != "long_line"} {set r -2} + + # check that the correct file is displayed + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + if {[string compare $file2(source) $a]} {set r -3} + + # check for PC_TAG and STACK_TAG on correct lines + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "PC_TAG"} { + if {$i == "32.2"} { + incr r + } else { + incr r 5 + } + } + if {$v == "STACK_TAG"} { + if {$i == "22.2"} { + incr r + } else { + incr r 10 + } + } + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {2} + +# Test: srcwin-3.2 +# Desc: Another "stack up" test +gdbtk_test srcwin-3.2 "stack up (2)" { + $srcwin stack up + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != "list1.c"} {set r -1} + if {$func != "bar"} {set r -2} + + # check that the correct file is displayed + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + if {[string compare $file2(source) $a]} {set r -3} + + # check for PC_TAG and STACK_TAG on correct lines + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "PC_TAG"} { + if {$i == "32.2"} { + incr r + } else { + incr r 5 + } + } + if {$v == "STACK_TAG"} { + if {$i == "7.2"} { + incr r + } else { + incr r 10 + } + } + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {2} + +# Test: srcwin-3.3 +# Desc: Another "stack up" test +gdbtk_test srcwin-3.3 "stack up (3)" { + $srcwin stack up + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != "list0.h"} {set r -1} + if {$func != "foo"} {set r -2} + + # check that the correct file is displayed + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + if {![string compare $file2(source) $a]} {set r -3} + + # check for PC_TAG and STACK_TAG on correct lines + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "STACK_TAG"} { + if {$i == "8.2"} { + incr r + } else { + incr r 5 + } + } + if {$v == "PC_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {1} + +# Test: srcwin-3.4 +# Desc: Another "stack up" test +gdbtk_test srcwin-3.4 "stack up (4)" { + $srcwin stack up + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != "list0.c"} {set r -1} + if {$func != "main"} {set r -2} + + # check that the correct file is displayed + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + if {[string compare $file1(source) $a]} {set r -3} + + # check for PC_TAG and STACK_TAG on correct lines + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "STACK_TAG"} { + if {$i == "12.2"} { + incr r + } else { + incr r 5 + } + } + if {$v == "PC_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {1} + +# Test: srcwin-3.5 +# Desc: "stack up" when we are at the top +gdbtk_test srcwin-3.5 "stack up when at the top" { + $srcwin stack up + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != "list0.c"} {set r -1} + if {$func != "main"} {set r -2} + + # check that the correct file is displayed + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + if {[string compare $file1(source) $a]} {set r -3} + + # check for PC_TAG and STACK_TAG on correct lines + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "STACK_TAG"} { + if {$i == "12.2"} { + incr r + } else { + incr r 5 + } + } + if {$v == "PC_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {1} + +# Test: srcwin-3.6 +# Desc: "stack down" test +gdbtk_test srcwin-3.6 "stack down" { + $srcwin stack down + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != "list0.h"} {set r -1} + if {$func != "foo"} {set r -2} + + # check that the correct file is displayed + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + if {![string compare $file2(source) $a]} {set r -3} + + # check for PC_TAG and STACK_TAG on correct lines + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "STACK_TAG"} { + if {$i == "8.2"} { + incr r + } else { + incr r 5 + } + } + if {$v == "PC_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {1} + +# Test: srcwin-3.7 +# Desc: "stack bottom" test +gdbtk_test srcwin-3.7 "stack bottom" { + $srcwin stack bottom + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != "list1.c"} {set r -1} + if {$func != "oof"} {set r -2} + + # check that the correct file is displayed + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + if {[string compare $file2(source) $a]} {set r -3} + + # check for PC_TAG on correct line + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "PC_TAG"} { + if {$i == "32.2"} { + incr r + } else { + incr r 5 + } + } + if {$v == "STACK_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {1} + +# Test: srcwin-3.8 +# Desc: "stack down" when at bottom +gdbtk_test srcwin-3.8 "stack down when at bottom" { + $srcwin stack down + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != "list1.c"} {set r -1} + if {$func != "oof"} {set r -2} + + # check that the correct file is displayed + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + if {[string compare $file2(source) $a]} {set r -3} + + # check for PC_TAG on correct line + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "PC_TAG"} { + if {$i == "32.2"} { + incr r + } else { + incr r 5 + } + } + if {$v == "STACK_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {1} + +# 4 - BREAKPOINTS + +# Test: srcwin-4.1 +# Desc: Set BP in another file. Tests bp and cache functions +gdbtk_test srcwin-4.1 "set BP in another file" { + gdb_immediate "break foo" 1 + $srcwin goto_func "" foo + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != "list0.h"} {set r -1} + if {$func != "foo"} {set r -2} + + set twin [$stw test_get twin] + + # check for BROWSE_TAG and BP image on correct line + if {$r == 0} { + if {![catch {set z [$twin dump 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "BROWSE_TAG"} { + if {$i == "8.2"} { + incr r + } else { + incr r 5 + } + } + if {$v == "STACK_TAG"} {incr r 10} + if {$v == "PC_TAG"} {incr r 100} + } elseif {$k == "image"} { + if {$i == "8.0"} { + incr r + } else { + set r -200 + } + } + } + } else { + set r -4 + } + } + + if {$r == 2} { + # clear BP and compare with previous contents. This should succeed, + gdb_immediate "clear foo" 1 + set a [$twin get 1.0 end] + if {[string compare $file3(source) $a]} {set r -3} + } + + set r +} {2} + +# Test: srcwin-4.2 +# Desc: Test temporary BP +gdbtk_test srcwin-4.2 "temporary BP" { + set r 0 + if {[catch {gdb_immediate "tbreak foo" 1} msg]} { + set r -500 + } + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != "list0.h"} {set r -1} + if {$func != "foo"} {set r -2} + + set twin [$stw test_get twin] + + # check for BROWSE_TAG and BP image on correct line + if {$r == 0} { + if {![catch {set z [$twin dump 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "BROWSE_TAG"} { + if {$i == "8.2"} { + incr r + } else { + incr r 5 + } + } + if {$v == "STACK_TAG"} {incr r 10} + if {$v == "PC_TAG"} {incr r 100} + } elseif {$k == "image"} { + if {$i == "8.0"} { + incr r + } else { + set r -200 + } + } + } + } else { + set r -4 + } + } + + gdb_immediate "continue" 1 + + # now check for PC_TAG and no image + if {$r == 2} { + if {![catch {set z [$twin dump 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "PC_TAG"} { + if {$i == "8.2"} { + incr r + } else { + incr r 5 + } + } + if {$v == "STACK_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } elseif {$k == "image"} { + set r -200 + } + } + } else { + set r -4 + } + } + + set r +} {3} + +# Test: srcwin-4.3 +# Desc: Test BP balloons +gdbtk_test srcwin-4.3 "BP Balloons" { + # move pointer out of the way + warp_pointer . 0 0 + set r 0 + gdb_immediate "break 10" 1 + gdb_immediate "tbreak 10" 1 + + set twin [$stw test_get twin] + + # check for BROWSE_TAG and BP image on correct line + if {$r == 0} { + if {![catch {set z [$twin dump 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "PC_TAG"} { + if {$i == "8.2"} { + incr r + } else { + incr r 5 + } + } + if {$v == "STACK_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } elseif {$k == "image"} { + if {$i == "10.0"} { + incr r + # we found the bp image, now we will test the bp balloon messages + set balloon [winfo toplevel [namespace tail $srcwin]].__balloon + # shouldn't be mapped yet + if {[winfo ismapped $balloon]} { + set r -3000 + break + } + move_mouse_to $twin [$twin bbox $i] + #wait a second for the balloon message to appear + sleep 1 + if {![winfo ismapped $balloon]} { + set r -4000 + break + } + # read the contents of the balloon and parse it into lines + set a [split [$balloon.label cget -text] \n] + set i 0 + # foreach line parse it and check the type and make sure it is enabled + foreach line $a { + if {[lindex $line 0] == "breakpoint"} {continue} + incr i + set enabled [lindex $line 0] + set bptype [lindex $line 2] + switch $i { + 1 { + if {$bptype != "donttouch"} {set r -1000} + } + 2 { + if {$bptype != "delete"} {set r -2000} + } + } + } + } else { + set r -200 + } + } + } + } else { + set r -4 + } + } + set r +} {2} + +#ManagedWin::open DebugWin + +# Test: srcwin-4.4 +# Desc: Click on line to set BP +gdbtk_test srcwin-4.4 "Click on line to set BP" { + set r 0 + + # click mouse button 1 at index 14.1 + if {![click $twin [$twin bbox 14.1] <Button-1>]} { + set r "Click failed on line 14.1" + } else { + + # now look for BP at line 14 + foreach bpnum [gdb_get_breakpoint_list] { + set bpinfo [gdb_get_breakpoint_info $bpnum] + lassign $bpinfo file func line pc type enabled disposition \ + ignore_count commands cond thread hit_count + set file [lindex [file split $file] end] + if {$file == "list0.h"} { + if {$line == "14"} { + if {$enabled == "1"} {incr r} + if {$func == "foo"} {incr r} + if {$type == "breakpoint"} {incr r} + if {$disposition == "donttouch"} {incr r} + } + } + } + } + set r +} {4} + + +# Test: srcwin-4.5 +# Desc: Continue till here popup +gdbtk_test srcwin-4.5 "Continue till here popup" { + set r + set twin [$stw test_get twin] + + # click mouse button 1 at index 12.1 + set b [$twin bbox 12.1] + if {![click $twin $b <ButtonPress-3>]} { + set r "Click failed on $b" + } else { + + # Hack. Just release the botton 10 pixels to the right and below + # where the press was. This should select the first entry in the + # popup menu, "Continue to Here". This should be made more robust. + if {[llength $b] == 4} { + set x [expr [lindex $b 0] + [lindex $b 2] / 2 + 10] + set y [expr [lindex $b 1] + [lindex $b 3] / 2 + 10] + if {![click $twin [list $x $y 0 0] <ButtonRelease-3>]} { + set r "Click failed at $x $y" + } else { + + # check for PC_TAG on the correct line + if {$r == 0} { + if {![catch {set z [$twin dump 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "PC_TAG"} { + if {$i == "12.2"} { + incr r + } else { + incr r 5 + } + } + if {$v == "STACK_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } elseif {$k == "image"} { + switch $i { + 10.0 {incr r} + 12.0 {incr r} + 14.0 {incr r} + default {incr r 1000} + } + } + } + } else { + set r -4 + } + } + } + } else { + set r "Line 12.1 was not visible..." + } + # should have seen on PC_TAG at line 12, plus BP images at 10.0, 12.0 and 14.0 + } + set r +} {4} + +# 5.1 balloon variables +# Test: srcwin-5.1 +# Desc: variable balloon test +# continues to BP at line 14 and checks to see that value was updated +gdbtk_test srcwin-5.1 "variable balloon test" { + # move pointer out of the way + warp_pointer . 0 0 + set r 0 + set twin [$stw test_get twin] + + # move pointer to variable "x" and check balloon + set index [string first "x++" [$twin get 10.0 10.end]] + move_mouse_to $twin [$twin bbox 10.$index] + sleep 1 + if {[winfo ismapped $balloon]} { + if {![string compare "x=6" [$balloon.label cget -text]]} {incr r} + gdb_immediate "continue" 1 + if {![string compare "x=8" [$balloon.label cget -text]]} {incr r} + } else { + set r -1 + } + + set r +} {2} + +# 6.1 mixed mode disassembly of include file +# Test: srcwin-6.1 +# Desc: Some versions of GDBtk can't do mixed-mode disassembly of a function +# that is in an include file. +gdbtk_test srcwin-6.1 "mixed mode disassembly of include file" { + set r 0 + $srcwin mode "" MIXED + + # check contents of name and function comboboxes + set name [$statbar.name get] + set func [$statbar.func get] + if {$name != "list0.h"} {set r -1} + if {$func != "foo"} {set r -2} + + # check contents of source window + set twin [$stw test_get twin] + set text [$twin get 1.0 end] + # Is it correct? I don't know. Guess we look for some pieces of source... + if {[string first "static void" $text] != -1 && + [string first "foo (x)" $text] != -1 && + [string first "bar (x++);" $text] != -1} { + set r 1 + } + + set r +} {1} + +gdbtk_test_done + +# Local variables: +# mode: tcl +# change-log-default-name: "ChangeLog-gdbtk" +# End: diff --git a/gdb/testsuite/gdb.gdbtk/srcwin2.test b/gdb/testsuite/gdb.gdbtk/srcwin2.test new file mode 100644 index 00000000000..395ce0b3138 --- /dev/null +++ b/gdb/testsuite/gdb.gdbtk/srcwin2.test @@ -0,0 +1,906 @@ +# Copyright (C) 1999 Cygnus Solutions +# +# 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. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# This file was written by Martin Hunt (hunt@cygnus.com) + + +# same as srcwin.test, except test debugging executables +# when source files are missing. + +# Read in the standard defs file + +if {![gdbtk_read_defs]} { + break +} + +global objdir srcdir + +##### ##### +# # +# SECTION 1: Mode Tests # +# # +##### ##### + +# Load the test executable +if {$tcl_platform(platform) == "windows"} { + set file [file join $objdir list.exe] +} else { + set file [file join $objdir list] +} + +# This isn't a test case, since if this fails, we're hosed. +if {[catch {gdb_cmd "file $file" 1} t]} { + # an error occured loading the file + gdbtk_test_error "loading \"$file\": $t" +} + +set srcwin [ManagedWin::open SrcWin] +set stw [$srcwin test_get twin] +set twin [$stw test_get twin] +set statbar [$srcwin test_get _statbar] + +# get things started +gdb_cmd "break main" +run_executable + +# Test: srcwin2-1.1 +# Desc: Check for something in source window +gdbtk_test srcwin2-1.1 "source window has contents" { + set r 0 + set file1(source) [$twin get 1.0 end] + if {$file1(source) == ""} {set r -1} + if {[$statbar.mode get] != "ASSEMBLY"} {set r -2} + set r +} {0} + +# Test: srcwin2-1.2 +# Desc: source->assembly mode change +gdbtk_test srcwin2-1.2 "source->assembly mode change" { + $srcwin mode "" ASSEMBLY + set twin [$stw test_get twin] + set file1(assembly) [$twin get 1.0 end] + # source == assembly because for there is no source + string compare $file1(source) $file1(assembly) +} {0} + +# Test: srcwin2-1.3 +# Desc: assembly->mixed mode change +gdbtk_test srcwin2-1.3 "assembly->mixed mode change" { + set r 0 + $srcwin mode "" MIXED + set twin [$stw test_get twin] + set file1(mixed) [$twin get 1.0 end] + # mixed != assembly because the lines with source should + # be noted, even if source in unavailable. + if {$file1(mixed) == $file1(assembly)} {set r -1} + if {[$statbar.mode get] != "MIXED"} {set r -2} + set r +} {0} + +# Test: srcwin2-1.4 +# Desc: mixed->src+asm mode change +gdbtk_test srcwin2-1.4 "mixed->src+asm mode change" { + set r 0 + # mode change may fail if fallover to ASSEMBLY fails + if {[catch {$srcwin mode "" SRC+ASM}]} { set r -5 } + set twin [$stw test_get twin] + if {[$twin get 1.0 end] != $file1(assembly)} {set r -1} + if {[$statbar.mode get] != "ASSEMBLY"} {set r -2} + set r +} {0} + +# Test: srcwin2-1.5 +# Desc: src+asm->source mode change +gdbtk_test srcwin2-1.5 "src+asm->source mode change" { + set r 0 + $srcwin mode "" SOURCE + set twin [$stw test_get twin] + if {[$stw test_get bwin] != ""} {set r -2} + if {[$twin get 1.0 end] != $file1(assembly)} {set r -1} + if {[$statbar.mode get] != "ASSEMBLY"} {set r -3} + set r +} {0} + +# Test: srcwin2-1.6 +# Desc: source->mixed mode change +gdbtk_test srcwin2-1.6 "source->mixed mode change" { + set r 0 + $srcwin mode "" MIXED + set twin [$stw test_get twin] + if {[$twin get 1.0 end] != $file1(mixed)} {set r -1} + if {[$statbar.mode get] != "MIXED"} {set r -2} + set r +} {0} + +# Test: srcwin2-1.7 +# Desc: mixed->source mode change +gdbtk_test srcwin2-1.7 "mixed->source mode change" { + set r 0 + $srcwin mode "" SOURCE + set twin [$stw test_get twin] + if {[$twin get 1.0 end] != $file1(source)} {set r -1} + if {[$statbar.mode get] != "ASSEMBLY"} {set r -2} + set r +} {0} + +# Test: srcwin2-1.8 +# Desc: source->src+asm mode change +gdbtk_test srcwin2-1.8 "source->src+asm mode change" { + set r 0 + # mode change may fail if fallover to ASSEMBLY fails + if {[catch {$srcwin mode "" SRC+ASM}]} { set r -5 } + set twin [$stw test_get twin] + set bwin [$stw test_get bwin] + if {[$twin get 1.0 end] != $file1(assembly)} {set r -1} + if {$bwin != ""} {set r -2} + if {[$statbar.mode get] != "ASSEMBLY"} {set r -3} + set r +} {0} + +# Test: srcwin2-1.9 +# Desc: src+asm->assembly mode change +gdbtk_test srcwin2-1.9 "src+asm->assembly mode change" { + set r 0 + $srcwin mode "" ASSEMBLY + set twin [$stw test_get twin] + if {[$twin get 1.0 end] != $file1(assembly)} {set r -1} + if {[$statbar.mode get] != "ASSEMBLY"} {set r -2} + set r +} {0} + +# Test: srcwin2-1.10 +# Desc: assembly->src+asm mode change +gdbtk_test srcwin2-1.10 "assembly->src+asm mode change" { + set r 0 + # mode change may fail if fallover to ASSEMBLY fails + if {[catch {$srcwin mode "" SRC+ASM}]} { set r -5 } + set twin [$stw test_get twin] + set bwin [$stw test_get bwin] + if {[$twin get 1.0 end] != $file1(assembly)} {set r -1} + if {$bwin != ""} {set r -2} + if {[$statbar.mode get] != "ASSEMBLY"} {set r -3} + set r +} {0} + +# Test: srcwin2-1.11 +# Desc: src+asm->mixed mode change +gdbtk_test srcwin2-1.11 "src+asm->mixed mode change" { + set r 0 + $srcwin mode "" MIXED + set twin [$stw test_get twin] + if {[$twin get 1.0 end] != $file1(mixed)} {set r -1} + if {[$statbar.mode get] != "MIXED"} {set r -2} + set r +} {0} + +# Test: srcwin2-1.12 +# Desc: mixed->assembly mode change +gdbtk_test srcwin2-1.12 "mixed->assembly mode change" { + set r 0 + $srcwin mode "" ASSEMBLY + set twin [$stw test_get twin] + if {[$twin get 1.0 end] != $file1(assembly)} {set r -1} + if {[$statbar.mode get] != "ASSEMBLY"} {set r -2} + set r +} {0} + +# Test: srcwin2-1.13 +# Desc: assembly->source mode change +gdbtk_test srcwin2-1.13 "assembly->source mode change" { + set r 0 + $srcwin mode "" SOURCE + set twin [$stw test_get twin] + if {[$twin get 1.0 end] != $file1(source)} {set r -1} + if {[$statbar.mode get] != "ASSEMBLY"} {set r -2} + set r +} {0} + + +##### ##### +# # +# SECTION 2: Basic Operations # +# # +##### ##### + +# Test: srcwin2-2.1 +# Desc: check contents of filename combobox +gdbtk_test srcwin2-2.1 "check contents of filename combobox" { + set names [$statbar.name listget 0 end] + set r 0 + foreach f {list0.c list1.c list0.h} { + if {[lsearch $names $f] != -1} { + incr r + } + } + set r +} {3} + +# Test: srcwin2-2.2 +# Desc: check contents of function combobox +gdbtk_test srcwin2-2.2 "check contents of function combobox" { + set names [$statbar.func listget 0 end] + set r 0 + foreach f {main foo unused} { + if {[lsearch $names $f] != -1} { + incr r + } + } + set r +} {3} + +# Test: srcwin2-2.3 +# Desc: goto filename +gdbtk_test srcwin2-2.3 "goto filename" { + set func [$srcwin test_get _name 1] + $func "" list1.c + set twin [$stw test_get twin] + set file2(source) [$twin get 1.0 end] + expr {![string compare $file1(source) $file2(source)]} +} {0} + +# Test: srcwin2-2.4 +# Desc: check contents of function combobox +gdbtk_test srcwin2-2.4 "check contents of function combobox" { + set names [$statbar.func listget 0 end] + set r 0 + foreach f {bar long_line oof unused} { + if {[lsearch $names $f] != -1} { + incr r + } + } + set r +} {4} + +# Test: srcwin2-2.5 +# Desc: function combobox entry field should be empty after switching to a new file +gdbtk_test srcwin2-2.5 "function combobox entry field should be empty" { + set names [$statbar.func get] + string length $names +} {0} + +# Test: srcwin2-2.6 +# Desc: goto function +gdbtk_test srcwin2-2.6 "goto function bar" { + $srcwin goto_func "" bar + set r 0 + + # now get a dump of all tags and check that only one line is + # marked BROWSE_TAG and no lines are STACK_TAG or PC_TAG. + + # We know that list1.c should have BROWSE_TAG set at index 5.2 + # for function "bar". If list1.c is changed or the layout of the source + # window is changed, this must be updated. + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "BROWSE_TAG"} { + if {$i == "5.2"} { + incr r + } else { + incr r 5 + } + } + if {$v == "STACK_TAG"} { incr r 10} + if {$v == "PC_TAG"} { incr r 100} + } + } + } else { + set r -1 + } + + if {$r == 1} { + # things are OK so far, so just verify the function name is displayed + # in the combobox entry field. + set names [$statbar.func get] + if {[string compare $names "bar"]} {set r -2} + } + set r +} {1} + +# Test: srcwin2-2.7 +# Desc: goto function "oof". This tests that the correct line is highlighted +# with BROWSE_TAG and no other lines are highlighted. It also checks that +# the combobox has the correct function name in it. Finally, list1.c +# has an extremely long line, line 32, that breaks some functions. We verify +# that the GDBtk has the correct line number. + +gdbtk_test srcwin2-2.7 "goto function oof" { + $srcwin goto_func "" oof + set r 0 + + # now get a dump of all tags and check that only one line is + # marked BROWSE_TAG and no lines are STACK_TAG or PC_TAG. + + # We know that list1.c should have BROWSE_TAG set at index 32.2 + # for function "oof". If list1.c is changed or the layout of the source + # window is changed, this must be updated. + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "BROWSE_TAG"} { + if {$i == "32.2"} { + set line_number [$twin get "$i wordstart" "$i wordend"] + if {$line_number == "32"} { + incr r + } else { + incr r -100 + } + } else { + incr r 5 + } + } + if {$v == "STACK_TAG"} {incr r 10} + if {$v == "PC_TAG"} {incr r 100} + } + } + } else { + set r -1 + } + + if {$r == 1} { + # things are OK so far, so just verify the function name is displayed + # in the combobox entry field. + set names [$statbar.func get] + if {[string compare $names "oof"]} {set r -2} + } + set r +} {1} + +# Test: srcwin2-2.8 +# Desc: This test issues a next command while browsing list1.c. +# It should display list0.c and highlight the correct line. +gdbtk_test srcwin2-2.8 "step while browsing" { + gdb_immediate "next" 1 + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != "list0.c"} {set r -1} + if {$func != "main"} {set r -2} + + # check that correct file is displayed + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + if {[string compare $file1(source) $a]} {set r -3} + + # check for PC_TAG + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "PC_TAG"} { + incr r + } + if {$v == "STACK_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {1} + +# Test: srcwin2-2.11 +# Desc: This test issues a break and a continue +gdbtk_test srcwin2-2.11 "set BP and continue" { + gdb_immediate "break oof" 1 + gdb_immediate "continue" 1 + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != "list1.c"} {set r -1} + if {$func != "oof"} {set r -2} + + # check that the correct file is displayed + # we must clear the breakpoint first so it doesn't mess up the + # comparison... + gdb_immediate "clear oof" 1 + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + if {[string compare $file2(source) $a]} {set r -3} + + # check for PC_TAG on correct line + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "PC_TAG"} { + if {$i == "32.2"} { + incr r + } else { + incr r 5 + } + } + if {$v == "STACK_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {1} + +##### ##### +# # +# SECTION 3: Stack Operations # +# # +##### ##### + +# Test: srcwin2-3.1 +# Desc: This tests "stack up" +gdbtk_test srcwin2-3.1 "stack up (1)" { + $srcwin stack up + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != "list1.c"} {set r -1} + if {$func != "long_line"} {set r -2} + + # check that the correct file is displayed + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + if {[string compare $file2(source) $a]} {set r -3} + + # check for PC_TAG and STACK_TAG on correct lines + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "PC_TAG"} { + if {$i == "32.2"} { + incr r + } else { + incr r 5 + } + } + if {$v == "STACK_TAG"} { + if {$i == "22.2"} { + incr r + } else { + incr r 10 + } + } + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {2} + +# Test: srcwin2-3.2 +# Desc: Another "stack up" test +gdbtk_test srcwin2-3.2 "stack up (2)" { + $srcwin stack up + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != "list1.c"} {set r -1} + if {$func != "bar"} {set r -2} + + # check that the correct file is displayed + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + if {[string compare $file2(source) $a]} {set r -3} + + # check for PC_TAG and STACK_TAG on correct lines + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "PC_TAG"} { + if {$i == "32.2"} { + incr r + } else { + incr r 5 + } + } + if {$v == "STACK_TAG"} { + if {$i == "7.2"} { + incr r + } else { + incr r 10 + } + } + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {2} + +# Test: srcwin2-3.3 +# Desc: Another "stack up" test +gdbtk_test srcwin2-3.3 "stack up (3)" { + $srcwin stack up + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != "list0.h"} {set r -1} + if {$func != "foo"} {set r -2} + + # check that the correct file is displayed + set twin [$stw test_get twin] + set file3(source) [$twin get 1.0 end] + if {![string compare $file2(source) $file3(source)]} {set r -3} + + # check for PC_TAG and STACK_TAG on correct lines + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "STACK_TAG"} { + if {$i == "8.2"} { + incr r + } else { + incr r 5 + } + } + if {$v == "PC_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {1} + +# Test: srcwin2-3.4 +# Desc: Another "stack up" test +gdbtk_test srcwin2-3.4 "stack up (4)" { + $srcwin stack up + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != "list0.c"} {set r -1} + if {$func != "main"} {set r -2} + + # check that the correct file is displayed + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + if {[string compare $file1(source) $a]} {set r -3} + + # check for STACK_TAG + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "STACK_TAG"} { + incr r + } + if {$v == "PC_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {1} + +# Test: srcwin2-3.5 +# Desc: "stack up" when we are at the top +gdbtk_test srcwin2-3.5 "stack up when at the top" { + $srcwin stack up + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != "list0.c"} {set r -1} + if {$func != "main"} {set r -2} + + # check that the correct file is displayed + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + if {[string compare $file1(source) $a]} {set r -3} + + # check for STACK_TAG + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "STACK_TAG"} { + incr r + } + if {$v == "PC_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {1} + +# Test: srcwin2-3.6 +# Desc: "stack down" test +gdbtk_test srcwin2-3.6 "stack down" { + $srcwin stack down + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != "list0.h"} {set r -1} + if {$func != "foo"} {set r -2} + + # check that the correct file is displayed + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + if {![string compare $file2(source) $a]} {set r -3} + + # check for PC_TAG and STACK_TAG on correct lines + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "STACK_TAG"} { + if {$i == "8.2"} { + incr r + } else { + incr r 5 + } + } + if {$v == "PC_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {1} + +# Test: srcwin2-3.7 +# Desc: "stack bottom" test +gdbtk_test srcwin2-3.7 "stack bottom" { + $srcwin stack bottom + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != "list1.c"} {set r -1} + if {$func != "oof"} {set r -2} + + # check that the correct file is displayed + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + if {[string compare $file2(source) $a]} {set r -3} + + # check for PC_TAG on correct line + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "PC_TAG"} { + if {$i == "32.2"} { + incr r + } else { + incr r 5 + } + } + if {$v == "STACK_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {1} + +# Test: srcwin2-3.8 +# Desc: "stack down" when at bottom +gdbtk_test srcwin2-3.8 "stack down when at bottom" { + $srcwin stack down + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != "list1.c"} {set r -1} + if {$func != "oof"} {set r -2} + + # check that the correct file is displayed + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + if {[string compare $file2(source) $a]} {set r -3} + + # check for PC_TAG on correct line + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "PC_TAG"} { + if {$i == "32.2"} { + incr r + } else { + incr r 5 + } + } + if {$v == "STACK_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {1} + +# 4.1 bp, multiple, balloon, etc + +# Test: srcwin2-4.1 +# Desc: Set BP in another file. Tests bp and cache functions +gdbtk_test srcwin2-4.1 "set BP in another file" { + gdb_immediate "break foo" 1 + $srcwin goto_func "" foo + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != "list0.h"} {set r -1} + if {$func != "foo"} {set r -2} + + set twin [$stw test_get twin] + + # check for BROWSE_TAG and BP image on correct line + if {$r == 0} { + if {![catch {set z [$twin dump 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "BROWSE_TAG"} { + if {$i == "8.2"} { + incr r + } else { + incr r 5 + } + } + if {$v == "STACK_TAG"} {incr r 10} + if {$v == "PC_TAG"} {incr r 100} + } elseif {$k == "image"} { + if {$i == "8.0"} { + incr r + } else { + set r -200 + } + } + } + } else { + set r -4 + } + } + + if {$r == 2} { + # clear BP and compare with previous contents. This should succeed, + gdb_immediate "clear foo" 1 + set a [$twin get 1.0 end] + if {[string compare $file3(source) $a]} {set r -3} + } + + set r +} {2} + +# Test: srcwin2-4.2 +# Desc: Test temporary BP +gdbtk_test srcwin2-4.2 "temporary BP" { + set r 0 + if {[catch {gdb_immediate "tbreak foo" 1} msg]} { + set r -500 + } + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != "list0.h"} {set r -1} + if {$func != "foo"} {set r -2} + + set twin [$stw test_get twin] + + # check for BROWSE_TAG and BP image on correct line + if {$r == 0} { + if {![catch {set z [$twin dump 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "BROWSE_TAG"} { + if {$i == "8.2"} { + incr r + } else { + incr r 5 + } + } + if {$v == "STACK_TAG"} {incr r 10} + if {$v == "PC_TAG"} {incr r 100} + } elseif {$k == "image"} { + if {$i == "8.0"} { + incr r + } else { + set r -200 + } + } + } + } else { + set r -4 + } + } + + gdb_immediate "continue" 1 + + # now check for PC_TAG and no image + if {$r == 2} { + if {![catch {set z [$twin dump 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "PC_TAG"} { + if {$i == "8.2"} { + incr r + } else { + incr r 5 + } + } + if {$v == "STACK_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } elseif {$k == "image"} { + set r -200 + } + } + } else { + set r -4 + } + } + + set r +} {3} + +gdbtk_test_done + +# Local variables: +# mode: tcl +# change-log-default-name: "ChangeLog-gdbtk" +# End: diff --git a/gdb/testsuite/gdb.gdbtk/srcwin3.test b/gdb/testsuite/gdb.gdbtk/srcwin3.test new file mode 100644 index 00000000000..c329e9ca096 --- /dev/null +++ b/gdb/testsuite/gdb.gdbtk/srcwin3.test @@ -0,0 +1,798 @@ +# Copyright (C) 1999 Cygnus Solutions +# +# 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. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# This file was written by Martin Hunt (hunt@cygnus.com) + +########################################################### +# same as srcwin.test, except test debugging executables # +# build without "-g" # +########################################################### + +# Read in the standard defs file + +if {![gdbtk_read_defs]} { + break +} + +global objdir srcdir + +##### ##### +# # +# SECTION 1: Mode Tests # +# # +##### ##### + +# Load the test executable +if {$tcl_platform(platform) == "windows"} { + set file [file join $objdir list.exe] +} else { + set file [file join $objdir list] +} + +# This isn't a test case, since if this fails, we're hosed. +if {[catch {gdb_cmd "file $file" 1} t]} { + # an error occured loading the file + gdbtk_test_error "loading \"$file\": $t" +} + +set srcwin [ManagedWin::open SrcWin] +set stw [$srcwin test_get twin] +set twin [$stw test_get twin] +set statbar [$srcwin test_get _statbar] + +# get things started +gdb_cmd "break main" +run_executable + +# Test: srcwin3-1.1 +# Desc: Check for something in source window +gdbtk_test srcwin3-1.1 "source window has contents" { + set r 0 + set source(main) [$twin get 1.0 end] + if {$source(main) == ""} {set r -1} + if {[$statbar.mode get] != "ASSEMBLY"} {set r -2} + set r +} {0} + +# Test: srcwin3-1.2 +# Desc: source->assembly mode change +gdbtk_test srcwin3-1.2 "source->assembly mode change" { + set r 0 + $srcwin mode "" ASSEMBLY + set twin [$stw test_get twin] + if {$source(main) != [$twin get 1.0 end]} {set r -1} + if {[$statbar.mode get] != "ASSEMBLY"} {set r -2} + set r +} {0} + +# Test: srcwin3-1.3 +# Desc: assembly->mixed mode change +gdbtk_test srcwin3-1.3 "assembly->mixed mode change" { + set r 0 + $srcwin mode "" MIXED + set twin [$stw test_get twin] + if {$source(main) != [$twin get 1.0 end]} {set r -1} + if {[$statbar.mode get] != "MIXED"} {set r -2} + set r +} {0} + +# Test: srcwin3-1.4 +# Desc: mixed->src+asm mode change +gdbtk_test srcwin3-1.4 "mixed->src+asm mode change" { + set r 0 + # mode change may fail if fallover to ASSEMBLY fails + if {[catch {$srcwin mode "" SRC+ASM}]} { set r -5 } + set twin [$stw test_get twin] + if {[$twin get 1.0 end] != $source(main)} {set r -1} + if {[$statbar.mode get] != "ASSEMBLY"} {set r -2} + set r +} {0} + +# Test: srcwin3-1.5 +# Desc: src+asm->source mode change +gdbtk_test srcwin3-1.5 "src+asm->source mode change" { + set r 0 + $srcwin mode "" SOURCE + set twin [$stw test_get twin] + if {[$stw test_get bwin] != ""} {set r -2} + if {[$twin get 1.0 end] != $source(main)} {set r -1} + if {[$statbar.mode get] != "ASSEMBLY"} {set r -3} + set r +} {0} + +# Test: srcwin3-1.6 +# Desc: source->mixed mode change +gdbtk_test srcwin3-1.6 "source->mixed mode change" { + set r 0 + $srcwin mode "" MIXED + set twin [$stw test_get twin] + if {[$twin get 1.0 end] != $source(main)} {set r -1} + if {[$statbar.mode get] != "MIXED"} {set r -2} + set r +} {0} + +# Test: srcwin3-1.7 +# Desc: mixed->source mode change +gdbtk_test srcwin3-1.7 "mixed->source mode change" { + set r 0 + $srcwin mode "" SOURCE + set twin [$stw test_get twin] + if {[$twin get 1.0 end] != $source(main)} {set r -1} + if {[$statbar.mode get] != "ASSEMBLY"} {set r -2} + set r +} {0} + +# Test: srcwin3-1.8 +# Desc: source->src+asm mode change +gdbtk_test srcwin3-1.8 "source->src+asm mode change" { + set r 0 + # mode change may fail if fallover to ASSEMBLY fails + if {[catch {$srcwin mode "" SRC+ASM}]} { set r -5 } + set twin [$stw test_get twin] + set bwin [$stw test_get bwin] + if {[$twin get 1.0 end] != $source(main)} {set r -1} + if {$bwin != ""} {set r -2} + if {[$statbar.mode get] != "ASSEMBLY"} {set r -3} + set r +} {0} + +# Test: srcwin3-1.9 +# Desc: src+asm->assembly mode change +gdbtk_test srcwin3-1.9 "src+asm->assembly mode change" { + set r 0 + $srcwin mode "" ASSEMBLY + set twin [$stw test_get twin] + if {[$twin get 1.0 end] != $source(main)} {set r -1} + if {[$statbar.mode get] != "ASSEMBLY"} {set r -2} + set r +} {0} + +# Test: srcwin3-1.10 +# Desc: assembly->src+asm mode change +gdbtk_test srcwin3-1.10 "assembly->src+asm mode change" { + set r 0 + # mode change may fail if fallover to ASSEMBLY fails + if {[catch {$srcwin mode "" SRC+ASM}]} { set r -5 } + set twin [$stw test_get twin] + set bwin [$stw test_get bwin] + if {[$twin get 1.0 end] != $source(main)} {set r -1} + if {$bwin != ""} {set r -2} + if {[$statbar.mode get] != "ASSEMBLY"} {set r -3} + set r +} {0} + +# Test: srcwin3-1.11 +# Desc: src+asm->mixed mode change +gdbtk_test srcwin3-1.11 "src+asm->mixed mode change" { + set r 0 + $srcwin mode "" MIXED + set twin [$stw test_get twin] + if {[$twin get 1.0 end] != $source(main)} {set r -1} + if {[$statbar.mode get] != "MIXED"} {set r -2} + set r +} {0} + +# Test: srcwin3-1.12 +# Desc: mixed->assembly mode change +gdbtk_test srcwin3-1.12 "mixed->assembly mode change" { + set r 0 + $srcwin mode "" ASSEMBLY + set twin [$stw test_get twin] + if {[$twin get 1.0 end] != $source(main)} {set r -1} + if {[$statbar.mode get] != "ASSEMBLY"} {set r -2} + set r +} {0} + +# Test: srcwin3-1.13 +# Desc: assembly->source mode change +gdbtk_test srcwin3-1.13 "assembly->source mode change" { + set r 0 + $srcwin mode "" SOURCE + set twin [$stw test_get twin] + if {[$twin get 1.0 end] != $source(main)} {set r -1} + if {[$statbar.mode get] != "ASSEMBLY"} {set r -2} + set r +} {0} + + +##### ##### +# # +# SECTION 2: Basic Operations # +# # +##### ##### + +# Test: srcwin3-2.2 +# Desc: check contents of function combobox +# There won't be any because we have no debug info +gdbtk_test srcwin3-2.2 "check contents of function combobox" { + set names [$statbar.func listget 0 end] + llength $names +} {0} + +# Test: srcwin3-2.3 +# Desc: goto filename - this won't work, but should leave things as they were +gdbtk_test srcwin3-2.3 "goto filename" { + set func [$srcwin test_get _name 1] + $func "" list1.c + set twin [$stw test_get twin] + string compare $source(main) [$twin get 1.0 end] +} {0} + +# Test: srcwin3-2.6 +# Desc: goto function +gdbtk_test srcwin3-2.6 "goto function bar" { + $srcwin goto_func "" bar + set r 0 + set twin [$stw test_get twin] + set source(bar) [$twin get 1.0 end] + + if {$source(bar) == $source(main)} {set r -1000} + + # now get a dump of all tags and check that only one line is + # marked BROWSE_TAG and no lines are STACK_TAG or PC_TAG. + + # We know that list1.c should have BROWSE_TAG set at index 5.2 + # for function "bar". If list1.c is changed or the layout of the source + # window is changed, this must be updated. + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "BROWSE_TAG"} { + incr r + } + if {$v == "STACK_TAG"} { incr r 10} + if {$v == "PC_TAG"} { incr r 100} + } + } + } else { + set r -1 + } + + if {$r == 1} { + # things are OK so far, so just verify the function name is displayed + # in the combobox entry field. + set names [$statbar.func get] + if {[string compare $names "bar"]} {set r -2} + } + set r +} {1} + +# Test: srcwin3-2.7 +# Desc: goto function "oof". This tests that the correct line is highlighted +# with BROWSE_TAG and no other lines are highlighted. It also checks that +# the combobox has the correct function name in it. + +gdbtk_test srcwin3-2.7 "goto function oof" { + $srcwin goto_func "" oof + set r 0 + + set twin [$stw test_get twin] + set source(oof) [$twin get 1.0 end] + + if {$source(bar) == $source(oof)} {set r -1000} + if {$source(oof) == $source(main)} {set r -2000} + + # now get a dump of all tags and check that only one line is + # marked BROWSE_TAG and no lines are STACK_TAG or PC_TAG. + + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "BROWSE_TAG"} { + incr r + } + if {$v == "STACK_TAG"} {incr r 10} + if {$v == "PC_TAG"} {incr r 100} + } + } + } else { + set r -1 + } + + if {$r == 1} { + # things are OK so far, so just verify the function name is displayed + # in the combobox entry field. + set names [$statbar.func get] + if {[string compare $names "oof"]} {set r -2} + } + set r +} {1} + +# Test: srcwin3-2.8 +# Desc: This test issues a nexti command while browsing oof. +# It should jump back to main +gdbtk_test srcwin3-2.8 "nexti while browsing" { + gdb_immediate "nexti" 1 + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of function combobox + if {$func != "main"} {set r -2} + if {$name != ""} {set r -1} + + # check that correct file is displayed + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + if {[string compare $source(main) $a]} {set r -3} + + # check for PC_TAG + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "PC_TAG"} { + incr r + } + if {$v == "STACK_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {1} + +# Test: srcwin3-2.11 +# Desc: This test issues a break and a continue +gdbtk_test srcwin3-2.11 "set BP and continue" { + gdb_immediate "break oof" 1 + gdb_immediate "continue" 1 + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != ""} {set r -1} + if {$func != "oof"} {set r -2} + + # check that the correct file is displayed + # we must clear the breakpoint first so it doesn't mess up the + # comparison... + gdb_immediate "clear oof" 1 + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + if {[string compare $source(oof) $a]} {set r -3} + + # check for PC_TAG + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "PC_TAG"} { + incr r + } + if {$v == "STACK_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {1} + +##### ##### +# # +# SECTION 3: Stack Operations # +# # +##### ##### + +# Test: srcwin3-3.1 +# Desc: This tests "stack up" +gdbtk_test srcwin3-3.1 "stack up (1)" { + $srcwin stack up + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != ""} {set r -1} + if {$func != "long_line"} {set r -2} + + # check that the correct file is displayed + set twin [$stw test_get twin] + set source(long_line) [$twin get 1.0 end] + if {![string compare $source(long_line) $source(oof)]} {set r -3} + + # check for PC_TAG and STACK_TAG on correct lines + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "PC_TAG"} {incr r 5} + if {$v == "STACK_TAG"} {incr r} + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {1} + +# Test: srcwin3-3.2 +# Desc: Another "stack up" test +gdbtk_test srcwin3-3.2 "stack up (2)" { + $srcwin stack up + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != ""} {set r -1} + if {$func != "bar"} {set r -2} + + # check that the correct file is displayed + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + if {[string compare $source(bar) $a]} {set r -3} + + # check for PC_TAG and STACK_TAG on correct lines + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "PC_TAG"} { + set r -100 + } + if {$v == "STACK_TAG"} { + incr r + } + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {1} + +# Test: srcwin3-3.3 +# Desc: Another "stack up" test +gdbtk_test srcwin3-3.3 "stack up (3)" { + $srcwin stack up + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != ""} {set r -1} + if {$func != "foo"} {set r -2} + + # check that the correct file is displayed + set twin [$stw test_get twin] + set source(foo) [$twin get 1.0 end] + if {![string compare $source(foo) $source(bar)]} {set r -3} + + # check for PC_TAG and STACK_TAG on correct lines + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "STACK_TAG"} { + incr r + } + if {$v == "PC_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {1} + +# Test: srcwin3-3.4 +# Desc: Another "stack up" test +gdbtk_test srcwin3-3.4 "stack up (4)" { + $srcwin stack up + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != ""} {set r -1} + if {$func != "main"} {set r -2} + + # check that the correct file is displayed + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + if {[string compare $source(main) $a]} {set r -3} + + # check for STACK_TAG + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "STACK_TAG"} { + incr r + } + if {$v == "PC_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {1} + +# Test: srcwin3-3.5 +# Desc: "stack up" when we are at the top +gdbtk_test srcwin3-3.5 "stack up when at the top" { + $srcwin stack up + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != ""} {set r -1} + if {$func != "main"} {set r -2} + + # check that the correct file is displayed + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + if {[string compare $source(main) $a]} {set r -3} + + # check for STACK_TAG + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "STACK_TAG"} { + incr r + } + if {$v == "PC_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {1} + +# Test: srcwin3-3.6 +# Desc: "stack down" test +gdbtk_test srcwin3-3.6 "stack down" { + $srcwin stack down + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != ""} {set r -1} + if {$func != "foo"} {set r -2} + + # check that the correct file is displayed + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + if {[string compare $source(foo) $a]} {set r -3} + + # check for PC_TAG and STACK_TAG on correct lines + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "STACK_TAG"} { + incr r + } + if {$v == "PC_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {1} + +# Test: srcwin3-3.7 +# Desc: "stack bottom" test +gdbtk_test srcwin3-3.7 "stack bottom" { + $srcwin stack bottom + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != ""} {set r -1} + if {$func != "oof"} {set r -2} + + # check that the correct file is displayed + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + if {[string compare $source(oof) $a]} {set r -3} + + # check for PC_TAG on correct line + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "PC_TAG"} { + incr r + } + if {$v == "STACK_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {1} + +# Test: srcwin3-3.8 +# Desc: "stack down" when at bottom +gdbtk_test srcwin3-3.8 "stack down when at bottom" { + $srcwin stack down + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != ""} {set r -1} + if {$func != "oof"} {set r -2} + + # check that the correct file is displayed + set twin [$stw test_get twin] + set a [$twin get 1.0 end] + if {[string compare $source(oof) $a]} {set r -3} + + # check for PC_TAG on correct line + if {$r == 0} { + if {![catch {set z [$twin dump -tag 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "PC_TAG"} { + incr r + } + if {$v == "STACK_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } + } + } else { + set r -4 + } + } + set r +} {1} + +# 4.1 bp, multiple, balloon, etc + +# Test: srcwin3-4.1 +# Desc: Set BP in another file. Tests bp and cache functions +gdbtk_test srcwin3-4.1 "set BP in another file" { + gdb_immediate "break foo" 1 + $srcwin goto_func "" foo + set r 0 + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != ""} {set r -1} + if {$func != "foo"} {set r -2} + + set twin [$stw test_get twin] + + # check for BROWSE_TAG and BP image + if {$r == 0} { + if {![catch {set z [$twin dump 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "BROWSE_TAG"} { + incr r + } + if {$v == "STACK_TAG"} {incr r 10} + if {$v == "PC_TAG"} {incr r 100} + } elseif {$k == "image"} { + incr r + } + } + } else { + set r -4 + } + } + + if {$r == 2} { + # clear BP and compare with previous contents. This should succeed, + gdb_immediate "clear foo" 1 + set a [$twin get 1.0 end] + if {[string compare $source(foo) $a]} {set r -3} + } + + set r +} {2} + +# Test: srcwin3-4.2 +# Desc: Test temporary BP +gdbtk_test srcwin3-4.2 "temporary BP" { + set r 0 + if {[catch {gdb_immediate "tbreak foo" 1} msg]} { + set r -500 + } + set name [$statbar.name get] + set func [$statbar.func get] + + # check contents of name and function comboboxes + if {$name != ""} {set r -1} + if {$func != "foo"} {set r -2} + + set twin [$stw test_get twin] + + # check for BROWSE_TAG and BP image on correct line + if {$r == 0} { + if {![catch {set z [$twin dump 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "BROWSE_TAG"} { + incr r + } + if {$v == "STACK_TAG"} {incr r 10} + if {$v == "PC_TAG"} {incr r 100} + } elseif {$k == "image"} { + incr r + } + } + } else { + set r -4 + } + } + + gdb_immediate "continue" 1 + + # now check for PC_TAG and no image + if {$r == 2} { + if {![catch {set z [$twin dump 1.0 end]}]} { + foreach {k v i} $z { + if {$k == "tagon"} { + if {$v == "PC_TAG"} { + incr r + } + if {$v == "STACK_TAG"} {incr r 10} + if {$v == "BROWSE_TAG"} {incr r 100} + } elseif {$k == "image"} { + set r -200 + } + } + } else { + set r -4 + } + } + + set r +} {3} + +gdbtk_test_done + +# Local variables: +# mode: tcl +# change-log-default-name: "ChangeLog-gdbtk" +# End: diff --git a/gdb/testsuite/gdb.gdbtk/stack1.c b/gdb/testsuite/gdb.gdbtk/stack1.c new file mode 100644 index 00000000000..389260a22a5 --- /dev/null +++ b/gdb/testsuite/gdb.gdbtk/stack1.c @@ -0,0 +1,231 @@ +/* Functions defined in other files */ +extern void extern_func1_1 (int a, char *b, unsigned long c); + +/* Functions defined in this file */ +static void static_func_1 (int a, char *b, unsigned long c); +static void static_func_2 (int a, char *b, unsigned long c); +static void static_func_3 (int a, char *b, unsigned long c); +static void static_func_4 (int a, char *b, unsigned long c); +static void static_func_5 (int a, char *b, unsigned long c); +static void static_func_6 (int a, char *b, unsigned long c); +static void static_func_7 (int a, char *b, unsigned long c); +static void static_func_8 (int a, char *b, unsigned long c); +static void static_func_9 (int a, char *b, unsigned long c); +static void static_func_10 (int a, char *b, unsigned long c); +static void static_func_11 (int a, char *b, unsigned long c); +static void static_func_12 (int a, char *b, unsigned long c); +static void static_func_13 (int a, char *b, unsigned long c); +static void static_func_14 (int a, char *b, unsigned long c); +static void static_func_15 (int a, char *b, unsigned long c); + +void func_1 (int a, char *b, unsigned long c); +void func_2 (int a, char *b, unsigned long c); +void func_3 (int a, char *b, unsigned long c); +void func_4 (int a, char *b, unsigned long c); +void func_5 (int a, char *b, unsigned long c); +void func_6 (int a, char *b, unsigned long c); +void func_7 (int a, char *b, unsigned long c); +void func_8 (int a, char *b, unsigned long c); +void func_9 (int a, char *b, unsigned long c); +void func_10 (int a, char *b, unsigned long c); +void func_11 (int a, char *b, unsigned long c); +void func_12 (int a, char *b, unsigned long c); +void func_13 (int a, char *b, unsigned long c); +void func_14 (int a, char *b, unsigned long c); +void func_15 (int a, char *b, unsigned long c); + +int +main (int argc, char *argv[]) +{ + int a; + char *b; + unsigned long c; + + a = 1; + b = "This is a string."; + c = 0xdeadL; + + func_1 (a, b, c); + + exit (0); +} + +void +func_1 (int a, char *b, unsigned long c) +{ + func_2 (a, b, c); +} + +void +func_2 (int a, char *b, unsigned long c) +{ + func_3 (a, b, c); +} + +void +func_3 (int a, char *b, unsigned long c) +{ + func_4 (a, b, c); +} + +void +func_4 (int a, char *b, unsigned long c) +{ + func_5 (a, b, c); +} + +void +func_5 (int a, char *b, unsigned long c) +{ + func_6 (a, b, c); +} + +void +func_6 (int a, char *b, unsigned long c) +{ + func_7 (a, b, c); +} + +void +func_7 (int a, char *b, unsigned long c) +{ + func_8 (a, b, c); +} + +void +func_8 (int a, char *b, unsigned long c) +{ + func_9 (a, b, c); +} + +void +func_9 (int a, char *b, unsigned long c) +{ + func_10 (a, b, c); +} + +void +func_10 (int a, char *b, unsigned long c) +{ + func_11 (a, b, c); +} + +void +func_11 (int a, char *b, unsigned long c) +{ + func_12 (a, b, c); +} + +void +func_12 (int a, char *b, unsigned long c) +{ + func_13 (a, b, c); +} + +void +func_13 (int a, char *b, unsigned long c) +{ + func_14 (a, b, c); +} + +void +func_14 (int a, char *b, unsigned long c) +{ + func_15 (a, b, c); +} + +void +func_15 (int a, char *b, unsigned long c) +{ + static_func_1 (a, b, c); +} + +static void +static_func_1 (int a, char *b, unsigned long c) +{ + static_func_2 (a, b, c); +} + +static void +static_func_2 (int a, char *b, unsigned long c) +{ + static_func_3 (a, b, c); +} + +static void +static_func_3 (int a, char *b, unsigned long c) +{ + static_func_4 (a, b, c); +} + +static void +static_func_4 (int a, char *b, unsigned long c) +{ + static_func_5 (a, b, c); +} + +static void +static_func_5 (int a, char *b, unsigned long c) +{ + static_func_6 (a, b, c); +} + +static void +static_func_6 (int a, char *b, unsigned long c) +{ + static_func_7 (a, b, c); +} + +static void +static_func_7 (int a, char *b, unsigned long c) +{ + static_func_8 (a, b, c); +} + +static void +static_func_8 (int a, char *b, unsigned long c) +{ + static_func_9 (a, b, c); +} + +static void +static_func_9 (int a, char *b, unsigned long c) +{ + static_func_10 (a, b, c); +} + +static void +static_func_10 (int a, char *b, unsigned long c) +{ + static_func_11 (a, b, c); +} + +static void +static_func_11 (int a, char *b, unsigned long c) +{ + static_func_12 (a, b, c); +} + +static void +static_func_12 (int a, char *b, unsigned long c) +{ + static_func_13 (a, b, c); +} + +static void +static_func_13 (int a, char *b, unsigned long c) +{ + static_func_14 (a, b, c); +} + +static void +static_func_14 (int a, char *b, unsigned long c) +{ + static_func_15 (a, b, c); +} + +static void +static_func_15 (int a, char *b, unsigned long c) +{ + extern_func1_1 (a, b, c); +} diff --git a/gdb/testsuite/gdb.gdbtk/stack2.c b/gdb/testsuite/gdb.gdbtk/stack2.c new file mode 100644 index 00000000000..db47c469e6e --- /dev/null +++ b/gdb/testsuite/gdb.gdbtk/stack2.c @@ -0,0 +1,107 @@ +/* Functions defined in this file */ +void extern_func1_1 (int, char *, unsigned long); +void extern_func1_2 (int, char *, unsigned long); +void extern_func1_3 (int, char *, unsigned long); +void extern_func1_4 (int, char *, unsigned long); +void extern_func1_5 (int, char *, unsigned long); +void extern_func1_6 (int, char *, unsigned long); +void extern_func1_7 (int, char *, unsigned long); +void extern_func1_8 (int, char *, unsigned long); +void extern_func1_9 (int, char *, unsigned long); +void extern_func1_10 (int, char *, unsigned long); +void extern_func1_11 (int, char *, unsigned long); +void extern_func1_12 (int, char *, unsigned long); +void extern_func1_13 (int, char *, unsigned long); +void extern_func1_14 (int, char *, unsigned long); +void extern_func1_15 (int, char *, unsigned long); + +void +extern_func1_1 (int a, char *b, unsigned long c) +{ + extern_func1_2 (a, b, c); +} + +void +extern_func1_2 (int a, char *b, unsigned long c) +{ + extern_func1_3 (a, b, c); +} + +void +extern_func1_3 (int a, char *b, unsigned long c) +{ + extern_func1_4 (a, b, c); +} + +void +extern_func1_4 (int a, char *b, unsigned long c) +{ + extern_func1_5 (a, b, c); +} + +void +extern_func1_5 (int a, char *b, unsigned long c) +{ + extern_func1_6 (a, b, c); +} + +void +extern_func1_6 (int a, char *b, unsigned long c) +{ + extern_func1_7 (a, b, c); +} + +void +extern_func1_7 (int a, char *b, unsigned long c) +{ + extern_func1_8 (a, b, c); +} + +void +extern_func1_8 (int a, char *b, unsigned long c) +{ + extern_func1_9 (a, b, c); +} + +void +extern_func1_9 (int a, char *b, unsigned long c) +{ + extern_func1_10 (a, b, c); +} + +void +extern_func1_10 (int a, char *b, unsigned long c) +{ + extern_func1_11 (a, b, c); +} + +void +extern_func1_11 (int a, char *b, unsigned long c) +{ + extern_func1_12 (a, b, c); +} + +void +extern_func1_12 (int a, char *b, unsigned long c) +{ + extern_func1_13 (a, b, c); +} + +void +extern_func1_13 (int a, char *b, unsigned long c) +{ + extern_func1_14 (a, b, c); +} + +void +extern_func1_14 (int a, char *b, unsigned long c) +{ + extern_func1_15 (a, b, c); +} + +void +extern_func1_15 (int a, char *b, unsigned long c) +{ + /* THE END */ + return; +} diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 2ef42bf3db9..94cd40a0917 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -1584,3 +1584,104 @@ proc rerun_to_main {} { } } +# From dejagnu: +# srcdir = testsuite src dir (e.g., devo/gdb/testsuite) +# objdir = testsuite obj dir (e.g., gdb/testsuite) +# subdir = subdir of testsuite (e.g., gdb.gdbtk) +# +# To gdbtk: +# env(DEFS)=the "defs" files (e.g., devo/gdb/testsuite/gdb.gdbtk/defs) +# env(SRCDIR)=directory containing the test code (e.g., *.test) +# env(OBJDIR)=directory which contains any executables +# (e.g., gdb/testsuite/gdb.gdbtk) +proc gdbtk_start {test} { + global verbose + global GDB + global GDBFLAGS + global env srcdir subdir objdir + + gdb_stop_suppressing_tests; + + verbose "Starting $GDB -nx -q --tclcommand=$test" + + set real_test [which $test] + if {$real_test == 0} { + perror "$test is not found" + exit 1 + } + + if {![is_remote host]} { + if { [which $GDB] == 0 } { + perror "$GDB does not exist." + exit 1 + } + } + + set wd [pwd] + cd [file join $srcdir .. gdbtcl2] + set env(GDBTK_LIBRARY) [pwd] + cd [file join $srcdir .. .. tcl library] + set env(TCL_LIBRARY) [pwd] + cd [file join $srcdir .. .. tk library] + set env(TK_LIBRARY) [pwd] + cd [file join $srcdir .. .. tix library] + set env(TIX_LIBRARY) [pwd] + cd [file join $srcdir .. .. itcl itcl library] + set env(ITCL_LIBRARY) [pwd] + cd [file join .. $srcdir .. .. libgui library] + set env(CYGNUS_GUI_LIBRARY) [pwd] + cd $wd + cd [file join $srcdir $subdir] + set env(DEFS) [file join [pwd] defs] + cd $wd + cd [file join $objdir $subdir] + set env(OBJDIR) [pwd] + cd $wd + cd $srcdir + set env(SRCDIR) [pwd] + cd $wd + set env(GDBTK_VERBOSE) 1 + set env(GDBTK_LOGFILE) [file join $objdir gdb.log] + set env(GDBTK_TEST_RUNNING) 1 + set err [catch {exec $GDB -nx -q --tclcommand=$test} res] + if { $err } { + perror "Execing $GDB failed: $res" + exit 1; + } + return $res +} + +# gdbtk tests call this function to print out the results of the +# tests. The argument is a proper list of lists of the form: +# {status name description msg}. All of these things typically +# come from the testsuite harness. +proc gdbtk_analyze_results {results} { + foreach test $results { + set status [lindex $test 0] + set name [lindex $test 1] + set description [lindex $test 2] + set msg [lindex $test 3] + + switch $status { + PASS { + pass "$description ($name)" + } + + FAIL { + fail "$description ($name)" + } + + ERROR { + perror "$name" + } + + XFAIL { + xfail "$description ($name)" + } + + XPASS { + xpass "$description ($name)" + } + } + } +} diff --git a/gdb/v850ice.c b/gdb/v850ice.c index 4e187c0bea2..dba9514db6d 100644 --- a/gdb/v850ice.c +++ b/gdb/v850ice.c @@ -31,6 +31,7 @@ #include "value.h" #include "command.h" +#include <tcl.h> #include <windows.h> #include <winuser.h> /* for WM_USER */ @@ -119,6 +120,8 @@ static int ice_nexti PARAMS ((char *)); static void togdb_force_update PARAMS ((void)); +static void view_source PARAMS ((CORE_ADDR)); + static void do_gdb (char *, char *, void (*func) PARAMS ((char *, int)), int); @@ -131,6 +134,7 @@ long (__stdcall * RegisterClient) PARAMS ((HWND)); long (__stdcall * UnregisterClient) PARAMS ((void)); +extern Tcl_Interp *gdbtk_interp; /* Globals local to this file only */ static int ice_open = 0; /* Is ICE open? */ @@ -256,6 +260,7 @@ v850ice_wndproc (hwnd, message, wParam, lParam) MessageBox (0, "Address resolution\nNot implemented", "GDB", MB_OK); break; case WM_SOURCE: + view_source ((CORE_ADDR) lParam); break; case WM_STATE_CHANGE: switch (wParam) @@ -837,7 +842,12 @@ ice_cont (c) printf_filtered ("continue (ice)\n"); ReplyMessage ((LRESULT) 1); + if (gdbtk_interp == NULL) + { continue_command (NULL, 1); + } + else + Tcl_Eval (gdbtk_interp, "gdb_immediate continue"); return 1; } @@ -855,7 +865,12 @@ do_gdb (cmd, str, func, count) { printf_unfiltered (str); + if (gdbtk_interp == NULL) + { func (NULL, 0); + } + else + Tcl_Eval (gdbtk_interp, cmd); } } @@ -896,8 +911,22 @@ v850ice_command (arg, from_tty) static void togdb_force_update (void) { + if (gdbtk_interp != NULL) + Tcl_Eval (gdbtk_interp, "gdbtk_update"); } +static void +view_source (addr) + CORE_ADDR addr; +{ + char c[256]; + + if (gdbtk_interp != NULL) + { + sprintf (c, "catch {set src [lindex [ManagedWin::find SrcWin] 0]\n$src location BROWSE [gdb_loc *0x%x]}", addr); + Tcl_Eval (gdbtk_interp, c); + } +} /* Define the target subroutine names */ |