From c98fe0c11974772749686145f3172dc8c9004909 Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Thu, 28 Jan 1999 03:50:17 +0000 Subject: [PATCH] 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. --- gdb/.Sanitize | 2 +- gdb/ChangeLog | 6 + gdb/ChangeLog-gdbtk | 143 +- gdb/Makefile.in | 31 +- gdb/aclocal.m4 | 235 ++- gdb/configure | 867 +++++++---- gdb/configure.in | 61 +- gdb/defs.h | 5 +- gdb/gdbtk-cmds.c | 94 +- gdb/gdbtk-hooks.c | 25 +- gdb/gdbtk-variable.c | 1622 +++++++++++++++++++++ gdb/gdbtk-wrapper.c | 475 ++++++ gdb/gdbtk-wrapper.h | 62 + gdb/gdbtk.c | 263 ++-- gdb/gdbtk.h | 16 +- gdb/i386-tdep.c | 137 +- gdb/rdi-share/host.h | 2 +- gdb/rdi-share/hostchan.c | 2 +- gdb/rdi-share/hostchan.h | 2 +- gdb/rdi-share/serdrv.c | 2 +- gdb/rdi-share/serpardr.c | 2 +- gdb/rdi-share/unixcomm.c | 6 +- gdb/ser-tcp.c | 2 +- gdb/ser-unix.c | 12 +- gdb/testsuite/gdb.gdbtk/.Sanitize | 7 + gdb/testsuite/gdb.gdbtk/console.test | 418 ++++++ gdb/testsuite/gdb.gdbtk/cpp_variable.h | 54 + gdb/testsuite/gdb.gdbtk/cpp_variable.test | 476 ++++++ gdb/testsuite/gdb.gdbtk/srcwin.exp | 32 + gdb/testsuite/gdb.gdbtk/srcwin.test | 858 +++++++++++ gdb/testsuite/lib/gdb.exp | 227 ++- gdb/top.c | 2 +- gdb/utils.c | 13 +- 33 files changed, 5608 insertions(+), 553 deletions(-) create mode 100644 gdb/gdbtk-variable.c create mode 100644 gdb/gdbtk-wrapper.c create mode 100644 gdb/gdbtk-wrapper.h create mode 100644 gdb/testsuite/gdb.gdbtk/console.test create mode 100644 gdb/testsuite/gdb.gdbtk/cpp_variable.h create mode 100644 gdb/testsuite/gdb.gdbtk/cpp_variable.test create mode 100644 gdb/testsuite/gdb.gdbtk/srcwin.exp create mode 100644 gdb/testsuite/gdb.gdbtk/srcwin.test diff --git a/gdb/.Sanitize b/gdb/.Sanitize index b2dad617e05..8654b2e5fb5 100644 --- a/gdb/.Sanitize +++ b/gdb/.Sanitize @@ -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}" diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d05d720c88f..4b1fb9b1037 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +1999-01-27 James Ingham + + Merging changes in from gdbtk-980810-branch: + + * typeprint.c (whatis_exp): Remove static declaration. + Wed Jan 27 16:50:25 1999 Elena Zannoni * hp-psymtab-read.c: reformatted using indent. diff --git a/gdb/ChangeLog-gdbtk b/gdb/ChangeLog-gdbtk index 9bf91214773..55d8255b260 100644 --- a/gdb/ChangeLog-gdbtk +++ b/gdb/ChangeLog-gdbtk @@ -1,4 +1,145 @@ -Mon Dec 28 17:44:36 1998 David Taylor +M1999-01-27 James Ingham + + Merging in changes from gdbtk-980810 - the Itcl3 + gdb branch. + + 1999-01-12 Martin Hunt + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * gdbtk-cmds.c (gdb_search): Don't mention C++ RTTI and + global constructor/destructor symbols. + + Thu Nov 12 15:20:15 1998 Jim Ingham + * 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 + + * gdbtk-cmds.c (gdb_set_bp_addr): For callback, send full + pathname instead of just basename. + + 1998-11-03 Keith Seitz + * 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 + + * 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 + + * gdbtk.c (gdbtk_init): Changed the startup code to use + tcl_findLibrary + + + + +on Dec 28 17:44:36 1998 David Taylor The following changes were made by Jim Blandy , diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 180c956d608..df397e25e39 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -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) \ diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4 index 7a05b2468d8..b33a5dc6fb9 100644 --- a/gdb/aclocal.m4 +++ b/gdb/aclocal.m4 @@ -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. diff --git a/gdb/configure b/gdb/configure index 52ba10c54e9..8bee796c60f 100755 --- a/gdb/configure +++ b/gdb/configure @@ -1,7 +1,7 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.12.2 +# Generated automatically using autoconf version 2.13 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -41,6 +41,10 @@ ac_help="$ac_help --with-tclinclude=DIR Directory where tcl private headers are" ac_help="$ac_help --with-tkinclude=DIR Directory where tk private headers are" +ac_help="$ac_help + --with-itclconfig directory containing itcl configuration (itclConfig.sh)" +ac_help="$ac_help + --with-itkconfig directory containing itk configuration (itkConfig.sh)" ac_help="$ac_help --with-x use the X Window System" ac_help="$ac_help @@ -371,7 +375,7 @@ EOF verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.12.2" + echo "configure generated by autoconf version 2.13" exit 0 ;; -with-* | --with-*) @@ -564,7 +568,7 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:568: checking for $ac_word" >&5 +echo "configure:572: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -572,7 +576,8 @@ else ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - for ac_dir in $PATH; do + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="gcc" @@ -593,7 +598,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:597: checking for $ac_word" >&5 +echo "configure:602: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -602,7 +607,8 @@ else else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no - for ac_dir in $PATH; do + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then @@ -643,7 +649,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:647: checking for $ac_word" >&5 +echo "configure:653: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -651,7 +657,8 @@ else ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - for ac_dir in $PATH; do + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="cl" @@ -674,7 +681,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:678: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:685: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -683,12 +690,14 @@ ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross -cat > conftest.$ac_ext < conftest.$ac_ext << EOF + +#line 696 "configure" #include "confdefs.h" + main(){return(0);} EOF -if { (eval echo configure:692: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -702,18 +711,24 @@ else ac_cv_prog_cc_works=no fi rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:712: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:727: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:717: checking whether we are using GNU C" >&5 +echo "configure:732: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -722,7 +737,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:726: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:741: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -741,7 +756,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:745: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:760: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -773,7 +788,7 @@ else fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:777: checking how to run the C preprocessor" >&5 +echo "configure:792: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -788,13 +803,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:798: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:813: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -805,13 +820,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:815: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:830: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -822,13 +837,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:832: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:847: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -853,9 +868,9 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for AIX""... $ac_c" 1>&6 -echo "configure:857: checking for AIX" >&5 +echo "configure:872: checking for AIX" >&5 cat > conftest.$ac_ext <&6 -echo "configure:881: checking for POSIXized ISC" >&5 +echo "configure:896: checking for POSIXized ISC" >&5 if test -d /etc/conf/kconfig.d && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then @@ -901,7 +916,7 @@ fi echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6 -echo "configure:905: checking for ${CC-cc} option to accept ANSI C" >&5 +echo "configure:920: checking for ${CC-cc} option to accept ANSI C" >&5 if eval "test \"`echo '$''{'am_cv_prog_cc_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -917,7 +932,7 @@ for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__ do CC="$ac_save_CC $ac_arg" cat > conftest.$ac_ext < #include @@ -954,7 +969,7 @@ return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } EOF -if { (eval echo configure:958: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:973: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* am_cv_prog_cc_stdc="$ac_arg"; break else @@ -1025,7 +1040,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:1029: checking host system type" >&5 +echo "configure:1044: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -1046,7 +1061,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:1050: checking target system type" >&5 +echo "configure:1065: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -1064,7 +1079,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:1068: checking build system type" >&5 +echo "configure:1083: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -1089,7 +1104,7 @@ test "$host_alias" != "$target_alias" && ALL_LINGUAS= echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1093: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1108: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1118,7 +1133,7 @@ fi # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1122: checking for $ac_word" >&5 +echo "configure:1137: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1126,7 +1141,8 @@ else ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - for ac_dir in $PATH; do + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_RANLIB="ranlib" @@ -1145,12 +1161,12 @@ else fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1149: checking for ANSI C header files" >&5 +echo "configure:1165: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1158,7 +1174,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1162: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1178: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1175,7 +1191,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1193,7 +1209,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1214,7 +1230,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1225,7 +1241,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1229: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1245: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1249,12 +1265,12 @@ EOF fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1253: checking for working const" >&5 +echo "configure:1269: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1323: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1324,21 +1340,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:1328: checking for inline" >&5 +echo "configure:1344: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1358: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -1364,12 +1380,12 @@ EOF esac echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:1368: checking for off_t" >&5 +echo "configure:1384: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1378,7 +1394,7 @@ else #endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_off_t=yes else @@ -1397,12 +1413,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:1401: checking for size_t" >&5 +echo "configure:1417: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1411,7 +1427,7 @@ else #endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_size_t=yes else @@ -1432,19 +1448,19 @@ fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:1436: checking for working alloca.h" >&5 +echo "configure:1452: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:1448: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1464: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -1465,12 +1481,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:1469: checking for alloca" >&5 +echo "configure:1485: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1518: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -1530,12 +1546,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:1534: checking whether alloca needs Cray hooks" >&5 +echo "configure:1550: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1564: checking for $ac_func" >&5 +echo "configure:1580: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1608: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1615,7 +1631,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:1619: checking stack direction for C alloca" >&5 +echo "configure:1635: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1623,7 +1639,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1662: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -1667,17 +1683,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1671: checking for $ac_hdr" >&5 +echo "configure:1687: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1681: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1697: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1706,12 +1722,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1710: checking for $ac_func" >&5 +echo "configure:1726: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1754: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1759,7 +1775,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:1763: checking for working mmap" >&5 +echo "configure:1779: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1767,7 +1783,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1927: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -1935,17 +1951,17 @@ unistd.h values.h sys/param.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1939: checking for $ac_hdr" >&5 +echo "configure:1955: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1949: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1965: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1975,12 +1991,12 @@ done __argz_count __argz_stringify __argz_next do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1979: checking for $ac_func" >&5 +echo "configure:1995: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2023: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2032,12 +2048,12 @@ done for ac_func in stpcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2036: checking for $ac_func" >&5 +echo "configure:2052: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2080: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2094,19 +2110,19 @@ EOF if test $ac_cv_header_locale_h = yes; then echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:2098: checking for LC_MESSAGES" >&5 +echo "configure:2114: checking for LC_MESSAGES" >&5 if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return LC_MESSAGES ; return 0; } EOF -if { (eval echo configure:2110: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2126: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_val_LC_MESSAGES=yes else @@ -2127,7 +2143,7 @@ EOF fi fi echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:2131: checking whether NLS is requested" >&5 +echo "configure:2147: checking whether NLS is requested" >&5 # Check whether --enable-nls or --disable-nls was given. if test "${enable_nls+set}" = set; then enableval="$enable_nls" @@ -2147,7 +2163,7 @@ fi EOF echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 -echo "configure:2151: checking whether included gettext is requested" >&5 +echo "configure:2167: checking whether included gettext is requested" >&5 # Check whether --with-included-gettext or --without-included-gettext was given. if test "${with_included_gettext+set}" = set; then withval="$with_included_gettext" @@ -2166,17 +2182,17 @@ fi ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:2170: checking for libintl.h" >&5 +echo "configure:2186: checking for libintl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2180: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2196: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2193,19 +2209,19 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6 -echo "configure:2197: checking for gettext in libc" >&5 +echo "configure:2213: checking for gettext in libc" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return (int) gettext ("") ; return 0; } EOF -if { (eval echo configure:2209: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2225: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libc=yes else @@ -2221,7 +2237,7 @@ echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6 if test "$gt_cv_func_gettext_libc" != "yes"; then echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6 -echo "configure:2225: checking for bindtextdomain in -lintl" >&5 +echo "configure:2241: checking for bindtextdomain in -lintl" >&5 ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2229,7 +2245,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2260: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2256,19 +2272,19 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6 -echo "configure:2260: checking for gettext in libintl" >&5 +echo "configure:2276: checking for gettext in libintl" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libintl=yes else @@ -2296,7 +2312,7 @@ EOF # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2300: checking for $ac_word" >&5 +echo "configure:2316: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2330,12 +2346,12 @@ fi for ac_func in dcgettext do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2334: checking for $ac_func" >&5 +echo "configure:2350: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2378: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2385,7 +2401,7 @@ done # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2389: checking for $ac_word" >&5 +echo "configure:2405: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2398,7 +2414,8 @@ else ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - for ac_dir in $PATH; do + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_GMSGFMT="$ac_dir/$ac_word" @@ -2420,7 +2437,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2424: checking for $ac_word" >&5 +echo "configure:2441: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2452,7 +2469,7 @@ else fi cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2481: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* CATOBJEXT=.gmo DATADIRNAME=share @@ -2492,7 +2509,7 @@ fi # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2496: checking for $ac_word" >&5 +echo "configure:2513: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2526,7 +2543,7 @@ fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2530: checking for $ac_word" >&5 +echo "configure:2547: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2539,7 +2556,8 @@ else ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - for ac_dir in $PATH; do + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_GMSGFMT="$ac_dir/$ac_word" @@ -2561,7 +2579,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2565: checking for $ac_word" >&5 +echo "configure:2583: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2651,7 +2669,7 @@ fi LINGUAS= else echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:2655: checking for catalogs to be installed" >&5 +echo "configure:2673: checking for catalogs to be installed" >&5 NEW_LINGUAS= for lang in ${LINGUAS=$ALL_LINGUAS}; do case "$ALL_LINGUAS" in @@ -2679,17 +2697,17 @@ echo "configure:2655: checking for catalogs to be installed" >&5 if test "$CATOBJEXT" = ".cat"; then ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6 -echo "configure:2683: checking for linux/version.h" >&5 +echo "configure:2701: checking for linux/version.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2693: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2711: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2776,7 +2794,7 @@ configdirs="doc testsuite" # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:2780: checking for a BSD compatible install" >&5 +echo "configure:2798: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2824,6 +2842,8 @@ echo "$ac_t""$INSTALL" 1>&6 # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' if test $host != $build; then @@ -2835,7 +2855,7 @@ fi # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2839: checking for $ac_word" >&5 +echo "configure:2859: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2843,7 +2863,8 @@ else ac_cv_prog_AR="$AR" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - for ac_dir in $PATH; do + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_AR="${ac_tool_prefix}ar" @@ -2866,7 +2887,7 @@ fi # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2870: checking for $ac_word" >&5 +echo "configure:2891: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2874,7 +2895,8 @@ else ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - for ac_dir in $PATH; do + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" @@ -2897,7 +2919,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2901: checking for $ac_word" >&5 +echo "configure:2923: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2905,7 +2927,8 @@ else ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - for ac_dir in $PATH; do + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_RANLIB="ranlib" @@ -2933,7 +2956,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2937: checking for $ac_word" >&5 +echo "configure:2960: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2941,7 +2964,8 @@ else ac_cv_prog_YACC="$YACC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - for ac_dir in $PATH; do + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_YACC="$ac_prog" @@ -2984,12 +3008,12 @@ test "$program_transform_name" = "" && program_transform_name="s,x,x," echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:2988: checking return type of signal handlers" >&5 +echo "configure:3012: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -3006,7 +3030,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:3010: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3034: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -3026,12 +3050,12 @@ EOF echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:3030: checking for ANSI C header files" >&5 +echo "configure:3054: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -3039,7 +3063,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3043: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3067: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3056,7 +3080,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -3074,7 +3098,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -3095,7 +3119,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -3106,7 +3130,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:3110: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3134: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -3129,25 +3153,26 @@ EOF fi + for ac_hdr in 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 + 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 do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3141: checking for $ac_hdr" >&5 +echo "configure:3166: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3151: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3176: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3173,14 +3198,13 @@ else fi done - echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6 -echo "configure:3179: checking whether stat file-mode macros are broken" >&5 +echo "configure:3203: checking whether stat file-mode macros are broken" >&5 if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -3232,12 +3256,12 @@ fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:3236: checking for working const" >&5 +echo "configure:3260: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3314: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -3310,12 +3334,12 @@ fi for ac_func in setpgid sbrk sigaction isascii bzero bcopy btowc do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3314: checking for $ac_func" >&5 +echo "configure:3338: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3366: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3365,19 +3389,19 @@ done # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:3369: checking for working alloca.h" >&5 +echo "configure:3393: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:3381: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -3398,12 +3422,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:3402: checking for alloca" >&5 +echo "configure:3426: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3459: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -3463,12 +3487,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:3467: checking whether alloca needs Cray hooks" >&5 +echo "configure:3491: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3497: checking for $ac_func" >&5 +echo "configure:3521: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3549: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3548,7 +3572,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:3552: checking stack direction for C alloca" >&5 +echo "configure:3576: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3556,7 +3580,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3603: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -3598,12 +3622,12 @@ fi echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6 -echo "configure:3602: checking whether malloc must be declared" >&5 +echo "configure:3626: checking whether malloc must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_malloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -3624,7 +3648,7 @@ int main() { char *(*pfn) = (char *(*)) malloc ; return 0; } EOF -if { (eval echo configure:3628: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3652: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_malloc=no else @@ -3646,12 +3670,12 @@ EOF fi echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6 -echo "configure:3650: checking whether realloc must be declared" >&5 +echo "configure:3674: checking whether realloc must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_realloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -3672,7 +3696,7 @@ int main() { char *(*pfn) = (char *(*)) realloc ; return 0; } EOF -if { (eval echo configure:3676: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3700: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_realloc=no else @@ -3694,12 +3718,12 @@ EOF fi echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6 -echo "configure:3698: checking whether free must be declared" >&5 +echo "configure:3722: checking whether free must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -3720,7 +3744,7 @@ int main() { char *(*pfn) = (char *(*)) free ; return 0; } EOF -if { (eval echo configure:3724: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3748: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_free=no else @@ -3742,12 +3766,12 @@ EOF fi echo $ac_n "checking whether strerror must be declared""... $ac_c" 1>&6 -echo "configure:3746: checking whether strerror must be declared" >&5 +echo "configure:3770: checking whether strerror must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strerror'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -3768,7 +3792,7 @@ int main() { char *(*pfn) = (char *(*)) strerror ; return 0; } EOF -if { (eval echo configure:3772: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3796: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strerror=no else @@ -3790,12 +3814,12 @@ EOF fi echo $ac_n "checking whether strdup must be declared""... $ac_c" 1>&6 -echo "configure:3794: checking whether strdup must be declared" >&5 +echo "configure:3818: checking whether strdup must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strdup'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -3816,7 +3840,7 @@ int main() { char *(*pfn) = (char *(*)) strdup ; return 0; } EOF -if { (eval echo configure:3820: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3844: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strdup=no else @@ -3855,19 +3879,19 @@ EOF fi echo $ac_n "checking for gregset_t type""... $ac_c" 1>&6 -echo "configure:3859: checking for gregset_t type" >&5 +echo "configure:3883: checking for gregset_t type" >&5 if eval "test \"`echo '$''{'gdb_cv_have_gregset_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { gregset_t *gregsetp = 0 ; return 0; } EOF -if { (eval echo configure:3871: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3895: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gdb_cv_have_gregset_t=yes else @@ -3888,19 +3912,19 @@ EOF fi echo $ac_n "checking for fpregset_t type""... $ac_c" 1>&6 -echo "configure:3892: checking for fpregset_t type" >&5 +echo "configure:3916: checking for fpregset_t type" >&5 if eval "test \"`echo '$''{'gdb_cv_have_fpregset_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { fpregset_t *fpregsetp = 0 ; return 0; } EOF -if { (eval echo configure:3904: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3928: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gdb_cv_have_fpregset_t=yes else @@ -3921,7 +3945,7 @@ EOF fi echo $ac_n "checking for main in -lm""... $ac_c" 1>&6 -echo "configure:3925: checking for main in -lm" >&5 +echo "configure:3949: checking for main in -lm" >&5 ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3929,14 +3953,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3964: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3965,7 +3989,7 @@ fi echo $ac_n "checking for wctype in -lc""... $ac_c" 1>&6 -echo "configure:3969: checking for wctype in -lc" >&5 +echo "configure:3993: checking for wctype in -lc" >&5 ac_lib_var=`echo c'_'wctype | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3973,7 +3997,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4012: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4003,7 +4027,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for wctype in -lw""... $ac_c" 1>&6 -echo "configure:4007: checking for wctype in -lw" >&5 +echo "configure:4031: checking for wctype in -lw" >&5 ac_lib_var=`echo w'_'wctype | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4011,7 +4035,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lw $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4050: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4054,7 +4078,7 @@ fi TERM_LIB= echo $ac_n "checking for tgetent in -lncurses""... $ac_c" 1>&6 -echo "configure:4058: checking for tgetent in -lncurses" >&5 +echo "configure:4082: checking for tgetent in -lncurses" >&5 ac_lib_var=`echo ncurses'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4062,7 +4086,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lncurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4101: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4092,7 +4116,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -ltermlib""... $ac_c" 1>&6 -echo "configure:4096: checking for tgetent in -ltermlib" >&5 +echo "configure:4120: checking for tgetent in -ltermlib" >&5 ac_lib_var=`echo termlib'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4100,7 +4124,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ltermlib $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4139: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4130,7 +4154,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6 -echo "configure:4134: checking for tgetent in -ltermcap" >&5 +echo "configure:4158: checking for tgetent in -ltermcap" >&5 ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4138,7 +4162,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ltermcap $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4177: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4168,7 +4192,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -lcurses""... $ac_c" 1>&6 -echo "configure:4172: checking for tgetent in -lcurses" >&5 +echo "configure:4196: checking for tgetent in -lcurses" >&5 ac_lib_var=`echo curses'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4176,7 +4200,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4215: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4206,7 +4230,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -lterminfo""... $ac_c" 1>&6 -echo "configure:4210: checking for tgetent in -lterminfo" >&5 +echo "configure:4234: checking for tgetent in -lterminfo" >&5 ac_lib_var=`echo terminfo'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4214,7 +4238,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lterminfo $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4253: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4263,12 +4287,12 @@ fi echo $ac_n "checking for long long support in compiler""... $ac_c" 1>&6 -echo "configure:4267: checking for long long support in compiler" >&5 +echo "configure:4291: checking for long long support in compiler" >&5 if eval "test \"`echo '$''{'gdb_cv_c_long_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4306: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_c_long_long=yes else @@ -4300,7 +4324,7 @@ fi echo $ac_n "checking for long long support in printf""... $ac_c" 1>&6 -echo "configure:4304: checking for long long support in printf" >&5 +echo "configure:4328: checking for long long support in printf" >&5 if eval "test \"`echo '$''{'gdb_cv_printf_has_long_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4308,7 +4332,7 @@ else gdb_cv_printf_has_long_long=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4350: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then gdb_cv_printf_has_long_long=yes else @@ -4346,19 +4370,19 @@ echo "$ac_t""$gdb_cv_printf_has_long_long" 1>&6 echo $ac_n "checking for long double support in compiler""... $ac_c" 1>&6 -echo "configure:4350: checking for long double support in compiler" >&5 +echo "configure:4374: checking for long double support in compiler" >&5 if eval "test \"`echo '$''{'ac_cv_c_long_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4386: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_long_double=yes else @@ -4380,7 +4404,7 @@ fi echo $ac_n "checking for long double support in printf""... $ac_c" 1>&6 -echo "configure:4384: checking for long double support in printf" >&5 +echo "configure:4408: checking for long double support in printf" >&5 if eval "test \"`echo '$''{'gdb_cv_printf_has_long_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4388,7 +4412,7 @@ else gdb_cv_printf_has_long_double=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4426: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then gdb_cv_printf_has_long_double=yes else @@ -4422,7 +4446,7 @@ echo "$ac_t""$gdb_cv_printf_has_long_double" 1>&6 echo $ac_n "checking for long double support in scanf""... $ac_c" 1>&6 -echo "configure:4426: checking for long double support in scanf" >&5 +echo "configure:4450: checking for long double support in scanf" >&5 if eval "test \"`echo '$''{'gdb_cv_scanf_has_long_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4430,7 +4454,7 @@ else gdb_cv_scanf_has_long_double=no else cat > conftest.$ac_ext < 3.14159 && f < 3.14160); } EOF -if { (eval echo configure:4444: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4468: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then gdb_cv_scanf_has_long_double=yes else @@ -4466,17 +4490,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4470: checking for $ac_hdr" >&5 +echo "configure:4494: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4480: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4504: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4505,12 +4529,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4509: checking for $ac_func" >&5 +echo "configure:4533: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4561: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4558,7 +4582,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:4562: checking for working mmap" >&5 +echo "configure:4586: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4566,7 +4590,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4734: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -4735,7 +4759,7 @@ if test ${build} = ${host} -a ${host} = ${target} ; then case ${host_os} in hpux*) echo $ac_n "checking for HPUX/OSF thread support""... $ac_c" 1>&6 -echo "configure:4739: checking for HPUX/OSF thread support" >&5 +echo "configure:4763: checking for HPUX/OSF thread support" >&5 if test -f /usr/include/dce/cma_config.h ; then if test "$GCC" = "yes" ; then echo "$ac_t""yes" 1>&6 @@ -4754,7 +4778,7 @@ EOF ;; solaris*) echo $ac_n "checking for Solaris thread debugging library""... $ac_c" 1>&6 -echo "configure:4758: checking for Solaris thread debugging library" >&5 +echo "configure:4782: checking for Solaris thread debugging library" >&5 if test -f /usr/lib/libthread_db.so.1 ; then echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF @@ -4764,7 +4788,7 @@ EOF CONFIG_OBS="${CONFIG_OBS} sol-thread.o" CONFIG_SRCS="${CONFIG_SRCS} sol-thread.c" echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:4768: checking for dlopen in -ldl" >&5 +echo "configure:4792: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4772,7 +4796,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4811: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4815,17 +4839,17 @@ fi # all symbols visible in the dynamic symbol table. hold_ldflags=$LDFLAGS echo $ac_n "checking for the ld -export-dynamic flag""... $ac_c" 1>&6 -echo "configure:4819: checking for the ld -export-dynamic flag" >&5 +echo "configure:4843: checking for the ld -export-dynamic flag" >&5 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4853: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* found=yes else @@ -4844,13 +4868,13 @@ rm -f conftest* # Sun randomly tweaked the prototypes in # at one point. echo $ac_n "checking if is old""... $ac_c" 1>&6 -echo "configure:4848: checking if is old" >&5 +echo "configure:4872: checking if is old" >&5 if eval "test \"`echo '$''{'gdb_cv_proc_service_is_old'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -4861,7 +4885,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:4865: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4889: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_proc_service_is_old=no else @@ -5224,12 +5248,12 @@ fi # In the Cygwin environment, we need some additional flags. echo $ac_n "checking for cygwin""... $ac_c" 1>&6 -echo "configure:5228: checking for cygwin" >&5 +echo "configure:5252: checking for cygwin" >&5 if eval "test \"`echo '$''{'gdb_cv_os_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 -echo "configure:5293: checking for Tcl configuration" >&5 +echo "configure:5317: checking for Tcl configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_tclconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5397,7 +5421,7 @@ if test "${with_tkconfig+set}" = set; then fi echo $ac_n "checking for Tk configuration""... $ac_c" 1>&6 -echo "configure:5401: checking for Tk configuration" >&5 +echo "configure:5425: checking for Tk configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_tkconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5493,7 +5517,7 @@ fi no_tcl=true echo $ac_n "checking for Tcl private headers. dir=${configdir}""... $ac_c" 1>&6 -echo "configure:5497: checking for Tcl private headers. dir=${configdir}" >&5 +echo "configure:5521: checking for Tcl private headers. dir=${configdir}" >&5 # Check whether --with-tclinclude or --without-tclinclude was given. if test "${with_tclinclude+set}" = set; then withval="$with_tclinclude" @@ -5559,17 +5583,17 @@ fi if test x"${ac_cv_c_tclh}" = x ; then ac_safe=`echo "tclInt.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for tclInt.h""... $ac_c" 1>&6 -echo "configure:5563: checking for tclInt.h" >&5 +echo "configure:5587: checking for tclInt.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5573: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5597: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5629,7 +5653,7 @@ fi # no_tk=true echo $ac_n "checking for Tk private headers""... $ac_c" 1>&6 -echo "configure:5633: checking for Tk private headers" >&5 +echo "configure:5657: checking for Tk private headers" >&5 # Check whether --with-tkinclude or --without-tkinclude was given. if test "${with_tkinclude+set}" = set; then withval="$with_tkinclude" @@ -5695,17 +5719,17 @@ fi if test x"${ac_cv_c_tkh}" = x ; then ac_safe=`echo "tk.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for tk.h""... $ac_c" 1>&6 -echo "configure:5699: checking for tk.h" >&5 +echo "configure:5723: checking for tk.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5709: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5733: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5751,11 +5775,11 @@ fi echo $ac_n "checking for Itcl private headers. srcdir=${srcdir}""... $ac_c" 1>&6 -echo "configure:5755: checking for Itcl private headers. srcdir=${srcdir}" >&5 +echo "configure:5779: checking for Itcl private headers. srcdir=${srcdir}" >&5 if test x"${ac_cv_c_itclh}" = x ; then - for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ; 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 @@ -5768,13 +5792,36 @@ 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(ITCLLIB) + +echo $ac_n "checking for Itk private headers. srcdir=${srcdir}""... $ac_c" 1>&6 +echo "configure:5802: checking for Itk private headers. srcdir=${srcdir}" >&5 +if test x"${ac_cv_c_itkh}" = x ; then + for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itk; do + if test -f $i/generic/itk.h ; then + ac_cv_c_itkh=`(cd $i/generic; pwd)` + break + fi + done +fi +if test x"${ac_cv_c_itkh}" = x ; then + ITKHDIR="# no Itk private headers found" + { echo "configure: error: Can't find Itk private headers" 1>&2; exit 1; } +fi +if test x"${ac_cv_c_itkh}" != x ; then + ITKHDIR="-I${ac_cv_c_itkh}" +fi +# should always be here +# ITKLIB="../itcl/itk/unix/libitk.a" + +#AC_SUBST(ITKLIB) echo $ac_n "checking for Tix private headers. srcdir=${srcdir}""... $ac_c" 1>&6 -echo "configure:5778: checking for Tix private headers. srcdir=${srcdir}" >&5 +echo "configure:5825: checking for Tix private headers. srcdir=${srcdir}" >&5 if test x"${ac_cv_c_tixh}" = x ; then for i in ${srcdir}/../tix ${srcdir}/../../tix ${srcdir}/../../../tix ; do if test -f $i/generic/tix.h ; then @@ -5793,6 +5840,232 @@ fi + # now look for Itcl library stuff + + +# +# Ok, lets find the itcl configuration +# First, look for one uninstalled. +# the alternative search directory is invoked by --with-itclconfig +# + +if test x"${no_itcl}" = x ; then + # we reset no_itcl in case something fails here + no_itcl=true + # Check whether --with-itclconfig or --without-itclconfig was given. +if test "${with_itclconfig+set}" = set; then + withval="$with_itclconfig" + with_itclconfig=${withval} +fi + + echo $ac_n "checking for Itcl configuration""... $ac_c" 1>&6 +echo "configure:5863: checking for Itcl configuration" >&5 + if eval "test \"`echo '$''{'ac_cv_c_itclconfig'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + + # First check to see if --with-itclconfig was specified. + if test x"${with_itclconfig}" != x ; then + if test -f "${with_itclconfig}/itclConfig.sh" ; then + ac_cv_c_itclconfig=`(cd ${with_itclconfig}; pwd)` + else + { echo "configure: error: ${with_itclconfig} directory doesn't contain itclConfig.sh" 1>&2; exit 1; } + fi + fi + + # then check for a private Itcl library + if test x"${ac_cv_c_itclconfig}" = x ; then + for i in \ + ../itcl/itcl \ + `ls -dr ../itcl[4-9]*/itcl 2>/dev/null` \ + ../../itcl \ + `ls -dr ../../itcl[4-9]*/itcl 2>/dev/null` \ + ../../../itcl \ + `ls -dr ../../../itcl[4-9]*/itcl 2>/dev/null` ; do + if test -f "$i/${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 + +fi + + if test x"${ac_cv_c_itclconfig}" = x ; then + ITCLCONFIG="# no Itcl configs found" + echo "configure: warning: Can't find Itcl configuration definitions" 1>&2 + else + no_itcl= + ITCLCONFIG=${ac_cv_c_itclconfig}/itclConfig.sh + echo "$ac_t""found $ITCLCONFIG" 1>&6 + fi +fi + + + if test -z "${no_itcl}"; then + + if test -f "$ITCLCONFIG" ; then + . $ITCLCONFIG + fi + + + + + + + + + + + + case "${host}" in + *-*-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 + +# +# Ok, lets find the itk configuration +# First, look for one uninstalled. +# the alternative search directory is invoked by --with-itkconfig +# + +if test x"${no_itk}" = x ; then + # we reset no_itk in case something fails here + no_itk=true + # Check whether --with-itkconfig or --without-itkconfig was given. +if test "${with_itkconfig+set}" = set; then + withval="$with_itkconfig" + with_itkconfig=${withval} +fi + + echo $ac_n "checking for Itk configuration""... $ac_c" 1>&6 +echo "configure:5976: checking for Itk configuration" >&5 + if eval "test \"`echo '$''{'ac_cv_c_itkconfig'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + + # First check to see if --with-itkconfig was specified. + if test x"${with_itkconfig}" != x ; then + if test -f "${with_itkconfig}/itkConfig.sh" ; then + ac_cv_c_itkconfig=`(cd ${with_itkconfig}; pwd)` + else + { echo "configure: error: ${with_itkconfig} directory doesn't contain itkConfig.sh" 1>&2; exit 1; } + fi + fi + + # then check for a private Itk library + if test x"${ac_cv_c_itkconfig}" = x ; then + for i in \ + ../itcl/itk \ + `ls -dr ../itcl[4-9]*/itk 2>/dev/null` \ + ../../itk \ + `ls -dr ../../itcl[4-9]*/itk 2>/dev/null` \ + ../../../itk \ + `ls -dr ../../../itcl[4-9]*/itk 2>/dev/null` ; do + if test -f "$i/${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 + +fi + + if test x"${ac_cv_c_itkconfig}" = x ; then + ITKCONFIG="# no Itk configs found" + echo "configure: warning: Can't find Itk configuration definitions" 1>&2 + else + no_itk= + ITKCONFIG=${ac_cv_c_itkconfig}/itkConfig.sh + echo "$ac_t""found $ITKCONFIG" 1>&6 + fi +fi + + + if test -z "${no_itcl}"; then + + if test -f "$ITKCONFIG" ; then + . $ITKCONFIG + fi + + + + + + + + + + + + + case "${host}" in + *-*-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 @@ -5831,11 +6104,11 @@ fi # 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 @@ -5843,7 +6116,7 @@ fi # 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" @@ -5861,6 +6134,10 @@ fi + + + + # end-sanitize-gdbtk # If we find X, set shell vars x_includes and x_libraries to the @@ -5868,7 +6145,7 @@ fi # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:5872: checking for X" >&5 +echo "configure:6149: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -5930,12 +6207,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5939: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6216: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6004,14 +6281,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6292: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -6279,7 +6556,7 @@ links="${links} nm.h" fi # start-sanitize-gdbtk echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:6283: checking whether ln -s works" >&5 +echo "configure:6560: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6314,19 +6591,19 @@ fi echo $ac_n "checking for Cygwin32 environment""... $ac_c" 1>&6 -echo "configure:6318: checking for Cygwin32 environment" >&5 +echo "configure:6595: checking for Cygwin32 environment" >&5 if eval "test \"`echo '$''{'am_cv_cygwin32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6607: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* am_cv_cygwin32=yes else @@ -6343,19 +6620,19 @@ echo "$ac_t""$am_cv_cygwin32" 1>&6 CYGWIN32= test "$am_cv_cygwin32" = yes && CYGWIN32=yes echo $ac_n "checking for Mingw32 environment""... $ac_c" 1>&6 -echo "configure:6347: checking for Mingw32 environment" >&5 +echo "configure:6624: checking for Mingw32 environment" >&5 if eval "test \"`echo '$''{'am_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6636: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* am_cv_mingw32=yes else @@ -6374,7 +6651,7 @@ test "$am_cv_mingw32" = yes && MINGW32=yes echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:6378: checking for executable suffix" >&5 +echo "configure:6655: checking for executable suffix" >&5 if eval "test \"`echo '$''{'am_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6430,7 +6707,7 @@ EOF # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | - case `(ac_space=' '; set) 2>&1 | grep ac_space` in + case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). @@ -6497,7 +6774,7 @@ do echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.12.2" + echo "$CONFIG_STATUS generated by autoconf version 2.13" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; @@ -6521,6 +6798,7 @@ s%@SHELL@%$SHELL%g s%@CFLAGS@%$CFLAGS%g s%@CPPFLAGS@%$CPPFLAGS%g s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g s%@DEFS@%$DEFS%g s%@LDFLAGS@%$LDFLAGS%g s%@LIBS@%$LIBS%g @@ -6580,6 +6858,7 @@ s%@GT_YES@%$GT_YES%g s%@MKINSTALLDIRS@%$MKINSTALLDIRS%g s%@l@%$l%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@INSTALL_DATA@%$INSTALL_DATA%g s%@AR@%$AR%g s%@YACC@%$YACC%g @@ -6631,12 +6910,26 @@ s%@TK_LIB_SPEC@%$TK_LIB_SPEC%g s%@TCLHDIR@%$TCLHDIR%g s%@TKHDIR@%$TKHDIR%g s%@ITCLHDIR@%$ITCLHDIR%g -s%@ITCLLIB@%$ITCLLIB%g +s%@ITKHDIR@%$ITKHDIR%g s%@TIXHDIR@%$TIXHDIR%g +s%@ITCL_VERSION@%$ITCL_VERSION%g +s%@ITCL_DEFS@%$ITCL_DEFS%g +s%@ITCL_BUILD_INCLUDES@%$ITCL_BUILD_INCLUDES%g +s%@ITCL_BUILD_LIB_SPEC@%$ITCL_BUILD_LIB_SPEC%g +s%@ITCL_LIB_SPEC@%$ITCL_LIB_SPEC%g +s%@ITK_VERSION@%$ITK_VERSION%g +s%@ITK_DEFS@%$ITK_DEFS%g +s%@ITK_BUILD_INCLUDES@%$ITK_BUILD_INCLUDES%g +s%@ITK_BUILD_LIB_SPEC@%$ITK_BUILD_LIB_SPEC%g +s%@ITK_LIB_SPEC@%$ITK_LIB_SPEC%g s%@ENABLE_GDBTK@%$ENABLE_GDBTK%g s%@X_CFLAGS@%$X_CFLAGS%g s%@X_LDFLAGS@%$X_LDFLAGS%g s%@X_LIBS@%$X_LIBS%g +s%@ITCLLIB@%$ITCLLIB%g +s%@ITCL_DEPS@%$ITCL_DEPS%g +s%@ITKLIB@%$ITKLIB%g +s%@ITK_DEPS@%$ITK_DEPS%g s%@TIXLIB@%$TIXLIB%g s%@TIX_DEPS@%$TIX_DEPS%g s%@GDBTKLIBS@%$GDBTKLIBS%g diff --git a/gdb/configure.in b/gdb/configure.in index 38363e0aeb0..be6864305d8 100644 --- a/gdb/configure.in +++ b/gdb/configure.in @@ -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) diff --git a/gdb/defs.h b/gdb/defs.h index ce2df7f963d..196fc72985d 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -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. */ diff --git a/gdb/gdbtk-cmds.c b/gdb/gdbtk-cmds.c index 00199749d24..8c13f364515 100644 --- a/gdb/gdbtk-cmds.c +++ b/gdb/gdbtk-cmds.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 @@ -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: */ diff --git a/gdb/gdbtk-hooks.c b/gdb/gdbtk-hooks.c index 7bccc4f2592..f92beb95ea3 100644 --- a/gdb/gdbtk-hooks.c +++ b/gdb/gdbtk-hooks.c @@ -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: */ diff --git a/gdb/gdbtk-variable.c b/gdb/gdbtk-variable.c new file mode 100644 index 00000000000..9ed6a109f4d --- /dev/null +++ b/gdb/gdbtk-variable.c @@ -0,0 +1,1622 @@ +/* Variable user interface for GDB, the GNU debugger. + Copyright 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 "value.h" +#include "expression.h" +#include "frame.h" +#include "valprint.h" + +#include +#include +#include "gdbtk.h" +#include "gdbtk-wrapper.h" + +#include + +/* Enumeration type defining the return values for valueChanged */ +enum value_changed +{ + VALUE_UNCHANGED, /* the variable's value is unchanged */ + VALUE_CHANGED, /* the variable's value has changed */ + VALUE_OUT_OF_SCOPE /* the variable is no longer in scope */ +}; + +/* String representations of the value_changed enums */ +static char *value_changed_string[] = { + "VARIABLE_UNCHANGED", + "VARIABLE_CHANGED", + "VARIABLE_OUT_OF_SCOPE", + NULL +}; + +/* Enumeration for the format types */ +enum display_format +{ + FORMAT_NATURAL, /* What gdb actually calls 'natural' */ + FORMAT_BINARY, /* Binary display */ + FORMAT_DECIMAL, /* Decimal display */ + FORMAT_HEXADECIMAL, /* Hex display */ + FORMAT_OCTAL /* Octal display */ +}; + +/* Mappings of display_format enums to gdb's format codes */ +int format_code[] = {0, 't', 'd', 'x', 'o'}; + +/* String representations of the format codes */ +char *format_string[] = {"natural", "binary", "decimal", "hexadecimal", "octal"}; + +/* Every parent variable keeps a linked list of its children, described + by the following structure. */ +struct variable_child { + + /* Pointer to the child's data */ + struct _gdb_variable *child; + + /* Pointer to the next child */ + struct variable_child *next; +}; + +/* Every variable in the system has a structure of this type defined + for it. This structure holds all information necessary to manipulate + a particular object variable. Members which must be freed are noted. */ +struct _gdb_variable { + + /* Alloc'd name of the variable for this object.. If this variable is a + child, then this name will be the child's source name. + (bar, not foo.bar) */ + char *name; + + /* The alloc'd real name of this variable. This is used to construct the + variable's children. It is always a valid expression. */ + char *real_name; + + /* The alloc'd name for this variable's object. This is here for + convenience when constructing this object's children. */ + char *obj_name; + + /* Alloc'd expression for this variable */ + struct expression *exp; + + /* Block for which this expression is valid */ + struct block *valid_block; + + /* The frame for this expression */ + CORE_ADDR frame; + + /* The value of this expression */ + value_ptr value; + + /* Did an error occur evaluating the expression or getting its value? */ + int error; + + /* The number of (immediate) children this variable has */ + int num_children; + + /* If this object is a child, this points to its parent. */ + struct _gdb_variable *parent; + + /* A list of this object's children */ + struct variable_child *children; + + /* The format of the output for this object */ + enum display_format format; +}; + +typedef struct _gdb_variable gdb_variable; + +/* This variable will hold the value of the output from gdb + for commands executed through call_gdb_* */ +static Tcl_Obj *fputs_obj; + +/* + * Public functions defined in this file + */ + +int gdb_variable_init PARAMS ((Tcl_Interp *)); + +/* + * Private functions defined in this file + */ + +/* Entries into this file */ + +static int gdb_variable_command PARAMS ((ClientData, Tcl_Interp *, int, + Tcl_Obj *CONST[])); + +static int variable_create PARAMS ((Tcl_Interp *, int, Tcl_Obj *CONST[])); + +static void variable_delete PARAMS ((Tcl_Interp *, gdb_variable *)); + +static void variable_debug PARAMS ((gdb_variable *)); + +static int variable_obj_command PARAMS ((ClientData, Tcl_Interp *, int, + Tcl_Obj *CONST[])); +static Tcl_Obj *variable_children PARAMS ((Tcl_Interp *, gdb_variable *)); + +static enum value_changed variable_value_changed PARAMS ((gdb_variable *)); + +static int variable_format PARAMS ((Tcl_Interp *, int, Tcl_Obj *CONST[], + gdb_variable *)); + +static int variable_type PARAMS ((Tcl_Interp *, int, Tcl_Obj *CONST[], + gdb_variable *)); + +static int variable_value PARAMS ((Tcl_Interp *, int, Tcl_Obj *CONST[], + gdb_variable *)); + +static int variable_editable PARAMS ((gdb_variable *)); + +/* Helper functions for the above functions. */ + +static gdb_variable *create_variable PARAMS ((char *, char *, CORE_ADDR)); + +static void delete_children PARAMS ((Tcl_Interp *, gdb_variable *, int)); + +static void install_variable PARAMS ((Tcl_Interp *, char *, gdb_variable *)); + +static void uninstall_variable PARAMS ((Tcl_Interp *, gdb_variable *)); + +static gdb_variable *child_exists PARAMS ((gdb_variable *, char *)); + +static gdb_variable *create_child PARAMS ((Tcl_Interp *, gdb_variable *, + char *, int)); +static char *name_of_child PARAMS ((gdb_variable *, int)); + +static int number_of_children PARAMS ((gdb_variable *)); + +static enum display_format variable_default_display PARAMS ((gdb_variable *)); + +static void save_child_in_parent PARAMS ((gdb_variable *, gdb_variable *)); + +static void remove_child_from_parent PARAMS ((gdb_variable *, gdb_variable *)); + +static struct type *get_type PARAMS ((value_ptr)); + +static struct type *get_target_type PARAMS ((struct type *)); + +static Tcl_Obj *get_call_output PARAMS ((void)); + +static void clear_gdb_output PARAMS ((void)); + +static int call_gdb_type_print PARAMS ((value_ptr)); + +static int call_gdb_val_print PARAMS ((value_ptr, int)); + +static void variable_fputs PARAMS ((const char *, FILE *)); + +static void null_fputs PARAMS ((const char *, FILE *)); + +static int my_value_equal PARAMS ((gdb_variable *, value_ptr)); + +#define INIT_VARIABLE(x) { \ +(x)->name = NULL; \ +(x)->real_name = NULL; \ +(x)->obj_name = NULL; \ +(x)->exp = NULL; \ +(x)->valid_block = NULL; \ +(x)->frame = (CORE_ADDR) 0; \ +(x)->value = NULL; \ +(x)->error = 0; \ +(x)->num_children = 0; \ +(x)->parent = NULL; \ +(x)->children = NULL; \ +(x)->format = FORMAT_NATURAL; \ +} + +#if defined(FREEIF) +# undef FREEIF +#endif +#define FREEIF(x) if (x != NULL) free((char *) (x)) + +/* Initialize the variable code. This function should be called once + to install and initialize the variable code into the interpreter. */ +int +gdb_variable_init (interp) + Tcl_Interp *interp; +{ + Tcl_Command result; + + result = Tcl_CreateObjCommand (interp, "gdb_variable", call_wrapper, + (ClientData) gdb_variable_command, NULL); + if (result == NULL) + return TCL_ERROR; + + return TCL_OK; +} + +/* This function defines the "gdb_variable" command which is used to + create variable objects. Its syntax includes: + + gdb_variable create + gdb_variable create NAME + gdb_variable create -expr EXPR + gdb_variable create NAME -expr EXPR + + NAME = name of object to create. If no NAME, then automatically create + a name + EXPR = the gdb expression for which to create a variable. This will + be the most common usage. +*/ +static int +gdb_variable_command (clientData, interp, objc, objv) + ClientData clientData; + Tcl_Interp *interp; + int objc; + Tcl_Obj *CONST objv[]; +{ + static char *commands[] = { "create", NULL }; + enum commands_enum { VARIABLE_CREATE }; + int index, result; + + if (objc < 2) + { + Tcl_WrongNumArgs (interp, 1, objv, "option ?arg...?"); + return TCL_ERROR; + } + + if (Tcl_GetIndexFromObj (interp, objv[1], commands, "options", 0, + &index) != TCL_OK) + { + return TCL_ERROR; + } + + switch ((enum commands_enum) index) + { + case VARIABLE_CREATE: + result = variable_create (interp, objc - 2, objv + 2); + break; + + default: + return TCL_ERROR; + } + + return result; +} + +/* This function implements the actual object command for each + variable object that is created (and each of its children). + + Currently the following commands are implemented: + - delete delete this object and its children + - valueChanged has the value of this object changed since the last check? + - numChildren how many children does this object have + - children create the children and return a list of their objects + - debug print out a little debug info for the object + - name print out the name of this variable +*/ +static int +variable_obj_command (clientData, interp, objc, objv) + ClientData clientData; + Tcl_Interp *interp; + int objc; + Tcl_Obj *CONST objv[]; +{ + enum commands_enum { + VARIABLE_DELETE, + VARIABLE_VALUE_CHANGED, + VARIABLE_NUM_CHILDREN, + VARIABLE_CHILDREN, + VARIABLE_DEBUG, + VARIABLE_FORMAT, + VARIABLE_TYPE, + VARIABLE_VALUE, + VARIABLE_NAME, + VARIABLE_EDITABLE + }; + static char *commands[] = { + "delete", + "valueChanged", + "numChildren", + "children", + "debug", + "format", + "type", + "value", + "name", + "editable", + NULL + }; + gdb_variable *var = (gdb_variable *) clientData; + int index, result; + + if (objc < 2) + { + Tcl_WrongNumArgs (interp, 1, objv, "option ?arg...?"); + return TCL_ERROR; + } + + if (Tcl_GetIndexFromObj (interp, objv[1], commands, "options", 0, + &index) != TCL_OK) + return TCL_ERROR; + + result = TCL_OK; + switch ((enum commands_enum) index) + { + case VARIABLE_DELETE: + if (objc > 2) + { + int len; + char *s = Tcl_GetStringFromObj (objv[2], &len); + if (*s == 'c' && strncmp (s, "children", len) == 0) + { + delete_children (interp, var, 1); + break; + } + } + variable_delete (interp, var); + break; + + case VARIABLE_VALUE_CHANGED: + { + enum value_changed vc = variable_value_changed (var); + Tcl_SetObjResult (interp, Tcl_NewStringObj (value_changed_string[vc], -1)); + } + break; + + case VARIABLE_NUM_CHILDREN: + Tcl_SetObjResult (interp, Tcl_NewIntObj (var->num_children)); + break; + + case VARIABLE_CHILDREN: + { + Tcl_Obj *children = variable_children (interp, var); + Tcl_SetObjResult (interp, children); + } + break; + + case VARIABLE_DEBUG: + variable_debug (var); + break; + + case VARIABLE_FORMAT: + result = variable_format (interp, objc, objv, var); + break; + + case VARIABLE_TYPE: + result = variable_type (interp, objc, objv, var); + break; + + case VARIABLE_VALUE: + result = variable_value (interp, objc, objv, var); + break; + + case VARIABLE_NAME: + Tcl_SetObjResult (interp, Tcl_NewStringObj (var->name, -1)); + break; + + case VARIABLE_EDITABLE: + Tcl_SetObjResult (interp, Tcl_NewIntObj (variable_editable (var))); + break; + + default: + return TCL_ERROR; + } + + return result; +} + +/* + * Variable object construction/destruction + */ + +/* This function is responsible for processing the user's specifications + and constructing a variable object. */ +static int +variable_create (interp, objc, objv) + Tcl_Interp *interp; + int objc; + Tcl_Obj *CONST objv[]; +{ + enum create_opts { CREATE_EXPR, CREATE_PC }; + static char *create_options[] = { "-expr", "-pc", NULL }; + gdb_variable *var; + char *name; + char obj_name[31]; + int index; + static int id = 0; + CORE_ADDR pc = (CORE_ADDR) -1; + + /* REMINDER: This command may be invoked in the following ways: + gdb_variable create + gdb_variable create NAME + gdb_variable create -expr EXPR + gdb_variable create NAME -expr EXPR + + NAME = name of object to create. If no NAME, then automatically create + a name + EXPR = the gdb expression for which to create a variable. This will + be the most common usage. + */ + name = NULL; + if (objc) + name = Tcl_GetStringFromObj (objv[0], NULL); + if (name == NULL || *name == '-') + { + /* generate a name for this object */ + id++; + sprintf (obj_name, "var%d", id); + } + else + { + /* specified name for object */ + strncpy (obj_name, name, 30); + objv++; + objc--; + } + + /* Run through all the possible options for this command */ + name = NULL; + while (objc > 0) + { + if (Tcl_GetIndexFromObj (interp, objv[0], create_options, "options", + 0, &index) != TCL_OK) + { + result_ptr->flags |= GDBTK_IN_TCL_RESULT; + return TCL_ERROR; + } + + switch ((enum create_opts) index) + { + case CREATE_EXPR: + name = Tcl_GetStringFromObj (objv[1], NULL); + objc--; + objv++; + break; + + case CREATE_PC: + { + char *str; + str = Tcl_GetStringFromObj (objv[1], NULL); + pc = parse_and_eval_address (str); + objc--; + objv++; + } + break; + + default: + break; + } + + objc--; + objv++; + } + + /* Create the variable */ + var = create_variable (name, name, pc); + + if (var != NULL) + { + /* Install a command into the interpreter that represents this + object */ + install_variable (interp, obj_name, var); + Tcl_SetObjResult (interp, Tcl_NewStringObj (obj_name, -1)); + result_ptr->flags |= GDBTK_IN_TCL_RESULT; + + return TCL_OK; + } + + return TCL_ERROR; +} + +/* Fill out a gdb_variable structure for the variable being constructed. + This function should never fail if real_name is a valid expression. + (That means no longjmp'ing!) */ +static gdb_variable * +create_variable (name, real_name, pc) + char *name; + char *real_name; + CORE_ADDR pc; +{ + gdb_variable *var; + value_ptr mark; + struct frame_info *fi, *old_fi; + struct block *block; + void (*old_fputs) PARAMS ((const char *, FILE *)); + gdb_result r; + + var = (gdb_variable *) xmalloc (sizeof (gdb_variable)); + INIT_VARIABLE (var); + + if (name != NULL) + { + char *p; + + /* Parse and evaluate the expression, filling in as much + of the variable's data as possible */ + + /* Allow creator to specify context of variable */ + if (pc == (CORE_ADDR) -1) + block = 0; + else + { + r = GDB_block_for_pc (pc, &block); + if (r != GDB_OK) + block = 0; + } + + p = real_name; + innermost_block = NULL; + r = GDB_parse_exp_1 (&p, block, 0, &(var->exp)); + if (r != GDB_OK) + { + FREEIF ((char *) var); + return NULL; + } + + /* Don't allow variables to be created for types. */ + if (var->exp->elts[0].opcode == OP_TYPE) + { + free_current_contents ((char **) &(var->exp)); + FREEIF (var); + printf_unfiltered ("Attempt to use a type name as an expression."); + return NULL; + } + + var->valid_block = innermost_block; + var->name = savestring (name, strlen (name)); + var->real_name = savestring (real_name, strlen (real_name)); + + /* Several of the GDB_* calls can cause messages to be displayed. We swallow + those here, because we don't need them (the "value" command will + show them). */ + old_fputs = fputs_unfiltered_hook; + fputs_unfiltered_hook = null_fputs; + + /* When the PC is different from the current PC (pc == -1), + then we must select the appropriate frame before parsing + the expression, otherwise the value will not be current. + Since select_frame is so benign, just call it for all cases. */ + r = GDB_block_innermost_frame (var->valid_block, &fi); + if (r != GDB_OK) + fi = NULL; + if (fi) + var->frame = FRAME_FP (fi); + old_fi = selected_frame; + GDB_select_frame (fi, -1); + + mark = value_mark (); + if (GDB_evaluate_expression (var->exp, &var->value) == GDB_OK) + { + release_value (var->value); + if (VALUE_LAZY (var->value)) + { + if (GDB_value_fetch_lazy (var->value) != GDB_OK) + var->error = 1; + else + var->error = 0; + } + } + else + var->error = 1; + value_free_to_mark (mark); + + /* Reset the selected frame */ + GDB_select_frame (old_fi, -1); + + /* Restore the output hook to normal */ + fputs_unfiltered_hook = old_fputs; + + var->num_children = number_of_children (var); + var->format = variable_default_display (var); + } + + return var; +} + +/* Install the given variable VAR into the tcl interpreter with + the object name NAME. */ +static void +install_variable (interp, name, var) + Tcl_Interp *interp; + char *name; + gdb_variable *var; +{ + var->obj_name = savestring (name, strlen (name)); + Tcl_CreateObjCommand (interp, name, variable_obj_command, + (ClientData) var, NULL); +} + +/* Unistall the object VAR in the tcl interpreter. */ +static void +uninstall_variable (interp, var) + Tcl_Interp *interp; + gdb_variable *var; +{ + Tcl_DeleteCommand (interp, var->obj_name); +} + +/* Delete the variable object VAR and its children */ +static void +variable_delete (interp, var) + Tcl_Interp *interp; + gdb_variable *var; +{ + /* Delete any children of this variable, too. */ + delete_children (interp, var, 0); + + /* If this variable has a parent, remove it from its parent's list */ + if (var->parent != NULL) + { + remove_child_from_parent (var->parent, var); + } + + uninstall_variable (interp, var); + + /* Free memory associated with this variable */ + FREEIF (var->name); + FREEIF (var->real_name); + FREEIF (var->obj_name); + if (var->exp != NULL) + free_current_contents ((char **) &var->exp); + FREEIF (var); +} + +/* Silly debugging info */ +static void +variable_debug (var) + gdb_variable *var; +{ + Tcl_Obj *str; + + str = Tcl_NewStringObj ("name=", -1); + Tcl_AppendStringsToObj (str, var->name, "\nreal_name=", var->real_name, + "\nobj_name=", var->obj_name, NULL); + Tcl_SetObjResult (gdbtk_interp, str); +} + +/* + * Child construction/destruction + */ + +/* Delete the children associated with the object VAR. If NOTIFY is set, + notify the parent object that this child was deleted. This is used as + a small optimization when deleting variables and their children. If the + parent is also being deleted, don't bother notifying it that its children + are being deleted. */ +static void +delete_children (interp, var, notify) + Tcl_Interp *interp; + gdb_variable *var; + int notify; +{ + struct variable_child *vc; + struct variable_child *next; + + for (vc = var->children; vc != NULL; vc = next) + { + if (!notify) + vc->child->parent = NULL; + variable_delete (interp, vc->child); + next = vc->next; + free (vc); + } +} + +/* Return the number of children for a given variable. + + This can get a little complicated, since we would like to make + certain assumptions about certain types of variables. + + - struct/union *: dereference first + - (*)(): do not allow derefencing + - arrays: + - declared size = num of children or + - -1 if we don't know, i.e., int foo []; + - if there was an error reported constructing this object, + assume it has no children (and try this again later) + - void * and char * have no children +*/ +static int +number_of_children (var) + gdb_variable *var; +{ + struct type *type; + struct type *target; + int children; + + if (var->value != NULL) + { + type = get_type (var->value); + target = get_target_type (type); + children = 0; + + switch (TYPE_CODE (type)) + { + case TYPE_CODE_ARRAY: + if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (target) > 0 + && TYPE_ARRAY_UPPER_BOUND_TYPE (type) != BOUND_CANNOT_BE_DETERMINED) + children = TYPE_LENGTH (type) / TYPE_LENGTH (target); + else + children = -1; + break; + + case TYPE_CODE_STRUCT: + case TYPE_CODE_UNION: + /* If we have a virtual table pointer, omit it. */ + if (TYPE_VPTR_BASETYPE (type) == type + && !(TYPE_VPTR_FIELDNO (type) < 0)) + children = TYPE_NFIELDS (type) - 1; + else + children = TYPE_NFIELDS (type); + break; + + case TYPE_CODE_PTR: + /* This is where things get compilcated. All pointers have one child. + Except, of course, for struct and union ptr, which we automagically + dereference for the user and function ptrs, which have no children. */ + switch (TYPE_CODE (target)) + { + case TYPE_CODE_STRUCT: + case TYPE_CODE_UNION: + /* If we have a virtual table pointer, omit it. */ + if (TYPE_VPTR_BASETYPE (target) == target + && !(TYPE_VPTR_FIELDNO (target) < 0)) + children = TYPE_NFIELDS (target) - 1; + else + children = TYPE_NFIELDS (target); + break; + + case TYPE_CODE_FUNC: + children = 0; + break; + + default: + /* Don't dereference char* or void*. */ + if (TYPE_NAME (target) != NULL + && (STREQ (TYPE_NAME (target), "char") + || STREQ (TYPE_NAME (target), "void"))) + children = 0; + else + children = 1; + } + break; + + default: + break; + } + } + else + { + /* var->value can be null if we tried to access non-existent or + protected memory. In this case, we simply do not allow any + children. This will be checked again when we check if its + value has changed. */ + children = 0; + } + + return children; +} + +/* Return a list of all the children of VAR, creating them if necessary. */ +static Tcl_Obj * +variable_children (interp, var) + Tcl_Interp *interp; + gdb_variable *var; +{ + Tcl_Obj *list; + gdb_variable *child; + char *name; + int i; + + list = Tcl_NewListObj (0, NULL); + for (i = 0; i < var->num_children; i++) + { + /* check if child exists */ + name = name_of_child (var, i); + child = child_exists (var, name); + if (child == NULL) + { + child = create_child (interp, var, name, i); + + /* name_of_child returns a malloc'd string */ + free (name); + } + Tcl_ListObjAppendElement (NULL, list, Tcl_NewStringObj (child->obj_name, -1)); + } + + return list; +} + +/* Does a child with the name NAME exist in VAR? If so, return its data. + If not, return NULL. */ +static gdb_variable * +child_exists (var, name) + gdb_variable *var; /* Parent */ + char *name; /* name of child */ +{ + struct variable_child *vc; + + for (vc = var->children; vc != NULL; vc = vc->next) + { + if (STREQ (vc->child->name, name)) + return vc->child; + } + + return NULL; +} + +/* Create and install a child of the parent of the given name */ +static gdb_variable * +create_child (interp, parent, name, index) + Tcl_Interp *interp; + gdb_variable *parent; + char *name; + int index; +{ + struct type *type; + struct type *target; + gdb_variable *child; + char separator[10], prefix[2048], suffix[20]; + char *childs_name; + char *save_name; + int deref = 0; + int len; + + /* name should never be null. For pointer derefs, it should contain "*name". + For arrays of a known size, the name will simply contain the index into + the array. */ + + separator[0] = '\0'; + prefix[0] = '\0'; + suffix[0] = '\0';; + save_name = name; + + /* This code must contain a lot of the logic for children based on the parent's + type. */ + type = get_type (parent->value); + target = get_target_type (type); + + switch (TYPE_CODE (type)) + { + case TYPE_CODE_ARRAY: + sprintf (suffix, "[%s]", name); + name = ""; + break; + + case TYPE_CODE_STRUCT: + case TYPE_CODE_UNION: + if (index < TYPE_N_BASECLASSES (type)) + { + strcpy (prefix, "(("); + strcat (prefix, name); + strcat (prefix, ")"); + strcpy (suffix, ") "); + name = ""; + } + else + strcpy (separator, "."); + break; + + case TYPE_CODE_PTR: + switch (TYPE_CODE (target)) + { + case TYPE_CODE_STRUCT: + case TYPE_CODE_UNION: + if (index < TYPE_N_BASECLASSES (target)) + { + strcpy (prefix, "(*("); + strcat (prefix, name); + strcat (prefix, " *)"); + strcpy (suffix, ")"); + name = ""; + } + else + strcpy (separator, "->"); + break; + + default: + deref = 1; + break; + } + + default: + break; + } + + /* When we get here, we should know how to construct a legal + expression for the child's name */ + len = strlen (prefix); + len += strlen (parent->real_name); + len += strlen (separator); + len += strlen (name); + len += strlen (suffix); + if (deref) + len += 3; + childs_name = (char *) xmalloc ((len + 1) * sizeof (char)); + if (deref) + { + strcpy (childs_name, "(*"); + strcat (childs_name, parent->real_name); + strcat (childs_name, suffix); + strcat (childs_name, ")"); + } + else + { + strcpy (childs_name, prefix); + strcat (childs_name, parent->real_name); + strcat (childs_name, separator); + strcat (childs_name, name); + strcat (childs_name, suffix); + } + + /* childs_name now contains a valid expression for the child */ + child = create_variable (save_name, childs_name, (CORE_ADDR) -1); + child->parent = parent; + free (childs_name); + childs_name = (char *) xmalloc ((strlen (parent->obj_name) + strlen (save_name) + 2) + * sizeof (char)); + sprintf (childs_name, "%s.%s", parent->obj_name, save_name); + install_variable (interp, childs_name, child); + free (childs_name); + + /* Save a pointer to this child in the parent */ + save_child_in_parent (parent, child); + + return child; +} + +/* Save CHILD in the PARENT's data. */ +static void +save_child_in_parent (parent, child) + gdb_variable *parent; + gdb_variable *child; +{ + struct variable_child *vc; + + /* Insert the child at the top */ + vc = parent->children; + parent->children = + (struct variable_child *) xmalloc (sizeof (struct variable_child)); + + parent->children->next = vc; + parent->children->child = child; +} + +/* Remove the CHILD from the PARENT's list of children. */ +static void +remove_child_from_parent (parent, child) + gdb_variable *parent; + gdb_variable *child; +{ + struct variable_child *vc, *prev; + + /* Find the child in the parent's list */ + prev = NULL; + for (vc = parent->children; vc != NULL; ) + { + if (vc->child == child) + break; + prev = vc; + vc = vc->next; + } + + if (prev == NULL) + parent->children = vc->next; + else + prev->next = vc->next; + +} + +/* What is the name of the INDEX'th child of VAR? */ +static char * +name_of_child (var, index) + gdb_variable *var; + int index; +{ + struct type *type; + struct type *target; + char *name; + char *string; + + type = get_type (var->value); + target = get_target_type (type); + + switch (TYPE_CODE (type)) + { + case TYPE_CODE_ARRAY: + { + /* We never get here unless var->num_children is greater than 0... */ + int len = 1; + while ((int) pow ((double) 10, (double) len) < index) + len++; + name = (char *) xmalloc (1 + len * sizeof (char)); + sprintf (name, "%d", index); + } + break; + + case TYPE_CODE_STRUCT: + case TYPE_CODE_UNION: + string = TYPE_FIELD_NAME (type, index); + name = savestring (string, strlen (string)); + break; + + case TYPE_CODE_PTR: + switch (TYPE_CODE (target)) + { + case TYPE_CODE_STRUCT: + case TYPE_CODE_UNION: + string = TYPE_FIELD_NAME (target, index); + name = savestring (string, strlen (string)); + break; + + default: + name = (char *) xmalloc ((strlen (var->name) + 2) * sizeof (char)); + sprintf (name, "*%s", var->name); + break; + } + } + + return name; +} + +/* Has the value of this object changed since the last time we looked? + + There are some special cases: + - structs/unions/arrays. The "value" of these never changes. + Only their children's values change. + - if an error occurred with evaluate_expression or fetch_value_lazy, + then we need to be a little more elaborate with our determination + of "value changed". Specifically, the value does not change when + both the previous evaluate fails and the one done here also fails. +*/ +static enum value_changed +variable_value_changed (var) + gdb_variable *var; +{ + value_ptr mark, new_val; + struct frame_info *fi, *old_fi; + int within_scope; + enum value_changed result; + gdb_result r; + + /* Save the selected stack frame, since we will need to change it + in order to evaluate expressions. */ + old_fi = selected_frame; + + /* Determine whether the variable is still around. */ + if (var->valid_block == NULL) + within_scope = 1; + else + { + GDB_reinit_frame_cache (); + r = GDB_find_frame_addr_in_frame_chain (var->frame, &fi); + if (r != GDB_OK) + fi = NULL; + within_scope = fi != NULL; + /* FIXME: GDB_select_frame could fail */ + if (within_scope) + GDB_select_frame (fi, -1); + } + + result = VALUE_OUT_OF_SCOPE; + if (within_scope) + { + struct type *type = get_type (var->value); + + /* Arrays, struct, classes, unions never change value */ + if (type != NULL && (TYPE_CODE (type) == TYPE_CODE_STRUCT + || TYPE_CODE (type) == TYPE_CODE_UNION + || TYPE_CODE (type) == TYPE_CODE_ARRAY)) + result = VALUE_UNCHANGED; + else + { + mark = value_mark (); + if (GDB_evaluate_expression (var->exp, &new_val) == GDB_OK) + { + if (!my_value_equal (var, new_val)) + { + /* value changed */ + release_value (new_val); + if (var->value == NULL) + { + /* This can happen if there was an error + evaluating the expression (like deref NULL) */ + var->num_children = number_of_children (var); + } + value_free (var->value); + var->value = new_val; + result = VALUE_CHANGED; + } + else + result = VALUE_UNCHANGED; + } + else + { + /* evaluate expression failed. If we failed before, then + the value of this variable has not changed. If we + succeed before, then the value did change. */ + if (var->value == NULL) + result = VALUE_UNCHANGED; + else + { + var->value = NULL; + var->error = 1; + result = VALUE_CHANGED; + } + } + + value_free_to_mark (mark); + } + } + + /* Restore selected frame */ + GDB_select_frame (old_fi, -1); + + return result; +} + +static int +variable_format (interp, objc, objv, var) + Tcl_Interp *interp; + int objc; + Tcl_Obj *CONST objv[]; + gdb_variable *var; +{ + + if (objc > 2) + { + /* Set the format of VAR to given format */ + int len; + char *fmt = Tcl_GetStringFromObj (objv[2], &len); + if (STREQN (fmt, "natural", len)) + var->format = FORMAT_NATURAL; + else if (STREQN (fmt, "binary", len)) + var->format = FORMAT_NATURAL; + else if (STREQN (fmt, "decimal", len)) + var->format = FORMAT_DECIMAL; + else if (STREQN (fmt, "hexadecimal", len)) + var->format = FORMAT_HEXADECIMAL; + else if (STREQN (fmt, "octal", len)) + var->format = FORMAT_OCTAL; + else + { + Tcl_Obj *obj = Tcl_NewStringObj (NULL, 0); + Tcl_AppendStringsToObj (obj, "unknown display format \"", + fmt, "\": must be: \"natural\", \"binary\"" + ", \"decimal\", \"hexadecimal\", or \"octal\"", + NULL); + Tcl_SetObjResult (interp, obj); + return TCL_ERROR; + } + } + else + { + /* Report the current format */ + Tcl_Obj *fmt; + + fmt = Tcl_NewStringObj (format_string [(int) var->format], -1); + Tcl_SetObjResult (interp, fmt); + } + + return TCL_OK; +} + +/* What is the default display for this variable? We assume that + everything is "natural". Any exceptions? */ +static enum display_format +variable_default_display (var) + gdb_variable *var; +{ + return FORMAT_NATURAL; +} + +/* This function returns the type of a variable in the interpreter (or an error) + and returns either TCL_OK or TCL_ERROR as appropriate. */ +static int +variable_type (interp, objc, objv, var) + Tcl_Interp *interp; + int objc; + Tcl_Obj *CONST objv[]; + gdb_variable *var; +{ + int result; + value_ptr val; + char *first, *last, *string; + Tcl_RegExp regexp; + gdb_result r; + + if (var->value != NULL) + val = var->value; + else + { + r = GDB_evaluate_type (var->exp, &val); + if (r != GDB_OK) + return TCL_ERROR; + } + + result = call_gdb_type_print (val); + if (result == TCL_OK) + { + string = strdup (Tcl_GetStringFromObj (get_call_output (), NULL)); + first = string; + + /* gdb will print things out like "struct {...}" for anonymous structs. + In gui-land, we don't want the {...}, so we strip it here. */ + regexp = Tcl_RegExpCompile (interp, "{...}"); + if (Tcl_RegExpExec (interp, regexp, string, first)) + { + /* We have an anonymous struct/union/class/enum */ + Tcl_RegExpRange (regexp, 0, &first, &last); + if (*(first - 1) == ' ') + first--; + *first = '\0'; + } + + Tcl_SetObjResult (interp, Tcl_NewStringObj (string, -1)); + FREEIF (string); + return TCL_OK; + } + + Tcl_SetObjResult (interp, get_call_output ()); + return result; +} + +/* This function returns the value of a variable in the interpreter (or an error) + and returns either TCL_OK or TCL_ERROR as appropriate. */ +static int +variable_value (interp, objc, objv, var) + Tcl_Interp *interp; + int objc; + Tcl_Obj *CONST objv[]; + gdb_variable *var; +{ + int result; + struct type *type; + value_ptr val; + Tcl_Obj *str; + gdb_result r; + int real_addressprint; + + /* If we set the value of the variable, objv[2] will contain the + variable's new value. We need to first construct a legal expression + for this -- ugh! */ + if (objc > 2) + { + /* Does this cover all the bases? */ + struct expression *exp; + value_ptr value; + int saved_input_radix = input_radix; + + if (VALUE_LVAL (var->value) != not_lval && var->value->modifiable) + { + char *s; + + input_radix = 10; /* ALWAYS reset to decimal temporarily */ + s = Tcl_GetStringFromObj (objv[2], NULL); + r = GDB_parse_exp_1 (&s, 0, 0, &exp); + if (r != GDB_OK) + return TCL_ERROR; + if (GDB_evaluate_expression (exp, &value) != GDB_OK) + return TCL_ERROR; + + val = value_assign (var->value, value); + value_free (var->value); + release_value (val); + var->value = val; + input_radix = saved_input_radix; + } + + return TCL_OK; + } + + if (var->value != NULL) + val = var->value; + else + { + /* This can happen if we attempt to get the value of a struct + member when the parent is an invalid pointer. + + GDB reports the error as the error derived from accessing the + parent, but we don't have access to that here... */ + Tcl_SetObjResult (interp, Tcl_NewStringObj ("???", -1)); + return TCL_ERROR; + } + + /* C++: addressprint causes val_print to print the + address of the reference, too. So clear it to get + the real value -- BUT ONLY FOR C++ REFERENCE TYPES! */ + real_addressprint = addressprint; + + /* BOGUS: if val_print sees a struct/class, it will print out its + children instead of "{...}" */ + type = get_type (val); + switch (TYPE_CODE (type)) + { + case TYPE_CODE_STRUCT: + case TYPE_CODE_UNION: + str = Tcl_NewStringObj ("{...}", -1); + break; + + case TYPE_CODE_ARRAY: + { + char number[256]; + str = Tcl_NewStringObj (NULL, 0); + sprintf (number, "%d", var->num_children); + Tcl_AppendStringsToObj (str, "[", number, "]", NULL); + } + break; + + case TYPE_CODE_REF: + /* Clear addressprint so that the actual value is printed */ + addressprint = 0; + + /* fall through */ + default: + result = call_gdb_val_print (val, format_code[(int) var->format]); + Tcl_SetObjResult (interp, get_call_output ()); + + /* Restore addressprint */ + addressprint = real_addressprint; + return result; + } + + /* We only get here if we encountered one of the "special types" above */ + + /* Restore addressprint */ + addressprint = real_addressprint; + + Tcl_SetObjResult (interp, str); + return TCL_OK; +} + +/* Is this variable editable? Use the variable's type to make + this determination. */ +static int +variable_editable (var) + gdb_variable *var; +{ + struct type *type; + int result; + gdb_result r; + + type = get_type (var->value); + if (type == NULL) + { + value_ptr val; + r = GDB_evaluate_type (var->exp, &val); + if (r != GDB_OK) + return 0; + type = get_type (val); + } + + switch (TYPE_CODE (type)) + { + case TYPE_CODE_STRUCT: + case TYPE_CODE_UNION: + case TYPE_CODE_ARRAY: + case TYPE_CODE_FUNC: + case TYPE_CODE_MEMBER: + case TYPE_CODE_METHOD: + result = 0; + break; + + default: + result = 1; + break; + } + + return result; +} + +/* + * Call stuff. These functions are used to capture the output of gdb commands + * without going through the tcl interpreter. + */ + +/* Retrieve gdb output in the buffer since last call. */ +static Tcl_Obj * +get_call_output () +{ + /* Clear the error flags, in case we errored. */ + if (result_ptr != NULL) + result_ptr->flags &= ~GDBTK_ERROR_ONLY; + return fputs_obj; +} + +/* Clear the output of the buffer. */ +static void +clear_gdb_output () +{ + if (fputs_obj != NULL) + Tcl_DecrRefCount (fputs_obj); + + fputs_obj = Tcl_NewStringObj (NULL, -1); + Tcl_IncrRefCount (fputs_obj); +} + +/* Call the gdb command "type_print", retaining its output in the buffer. */ +static int +call_gdb_type_print (val) + value_ptr val; +{ + void (*old_hook) PARAMS ((const char *, FILE *)); + int result; + + /* Save the old hook and install new hook */ + old_hook = fputs_unfiltered_hook; + fputs_unfiltered_hook = variable_fputs; + + /* Call our command with our args */ + clear_gdb_output (); + + + if (GDB_type_print (val, "", gdb_stdout, -1) == GDB_OK) + result = TCL_OK; + else + result = TCL_ERROR; + + /* Restore fputs hook */ + fputs_unfiltered_hook = old_hook; + + return result; +} + +/* Call the gdb command "val_print", retaining its output in the buffer. */ +static int +call_gdb_val_print (val, format) + value_ptr val; + int format; +{ + void (*old_hook) PARAMS ((const char *, FILE *)); + gdb_result r; + int result; + + /* Save the old hook and install new hook */ + old_hook = fputs_unfiltered_hook; + fputs_unfiltered_hook = variable_fputs; + + /* Call our command with our args */ + clear_gdb_output (); + + if (VALUE_LAZY (val)) + { + r = GDB_value_fetch_lazy (val); + if (r != GDB_OK) + { + fputs_unfiltered_hook = old_hook; + return TCL_ERROR; + } + } + r = GDB_val_print (VALUE_TYPE (val), VALUE_CONTENTS_RAW (val), VALUE_ADDRESS (val), + gdb_stdout, format, 1, 0, 0); + if (r == GDB_OK) + result = TCL_OK; + else + result = TCL_ERROR; + + /* Restore fputs hook */ + fputs_unfiltered_hook = old_hook; + + return result; +} + +/* The fputs_unfiltered_hook function used to save the output from one of the + call commands in this file. */ +static void +variable_fputs (text, stream) + const char *text; + FILE *stream; +{ + /* Just append everything to the fputs_obj... Issues with stderr/stdout? */ + Tcl_AppendToObj (fputs_obj, (char *) text, -1); +} + +/* Empty handler for the fputs_unfiltered_hook. Set the hook to this function + whenever the output is irrelevent. */ +static void +null_fputs (text, stream) + const char *text; + FILE *stream; +{ + return; +} + +/* + * Special wrapper-like stuff to supplement the generic wrappers + */ + +/* This returns the type of the variable. This skips past typedefs + and returns the real type of the variable. */ +static struct type * +get_type (val) + value_ptr val; +{ + struct type *type = NULL; + + if (val != NULL) + { + type = VALUE_TYPE (val); + while (type != NULL && TYPE_CODE (type) == TYPE_CODE_TYPEDEF) + type = TYPE_TARGET_TYPE (type); + } + + return type; +} + +/* This returns the target type (or NULL) of TYPE, also skipping + past typedefs, just like get_type (). */ +static struct type * +get_target_type (type) + struct type *type; +{ + if (type != NULL) + { + type = TYPE_TARGET_TYPE (type); + while (type != NULL && TYPE_CODE (type) == TYPE_CODE_TYPEDEF) + type = TYPE_TARGET_TYPE (type); + } + + return type; +} + +/* This function is a special wrap. This call never "fails".*/ +static int +my_value_equal (var, val2) + gdb_variable *var; + value_ptr val2; +{ + int err1, err2, r; + + /* This is bogus, but unfortunately necessary. We must know + exactly what caused an error -- reading var->val (which we + get from var->error and/or val2, so that we can really determine + if we think that something has changed. */ + err1 = var->error; + err2 = 0; + if (VALUE_LAZY (val2) && GDB_value_fetch_lazy (val2) != GDB_OK) + err2 = 1; + + /* Another special case: NULL values. If both are null, say + they're equal. */ + if (var->value == NULL && val2 == NULL) + return 1; + else if (var->value == NULL || val2 == NULL) + return 0; + + if (GDB_value_equal (var->value, val2, &r) != GDB_OK) + { + /* An error occurred, this could have happened if + either val1 or val2 errored. ERR1 and ERR2 tell + us which of these it is. If both errored, then + we assume nothing has changed. If one of them is + valid, though, then something has changed. */ + if (err1 == err2) + { + /* both the old and new values caused errors, so + we say the value did not change */ + /* This is indeterminate, though. Perhaps we should + be safe and say, yes, it changed anyway?? */ + return 1; + } + else + { + /* err2 replaces var->error since this new value + WILL replace the old one. */ + var->error = err2; + return 0; + } + } + + return r; +} + +/* Local variables: */ +/* change-log-default-name: "ChangeLog-gdbtk" */ +/* End: */ diff --git a/gdb/gdbtk-wrapper.c b/gdb/gdbtk-wrapper.c new file mode 100644 index 00000000000..9d9a2630abc --- /dev/null +++ b/gdb/gdbtk-wrapper.c @@ -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: */ diff --git a/gdb/gdbtk-wrapper.h b/gdb/gdbtk-wrapper.h new file mode 100644 index 00000000000..6b5b352f5e9 --- /dev/null +++ b/gdb/gdbtk-wrapper.h @@ -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: */ diff --git a/gdb/gdbtk.c b/gdb/gdbtk.c index a15eccb1489..6b975cd12fc 100644 --- a/gdb/gdbtk.c +++ b/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 @@ -71,7 +71,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "annotate.h" #include -#ifdef __CYGWIN__ +#ifdef __CYGWIN32__ #include /* 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 or --external-editor 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."); - - /* 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); + /* + * 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); - if (!found_main) - { - /* Try finding it with the auto path. */ + /* find the gdb tcl library and source main.tcl */ - static const char script[] ="\ + { +#ifdef NO_TCLPRO_DEBUGGER + static const char script[] ="\ +proc gdbtk_find_main {} {\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"; +#else + 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\ + 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\ - }\n\ - return ""\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"; - - 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(""); - } +#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: */ diff --git a/gdb/gdbtk.h b/gdb/gdbtk.h index 1f063648a6b..4c98de3c8f8 100644 --- a/gdb/gdbtk.h +++ b/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: */ diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 7ee239b24f7..151d626b44a 100644 --- a/gdb/i386-tdep.c +++ b/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 = print_insn_i386; + tm_print_insn = gdb_print_insn_i386; + tm_print_insn_info.mach = bfd_lookup_arch (bfd_arch_i386, 0)->mach; + + /* 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; + } diff --git a/gdb/rdi-share/host.h b/gdb/rdi-share/host.h index 4a431fa0c9b..4dffa8475fb 100644 --- a/gdb/rdi-share/host.h +++ b/gdb/rdi-share/host.h @@ -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 diff --git a/gdb/rdi-share/hostchan.c b/gdb/rdi-share/hostchan.c index b1ead66821f..8e41da49860 100644 --- a/gdb/rdi-share/hostchan.c +++ b/gdb/rdi-share/hostchan.c @@ -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(); diff --git a/gdb/rdi-share/hostchan.h b/gdb/rdi-share/hostchan.h index 5706fdc2bc5..44563a6112a 100644 --- a/gdb/rdi-share/hostchan.h +++ b/gdb/rdi-share/hostchan.h @@ -24,7 +24,7 @@ #endif /* struct timeval */ -#if defined(__unix) || defined(__CYGWIN__) +#if defined(__unix) || defined(__CYGWIN32__) # include #else # include "winsock.h" diff --git a/gdb/rdi-share/serdrv.c b/gdb/rdi-share/serdrv.c index 7ce6d24a124..43fd5a00f22 100644 --- a/gdb/rdi-share/serdrv.c +++ b/gdb/rdi-share/serdrv.c @@ -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 diff --git a/gdb/rdi-share/serpardr.c b/gdb/rdi-share/serpardr.c index fad05481402..604d0480613 100644 --- a/gdb/rdi-share/serpardr.c +++ b/gdb/rdi-share/serpardr.c @@ -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 diff --git a/gdb/rdi-share/unixcomm.c b/gdb/rdi-share/unixcomm.c index df8e28f1b6e..7c2183de3e5 100644 --- a/gdb/rdi-share/unixcomm.c +++ b/gdb/rdi-share/unixcomm.c @@ -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; diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c index ef3cd9fac0e..c55133760fa 100644 --- a/gdb/ser-tcp.c +++ b/gdb/ser-tcp.c @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include -#ifndef __CYGWIN__ +#ifndef __CYGWIN32__ #include #endif diff --git a/gdb/ser-unix.c b/gdb/ser-unix.c index 6b34d8b630c..f279c94cfdb 100644 --- a/gdb/ser-unix.c +++ b/gdb/ser-unix.c @@ -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 diff --git a/gdb/testsuite/gdb.gdbtk/.Sanitize b/gdb/testsuite/gdb.gdbtk/.Sanitize index beedc2f9681..f9e6380a6f6 100644 --- a/gdb/testsuite/gdb.gdbtk/.Sanitize +++ b/gdb/testsuite/gdb.gdbtk/.Sanitize @@ -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 diff --git a/gdb/testsuite/gdb.gdbtk/console.test b/gdb/testsuite/gdb.gdbtk/console.test new file mode 100644 index 00000000000..90c5f12f6a0 --- /dev/null +++ b/gdb/testsuite/gdb.gdbtk/console.test @@ -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 <> + 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 + 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 + event generate $text + 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 + } + 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 + } + 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 + } + event generate $text + 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 + } + + event generate $text + event generate $text + 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 + } + + for {set i 0} {$i < 4} {incr i} { + event generate $text + } + 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 + } + + for {set i 0} {$i < 20} {incr i} { + event generate $text + } + 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 diff --git a/gdb/testsuite/gdb.gdbtk/cpp_variable.h b/gdb/testsuite/gdb.gdbtk/cpp_variable.h new file mode 100644 index 00000000000..7abda54d0a8 --- /dev/null +++ b/gdb/testsuite/gdb.gdbtk/cpp_variable.h @@ -0,0 +1,54 @@ +struct _foo +{ + int a[10]; + char *p; +}; + +class VA +{ + public: + int va_pub_int; + char *va_pub_charp; + + private: + int va_priv_int; + char *va_priv_charp; + + protected: + struct _foo bar; +}; + +class VB +{ + public: + int vb_pub_int; + + int fvb_pub (); + virtual int vvb_pub (); + + private: + int vb_priv_int; + char *vb_priv_charp; +}; + +class VC : public 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; +}; diff --git a/gdb/testsuite/gdb.gdbtk/cpp_variable.test b/gdb/testsuite/gdb.gdbtk/cpp_variable.test new file mode 100644 index 00000000000..ac5fc9623f5 --- /dev/null +++ b/gdb/testsuite/gdb.gdbtk/cpp_variable.test @@ -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 + + diff --git a/gdb/testsuite/gdb.gdbtk/srcwin.exp b/gdb/testsuite/gdb.gdbtk/srcwin.exp new file mode 100644 index 00000000000..bd4557c8ae7 --- /dev/null +++ b/gdb/testsuite/gdb.gdbtk/srcwin.exp @@ -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 +} diff --git a/gdb/testsuite/gdb.gdbtk/srcwin.test b/gdb/testsuite/gdb.gdbtk/srcwin.test new file mode 100644 index 00000000000..f13d3d0b711 --- /dev/null +++ b/gdb/testsuite/gdb.gdbtk/srcwin.test @@ -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: diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 3103f86ed06..b2f3ba9adb6 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -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 diff --git a/gdb/top.c b/gdb/top.c index 2f0ed0e3446..a64f1885e87 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -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 diff --git a/gdb/utils.c b/gdb/utils.c index fa2cb22d1e0..81c4452c6e7 100644 --- a/gdb/utils.c +++ b/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 { -- 2.30.2