This is the merge of the Itcl3.0 gdbtk development branch into the
trunk. To build it, you will have to do update -dP in the itcl directory, and update tcl, tk, tix and libgui as well.
This commit is contained in:
parent
988e60c43b
commit
c98fe0c119
33 changed files with 5608 additions and 553 deletions
|
@ -15,7 +15,7 @@
|
|||
|
||||
Do-first:
|
||||
|
||||
gdbtk_files="ChangeLog-gdbtk README.GDBTK gdbtk.c gdbtk.h gdbtk-cmds.c gdbtk-hooks.c gdbtcl2 gdb.rc gdbtool.ico"
|
||||
gdbtk_files="ChangeLog-gdbtk README.GDBTK gdbtk.c gdbtk.h gdbtk-cmds.c gdbtk-hooks.c gdbtk-wrapper.c gdbtk-wrapper.h gdbtk-variable.c gdbtcl2 gdb.rc gdbtool.ico"
|
||||
|
||||
if ( echo $* | grep lose\-gdbtk > /dev/null ) ; then
|
||||
lose_these_too="${gdbtk_files} ${lose_these_too}"
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
1999-01-27 James Ingham <jingham@cygnus.com>
|
||||
|
||||
Merging changes in from gdbtk-980810-branch:
|
||||
|
||||
* typeprint.c (whatis_exp): Remove static declaration.
|
||||
|
||||
Wed Jan 27 16:50:25 1999 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
|
||||
|
||||
* hp-psymtab-read.c: reformatted using indent.
|
||||
|
|
|
@ -1,4 +1,145 @@
|
|||
Mon Dec 28 17:44:36 1998 David Taylor <taylor@texas.cygnus.com>
|
||||
M1999-01-27 James Ingham <jingham@cygnus.com>
|
||||
|
||||
Merging in changes from gdbtk-980810 - the Itcl3
|
||||
gdb branch.
|
||||
|
||||
1999-01-12 Martin Hunt <hunt@cygnus.com>
|
||||
|
||||
* gdbtk-cmds.c (gdb_loadfile): Increase maximum line size so
|
||||
files with very long lines get numbered correctly.
|
||||
|
||||
Thu Jan 7 06:50:32 1999 Keith Seitz <keiths@cygnus.com>
|
||||
|
||||
* gdbtk-hooks.c (gdbtk_add_hooks): Add the error_begin_hook;
|
||||
(gdbtk_error_begin): New function.
|
||||
(gdbtk_fputs): If GDBTK_ERROR_ONLY is set, treat output to
|
||||
any stream as if it had come from gdb_stderr.
|
||||
|
||||
* gdbtk.h: Define GDBTK_SYMBOL_SOURCE_NAME: does the same thing
|
||||
as SYMBOL_SOURCE_NAME, except that it NEVER returns a mangled name.
|
||||
Define GDBTK_ERROR_ONLY flag for result_ptr.
|
||||
|
||||
* gdbtk-cmds.c (gdb_listfuncs): Use SYMBOL_DEMANGLED_NAME to
|
||||
get the symbol's fully demangled name (including class and
|
||||
args for overloaded funcs), not cplus_demangle.
|
||||
(get_frame_name): Use GDBTK_SYMBOL_SOURCE_NAME to get the name
|
||||
of the frame level.
|
||||
|
||||
* gdbtk-wrapper.c, gdbtk-wrapper.h:
|
||||
(GDB_val_print): Allow caller to specify all function args to val_print.
|
||||
(wrap_val_print): Ditto.
|
||||
|
||||
* gdbtk-variable.c (variable_value): Clear addressprint when getting
|
||||
value of C++ reference-type variables
|
||||
If we errored because a parent (struct pointer) was junk, output
|
||||
an error message indicating so.
|
||||
(call_gdb_val_print): Tell val_print to dereference C++ reference
|
||||
types.
|
||||
(number_of_children): void * also has no children.
|
||||
(get_call_output): Clear any error flags that may have been set
|
||||
as a result of error_begin.
|
||||
|
||||
* utils.c (error_begin_hook): New hook.
|
||||
(error_begin): Call error_begin_hook so that the GUI
|
||||
gets notified.
|
||||
|
||||
* defs.h (error_begin_hook): Declare.
|
||||
|
||||
Wed Jan 6 08:43:31 1999 Keith Seitz <keiths@cygnus.com>
|
||||
|
||||
* gdbtk-wrapper.c, gdbtk-wrapper.h: Add wrappers for parse_exp_1,
|
||||
evaluate_type, block_for_pc, block_innermost_frame, reinit_frame_cache,
|
||||
and find_frame_addr_in_frame_chain.
|
||||
|
||||
* gdbtk-variable.c (variable_create): Check for failure when
|
||||
creating variables.
|
||||
(create_variable): Use wrapped calls for block_for_pc, parse_exp_1,
|
||||
and block_innermost_frame.
|
||||
Return NULL if parse_exp_1 fails.
|
||||
Attempt to prohibit creating a gdb_variable for type names.
|
||||
(variable_value_changed): Use wrapped calls for reinit_frame_cache and
|
||||
find_frame_addr_in_frame_chain.
|
||||
(variable_type): Use wrapped call for evaluate_type.
|
||||
(variable_value): Use wrapped call for parse_exp_1.
|
||||
(variable_editable): Use wrapped call for evaluate_type.
|
||||
|
||||
Tue Jan 5 11:37:17 1999 Keith Seitz <keiths@cygnus.com>
|
||||
|
||||
* gdbtk-variable.c: New variable object interface.
|
||||
* gdbtk-wrapper.c, gdbtk-wrapper.h: New wrappers for safely calling
|
||||
gdb functions without the fear of longjmp'ing.
|
||||
* configure.in (CONFIG_OBS): Add gdbtk-wrapper.o and gdbtk-variable.o
|
||||
when gdbtk is enabled.
|
||||
* configure: Regenerate.
|
||||
* Makefile.in: Add gdbtk-wrapper.o and gdbtk-variable.o
|
||||
* gdbtk-cmds.c (call_wrapper): Export so that other files can use.
|
||||
(Gdbtk_Init): Initialize new variable interface.
|
||||
* gdbtk.h: Add declaration for call_wrapper.
|
||||
|
||||
Tue Jan 5 11:19:14 1999 Keith Seitz <keiths@cygnus.com>
|
||||
|
||||
* gdbtk-cmds.c (gdb_loc): Call resolve_sal_pc to before using
|
||||
the sal's pc.
|
||||
|
||||
* gdbtk.c (gdbtk_init): Add global array GDBStartup to interpreter
|
||||
which contains any startup info. Add "inhibit_prefs" (follows -nx)
|
||||
so that "-nx" turns preference reading/writing off.
|
||||
|
||||
Mon Dec 21 11:11:02 1998 Keith Seitz <keiths@cygnus.com>
|
||||
|
||||
* gdbtk-cmds.c (get_register): Call get_saved_register instead of
|
||||
read_relative_register_raw_bytes to fetch registers.
|
||||
|
||||
Thu Dec 17 09:00:56 1998 Keith Seitz <keiths@cygnus.com>
|
||||
|
||||
* gdbtk-cmds.c (gdb_search): Don't mention C++ RTTI and
|
||||
global constructor/destructor symbols.
|
||||
|
||||
Thu Nov 12 15:20:15 1998 Jim Ingham <jingham@cygnus.com>
|
||||
* More bug fixes merged in from devo.
|
||||
|
||||
* gdbtk-cmds.c (gdb_cmd): Added an optional second argument to the
|
||||
gdb_cmd, which is from_tty. This is passed to the gdb command
|
||||
parser. It is 0 by default, and the console window passes 1.
|
||||
|
||||
* gdbtk-cmds.c: moved disassemble_from_exec from gdbtk.c to gdbtk-cmds.c
|
||||
with all the other link-var'ed variables
|
||||
|
||||
* gdbtk-hooks.c (gdbtk_trace_find): Only run the hook functions if
|
||||
we are called from_tty.
|
||||
|
||||
* gdbtk-hooks.c (gdbtk_trace_start_stop): Set the trace buttons
|
||||
from a trace_start_command callback rather than doing it as a
|
||||
special case in gdb_cmd.
|
||||
|
||||
* tracepoint.c (tstart_command, tstop_command): Add call to
|
||||
trace_start_stop_hook here.
|
||||
|
||||
1998-11-04 Martin M. Hunt <hunt@cygnus.com>
|
||||
|
||||
* gdbtk-cmds.c (gdb_set_bp_addr): For callback, send full
|
||||
pathname instead of just basename.
|
||||
|
||||
1998-11-03 Keith Seitz <keiths@cygnus.com>
|
||||
* v850ice.c (do_gdb): New function.
|
||||
(ice_stepi): Use do_gdb to step properly.
|
||||
(ice_nexti): Use do_gdb to step properly.
|
||||
(view_source): Correct call to src window's location for new version.
|
||||
|
||||
Tue Aug 25 18:13:30 1998 Jim Ingham <jingham@cygnus.com>
|
||||
|
||||
* gdbtk.c (gdbtk_init): I hadn't excised ALL the old startup code,
|
||||
so it was not working correctly. Now it does.
|
||||
|
||||
Fri Aug 21 14:37:40 1998 Jim Ingham <jingham@cygnus.com>
|
||||
|
||||
* gdbtk.c (gdbtk_init): Changed the startup code to use
|
||||
tcl_findLibrary
|
||||
|
||||
|
||||
|
||||
|
||||
on Dec 28 17:44:36 1998 David Taylor <taylor@texas.cygnus.com>
|
||||
|
||||
|
||||
The following changes were made by Jim Blandy <jimb@cygnus.com>,
|
||||
|
|
|
@ -161,10 +161,15 @@ TK = @TK_BUILD_LIB_SPEC@
|
|||
TK_CFLAGS = @TKHDIR@ @TK_BUILD_INCLUDES@
|
||||
TK_DEPS =
|
||||
|
||||
# Where is Itcl? Typically in ../itcl.
|
||||
# Where is Itcl? Typically in ../itcl/itcl.
|
||||
ITCL_CFLAGS = @ITCLHDIR@
|
||||
ITCL = @ITCLLIB@
|
||||
ITCL_DEPS = $(ITCL)
|
||||
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@
|
||||
|
@ -640,7 +645,7 @@ install-only:
|
|||
$(datadir)/gdbtcl/help/images \
|
||||
$(datadir)/gdbtcl/help/trace ; \
|
||||
cd $(srcdir)/gdbtcl2 ; \
|
||||
for i in *.tcl images/*.gif images2/*.gif images/icons.txt images2/icons.txt tclIndex help/*.html help/index.toc help/trace/*.html help/trace/index.toc help/images/*.gif; \
|
||||
for i in *.tcl *.ith *.itb images/*.gif images2/*.gif images/icons.txt images2/icons.txt tclIndex help/*.html help/index.toc help/trace/*.html help/trace/index.toc help/images/*.gif; \
|
||||
do \
|
||||
$(INSTALL_DATA) $$i $(datadir)/gdbtcl/$$i ; \
|
||||
done ;
|
||||
|
@ -1203,7 +1208,8 @@ gdbres.o: gdb.rc gdbtool.ico
|
|||
|
||||
gdbtk.o: gdbtk.c 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) \
|
||||
$(CC) -c $(INTERNAL_CFLAGS) $(IDE_CFLAGS) $(ITCL_CFLAGS) \
|
||||
$(ITK_CFLAGS) $(TIX_CFLAGS) \
|
||||
$(TCL_CFLAGS) $(TK_CFLAGS) $(X11_CFLAGS) \
|
||||
$(srcdir)/gdbtk.c -DGDBTK_LIBRARY=\"$(datadir)/gdbtcl\"
|
||||
|
||||
|
@ -1219,10 +1225,14 @@ gdbtk-hooks.o: gdbtk-hooks.c gdbtk.h $(defs_h) $(symtab_h) $(inferior_h) $(comma
|
|||
$(TCL_CFLAGS) $(TK_CFLAGS) $(X11_CFLAGS) \
|
||||
$(srcdir)/gdbtk-hooks.c -DGDBTK_LIBRARY=\"$(datadir)/gdbtcl\"
|
||||
|
||||
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)
|
||||
# end-sanitize-gdbtk
|
||||
gdbtk-variable.o: gdbtk-variable.c gdbtk.h gdbtk-wrapper.h
|
||||
$(CC) -c $(INTERNAL_CFLAGS) $(IDE_CFLAGS) $(ITCL_CFLAGS) $(TIX_CFLAGS) \
|
||||
$(TCL_CFLAGS) $(TK_CFLAGS) $(X11_CFLAGS) \
|
||||
$(srcdir)/gdbtk-variable.c
|
||||
|
||||
gdbtk-wrapper.o: gdbtk-wrapper.c gdbtk-wrapper.h
|
||||
$(CC) -c $(INTERNAL_CFLAGS) $(IDE_CFLAGS) \
|
||||
$(srcdir)/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 \
|
||||
|
@ -1231,6 +1241,11 @@ v850ice.o: v850ice.c $(defs_h) $(symtab_h) $(inferior_h) $(command_h) \
|
|||
$(TCL_CFLAGS) $(TK_CFLAGS) $(X11_CFLAGS) \
|
||||
$(srcdir)/v850ice.c
|
||||
|
||||
# end-sanitize-gdbtk
|
||||
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)
|
||||
|
||||
gdbarch.o: gdbarch.c $(defs_h) $(bfd_h) $(gdbcmd_h)
|
||||
|
||||
gdbtypes.o: gdbtypes.c $(bfd_h) complaints.h $(defs_h) $(expression_h) \
|
||||
|
|
235
gdb/aclocal.m4
vendored
235
gdb/aclocal.m4
vendored
|
@ -493,15 +493,115 @@ dnl AC_SUBST(TK_EXEC_PREFIX)
|
|||
AC_SUBST(TK_LIB_SPEC)
|
||||
])
|
||||
|
||||
AC_DEFUN(CY_AC_PATH_ITCLCONFIG, [
|
||||
#
|
||||
# Ok, lets find the itcl configuration
|
||||
# First, look for one uninstalled.
|
||||
# the alternative search directory is invoked by --with-itclconfig
|
||||
#
|
||||
|
||||
if test x"${no_itcl}" = x ; then
|
||||
# we reset no_itcl in case something fails here
|
||||
no_itcl=true
|
||||
AC_ARG_WITH(itclconfig, [ --with-itclconfig directory containing itcl configuration (itclConfig.sh)],
|
||||
with_itclconfig=${withval})
|
||||
AC_MSG_CHECKING([for Itcl configuration])
|
||||
AC_CACHE_VAL(ac_cv_c_itclconfig,[
|
||||
|
||||
# First check to see if --with-itclconfig was specified.
|
||||
if test x"${with_itclconfig}" != x ; then
|
||||
if test -f "${with_itclconfig}/itclConfig.sh" ; then
|
||||
ac_cv_c_itclconfig=`(cd ${with_itclconfig}; pwd)`
|
||||
else
|
||||
AC_MSG_ERROR([${with_itclconfig} directory doesn't contain itclConfig.sh])
|
||||
fi
|
||||
fi
|
||||
|
||||
# then check for a private Itcl library
|
||||
if test x"${ac_cv_c_itclconfig}" = x ; then
|
||||
for i in \
|
||||
../itcl/itcl \
|
||||
`ls -dr ../itcl[[4-9]]*/itcl 2>/dev/null` \
|
||||
../../itcl \
|
||||
`ls -dr ../../itcl[[4-9]]*/itcl 2>/dev/null` \
|
||||
../../../itcl \
|
||||
`ls -dr ../../../itcl[[4-9]]*/itcl 2>/dev/null` ; do
|
||||
if test -f "$i/${configdir}/itclConfig.sh" ; then
|
||||
ac_cv_c_itclconfig=`(cd $i/${configdir}; 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/${configdir}/itclConfig.sh" ; then
|
||||
ac_cv_c_itclconfig=`(cd $i/${configdir}; pwd)`
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
])
|
||||
if test x"${ac_cv_c_itclconfig}" = x ; then
|
||||
ITCLCONFIG="# no Itcl configs found"
|
||||
AC_MSG_WARN(Can't find Itcl configuration definitions)
|
||||
else
|
||||
no_itcl=
|
||||
ITCLCONFIG=${ac_cv_c_itclconfig}/itclConfig.sh
|
||||
AC_MSG_RESULT(found $ITCLCONFIG)
|
||||
fi
|
||||
fi
|
||||
|
||||
])
|
||||
|
||||
# Defined as a separate macro so we don't have to cache the values
|
||||
# from PATH_ITCLCONFIG (because this can also be cached).
|
||||
AC_DEFUN(CY_AC_LOAD_ITCLCONFIG, [
|
||||
if test -f "$ITCLCONFIG" ; then
|
||||
. $ITCLCONFIG
|
||||
fi
|
||||
|
||||
AC_SUBST(ITCL_VERSION)
|
||||
dnl not actually used, don't export to save symbols
|
||||
dnl AC_SUBST(ITCL_MAJOR_VERSION)
|
||||
dnl AC_SUBST(ITCL_MINOR_VERSION)
|
||||
AC_SUBST(ITCL_DEFS)
|
||||
|
||||
dnl not used, don't export to save symbols
|
||||
dnl AC_SUBST(ITCL_LIB_FILE)
|
||||
|
||||
dnl not used outside of configure
|
||||
dnl AC_SUBST(ITCL_LIBS)
|
||||
dnl not used, don't export to save symbols
|
||||
dnl AC_SUBST(ITCL_PREFIX)
|
||||
|
||||
dnl not used, don't export to save symbols
|
||||
dnl AC_SUBST(ITCL_EXEC_PREFIX)
|
||||
|
||||
AC_SUBST(ITCL_BUILD_INCLUDES)
|
||||
AC_SUBST(ITCL_BUILD_LIB_SPEC)
|
||||
AC_SUBST(ITCL_LIB_SPEC)
|
||||
])
|
||||
|
||||
# check for Itcl headers.
|
||||
|
||||
AC_DEFUN(CY_AC_PATH_ITCLH, [
|
||||
AC_MSG_CHECKING(for Itcl private headers. srcdir=${srcdir})
|
||||
if test x"${ac_cv_c_itclh}" = x ; then
|
||||
for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ; do
|
||||
if test -f $i/src/itcl.h ; then
|
||||
ac_cv_c_itclh=`(cd $i/src; pwd)`
|
||||
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
|
||||
|
@ -514,9 +614,134 @@ if test x"${ac_cv_c_itclh}" != x ; then
|
|||
ITCLHDIR="-I${ac_cv_c_itclh}"
|
||||
fi
|
||||
# should always be here
|
||||
ITCLLIB="../itcl/src/libitcl.a"
|
||||
# ITCLLIB="../itcl/itcl/unix/libitcl.a"
|
||||
AC_SUBST(ITCLHDIR)
|
||||
AC_SUBST(ITCLLIB)
|
||||
#AC_SUBST(ITCLLIB)
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN(CY_AC_PATH_ITKCONFIG, [
|
||||
#
|
||||
# Ok, lets find the itk configuration
|
||||
# First, look for one uninstalled.
|
||||
# the alternative search directory is invoked by --with-itkconfig
|
||||
#
|
||||
|
||||
if test x"${no_itk}" = x ; then
|
||||
# we reset no_itk in case something fails here
|
||||
no_itk=true
|
||||
AC_ARG_WITH(itkconfig, [ --with-itkconfig directory containing itk configuration (itkConfig.sh)],
|
||||
with_itkconfig=${withval})
|
||||
AC_MSG_CHECKING([for Itk configuration])
|
||||
AC_CACHE_VAL(ac_cv_c_itkconfig,[
|
||||
|
||||
# First check to see if --with-itkconfig was specified.
|
||||
if test x"${with_itkconfig}" != x ; then
|
||||
if test -f "${with_itkconfig}/itkConfig.sh" ; then
|
||||
ac_cv_c_itkconfig=`(cd ${with_itkconfig}; pwd)`
|
||||
else
|
||||
AC_MSG_ERROR([${with_itkconfig} directory doesn't contain itkConfig.sh])
|
||||
fi
|
||||
fi
|
||||
|
||||
# then check for a private Itk library
|
||||
if test x"${ac_cv_c_itkconfig}" = x ; then
|
||||
for i in \
|
||||
../itcl/itk \
|
||||
`ls -dr ../itcl[[4-9]]*/itk 2>/dev/null` \
|
||||
../../itk \
|
||||
`ls -dr ../../itcl[[4-9]]*/itk 2>/dev/null` \
|
||||
../../../itk \
|
||||
`ls -dr ../../../itcl[[4-9]]*/itk 2>/dev/null` ; do
|
||||
if test -f "$i/${configdir}/itkConfig.sh" ; then
|
||||
ac_cv_c_itkconfig=`(cd $i/${configdir}; 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/${configdir}/itkConfig.sh" ; then
|
||||
ac_cv_c_itkconfig=`(cd $i/${configdir}; pwd)`
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
])
|
||||
if test x"${ac_cv_c_itkconfig}" = x ; then
|
||||
ITKCONFIG="# no Itk configs found"
|
||||
AC_MSG_WARN(Can't find Itk configuration definitions)
|
||||
else
|
||||
no_itk=
|
||||
ITKCONFIG=${ac_cv_c_itkconfig}/itkConfig.sh
|
||||
AC_MSG_RESULT(found $ITKCONFIG)
|
||||
fi
|
||||
fi
|
||||
|
||||
])
|
||||
|
||||
# Defined as a separate macro so we don't have to cache the values
|
||||
# from PATH_ITKCONFIG (because this can also be cached).
|
||||
AC_DEFUN(CY_AC_LOAD_ITKCONFIG, [
|
||||
if test -f "$ITKCONFIG" ; then
|
||||
. $ITKCONFIG
|
||||
fi
|
||||
|
||||
AC_SUBST(ITK_VERSION)
|
||||
dnl not actually used, don't export to save symbols
|
||||
dnl AC_SUBST(ITK_MAJOR_VERSION)
|
||||
dnl AC_SUBST(ITK_MINOR_VERSION)
|
||||
AC_SUBST(ITK_DEFS)
|
||||
|
||||
dnl not used, don't export to save symbols
|
||||
dnl AC_SUBST(ITK_LIB_FILE)
|
||||
|
||||
dnl not used outside of configure
|
||||
dnl AC_SUBST(ITK_LIBS)
|
||||
dnl not used, don't export to save symbols
|
||||
dnl AC_SUBST(ITK_PREFIX)
|
||||
|
||||
dnl not used, don't export to save symbols
|
||||
dnl AC_SUBST(ITK_EXEC_PREFIX)
|
||||
|
||||
AC_SUBST(ITK_BUILD_INCLUDES)
|
||||
AC_SUBST(ITK_BUILD_LIB_SPEC)
|
||||
AC_SUBST(ITK_LIB_SPEC)
|
||||
])
|
||||
|
||||
AC_DEFUN(CY_AC_PATH_ITKH, [
|
||||
AC_MSG_CHECKING(for Itk private headers. srcdir=${srcdir})
|
||||
if test x"${ac_cv_c_itkh}" = x ; then
|
||||
for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itk; do
|
||||
if test -f $i/generic/itk.h ; then
|
||||
ac_cv_c_itkh=`(cd $i/generic; pwd)`
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if test x"${ac_cv_c_itkh}" = x ; then
|
||||
ITKHDIR="# no Itk private headers found"
|
||||
AC_MSG_ERROR([Can't find Itk private headers])
|
||||
fi
|
||||
if test x"${ac_cv_c_itkh}" != x ; then
|
||||
ITKHDIR="-I${ac_cv_c_itkh}"
|
||||
fi
|
||||
# should always be here
|
||||
# ITKLIB="../itcl/itk/unix/libitk.a"
|
||||
AC_SUBST(ITKHDIR)
|
||||
#AC_SUBST(ITKLIB)
|
||||
])
|
||||
|
||||
# check for Tix headers.
|
||||
|
|
867
gdb/configure
vendored
867
gdb/configure
vendored
File diff suppressed because it is too large
Load diff
|
@ -64,12 +64,12 @@ AC_ARG_PROGRAM
|
|||
AC_TYPE_SIGNAL
|
||||
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(ctype.h curses.h endian.h libintl.h link.h \
|
||||
memory.h objlist.h ptrace.h sgtty.h stddef.h stdlib.h \
|
||||
string.h sys/procfs.h sys/ptrace.h sys/reg.h \
|
||||
term.h termio.h termios.h unistd.h wait.h sys/wait.h \
|
||||
wchar.h wctype.h asm/debugreg.h)
|
||||
|
||||
AC_CHECK_HEADERS(ctype.h curses.h endian.h libintl.h link.h \
|
||||
memory.h objlist.h ptrace.h sgtty.h stddef.h stdlib.h \
|
||||
string.h sys/procfs.h sys/ptrace.h sys/reg.h \
|
||||
term.h termio.h termios.h unistd.h wait.h sys/wait.h \
|
||||
wchar.h wctype.h asm/debugreg.h)
|
||||
AC_HEADER_STAT
|
||||
|
||||
AC_C_CONST
|
||||
|
@ -633,8 +633,47 @@ if test "${enable_gdbtk}" = "yes"; then
|
|||
CY_AC_PATH_TCLH
|
||||
CY_AC_PATH_TKH
|
||||
CY_AC_PATH_ITCLH
|
||||
CY_AC_PATH_ITKH
|
||||
CY_AC_PATH_TIX
|
||||
|
||||
# now look for Itcl library stuff
|
||||
|
||||
CY_AC_PATH_ITCLCONFIG
|
||||
if test -z "${no_itcl}"; then
|
||||
CY_AC_LOAD_ITCLCONFIG
|
||||
case "${host}" in
|
||||
*-*-cygwin32*)
|
||||
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
|
||||
*-*-cygwin32*)
|
||||
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
|
||||
TIXVERSION=4.1.8.0
|
||||
. ${ac_cv_c_tclconfig}/tclConfig.sh
|
||||
|
@ -673,11 +712,11 @@ if test "${enable_gdbtk}" = "yes"; then
|
|||
|
||||
# Include some libraries that Tcl and Tk want.
|
||||
if test "${enable_ide}" = "yes"; then
|
||||
TCL_LIBS='$(LIBIDETCL) $(LIBIDE) $(LIBGUI) $(IDE) $(ITCL) $(TIX) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)'
|
||||
TCL_LIBS='$(LIBIDETCL) $(LIBIDE) $(LIBGUI) $(IDE) $(ITCL) $(ITK) $(TIX) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)'
|
||||
CONFIG_DEPS='$(LIBIDETCL) $(LIBIDE) $(LIBGUI) $(IDE_DEPS) $(ITCL_DEPS) $(TIX_DEPS) $(TK_DEPS) $(TCL_DEPS)'
|
||||
else
|
||||
TCL_LIBS='$(LIBGUI) $(ITCL) $(TIX) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)'
|
||||
CONFIG_DEPS='$(LIBGUI) $(ITCL_DEPS) $(TIX_DEPS) $(TK_DEPS) $(TCL_DEPS)'
|
||||
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)'
|
||||
fi
|
||||
# Yes, the ordering seems wrong here. But it isn't.
|
||||
# TK_LIBS is the list of libraries that need to be linked
|
||||
|
@ -685,7 +724,7 @@ if test "${enable_gdbtk}" = "yes"; then
|
|||
# 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_OBS="${CONFIG_OBS} gdbtk.o gdbtk-cmds.o gdbtk-hooks.o"
|
||||
CONFIG_OBS="${CONFIG_OBS} gdbtk.o gdbtk-cmds.o gdbtk-hooks.o gdbtk-variable.o gdbtk-wrapper.o"
|
||||
|
||||
if test x$gdb_cv_os_cygwin = xyes; then
|
||||
WIN32LIBS="${WIN32LIBS} -lshell32 -lgdi32 -lcomdlg32 -ladvapi32"
|
||||
|
@ -700,6 +739,10 @@ 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)
|
||||
|
|
|
@ -739,8 +739,8 @@ typedef int return_mask;
|
|||
extern NORETURN void
|
||||
return_to_top_level PARAMS ((enum return_reason)) ATTR_NORETURN;
|
||||
|
||||
extern int
|
||||
catch_errors PARAMS ((int (*) (char *), void *, char *, return_mask));
|
||||
typedef int (catch_errors_ftype) PARAMS ((PTR));
|
||||
extern int catch_errors PARAMS ((catch_errors_ftype *, PTR, char *, return_mask));
|
||||
|
||||
extern void warning_begin PARAMS ((void));
|
||||
|
||||
|
@ -1076,6 +1076,7 @@ extern void (*call_command_hook) PARAMS ((struct cmd_list_element *c,
|
|||
|
||||
extern NORETURN void (*error_hook) PARAMS ((void)) ATTR_NORETURN;
|
||||
|
||||
extern void (*error_begin_hook) PARAMS ((void));
|
||||
|
||||
|
||||
/* Inhibit window interface if non-zero. */
|
||||
|
|
|
@ -44,13 +44,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||
#include "guitcl.h"
|
||||
#include "gdbtk.h"
|
||||
|
||||
#ifdef IDE
|
||||
/* start-sanitize-ide */
|
||||
#ifdef IDE
|
||||
#include "event.h"
|
||||
#include "idetcl.h"
|
||||
#include "ilutk.h"
|
||||
/* end-sanitize-ide */
|
||||
#endif
|
||||
/* end-sanitize-ide */
|
||||
|
||||
#ifdef ANSI_PROTOTYPES
|
||||
#include <stdarg.h>
|
||||
|
@ -157,12 +157,14 @@ extern int breakpoint_count;
|
|||
*/
|
||||
int disassemble_from_exec = -1;
|
||||
|
||||
extern int gdb_variable_init PARAMS ((Tcl_Interp *interp));
|
||||
|
||||
/*
|
||||
* Declarations for routines exported from this file
|
||||
*/
|
||||
|
||||
int Gdbtk_Init (Tcl_Interp *interp);
|
||||
int call_wrapper PARAMS ((ClientData, Tcl_Interp *, int, Tcl_Obj *CONST []));
|
||||
|
||||
/*
|
||||
* Declarations for routines used only in this file.
|
||||
|
@ -170,7 +172,6 @@ int Gdbtk_Init (Tcl_Interp *interp);
|
|||
|
||||
static int compare_lines PARAMS ((const PTR, const PTR));
|
||||
static int comp_files PARAMS ((const void *, const void *));
|
||||
static int call_wrapper PARAMS ((ClientData, Tcl_Interp *, int, Tcl_Obj *CONST []));
|
||||
static int gdb_actions_command PARAMS ((ClientData, Tcl_Interp *, int,
|
||||
Tcl_Obj *CONST objv[]));
|
||||
static int gdb_changed_register_list PARAMS ((ClientData, Tcl_Interp *, int, Tcl_Obj *CONST []));
|
||||
|
@ -335,6 +336,10 @@ Gdbtk_Init (interp)
|
|||
Tcl_LinkVar (interp, "gdb_context_id",
|
||||
(char *) &gdb_context,
|
||||
TCL_LINK_INT | TCL_LINK_READ_ONLY);
|
||||
|
||||
/* Init variable interface...*/
|
||||
if (gdb_variable_init (interp) != TCL_OK)
|
||||
return TCL_ERROR;
|
||||
|
||||
/* Determine where to disassemble from */
|
||||
Tcl_LinkVar (gdbtk_interp, "disassemble-from-exec", (char *) &disassemble_from_exec,
|
||||
|
@ -352,7 +357,7 @@ Gdbtk_Init (interp)
|
|||
recursively, it needs to save and restore the contents of the result_ptr as
|
||||
necessary. */
|
||||
|
||||
static int
|
||||
int
|
||||
call_wrapper (clientData, interp, objc, objv)
|
||||
ClientData clientData;
|
||||
Tcl_Interp *interp;
|
||||
|
@ -664,6 +669,7 @@ gdb_eval (clientData, interp, objc, objv)
|
|||
*
|
||||
* Tcl Arguments:
|
||||
* command - The GDB command to execute
|
||||
* from_tty - 1 indicates this comes to the console. Pass this to the gdb command.
|
||||
* Tcl Result:
|
||||
* The output from the gdb command (except for the "load" & "while"
|
||||
* which dump their output to the console.
|
||||
|
@ -732,6 +738,7 @@ gdb_cmd (clientData, interp, objc, objv)
|
|||
*
|
||||
* Tcl Arguments:
|
||||
* command - The GDB command to execute
|
||||
* from_tty - 1 to indicate this is from the console.
|
||||
* Tcl Result:
|
||||
* None.
|
||||
*/
|
||||
|
@ -744,12 +751,23 @@ gdb_immediate_command (clientData, interp, objc, objv)
|
|||
Tcl_Obj *CONST objv[];
|
||||
{
|
||||
|
||||
if (objc != 2)
|
||||
int from_tty = 0;
|
||||
|
||||
if (objc < 2)
|
||||
{
|
||||
Tcl_SetStringObj (result_ptr->obj_ptr, "wrong # args", -1);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
if (objc == 3)
|
||||
{
|
||||
if (Tcl_GetBooleanFromObj (NULL, objv[2], &from_tty) != TCL_OK) {
|
||||
Tcl_SetStringObj (result_ptr->obj_ptr, "from_tty must be a boolean.",
|
||||
-1);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (running_now || load_in_progress)
|
||||
return TCL_OK;
|
||||
|
||||
|
@ -757,7 +775,7 @@ gdb_immediate_command (clientData, interp, objc, objv)
|
|||
|
||||
result_ptr->flags &= ~GDBTK_TO_RESULT;
|
||||
|
||||
execute_command (Tcl_GetStringFromObj (objv[1], NULL), 1);
|
||||
execute_command (Tcl_GetStringFromObj (objv[1], NULL), from_tty);
|
||||
|
||||
bpstat_do_actions (&stop_bpstat);
|
||||
|
||||
|
@ -1499,15 +1517,19 @@ gdb_listfuncs (clientData, interp, objc, objv)
|
|||
if (SYMBOL_CLASS (sym) == LOC_BLOCK)
|
||||
{
|
||||
|
||||
char *name = cplus_demangle (SYMBOL_NAME(sym), 0);
|
||||
char *name = SYMBOL_DEMANGLED_NAME (sym);
|
||||
|
||||
if (name)
|
||||
{
|
||||
/* strip out "global constructors" and "global destructors" */
|
||||
/* because we aren't interested in them. */
|
||||
if (strncmp (name, "global ", 7))
|
||||
{
|
||||
/* If the function is overloaded, print out the functions
|
||||
declaration, not just its name. */
|
||||
|
||||
funcVals[0] = Tcl_NewStringObj(name, -1);
|
||||
funcVals[1] = mangled;
|
||||
funcVals[1] = mangled;
|
||||
}
|
||||
else
|
||||
continue;
|
||||
|
@ -2338,15 +2360,10 @@ gdb_loc (clientData, interp, objc, objv)
|
|||
{
|
||||
char *filename;
|
||||
struct symtab_and_line sal;
|
||||
char *funcname, *fname;
|
||||
struct symbol *sym;
|
||||
char *fname;
|
||||
CORE_ADDR pc;
|
||||
|
||||
if (!have_full_symbols () && !have_partial_symbols ())
|
||||
{
|
||||
Tcl_SetStringObj (result_ptr->obj_ptr, "No symbol table is loaded", -1);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
if (objc == 1)
|
||||
{
|
||||
if (selected_frame && (selected_frame->pc != stop_pc))
|
||||
|
@ -2385,6 +2402,7 @@ gdb_loc (clientData, interp, objc, objv)
|
|||
Tcl_SetStringObj (result_ptr->obj_ptr, "Ambiguous line spec", -1);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
resolve_sal_pc (&sal);
|
||||
pc = sal.pc;
|
||||
}
|
||||
else
|
||||
|
@ -2399,18 +2417,25 @@ gdb_loc (clientData, interp, objc, objv)
|
|||
else
|
||||
Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr, Tcl_NewStringObj ("", 0));
|
||||
|
||||
find_pc_partial_function (pc, &funcname, NULL, NULL);
|
||||
fname = cplus_demangle (funcname, 0);
|
||||
if (fname)
|
||||
sym = find_pc_function (pc);
|
||||
if (sym != NULL)
|
||||
{
|
||||
Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr,
|
||||
Tcl_NewStringObj (fname, -1));
|
||||
free (fname);
|
||||
fname = SYMBOL_DEMANGLED_NAME (sym);
|
||||
if (fname)
|
||||
{
|
||||
Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr,
|
||||
Tcl_NewStringObj (fname, -1));
|
||||
}
|
||||
else
|
||||
Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr,
|
||||
Tcl_NewStringObj (SYMBOL_NAME (sym), -1));
|
||||
}
|
||||
else
|
||||
Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr,
|
||||
Tcl_NewStringObj (funcname, -1));
|
||||
|
||||
{
|
||||
Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr,
|
||||
Tcl_NewStringObj ("", -1));
|
||||
}
|
||||
|
||||
filename = symtab_to_filename (sal.symtab);
|
||||
if (filename == NULL)
|
||||
filename = "";
|
||||
|
@ -2630,7 +2655,7 @@ gdb_loadfile (clientData, interp, objc, objv)
|
|||
long mtime = 0;
|
||||
struct stat st;
|
||||
Tcl_DString text_cmd_1, text_cmd_2, *cur_cmd;
|
||||
char line[1024], line_num_buf[16];
|
||||
char line[10000], line_num_buf[16];
|
||||
int prefix_len_1, prefix_len_2, cur_prefix_len, widget_len;
|
||||
|
||||
|
||||
|
@ -3355,12 +3380,12 @@ get_frame_name (interp, list, fi)
|
|||
> BLOCK_START (SYMBOL_BLOCK_VALUE (func))))
|
||||
{
|
||||
func = 0;
|
||||
funname = SYMBOL_NAME (msymbol);
|
||||
funname = GDBTK_SYMBOL_SOURCE_NAME (msymbol);
|
||||
funlang = SYMBOL_LANGUAGE (msymbol);
|
||||
}
|
||||
else
|
||||
{
|
||||
funname = SYMBOL_NAME (func);
|
||||
funname = GDBTK_SYMBOL_SOURCE_NAME (func);
|
||||
funlang = SYMBOL_LANGUAGE (func);
|
||||
}
|
||||
}
|
||||
|
@ -3369,7 +3394,7 @@ get_frame_name (interp, list, fi)
|
|||
struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (fi->pc);
|
||||
if (msymbol != NULL)
|
||||
{
|
||||
funname = SYMBOL_NAME (msymbol);
|
||||
funname = GDBTK_SYMBOL_SOURCE_NAME (msymbol);
|
||||
funlang = SYMBOL_LANGUAGE (msymbol);
|
||||
}
|
||||
}
|
||||
|
@ -3378,12 +3403,7 @@ get_frame_name (interp, list, fi)
|
|||
{
|
||||
char *name = NULL;
|
||||
|
||||
if (funlang == language_cplus)
|
||||
name = cplus_demangle (funname, 0);
|
||||
if (name == NULL)
|
||||
name = funname;
|
||||
|
||||
objv[0] = Tcl_NewStringObj (name, -1);
|
||||
objv[0] = Tcl_NewStringObj (funname, -1);
|
||||
Tcl_ListObjAppendElement (interp, list, objv[0]);
|
||||
}
|
||||
else
|
||||
|
@ -3395,7 +3415,7 @@ get_frame_name (interp, list, fi)
|
|||
print_address_numeric (fi->pc, 1, gdb_stdout);
|
||||
printf_filtered (" in ");
|
||||
}
|
||||
fprintf_symbol_filtered (gdb_stdout, funname ? funname : "??", funlang,
|
||||
printf_symbol_filtered (gdb_stdout, funname ? funname : "??", funlang,
|
||||
DMGL_ANSI);
|
||||
#endif
|
||||
objv[0] = Tcl_NewStringObj (funname != NULL ? funname : "??", -1);
|
||||
|
@ -3541,3 +3561,7 @@ full_lookup_symtab(file)
|
|||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Local variables: */
|
||||
/* change-log-default-name: "ChangeLog-gdbtk" */
|
||||
/* End: */
|
||||
|
|
|
@ -77,7 +77,7 @@ extern int (*ui_load_progress_hook) PARAMS ((char *, unsigned long));
|
|||
extern void (*pre_add_symbol_hook) PARAMS ((char *));
|
||||
extern void (*post_add_symbol_hook) PARAMS ((void));
|
||||
extern void (*selected_frame_level_changed_hook) PARAMS ((int));
|
||||
#ifdef __CYGWIN__
|
||||
#ifdef __CYGWIN32__
|
||||
extern void (*ui_loop_hook) PARAMS ((int));
|
||||
#endif
|
||||
|
||||
|
@ -114,6 +114,7 @@ static void pc_changed PARAMS ((void));
|
|||
static void tracepoint_notify PARAMS ((struct tracepoint *, const char *));
|
||||
static void gdbtk_selected_frame_changed PARAMS ((int));
|
||||
static void gdbtk_context_change PARAMS ((int));
|
||||
static void gdbtk_error_begin PARAMS ((void));
|
||||
|
||||
/*
|
||||
* gdbtk_fputs can't be static, because we need to call it in gdbtk.c.
|
||||
|
@ -151,7 +152,7 @@ gdbtk_add_hooks(void)
|
|||
target_wait_hook = gdbtk_wait;
|
||||
ui_load_progress_hook = gdbtk_load_hash;
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
#ifdef __CYGWIN32__
|
||||
ui_loop_hook = x_event;
|
||||
#endif
|
||||
pre_add_symbol_hook = gdbtk_pre_add_symbol;
|
||||
|
@ -164,9 +165,12 @@ gdbtk_add_hooks(void)
|
|||
modify_tracepoint_hook = gdbtk_modify_tracepoint;
|
||||
trace_find_hook = gdbtk_trace_find;
|
||||
trace_start_stop_hook = gdbtk_trace_start_stop;
|
||||
|
||||
pc_changed_hook = pc_changed;
|
||||
selected_frame_level_changed_hook = gdbtk_selected_frame_changed;
|
||||
context_hook = gdbtk_context_change;
|
||||
|
||||
error_begin_hook = gdbtk_error_begin;
|
||||
}
|
||||
|
||||
/* These control where to put the gdb output which is created by
|
||||
|
@ -260,7 +264,7 @@ gdbtk_fputs (ptr, stream)
|
|||
else
|
||||
Tcl_AppendToObj (result_ptr->obj_ptr, (char *) ptr, -1);
|
||||
}
|
||||
else if (stream == gdb_stderr)
|
||||
else if (stream == gdb_stderr || result_ptr->flags & GDBTK_ERROR_ONLY)
|
||||
{
|
||||
if (result_ptr->flags & GDBTK_ERROR_STARTED)
|
||||
Tcl_AppendToObj (result_ptr->obj_ptr, (char *) ptr, -1);
|
||||
|
@ -369,7 +373,7 @@ x_event (signo)
|
|||
|
||||
in_x_event = 1;
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
#ifdef __CYGWIN32__
|
||||
if (signo == -2)
|
||||
gdbtk_stop_timer ();
|
||||
#endif
|
||||
|
@ -768,3 +772,16 @@ gdbtk_exec_file_display (filename)
|
|||
{
|
||||
gdbtk_two_elem_cmd ("gdbtk_tcl_exec_file_display", filename);
|
||||
}
|
||||
|
||||
/* Called from error_begin, this hook is used to warn the gui
|
||||
about multi-line error messages */
|
||||
static void
|
||||
gdbtk_error_begin ()
|
||||
{
|
||||
if (result_ptr != NULL)
|
||||
result_ptr->flags |= GDBTK_ERROR_ONLY;
|
||||
}
|
||||
|
||||
/* Local variables: */
|
||||
/* change-log-default-name: "ChangeLog-gdbtk" */
|
||||
/* End: */
|
||||
|
|
1622
gdb/gdbtk-variable.c
Normal file
1622
gdb/gdbtk-variable.c
Normal file
File diff suppressed because it is too large
Load diff
475
gdb/gdbtk-wrapper.c
Normal file
475
gdb/gdbtk-wrapper.c
Normal file
|
@ -0,0 +1,475 @@
|
|||
/* longjmp-free interface between gdb and gdbtk.
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "frame.h"
|
||||
#include "value.h"
|
||||
#include "gdbtk-wrapper.h"
|
||||
|
||||
/*
|
||||
* Wrapper functions exported to the world
|
||||
*/
|
||||
|
||||
gdb_result GDB_value_fetch_lazy PARAMS ((value_ptr));
|
||||
|
||||
gdb_result GDB_evaluate_expression PARAMS ((struct expression *, value_ptr *));
|
||||
|
||||
gdb_result GDB_type_print PARAMS ((value_ptr, char *, GDB_FILE *, int));
|
||||
|
||||
gdb_result GDB_val_print PARAMS ((struct type *type, char *valaddr,
|
||||
CORE_ADDR address, GDB_FILE *stream,
|
||||
int format, int deref_ref, int recurse,
|
||||
enum val_prettyprint pretty));
|
||||
|
||||
gdb_result GDB_select_frame PARAMS ((struct frame_info *, int));
|
||||
|
||||
gdb_result GDB_value_equal PARAMS ((value_ptr, value_ptr, int *));
|
||||
|
||||
gdb_result GDB_parse_exp_1 PARAMS ((char **stringptr, struct block *block, int comma,
|
||||
struct expression **result));
|
||||
|
||||
gdb_result GDB_evaluate_type PARAMS ((struct expression *exp, value_ptr *result));
|
||||
|
||||
gdb_result GDB_block_for_pc PARAMS ((CORE_ADDR pc, struct block **result));
|
||||
|
||||
gdb_result GDB_block_innermost_frame PARAMS ((struct block *block,
|
||||
struct frame_info **result));
|
||||
|
||||
gdb_result GDB_reinit_frame_cache PARAMS ((void));
|
||||
|
||||
gdb_result GDB_find_frame_addr_in_frame_chain PARAMS ((CORE_ADDR addr,
|
||||
struct frame_info **result));
|
||||
|
||||
/*
|
||||
* Private functions for this file
|
||||
*/
|
||||
static gdb_result call_wrapped_function PARAMS ((catch_errors_ftype *,
|
||||
struct gdb_wrapper_arguments *));
|
||||
|
||||
static int wrap_type_print PARAMS ((char *));
|
||||
|
||||
static int wrap_evaluate_expression PARAMS ((char *));
|
||||
|
||||
static int wrap_value_fetch_lazy PARAMS ((char *));
|
||||
|
||||
static int wrap_val_print PARAMS ((char*));
|
||||
|
||||
static int wrap_select_frame PARAMS ((char *));
|
||||
|
||||
static int wrap_value_equal PARAMS ((char *));
|
||||
|
||||
static int wrap_parse_exp_1 PARAMS ((char *opaque_arg));
|
||||
|
||||
static int wrap_evaluate_type PARAMS ((char *opaque_arg));
|
||||
|
||||
static int wrap_block_for_pc PARAMS ((char *opaque_arg));
|
||||
|
||||
static int wrap_block_innermost_frame PARAMS ((char *opaque_arg));
|
||||
|
||||
static int wrap_reinit_frame_cache PARAMS ((char *opaque_arg));
|
||||
|
||||
static int wrap_find_frame_addr_in_frame_chain PARAMS ((char *opaque_arg));
|
||||
|
||||
static gdb_result
|
||||
call_wrapped_function (fn, arg)
|
||||
catch_errors_ftype *fn;
|
||||
struct gdb_wrapper_arguments *arg;
|
||||
{
|
||||
if (!catch_errors (fn, (char *) &arg, "", RETURN_MASK_ERROR))
|
||||
{
|
||||
/* An error occurred */
|
||||
return GDB_ERROR;
|
||||
}
|
||||
|
||||
return GDB_OK;
|
||||
}
|
||||
|
||||
gdb_result
|
||||
GDB_type_print (val, varstring, stream, show)
|
||||
value_ptr val;
|
||||
char *varstring;
|
||||
GDB_FILE *stream;
|
||||
int show;
|
||||
{
|
||||
struct gdb_wrapper_arguments args;
|
||||
|
||||
args.args[0] = (char *) val;
|
||||
args.args[1] = varstring;
|
||||
args.args[2] = (char *) stream;
|
||||
args.args[3] = (char *) show;
|
||||
return call_wrapped_function ((catch_errors_ftype *) wrap_type_print, &args);
|
||||
}
|
||||
|
||||
static int
|
||||
wrap_type_print (a)
|
||||
char *a;
|
||||
{
|
||||
struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) a;
|
||||
value_ptr val = (value_ptr) (*args)->args[0];
|
||||
char *varstring = (*args)->args[1];
|
||||
GDB_FILE *stream = (GDB_FILE *) (*args)->args[2];
|
||||
int show = (int) (*args)->args[3];
|
||||
type_print (VALUE_TYPE (val), varstring, stream, show);
|
||||
return 1;
|
||||
}
|
||||
|
||||
gdb_result
|
||||
GDB_val_print (type, valaddr, address, stream, format, deref_ref,
|
||||
recurse, pretty)
|
||||
struct type *type;
|
||||
char *valaddr;
|
||||
CORE_ADDR address;
|
||||
GDB_FILE *stream;
|
||||
int format;
|
||||
int deref_ref;
|
||||
int recurse;
|
||||
enum val_prettyprint pretty;
|
||||
{
|
||||
struct gdb_wrapper_arguments args;
|
||||
|
||||
args.args[0] = (char *) type;
|
||||
args.args[1] = (char *) valaddr;
|
||||
args.args[2] = (char *) address;
|
||||
args.args[3] = (char *) stream;
|
||||
args.args[4] = (char *) format;
|
||||
args.args[5] = (char *) deref_ref;
|
||||
args.args[6] = (char *) recurse;
|
||||
args.args[7] = (char *) pretty;
|
||||
|
||||
return call_wrapped_function ((catch_errors_ftype *) wrap_val_print, &args);
|
||||
}
|
||||
|
||||
static int
|
||||
wrap_val_print (a)
|
||||
char *a;
|
||||
{
|
||||
struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) a;
|
||||
struct type *type;
|
||||
char *valaddr;
|
||||
CORE_ADDR address;
|
||||
GDB_FILE *stream;
|
||||
int format;
|
||||
int deref_ref;
|
||||
int recurse;
|
||||
enum val_prettyprint pretty;
|
||||
|
||||
type = (struct type *) (*args)->args[0];
|
||||
valaddr = (char *) (*args)->args[1];
|
||||
address = (CORE_ADDR) (*args)->args[2];
|
||||
stream = (GDB_FILE *) (*args)->args[3];
|
||||
format = (int) (*args)->args[4];
|
||||
deref_ref = (int) (*args)->args[5];
|
||||
recurse = (int) (*args)->args[6];
|
||||
pretty = (enum val_prettyprint) (*args)->args[7];
|
||||
|
||||
val_print (type, valaddr, 0, address, stream, format, deref_ref,
|
||||
recurse, pretty);
|
||||
return 1;
|
||||
}
|
||||
|
||||
gdb_result
|
||||
GDB_value_fetch_lazy (value)
|
||||
value_ptr value;
|
||||
{
|
||||
struct gdb_wrapper_arguments args;
|
||||
|
||||
args.args[0] = (char *) value;
|
||||
return call_wrapped_function ((catch_errors_ftype *) wrap_value_fetch_lazy, &args);
|
||||
}
|
||||
|
||||
static int
|
||||
wrap_value_fetch_lazy (a)
|
||||
char *a;
|
||||
{
|
||||
struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) a;
|
||||
|
||||
value_fetch_lazy ((value_ptr) (*args)->args[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
gdb_result
|
||||
GDB_evaluate_expression (exp, value)
|
||||
struct expression *exp;
|
||||
value_ptr *value;
|
||||
{
|
||||
struct gdb_wrapper_arguments args;
|
||||
gdb_result result;
|
||||
args.args[0] = (char *) exp;
|
||||
|
||||
result = call_wrapped_function ((catch_errors_ftype *) wrap_evaluate_expression, &args);
|
||||
if (result != GDB_OK)
|
||||
return result;
|
||||
|
||||
*value = (value_ptr) args.result;
|
||||
return GDB_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
wrap_evaluate_expression (a)
|
||||
char *a;
|
||||
{
|
||||
struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) a;
|
||||
|
||||
(*args)->result =
|
||||
(char *) evaluate_expression ((struct expression *) (*args)->args[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
gdb_result
|
||||
GDB_select_frame (fi, level)
|
||||
struct frame_info *fi;
|
||||
int level;
|
||||
{
|
||||
struct gdb_wrapper_arguments args;
|
||||
|
||||
args.args[0] = (char *) fi;
|
||||
args.args[1] = (char *) &level;
|
||||
|
||||
return call_wrapped_function ((catch_errors_ftype *) wrap_select_frame, &args);
|
||||
}
|
||||
|
||||
static int
|
||||
wrap_select_frame (a)
|
||||
char *a;
|
||||
{
|
||||
struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) a;
|
||||
int level = * (int *) (*args)->args[1];
|
||||
struct frame_info *fi = (struct frame_info *) (*args)->args[0];
|
||||
|
||||
select_frame (fi, level);
|
||||
return 1;
|
||||
}
|
||||
|
||||
gdb_result
|
||||
GDB_value_equal (val1, val2, result)
|
||||
value_ptr val1;
|
||||
value_ptr val2;
|
||||
int *result;
|
||||
{
|
||||
struct gdb_wrapper_arguments args;
|
||||
gdb_result r;
|
||||
|
||||
args.args[0] = (char *) val1;
|
||||
args.args[1] = (char *) val2;
|
||||
|
||||
r = call_wrapped_function ((catch_errors_ftype *) wrap_value_equal, &args);
|
||||
if (r != GDB_OK)
|
||||
return r;
|
||||
|
||||
*result = (int) args.result;
|
||||
return GDB_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
wrap_value_equal (a)
|
||||
char *a;
|
||||
{
|
||||
struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) a;
|
||||
value_ptr val1, val2;
|
||||
|
||||
val1 = (value_ptr) (*args)->args[0];
|
||||
val2 = (value_ptr) (*args)->args[1];
|
||||
|
||||
(*args)->result = (char *) value_equal (val1, val2);
|
||||
return 1;
|
||||
}
|
||||
|
||||
gdb_result
|
||||
GDB_parse_exp_1 (stringptr, block, comma, result)
|
||||
char **stringptr;
|
||||
struct block *block;
|
||||
int comma;
|
||||
struct expression **result;
|
||||
{
|
||||
struct gdb_wrapper_arguments args;
|
||||
gdb_result r;
|
||||
|
||||
args.args[0] = (char *) stringptr;
|
||||
args.args[1] = (char *) block;
|
||||
args.args[2] = (char *) comma;
|
||||
|
||||
r = call_wrapped_function ((catch_errors_ftype *) wrap_parse_exp_1, &args);
|
||||
if (r != GDB_OK)
|
||||
return r;
|
||||
|
||||
*result = (struct expression *) args.result;
|
||||
return GDB_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
wrap_parse_exp_1 (opaque_arg)
|
||||
char *opaque_arg;
|
||||
{
|
||||
struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) opaque_arg;
|
||||
struct block *block;
|
||||
char **stringptr;
|
||||
int comma;
|
||||
|
||||
stringptr = (char **) (*args)->args[0];
|
||||
block = (struct block *) (*args)->args[1];
|
||||
comma = (int) (*args)->args[2];
|
||||
|
||||
(*args)->result = (char *) parse_exp_1 (stringptr, block, comma);
|
||||
return 1;
|
||||
}
|
||||
|
||||
gdb_result
|
||||
GDB_evaluate_type (exp, result)
|
||||
struct expression *exp;
|
||||
value_ptr *result;
|
||||
{
|
||||
struct gdb_wrapper_arguments args;
|
||||
gdb_result r;
|
||||
|
||||
args.args[0] = (char *) exp;
|
||||
|
||||
r = call_wrapped_function ((catch_errors_ftype *) wrap_evaluate_type, &args);
|
||||
if (r != GDB_OK)
|
||||
return r;
|
||||
|
||||
*result = (value_ptr) args.result;
|
||||
return GDB_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
wrap_evaluate_type (opaque_arg)
|
||||
char *opaque_arg;
|
||||
{
|
||||
struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) opaque_arg;
|
||||
struct expression *exp;
|
||||
|
||||
exp = (struct expression *) (*args)->args[0];
|
||||
(*args)->result = (char *) evaluate_type (exp);
|
||||
return 1;
|
||||
}
|
||||
|
||||
gdb_result
|
||||
GDB_block_for_pc (pc, result)
|
||||
CORE_ADDR pc;
|
||||
struct block **result;
|
||||
{
|
||||
struct gdb_wrapper_arguments args;
|
||||
gdb_result r;
|
||||
|
||||
args.args[0] = (char *) pc;
|
||||
|
||||
r = call_wrapped_function ((catch_errors_ftype *) wrap_block_for_pc, &args);
|
||||
if (r != GDB_OK)
|
||||
return r;
|
||||
|
||||
*result = (struct block *) args.result;
|
||||
return GDB_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
wrap_block_for_pc (opaque_arg)
|
||||
char *opaque_arg;
|
||||
{
|
||||
struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) opaque_arg;
|
||||
CORE_ADDR pc;
|
||||
|
||||
pc = (CORE_ADDR) (*args)->args[0];
|
||||
(*args)->result = (char *) block_for_pc (pc);
|
||||
return 1;
|
||||
}
|
||||
|
||||
gdb_result
|
||||
GDB_block_innermost_frame (block, result)
|
||||
struct block *block;
|
||||
struct frame_info **result;
|
||||
{
|
||||
struct gdb_wrapper_arguments args;
|
||||
gdb_result r;
|
||||
|
||||
args.args[0] = (char *) block;
|
||||
|
||||
r = call_wrapped_function ((catch_errors_ftype *) wrap_block_innermost_frame, &args);
|
||||
if (r != GDB_OK)
|
||||
return r;
|
||||
|
||||
*result = (struct frame_info *) args.result;
|
||||
return GDB_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
wrap_block_innermost_frame (opaque_arg)
|
||||
char *opaque_arg;
|
||||
{
|
||||
struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) opaque_arg;
|
||||
struct block *block;
|
||||
|
||||
block = (struct block *) (*args)->args[0];
|
||||
(*args)->result = (char *) block_innermost_frame (block);
|
||||
return 1;
|
||||
}
|
||||
|
||||
gdb_result
|
||||
GDB_reinit_frame_cache ()
|
||||
{
|
||||
gdb_result r;
|
||||
|
||||
r = call_wrapped_function ((catch_errors_ftype *) wrap_reinit_frame_cache, NULL);
|
||||
if (r != GDB_OK)
|
||||
return r;
|
||||
|
||||
return GDB_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
wrap_reinit_frame_cache (opaque_arg)
|
||||
char *opaque_arg;
|
||||
{
|
||||
reinit_frame_cache ();
|
||||
return 1;
|
||||
}
|
||||
|
||||
gdb_result
|
||||
GDB_find_frame_addr_in_frame_chain (addr, result)
|
||||
CORE_ADDR addr;
|
||||
struct frame_info **result;
|
||||
{
|
||||
struct gdb_wrapper_arguments args;
|
||||
gdb_result r;
|
||||
|
||||
args.args[0] = (char *) addr;
|
||||
|
||||
r = call_wrapped_function ((catch_errors_ftype *) wrap_find_frame_addr_in_frame_chain, &args);
|
||||
if (r != GDB_OK)
|
||||
return r;
|
||||
|
||||
*result = (struct frame_info *) args.result;
|
||||
return GDB_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
wrap_find_frame_addr_in_frame_chain (opaque_arg)
|
||||
char *opaque_arg;
|
||||
{
|
||||
struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) opaque_arg;
|
||||
CORE_ADDR addr;
|
||||
|
||||
addr = (CORE_ADDR) (*args)->args[0];
|
||||
(*args)->result = (char *) find_frame_addr_in_frame_chain (addr);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* Local variables: */
|
||||
/* change-log-default-name: "ChangeLog-gdbtk" */
|
||||
/* End: */
|
62
gdb/gdbtk-wrapper.h
Normal file
62
gdb/gdbtk-wrapper.h
Normal file
|
@ -0,0 +1,62 @@
|
|||
/* longjmp-free interface between gdb and gdbtk.
|
||||
Copyright 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB. It contains routines to safely call common gdb
|
||||
functions without the fear of longjmp'ing.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef GDBTK_WRAPPER_H
|
||||
#define GDBTK_WRAPPER_H
|
||||
/* Use this struct used to pass arguments to wrapper routines. We assume
|
||||
(arbitrarily) that no gdb function takes more than ten arguments. */
|
||||
struct gdb_wrapper_arguments {
|
||||
|
||||
/* Pointer to some result from the gdb function call, if any */
|
||||
char *result;
|
||||
|
||||
/* The list of arguments. */
|
||||
char *args[10];
|
||||
};
|
||||
|
||||
/* Whenever any gdb function wrapper is called, its return status is: */
|
||||
typedef enum gdb_wrapper_status { GDB_OK, GDB_ERROR } gdb_result;
|
||||
|
||||
/* This list of functions which have been wrapped. Please keep this list
|
||||
in alphabetical order, using "GDB_" to prefix the actual name of the
|
||||
function. */
|
||||
extern gdb_result GDB_evaluate_expression PARAMS ((struct expression *expr, value_ptr *val));
|
||||
extern gdb_result GDB_select_frame PARAMS ((struct frame_info *fi, int level));
|
||||
extern gdb_result GDB_type_print PARAMS ((value_ptr val, char *varstring, GDB_FILE *stream, int show));
|
||||
extern gdb_result GDB_val_print PARAMS ((struct type *type, char *valaddr,
|
||||
CORE_ADDR address, GDB_FILE *stream,
|
||||
int format, int deref_ref, int recurse,
|
||||
enum val_prettyprint pretty));
|
||||
extern gdb_result GDB_value_fetch_lazy PARAMS ((value_ptr value));
|
||||
extern gdb_result GDB_value_equal PARAMS ((value_ptr val1, value_ptr val2, int *result));
|
||||
extern gdb_result GDB_parse_exp_1 PARAMS ((char **stringptr, struct block *block, int comma,
|
||||
struct expression **result));
|
||||
extern gdb_result GDB_evaluate_type PARAMS ((struct expression *exp, value_ptr *result));
|
||||
extern gdb_result GDB_block_for_pc PARAMS ((CORE_ADDR pc, struct block **result));
|
||||
extern gdb_result GDB_block_innermost_frame PARAMS ((struct block *block,
|
||||
struct frame_info **result));
|
||||
extern gdb_result GDB_reinit_frame_cache PARAMS ((void));
|
||||
extern gdb_result GDB_find_frame_addr_in_frame_chain PARAMS ((CORE_ADDR addr,
|
||||
struct frame_info **result));
|
||||
#endif /* GDBTK_WRAPPER_H */
|
||||
|
||||
/* Local variables: */
|
||||
/* change-log-default-name: "ChangeLog-gdbtk" */
|
||||
/* End: */
|
265
gdb/gdbtk.c
265
gdb/gdbtk.c
|
@ -44,13 +44,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||
#include "guitcl.h"
|
||||
#include "gdbtk.h"
|
||||
|
||||
#ifdef IDE
|
||||
/* start-sanitize-ide */
|
||||
#ifdef IDE
|
||||
#include "event.h"
|
||||
#include "idetcl.h"
|
||||
#include "ilutk.h"
|
||||
/* end-sanitize-ide */
|
||||
#endif
|
||||
/* end-sanitize-ide */
|
||||
|
||||
#ifdef ANSI_PROTOTYPES
|
||||
#include <stdarg.h>
|
||||
|
@ -71,7 +71,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||
#include "annotate.h"
|
||||
#include <sys/time.h>
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
#ifdef __CYGWIN32__
|
||||
#include <sys/cygwin.h> /* for cygwin32_attach_handle_to_fd */
|
||||
#endif
|
||||
|
||||
|
@ -83,6 +83,17 @@ static sigset_t nullsigmask;
|
|||
static struct sigaction act1, act2;
|
||||
static struct itimerval it_on, it_off;
|
||||
|
||||
/*
|
||||
* These two variables control the interaction with an external editor.
|
||||
* If enable_external_editor is set at startup, BEFORE Gdbtk_Init is run
|
||||
* then the Tcl variable of the same name will be set, and a command will
|
||||
* called external_editor_command will be invoked to call out to the
|
||||
* external editor. We give a dummy version here to warn if it is not set.
|
||||
*/
|
||||
int enable_external_editor = 0;
|
||||
char * external_editor_command = "tk_dialog .warn-external \\\n\
|
||||
\"No command is specified.\nUse --tclcommand <tcl/file> or --external-editor <cmd> to specify a new command\" 0 Ok";
|
||||
|
||||
extern int Tktable_Init PARAMS ((Tcl_Interp *interp));
|
||||
|
||||
static void gdbtk_init PARAMS ((char *));
|
||||
|
@ -317,17 +328,17 @@ gdbtk_init ( argv0 )
|
|||
char *argv0;
|
||||
{
|
||||
struct cleanup *old_chain;
|
||||
char *lib, *gdbtk_lib, *gdbtk_lib_tmp, *gdbtk_file;
|
||||
int found_main;
|
||||
char s[5];
|
||||
Tcl_Obj *auto_path_elem, *auto_path_name;
|
||||
|
||||
#ifdef IDE
|
||||
/* start-sanitize-ide */
|
||||
#ifdef IDE
|
||||
struct ide_event_handle *h;
|
||||
const char *errmsg;
|
||||
char *libexecdir;
|
||||
/* end-sanitize-ide */
|
||||
#endif
|
||||
/* end-sanitize-ide */
|
||||
|
||||
/* If there is no DISPLAY environment variable, Tk_Init below will fail,
|
||||
causing gdb to abort. If instead we simply return here, gdb will
|
||||
|
@ -354,18 +365,27 @@ gdbtk_init ( argv0 )
|
|||
if (Tcl_Init(gdbtk_interp) != TCL_OK)
|
||||
error ("Tcl_Init failed: %s", gdbtk_interp->result);
|
||||
|
||||
/* Set up some globals used by gdb to pass info to gdbtk
|
||||
for start up options and the like */
|
||||
sprintf (s, "%d", inhibit_gdbinit);
|
||||
Tcl_SetVar2 (gdbtk_interp, "GDBStartup", "inhibit_prefs", s, TCL_GLOBAL_ONLY);
|
||||
|
||||
/* start-sanitize-ide */
|
||||
#ifndef IDE
|
||||
/* end-sanitize-ide */
|
||||
/* For the IDE we register the cleanup later, after we've
|
||||
initialized events. */
|
||||
make_final_cleanup (gdbtk_cleanup, NULL);
|
||||
#endif
|
||||
/* start-sanitize-ide */
|
||||
#endif /* IDE */
|
||||
/* end-sanitize-ide */
|
||||
|
||||
/* Initialize the Paths variable. */
|
||||
if (ide_initialize_paths (gdbtk_interp, "gdbtcl") != TCL_OK)
|
||||
if (ide_initialize_paths (gdbtk_interp, "") != TCL_OK)
|
||||
error ("ide_initialize_paths failed: %s", gdbtk_interp->result);
|
||||
|
||||
#ifdef IDE
|
||||
/* start-sanitize-ide */
|
||||
#ifdef IDE
|
||||
/* Find the directory where we expect to find idemanager. We ignore
|
||||
errors since it doesn't really matter if this fails. */
|
||||
libexecdir = Tcl_GetVar2 (gdbtk_interp, "Paths", "libexecdir", TCL_GLOBAL_ONLY);
|
||||
|
@ -417,10 +437,12 @@ gdbtk_init ( argv0 )
|
|||
|
||||
Tcl_SetVar (gdbtk_interp, "IDE_ENABLED", "1", 0);
|
||||
}
|
||||
/* end-sanitize-ide */
|
||||
#else
|
||||
/* end-sanitize-ide */
|
||||
Tcl_SetVar (gdbtk_interp, "IDE_ENABLED", "0", 0);
|
||||
/* start-sanitize-ide */
|
||||
#endif /* IDE */
|
||||
/* end-sanitize-ide */
|
||||
|
||||
/* We don't want to open the X connection until we've done all the
|
||||
IDE initialization. Otherwise, goofy looking unfinished windows
|
||||
|
@ -431,12 +453,17 @@ gdbtk_init ( argv0 )
|
|||
|
||||
if (Itcl_Init(gdbtk_interp) == TCL_ERROR)
|
||||
error ("Itcl_Init failed: %s", gdbtk_interp->result);
|
||||
Tcl_StaticPackage(gdbtk_interp, "Tktable", Tktable_Init,
|
||||
Tcl_StaticPackage(gdbtk_interp, "Itcl", Itcl_Init,
|
||||
(Tcl_PackageInitProc *) NULL);
|
||||
|
||||
if (Itk_Init(gdbtk_interp) == TCL_ERROR)
|
||||
error ("Itk_Init failed: %s", gdbtk_interp->result);
|
||||
Tcl_StaticPackage(gdbtk_interp, "Itk", Itk_Init,
|
||||
(Tcl_PackageInitProc *) NULL);
|
||||
|
||||
if (Tix_Init(gdbtk_interp) != TCL_OK)
|
||||
error ("Tix_Init failed: %s", gdbtk_interp->result);
|
||||
Tcl_StaticPackage(gdbtk_interp, "Tktable", Tktable_Init,
|
||||
Tcl_StaticPackage(gdbtk_interp, "Tix", Tix_Init,
|
||||
(Tcl_PackageInitProc *) NULL);
|
||||
|
||||
if (Tktable_Init(gdbtk_interp) != TCL_OK)
|
||||
|
@ -448,7 +475,7 @@ gdbtk_init ( argv0 )
|
|||
* These are the commands to do some Windows Specific stuff...
|
||||
*/
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
#ifdef __CYGWIN32__
|
||||
if (ide_create_messagebox_command (gdbtk_interp) != TCL_OK)
|
||||
error ("messagebox command initialization failed");
|
||||
/* On Windows, create a sizebox widget command */
|
||||
|
@ -489,161 +516,91 @@ gdbtk_init ( argv0 )
|
|||
|
||||
add_com ("tk", class_obscure, tk_command,
|
||||
"Send a command directly into tk.");
|
||||
|
||||
/*
|
||||
* Set the variables for external editor:
|
||||
*/
|
||||
|
||||
Tcl_SetVar (gdbtk_interp, "enable_external_editor", enable_external_editor ? "1" : "0", 0);
|
||||
Tcl_SetVar (gdbtk_interp, "external_editor_command", external_editor_command, 0);
|
||||
|
||||
/* find the gdb tcl library and source main.tcl */
|
||||
|
||||
gdbtk_lib = getenv ("GDBTK_LIBRARY");
|
||||
if (!gdbtk_lib)
|
||||
{
|
||||
if (access ("gdbtcl/main.tcl", R_OK) == 0)
|
||||
gdbtk_lib = "gdbtcl";
|
||||
else
|
||||
gdbtk_lib = GDBTK_LIBRARY;
|
||||
}
|
||||
|
||||
gdbtk_lib_tmp = xstrdup (gdbtk_lib);
|
||||
|
||||
found_main = 0;
|
||||
/* see if GDBTK_LIBRARY is a path list */
|
||||
lib = strtok (gdbtk_lib_tmp, GDBTK_PATH_SEP);
|
||||
|
||||
auto_path_name = Tcl_NewStringObj ("auto_path", -1);
|
||||
|
||||
do
|
||||
{
|
||||
auto_path_elem = Tcl_NewStringObj (lib, -1);
|
||||
if (Tcl_ObjSetVar2 (gdbtk_interp, auto_path_name, NULL, auto_path_elem,
|
||||
TCL_GLOBAL_ONLY | TCL_APPEND_VALUE | TCL_LIST_ELEMENT ) == NULL)
|
||||
{
|
||||
fputs_unfiltered (Tcl_GetVar (gdbtk_interp, "errorInfo", 0), gdb_stderr);
|
||||
error ("");
|
||||
}
|
||||
if (!found_main)
|
||||
{
|
||||
gdbtk_file = concat (lib, "/main.tcl", (char *) NULL);
|
||||
if (access (gdbtk_file, R_OK) == 0)
|
||||
{
|
||||
found_main++;
|
||||
Tcl_SetVar (gdbtk_interp, "GDBTK_LIBRARY", lib, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
while ((lib = strtok (NULL, ":")) != NULL);
|
||||
|
||||
free (gdbtk_lib_tmp);
|
||||
Tcl_DecrRefCount(auto_path_name);
|
||||
|
||||
if (!found_main)
|
||||
{
|
||||
/* Try finding it with the auto path. */
|
||||
|
||||
static const char script[] ="\
|
||||
{
|
||||
#ifdef NO_TCLPRO_DEBUGGER
|
||||
static const char script[] ="\
|
||||
proc gdbtk_find_main {} {\n\
|
||||
global auto_path GDBTK_LIBRARY\n\
|
||||
foreach dir $auto_path {\n\
|
||||
set f [file join $dir main.tcl]\n\
|
||||
if {[file exists $f]} then {\n\
|
||||
set GDBTK_LIBRARY $dir\n\
|
||||
return $f\n\
|
||||
}\n\
|
||||
}\n\
|
||||
return ""\n\
|
||||
global Paths GDBTK_LIBRARY\n\
|
||||
rename gdbtk_find_main {}\n\
|
||||
tcl_findLibrary gdb 1.0 {} main.tcl GDBTK_LIBRARY GDBTK_LIBRARY gdbtcl2 gdbtcl {}\n\
|
||||
set Paths(appdir) $GDBTK_LIBRARY\n\
|
||||
}\n\
|
||||
gdbtk_find_main";
|
||||
|
||||
if (Tcl_GlobalEval (gdbtk_interp, (char *) script) != TCL_OK)
|
||||
{
|
||||
fputs_unfiltered (Tcl_GetVar (gdbtk_interp, "errorInfo", 0), gdb_stderr);
|
||||
error ("");
|
||||
}
|
||||
|
||||
if (gdbtk_interp->result[0] != '\0')
|
||||
{
|
||||
gdbtk_file = xstrdup (gdbtk_interp->result);
|
||||
found_main++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found_main)
|
||||
{
|
||||
fputs_unfiltered_hook = NULL; /* Force errors to stdout/stderr */
|
||||
if (getenv("GDBTK_LIBRARY"))
|
||||
{
|
||||
fprintf_unfiltered (gdb_stderr, "Unable to find main.tcl in %s\n",
|
||||
getenv("GDBTK_LIBRARY"));
|
||||
fprintf_unfiltered (gdb_stderr,
|
||||
"Please set GDBTK_LIBRARY to a path that includes the GDB tcl files.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf_unfiltered (gdb_stderr,
|
||||
"Unable to find main.tcl in %s\n", GDBTK_LIBRARY);
|
||||
fprintf_unfiltered (gdb_stderr,
|
||||
"You might want to set GDBTK_LIBRARY\n");
|
||||
}
|
||||
error("");
|
||||
}
|
||||
#else
|
||||
static const char script[] ="\
|
||||
proc gdbtk_find_main {} {\n\
|
||||
global Paths GDBTK_LIBRARY env\n\
|
||||
rename gdbtk_find_main {}\n\
|
||||
if {[info exists env(DEBUG_STUB)]} {\n\
|
||||
source $env(DEBUG_STUB)\n\
|
||||
debugger_init\n\
|
||||
set debug_startup 1\n\
|
||||
} else {\n\
|
||||
set debug_startup 0\n\
|
||||
}\n\
|
||||
tcl_findLibrary gdb 1.0 {} main.tcl GDBTK_LIBRARY GDBTK_LIBRARY gdbtcl2 gdbtcl {} $debug_startup\n\
|
||||
set Paths(appdir) $GDBTK_LIBRARY\n\
|
||||
}\n\
|
||||
gdbtk_find_main";
|
||||
#endif /* NO_TCLPRO_DEBUGGER */
|
||||
|
||||
fputs_unfiltered_hook = NULL; /* Force errors to stdout/stderr */
|
||||
|
||||
/*
|
||||
* Set the variables for external editor, do this before eval'ing main.tcl
|
||||
* since the value is used there...
|
||||
*/
|
||||
|
||||
Tcl_SetVar (gdbtk_interp, "enable_external_editor",
|
||||
enable_external_editor ? "1" : "0", 0);
|
||||
Tcl_SetVar (gdbtk_interp, "external_editor_command",
|
||||
external_editor_command, 0);
|
||||
|
||||
if (Tcl_GlobalEval (gdbtk_interp, (char *) script) != TCL_OK)
|
||||
{
|
||||
char *msg;
|
||||
|
||||
/* Force errorInfo to be set up propertly. */
|
||||
Tcl_AddErrorInfo (gdbtk_interp, "");
|
||||
|
||||
msg = Tcl_GetVar (gdbtk_interp, "errorInfo", TCL_GLOBAL_ONLY);
|
||||
|
||||
fputs_unfiltered_hook = NULL; /* Force errors to stdout/stderr */
|
||||
|
||||
#ifdef _WIN32
|
||||
MessageBox (NULL, msg, NULL, MB_OK | MB_ICONERROR | MB_TASKMODAL);
|
||||
#else
|
||||
fputs_unfiltered (msg, gdb_stderr);
|
||||
#endif
|
||||
|
||||
error ("");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* Defer setup of fputs_unfiltered_hook to near the end so that error messages
|
||||
prior to this point go to stdout/stderr. */
|
||||
|
||||
fputs_unfiltered_hook = gdbtk_fputs;
|
||||
|
||||
/* start-sanitize-tclpro */
|
||||
#ifdef TCLPRO_DEBUGGER
|
||||
{
|
||||
Tcl_DString source_cmd;
|
||||
|
||||
Tcl_DStringInit (&source_cmd);
|
||||
Tcl_DStringAppend (&source_cmd,
|
||||
"if {[info exists env(DEBUG_STUB)]} {source $env(DEBUG_STUB); " -1);
|
||||
Tcl_DStringAppend (&source_cmd, "debugger_init; debugger_eval {source {", -1);
|
||||
Tcl_DStringAppend (&source_cmd, gdbtk_file, -1);
|
||||
Tcl_DStringAppend (&source_cmd, "}}} else {source {", -1);
|
||||
Tcl_DStringAppend (&source_cmd, gdbtk_file, -1);
|
||||
Tcl_DStringAppend (&source_cmd, "}}", -1);
|
||||
if (Tcl_GlobalEval (gdbtk_interp, Tcl_DStringValue (&source_cmd)) != TCL_OK)
|
||||
#else
|
||||
/* end-sanitize-tclpro */
|
||||
if (Tcl_EvalFile (gdbtk_interp, gdbtk_file) != TCL_OK)
|
||||
/* start-sanitize-tclpro */
|
||||
#endif
|
||||
/* end-sanitize-tclpro */
|
||||
{
|
||||
char *msg;
|
||||
|
||||
/* Force errorInfo to be set up propertly. */
|
||||
Tcl_AddErrorInfo (gdbtk_interp, "");
|
||||
|
||||
msg = Tcl_GetVar (gdbtk_interp, "errorInfo", TCL_GLOBAL_ONLY);
|
||||
|
||||
fputs_unfiltered_hook = NULL; /* Force errors to stdout/stderr */
|
||||
|
||||
#ifdef _WIN32
|
||||
MessageBox (NULL, msg, NULL, MB_OK | MB_ICONERROR | MB_TASKMODAL);
|
||||
#else
|
||||
fputs_unfiltered (msg, gdb_stderr);
|
||||
#endif
|
||||
|
||||
error ("");
|
||||
}
|
||||
/* start-sanitize-tclpro */
|
||||
#ifdef TCLPRO_DEBUGGER
|
||||
Tcl_DStringFree(&source_cmd);
|
||||
}
|
||||
#endif
|
||||
/* end-sanitize-tclpro */
|
||||
|
||||
#ifdef IDE
|
||||
/* start-sanitize-ide */
|
||||
#ifdef IDE
|
||||
/* Don't do this until we have initialized. Otherwise, we may get a
|
||||
run command before we are ready for one. */
|
||||
if (ide_run_server_init (gdbtk_interp, h) != TCL_OK)
|
||||
error ("ide_run_server_init failed: %s", gdbtk_interp->result);
|
||||
/* end-sanitize-ide */
|
||||
#endif
|
||||
|
||||
free (gdbtk_file);
|
||||
/* end-sanitize-ide */
|
||||
|
||||
/* Now source in the filename provided by the --tclcommand option.
|
||||
This is mostly used for the gdbtk testsuite... */
|
||||
|
@ -686,11 +643,11 @@ _initialize_gdbtk ()
|
|||
/* Tell the rest of the world that Gdbtk is now set up. */
|
||||
|
||||
init_ui_hook = gdbtk_init;
|
||||
#ifdef __CYGWIN__
|
||||
#ifdef __CYGWIN32__
|
||||
(void) FreeConsole ();
|
||||
#endif
|
||||
}
|
||||
#ifdef __CYGWIN__
|
||||
#ifdef __CYGWIN32__
|
||||
else
|
||||
{
|
||||
DWORD ft = GetFileType (GetStdHandle (STD_INPUT_HANDLE));
|
||||
|
@ -744,4 +701,8 @@ tk_command (cmd, from_tty)
|
|||
|
||||
do_cleanups (old_chain);
|
||||
}
|
||||
|
||||
/* Local variables: */
|
||||
/* change-log-default-name: "ChangeLog-gdbtk" */
|
||||
/* End: */
|
||||
|
||||
|
|
16
gdb/gdbtk.h
16
gdb/gdbtk.h
|
@ -117,7 +117,9 @@ typedef struct gdbtk_result {
|
|||
the result we have been accumulating, or the
|
||||
error and the previous successful output
|
||||
will get mixed, which would be confusing. */
|
||||
|
||||
#define GDBTK_ERROR_ONLY 16 /* Indicates that all incoming I/O is
|
||||
to be treated as if it had arrived for gdb_stderr. This is
|
||||
used to help error_begin in utils.c. */
|
||||
|
||||
/* This is a pointer to the gdbtk_result struct that
|
||||
we are currently filling. We use the C stack to make a stack of these
|
||||
|
@ -141,6 +143,7 @@ extern void gdbtk_ignorable_warning PARAMS ((const char *));
|
|||
extern void gdbtk_interactive PARAMS ((void));
|
||||
extern void x_event PARAMS ((int));
|
||||
extern int gdbtk_two_elem_cmd PARAMS ((char *, char *));
|
||||
extern int call_wrapper PARAMS ((ClientData, Tcl_Interp *, int, Tcl_Obj *CONST []));
|
||||
|
||||
#ifdef _WIN32
|
||||
extern void close_bfds ();
|
||||
|
@ -152,3 +155,14 @@ TclDebug (const char *fmt, ...);
|
|||
#else
|
||||
TclDebug (va_alist);
|
||||
#endif
|
||||
|
||||
/* A convenience macro for getting the demangled source names,
|
||||
regardless of the user's mangling style. */
|
||||
#define GDBTK_SYMBOL_SOURCE_NAME(symbol) \
|
||||
(SYMBOL_DEMANGLED_NAME (symbol) != NULL \
|
||||
? SYMBOL_DEMANGLED_NAME (symbol) \
|
||||
: SYMBOL_NAME (symbol))
|
||||
|
||||
/* Local variables: */
|
||||
/* change-log-default-name: "ChangeLog-gdbtk" */
|
||||
/* End: */
|
||||
|
|
135
gdb/i386-tdep.c
135
gdb/i386-tdep.c
|
@ -1,5 +1,6 @@
|
|||
/* Intel 386 target-dependent stuff.
|
||||
Copyright (C) 1988, 1989, 1991, 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988, 1989, 1991, 1994, 1995, 1996, 1998
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
|
@ -26,6 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||
#include "floatformat.h"
|
||||
#include "symtab.h"
|
||||
#include "gdbcmd.h"
|
||||
#include "command.h"
|
||||
|
||||
static long i386_get_frame_setup PARAMS ((CORE_ADDR));
|
||||
|
||||
|
@ -37,6 +39,28 @@ static void codestream_seek PARAMS ((CORE_ADDR));
|
|||
|
||||
static unsigned char codestream_fill PARAMS ((int));
|
||||
|
||||
CORE_ADDR skip_trampoline_code PARAMS ((CORE_ADDR, char *));
|
||||
|
||||
static int gdb_print_insn_i386 (bfd_vma, disassemble_info *);
|
||||
|
||||
void _initialize_i386_tdep PARAMS ((void));
|
||||
|
||||
/* This is the variable the is set with "set disassembly-flavor",
|
||||
and its legitimate values. */
|
||||
static char att_flavor[] = "att";
|
||||
static char intel_flavor[] = "intel";
|
||||
static char *valid_flavors[] = {
|
||||
att_flavor,
|
||||
intel_flavor,
|
||||
NULL
|
||||
};
|
||||
static char *disassembly_flavor = att_flavor;
|
||||
|
||||
/* Get rid of these defines as soon as there are two functions
|
||||
to implement different disassembly flavors. */
|
||||
#define print_insn_i386_att print_insn_i386
|
||||
#define print_insn_i386_intel print_insn_i386
|
||||
|
||||
/* Stdio style buffering was used to minimize calls to ptrace, but this
|
||||
buffering did not take into account that the code section being accessed
|
||||
may not be an even number of buffers long (even if the buffer is only
|
||||
|
@ -210,6 +234,39 @@ i386_get_frame_setup (pc)
|
|||
op = codestream_get (); /* update next opcode */
|
||||
}
|
||||
|
||||
if (op == 0x68 || op == 0x6a)
|
||||
{
|
||||
/*
|
||||
* this function may start with
|
||||
*
|
||||
* pushl constant
|
||||
* call _probe
|
||||
* addl $4, %esp
|
||||
* followed by
|
||||
* pushl %ebp
|
||||
* etc.
|
||||
*/
|
||||
int pos;
|
||||
unsigned char buf[8];
|
||||
|
||||
/* Skip past the pushl instruction; it has either a one-byte
|
||||
or a four-byte operand, depending on the opcode. */
|
||||
pos = codestream_tell ();
|
||||
if (op == 0x68)
|
||||
pos += 4;
|
||||
else
|
||||
pos += 1;
|
||||
codestream_seek (pos);
|
||||
|
||||
/* Read the following 8 bytes, which should be "call _probe" (6 bytes)
|
||||
followed by "addl $4,%esp" (2 bytes). */
|
||||
codestream_read (buf, sizeof (buf));
|
||||
if (buf[0] == 0xe8 && buf[6] == 0xc4 && buf[7] == 0x4)
|
||||
pos += sizeof (buf);
|
||||
codestream_seek (pos);
|
||||
op = codestream_get (); /* update next opcode */
|
||||
}
|
||||
|
||||
if (op == 0x55) /* pushl %ebp */
|
||||
{
|
||||
/* check for movl %esp, %ebp - can be written two ways */
|
||||
|
@ -391,10 +448,11 @@ i386_frame_find_saved_regs (fip, fsrp)
|
|||
struct frame_info *fip;
|
||||
struct frame_saved_regs *fsrp;
|
||||
{
|
||||
long locals;
|
||||
long locals = -1;
|
||||
unsigned char op;
|
||||
CORE_ADDR dummy_bottom;
|
||||
CORE_ADDR adr;
|
||||
CORE_ADDR pc;
|
||||
int i;
|
||||
|
||||
memset (fsrp, 0, sizeof *fsrp);
|
||||
|
@ -417,7 +475,9 @@ i386_frame_find_saved_regs (fip, fsrp)
|
|||
return;
|
||||
}
|
||||
|
||||
locals = i386_get_frame_setup (get_pc_function_start (fip->pc));
|
||||
pc = get_pc_function_start (fip->pc);
|
||||
if (pc != 0)
|
||||
locals = i386_get_frame_setup (pc);
|
||||
|
||||
if (locals >= 0)
|
||||
{
|
||||
|
@ -656,6 +716,32 @@ i386v4_sigtramp_saved_pc (frame)
|
|||
}
|
||||
#endif /* I386V4_SIGTRAMP_SAVED_PC */
|
||||
|
||||
#ifdef STATIC_TRANSFORM_NAME
|
||||
/* SunPRO encodes the static variables. This is not related to C++ mangling,
|
||||
it is done for C too. */
|
||||
|
||||
char *
|
||||
sunpro_static_transform_name (name)
|
||||
char *name;
|
||||
{
|
||||
char *p;
|
||||
if (IS_STATIC_TRANSFORM_NAME (name))
|
||||
{
|
||||
/* For file-local statics there will be a period, a bunch
|
||||
of junk (the contents of which match a string given in the
|
||||
N_OPT), a period and the name. For function-local statics
|
||||
there will be a bunch of junk (which seems to change the
|
||||
second character from 'A' to 'B'), a period, the name of the
|
||||
function, and the name. So just skip everything before the
|
||||
last period. */
|
||||
p = strrchr (name, '.');
|
||||
if (p != NULL)
|
||||
name = p + 1;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
#endif /* STATIC_TRANSFORM_NAME */
|
||||
|
||||
|
||||
|
||||
/* Stuff for WIN32 PE style DLL's but is pretty generic really. */
|
||||
|
@ -682,34 +768,33 @@ skip_trampoline_code (pc, name)
|
|||
return 0; /* not a trampoline */
|
||||
}
|
||||
|
||||
static char *x86_assembly_types[] = {"i386", "i8086", NULL};
|
||||
static char *x86_assembly_result = "i386";
|
||||
|
||||
static void
|
||||
set_assembly_language_command (ignore, from_tty, c)
|
||||
char *ignore;
|
||||
int from_tty;
|
||||
struct cmd_list_element *c;
|
||||
static int
|
||||
gdb_print_insn_i386 (memaddr, info)
|
||||
bfd_vma memaddr;
|
||||
disassemble_info * info;
|
||||
{
|
||||
if (strcmp (x86_assembly_result, "i386") == 0)
|
||||
tm_print_insn = print_insn_i386;
|
||||
else
|
||||
tm_print_insn = print_insn_i8086;
|
||||
if (disassembly_flavor == att_flavor)
|
||||
print_insn_i386_att (memaddr, info);
|
||||
else if (disassembly_flavor == intel_flavor)
|
||||
print_insn_i386_intel (memaddr, info);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
_initialize_i386_tdep ()
|
||||
{
|
||||
struct cmd_list_element *cmd;
|
||||
tm_print_insn = gdb_print_insn_i386;
|
||||
tm_print_insn_info.mach = bfd_lookup_arch (bfd_arch_i386, 0)->mach;
|
||||
|
||||
tm_print_insn = print_insn_i386;
|
||||
/* Add the variable that controls the disassembly flavor */
|
||||
add_show_from_set(
|
||||
add_set_enum_cmd ("disassembly-flavor", no_class,
|
||||
valid_flavors,
|
||||
(char *) &disassembly_flavor,
|
||||
"Set the disassembly flavor, the valid values are \"att\" and \"intel\", \
|
||||
and the default value is \"att\".",
|
||||
&setlist),
|
||||
&showlist);
|
||||
|
||||
cmd = add_set_enum_cmd ("assembly-language", class_obscure,
|
||||
x86_assembly_types, (char *)&x86_assembly_result,
|
||||
"Set x86 instruction set to use for disassembly.\n\
|
||||
This value can be set to either i386 or i8086 to change how instructions are disassembled.",
|
||||
&setlist);
|
||||
add_show_from_set (cmd, &showlist);
|
||||
|
||||
cmd->function.sfunc = set_assembly_language_command;
|
||||
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#endif
|
||||
#if defined(_WIN32)
|
||||
# define COMPILING_ON_WIN32 1
|
||||
# if !defined(__CYGWIN__)
|
||||
# if !defined(__CYGWIN32__)
|
||||
# define COMPILING_ON_WINDOWS 1
|
||||
# endif
|
||||
#endif
|
||||
|
|
|
@ -546,7 +546,7 @@ static unsigned long tv_diff(const struct timeval *time_now,
|
|||
- ((time_was->tv_sec * 1000000) + time_was->tv_usec) );
|
||||
}
|
||||
|
||||
#if !defined(__unix) && !defined(__CYGWIN__)
|
||||
#if !defined(__unix) && !defined(__CYGWIN32__)
|
||||
static void gettimeofday( struct timeval *time_now, void *dummy )
|
||||
{
|
||||
time_t t = clock();
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#endif
|
||||
|
||||
/* struct timeval */
|
||||
#if defined(__unix) || defined(__CYGWIN__)
|
||||
#if defined(__unix) || defined(__CYGWIN32__)
|
||||
# include <sys/time.h>
|
||||
#else
|
||||
# include "winsock.h"
|
||||
|
|
|
@ -243,7 +243,7 @@ static int SerialOpen(const char *name, const char *arg)
|
|||
|
||||
serial_reset();
|
||||
|
||||
#if defined(__unix) || defined(__CYGWIN__)
|
||||
#if defined(__unix) || defined(__CYGWIN32__)
|
||||
Unix_ioctlNonBlocking();
|
||||
#endif
|
||||
|
||||
|
|
|
@ -278,7 +278,7 @@ static int SerparOpen(const char *name, const char *arg)
|
|||
|
||||
serpar_reset();
|
||||
|
||||
#if defined(__unix) || defined(__CYGWIN__)
|
||||
#if defined(__unix) || defined(__CYGWIN32__)
|
||||
Unix_ioctlNonBlocking();
|
||||
#endif
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
|
||||
|
||||
#define SERIAL_PREFIX "/dev/tty"
|
||||
#if defined(_WIN32) || defined (__CYGWIN__)
|
||||
#if defined(_WIN32) || defined (__CYGWIN32__)
|
||||
#define SERPORT1 "com1"
|
||||
#define SERPORT2 "com2"
|
||||
#define PARPORT1 "lpt1"
|
||||
|
@ -241,7 +241,7 @@ extern int Unix_IsSerialInUse(void)
|
|||
|
||||
extern int Unix_OpenSerial(const char *name)
|
||||
{
|
||||
#if defined(BSD) || defined(__CYGWIN__)
|
||||
#if defined(BSD) || defined(__CYGWIN32__)
|
||||
serpfd = open(name, O_RDWR);
|
||||
#else
|
||||
serpfd = open(name, O_RDWR | O_NONBLOCK);
|
||||
|
@ -305,7 +305,7 @@ extern void Unix_ResetSerial(void)
|
|||
struct termios terminfo;
|
||||
|
||||
tcgetattr(serpfd, &terminfo);
|
||||
#ifdef __CYGWIN__
|
||||
#ifdef __CYGWIN32__
|
||||
/* Expedient, but it works. */
|
||||
terminfo.c_iflag = 0;
|
||||
terminfo.c_oflag = 0;
|
||||
|
|
|
@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||
#include <netdb.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#ifndef __CYGWIN__
|
||||
#ifndef __CYGWIN32__
|
||||
#include <netinet/tcp.h>
|
||||
#endif
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ static int hardwire_setstopbits PARAMS ((serial_t, int));
|
|||
|
||||
void _initialize_ser_hardwire PARAMS ((void));
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
#ifdef __CYGWIN32__
|
||||
extern void (*ui_loop_hook) PARAMS ((int));
|
||||
#endif
|
||||
|
||||
|
@ -434,7 +434,7 @@ wait_for(scb, timeout)
|
|||
serial_t scb;
|
||||
int timeout;
|
||||
{
|
||||
#ifndef __CYGWIN__
|
||||
#ifndef __CYGWIN32__
|
||||
scb->timeout_remaining = 0;
|
||||
#endif
|
||||
|
||||
|
@ -551,21 +551,21 @@ hardwire_readchar (scb, timeout)
|
|||
int timeout;
|
||||
{
|
||||
int status;
|
||||
#ifdef __CYGWIN__
|
||||
#ifdef __CYGWIN32__
|
||||
int t;
|
||||
#endif
|
||||
|
||||
if (scb->bufcnt-- > 0)
|
||||
return *scb->bufp++;
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
#ifdef __CYGWIN32__
|
||||
if (timeout > 0)
|
||||
timeout++;
|
||||
#endif
|
||||
|
||||
while (1)
|
||||
{
|
||||
#ifdef __CYGWIN__
|
||||
#ifdef __CYGWIN32__
|
||||
t = timeout == 0 ? 0 : 1;
|
||||
scb->timeout_remaining = timeout < 0 ? timeout : timeout - t;
|
||||
status = wait_for (scb, t);
|
||||
|
@ -592,7 +592,7 @@ hardwire_readchar (scb, timeout)
|
|||
timeout = scb->timeout_remaining;
|
||||
continue;
|
||||
}
|
||||
#ifdef __CYGWIN__
|
||||
#ifdef __CYGWIN32__
|
||||
else if (scb->timeout_remaining < 0)
|
||||
continue;
|
||||
#endif
|
||||
|
|
|
@ -26,10 +26,17 @@ Things-to-keep:
|
|||
Makefile.in
|
||||
browser.exp
|
||||
browser.test
|
||||
c_variable.c
|
||||
c_variable.exp
|
||||
c_variable.test
|
||||
configure.in
|
||||
configure
|
||||
console.exp
|
||||
console.test
|
||||
cpp_variable.cc
|
||||
cpp_variable.exp
|
||||
cpp_variable.h
|
||||
cpp_variable.test
|
||||
defs
|
||||
simple.c
|
||||
stack1.c
|
||||
|
|
418
gdb/testsuite/gdb.gdbtk/console.test
Normal file
418
gdb/testsuite/gdb.gdbtk/console.test
Normal file
|
@ -0,0 +1,418 @@
|
|||
# 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 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-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
|
54
gdb/testsuite/gdb.gdbtk/cpp_variable.h
Normal file
54
gdb/testsuite/gdb.gdbtk/cpp_variable.h
Normal file
|
@ -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 VA
|
||||
{
|
||||
public:
|
||||
int vc_pub_int;
|
||||
|
||||
int fvc ();
|
||||
virtual int vfvc ();
|
||||
};
|
||||
|
||||
class V : public VA, public VB, public VC
|
||||
{
|
||||
public:
|
||||
int f ();
|
||||
virtual vv ();
|
||||
int v_pub_int;
|
||||
char *v_pub_charp;
|
||||
|
||||
private:
|
||||
int v_priv_int;
|
||||
char *v_priv_charp;
|
||||
};
|
476
gdb/testsuite/gdb.gdbtk/cpp_variable.test
Normal file
476
gdb/testsuite/gdb.gdbtk/cpp_variable.test
Normal file
|
@ -0,0 +1,476 @@
|
|||
# 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_valueChanged {} {
|
||||
global var
|
||||
|
||||
set changed {}
|
||||
set unchanged {}
|
||||
set out {}
|
||||
foreach ind [array names var] {
|
||||
set val [$var($ind) valueChanged]
|
||||
if {$val == "VARIABLE_CHANGED"} {
|
||||
lappend changed $ind
|
||||
} elseif {$val == "VARIABLE_UNCHANGED"} {
|
||||
lappend unchanged $ind
|
||||
} elseif {$val == "VARIABLE_OUT_OF_SCOPE"} {
|
||||
lappend out $ind
|
||||
} else {
|
||||
error "unknown result from valueChanged"
|
||||
}
|
||||
}
|
||||
|
||||
return [list $changed $unchanged $out]
|
||||
}
|
||||
|
||||
|
||||
# proc to create a variable
|
||||
proc create_variable {expr} {
|
||||
global var
|
||||
|
||||
set err [catch {gdb_variable create -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
|
||||
|
||||
set value [$var($v) value]
|
||||
set gdb [gdb_cmd "output/$fmt $v"]
|
||||
if {$value == $gdb} {
|
||||
set result ok
|
||||
} else {
|
||||
set result error
|
||||
}
|
||||
|
||||
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 main} {
|
||||
lindex [gdb_loc] 1
|
||||
} {do_simple_class_tests}
|
||||
|
||||
# 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
|
||||
} {7}
|
||||
|
||||
# Test: cpp_variable-1.4
|
||||
# Desc: children of v
|
||||
gdbtk_test cpp_variable-1.4 {children of v} {
|
||||
get_children v
|
||||
} {VA VB VC v_pub_int v_pub_charp 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_valueChanged
|
||||
} {{v.v_priv_int v.v_pub_charp v.v_pub_int v v.v_priv_charp} {v.VB v.VC 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.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.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_valueChanged
|
||||
} {v.v_pub_int {v.v_priv_int v.VB v.v_pub_charp v.VC v v.v_priv_charp 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.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.v_pub_int) format octal
|
||||
$var(v.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.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.v_pub_int) value 3
|
||||
value 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.9 {change value of v.v_pub_int (hexadecimal)} {
|
||||
$var(v.v_pub_int) value 0x21
|
||||
value 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.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.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.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.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.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_valueChanged
|
||||
} {v.v_priv_charp {v.v_priv_int v.VB v.v_pub_charp v.VC v.v_pub_int v 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.v_priv_charp) format hexadecimal
|
||||
$var(v.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.v_priv_charp) format octal
|
||||
$var(v.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.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.v_priv_charp) value 3
|
||||
value 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.v_priv_charp) value 0x21
|
||||
value 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.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.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.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_valueChanged
|
||||
} {{} {v.v_priv_int v.VB v.v_pub_charp v.VC v.v_pub_int v v.v_priv_charp 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
|
||||
} {5}
|
||||
|
||||
# Test: cpp_variable-2.48
|
||||
# Desc: children of v.VA
|
||||
gdbtk_test cpp_variable-2.48 {children of v.VA} {
|
||||
get_children v.VA
|
||||
} {va_pub_int va_pub_charp va_priv_int va_priv_charp 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_valueChanged
|
||||
} {{} {v.VA.va_pub_int v.v_pub_int v.VA.va_priv_int v.VA.va_pub_charp v.v_priv_int v.v_pub_charp v.VA.va_priv_charp v.VA.bar v v.v_priv_charp v.VA v.VB v.VC} {}}
|
||||
|
||||
# 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
|
||||
} {3}
|
||||
|
||||
# Test: cpp_variable-2.68
|
||||
# Desc: children of v.VB
|
||||
gdbtk_test cpp_variable-2.68 {children of v.VB} {
|
||||
get_children v.VB
|
||||
} {vb_pub_int 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}
|
||||
|
||||
|
||||
# Exit
|
||||
#
|
||||
gdbtk_test_done
|
||||
|
||||
|
32
gdb/testsuite/gdb.gdbtk/srcwin.exp
Normal file
32
gdb/testsuite/gdb.gdbtk/srcwin.exp
Normal file
|
@ -0,0 +1,32 @@
|
|||
#
|
||||
# Check if we have a display
|
||||
#
|
||||
if {![info exists ::env(DISPLAY)]} {
|
||||
warning "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
|
||||
}
|
858
gdb/testsuite/gdb.gdbtk/srcwin.test
Normal file
858
gdb/testsuite/gdb.gdbtk/srcwin.test
Normal file
|
@ -0,0 +1,858 @@
|
|||
# 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 test_ran
|
||||
|
||||
|
||||
##### #####
|
||||
# #
|
||||
# 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]
|
||||
expr {[string compare $a $file1(assembly)] ||
|
||||
[string compare $s $file1(source)] ||
|
||||
![winfo ismapped $bwin]}
|
||||
} {0}
|
||||
|
||||
# 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]
|
||||
expr {[string compare $file1(source) $a] ||
|
||||
[winfo ismapped $bwin]}
|
||||
} {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]
|
||||
expr {[string compare $a $file1(assembly)] ||
|
||||
[string compare $s $file1(source)] ||
|
||||
![winfo ismapped $bwin]}
|
||||
} {0}
|
||||
|
||||
# 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]
|
||||
expr {[string compare $a $file1(assembly)] ||
|
||||
[string compare $s $file1(source)] ||
|
||||
![winfo ismapped $bwin]}
|
||||
} {0}
|
||||
|
||||
# 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 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 == "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 {
|
||||
dbug X $i
|
||||
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.1 bp, multiple, balloon, etc
|
||||
# 5.1 balloon variables
|
||||
|
||||
|
||||
gdbtk_test_done
|
||||
|
||||
|
||||
# Local variables:
|
||||
# mode: tcl
|
||||
# End:
|
|
@ -101,7 +101,7 @@ proc gdb_unload {} {
|
|||
global gdb_prompt
|
||||
send_gdb "file\n"
|
||||
gdb_expect 60 {
|
||||
-re "No exec file now\[^\r\n\]*\[\r\n\]" { exp_continue }
|
||||
-re "No executable file now\[^\r\n\]*\[\r\n\]" { exp_continue }
|
||||
-re "No symbol file now\[^\r\n\]*\[\r\n\]" { exp_continue }
|
||||
-re "A program is being debugged already..*Kill it.*y or n. $"\
|
||||
{ send_gdb "y\n"
|
||||
|
@ -406,6 +406,13 @@ proc gdb_test { args } {
|
|||
}
|
||||
}
|
||||
gdb_expect $tmt {
|
||||
-re "\\*\\*\\* DOSEXIT code.*" {
|
||||
if { $message != "" } {
|
||||
fail "$message";
|
||||
}
|
||||
gdb_suppress_entire_file "GDB died";
|
||||
return -1;
|
||||
}
|
||||
-re "Ending remote debugging.*$gdb_prompt$" {
|
||||
if ![isnative] then {
|
||||
warning "Can`t communicate to remote target."
|
||||
|
@ -827,23 +834,128 @@ proc skip_chill_tests {} {
|
|||
return $skip_chill
|
||||
}
|
||||
|
||||
proc get_compiler_info {binfile} {
|
||||
# skip all the tests in the file if you are not on an hppa running hpux target.
|
||||
# and you compiled with gcc
|
||||
proc skip_hp_tests {gcc_used} {
|
||||
# if ![info exists do_hp_tests] {
|
||||
# return 1;
|
||||
# }
|
||||
eval set skip_hp [expr ![isnative] || ![istarget "hppa*-*-hpux*"] || $gcc_used!=0 ]
|
||||
verbose "Skip hp tests is $skip_hp"
|
||||
return $skip_hp
|
||||
}
|
||||
|
||||
proc get_compiler_info {binfile args} {
|
||||
# Create and source the file that provides information about the compiler
|
||||
# used to compile the test case.
|
||||
# Compiler_type can be null or c++. If null we assume c.
|
||||
global srcdir
|
||||
global subdir
|
||||
# These two come from compiler.c.
|
||||
global signed_keyword_not_used
|
||||
global gcc_compiled
|
||||
|
||||
if { [gdb_compile "${srcdir}/${subdir}/compiler.c" "${binfile}.ci" preprocess {}] != "" } {
|
||||
perror "Couldn't make ${binfile}.ci file"
|
||||
return 1;
|
||||
if {![istarget "hppa*-*-hpux*"]} {
|
||||
if { [llength $args] > 0 } {
|
||||
if {$args == "c++"} {
|
||||
if { [gdb_compile "${srcdir}/${subdir}/compiler.cc" "${binfile}.ci" preprocess {}] != "" } {
|
||||
perror "Couldn't make ${binfile}.ci file"
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if { [gdb_compile "${srcdir}/${subdir}/compiler.c" "${binfile}.ci" preprocess {}] != "" } {
|
||||
perror "Couldn't make ${binfile}.ci file"
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if { [llength $args] > 0 } {
|
||||
if {$args == "c++"} {
|
||||
if { [eval gdb_preprocess \
|
||||
[list "${srcdir}/${subdir}/compiler.cc" "${binfile}.ci"] \
|
||||
$args] != "" } {
|
||||
perror "Couldn't make ${binfile}.ci file"
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if { [eval gdb_preprocess \
|
||||
[list "${srcdir}/${subdir}/compiler.c" "${binfile}.ci"] \
|
||||
$args] != "" } {
|
||||
perror "Couldn't make ${binfile}.ci file"
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
source ${binfile}.ci
|
||||
return 0;
|
||||
}
|
||||
|
||||
proc gdb_preprocess {source dest args} {
|
||||
global CC_FOR_TARGET
|
||||
global CXX_FOR_TARGET
|
||||
|
||||
if { [llength $args] == 0 } {
|
||||
set which_compiler "c"
|
||||
} else {
|
||||
if { $args =="c++" } {
|
||||
set which_compiler "c++"
|
||||
} else {
|
||||
perror "Unknown compiler type supplied to gdb_preprocess"
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if [info exists CC_FOR_TARGET] {
|
||||
if { $which_compiler == "c"} {
|
||||
set compiler $CC_FOR_TARGET;
|
||||
}
|
||||
}
|
||||
|
||||
if [info exists CXX_FOR_TARGET] {
|
||||
if { $which_compiler == "c++"} {
|
||||
set compiler $CXX_FOR_TARGET;
|
||||
}
|
||||
}
|
||||
|
||||
if { ![info exists compiler] } {
|
||||
if { $which_compiler == "c" } {
|
||||
if {[info exists CC]} {
|
||||
set compiler $CC;
|
||||
}
|
||||
}
|
||||
if { $which_compiler == "c++" } {
|
||||
if {[info exists CXX]} {
|
||||
set compiler $CXX;
|
||||
}
|
||||
}
|
||||
if {![info exists compiler]} {
|
||||
set compiler [board_info [target_info name] compiler];
|
||||
if { $compiler == "" } {
|
||||
puts "default_target_compile: No compiler to compile with";
|
||||
return "default_target_compile: No compiler to compile with";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set cmdline "$compiler -E $source > $dest"
|
||||
|
||||
puts "Invoking $compiler -E $source > $dest"
|
||||
verbose "Invoking $compiler -E $source > $dest"
|
||||
verbose -log "Executing on local host: $cmdline" 2
|
||||
set status [catch "exec ${cmdline}" exec_output]
|
||||
|
||||
set result [prune_warnings $exec_output]
|
||||
regsub "\[\r\n\]*$" "$result" "" result;
|
||||
regsub "^\[\r\n\]*" "$result" "" result;
|
||||
if { $result != "" } {
|
||||
clone_output "gdb compile failed, $result"
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
proc gdb_compile {source dest type options} {
|
||||
global GDB_TESTCASE_OPTIONS;
|
||||
|
||||
|
@ -862,6 +974,7 @@ proc gdb_compile {source dest type options} {
|
|||
}
|
||||
verbose "options are $options"
|
||||
verbose "source is $source $dest $type $options"
|
||||
|
||||
set result [target_compile $source $dest $type $options];
|
||||
regsub "\[\r\n\]*$" "$result" "" result;
|
||||
regsub "^\[\r\n\]*" "$result" "" result;
|
||||
|
@ -1154,3 +1267,107 @@ proc gdb_step_for_stub { } {
|
|||
default {}
|
||||
}
|
||||
}
|
||||
|
||||
# start-sanitize-gdbtk
|
||||
# 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)"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
# end-sanitize-gdbtk
|
||||
|
|
|
@ -367,7 +367,7 @@ static void stop_sig PARAMS ((int));
|
|||
command file. */
|
||||
|
||||
void (*init_ui_hook) PARAMS ((char *argv0));
|
||||
#ifdef __CYGWIN__
|
||||
#ifdef __CYGWIN32__
|
||||
void (*ui_loop_hook) PARAMS ((int));
|
||||
#endif
|
||||
|
||||
|
|
13
gdb/utils.c
13
gdb/utils.c
|
@ -51,6 +51,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||
/* readline defines this. */
|
||||
#undef savestring
|
||||
|
||||
void (*error_begin_hook) PARAMS ((void));
|
||||
|
||||
/* Prototypes for local functions */
|
||||
|
||||
static void vfprintf_maybe_filtered PARAMS ((GDB_FILE *, const char *,
|
||||
|
@ -397,6 +399,9 @@ warning (va_alist)
|
|||
void
|
||||
error_begin ()
|
||||
{
|
||||
if (error_begin_hook)
|
||||
error_begin_hook ();
|
||||
|
||||
target_terminal_ours ();
|
||||
wrap_here (""); /* Force out any buffered output */
|
||||
gdb_flush (gdb_stdout);
|
||||
|
@ -984,9 +989,13 @@ print_spaces (n, file)
|
|||
{
|
||||
if (file->ts_streamtype == astring)
|
||||
{
|
||||
char *p;
|
||||
|
||||
gdb_file_adjust_strbuf (n, file);
|
||||
while (n-- > 0)
|
||||
strcat(file->ts_strbuf, " ");
|
||||
p = file->ts_strbuf + strlen (file->ts_strbuf);
|
||||
|
||||
memset (p, ' ', n);
|
||||
p[n] = '\000';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue