From 9bcf8fbbf82f461d6c997203653a94be1ada2dd9 Mon Sep 17 00:00:00 2001 From: Thomas Roessler Date: Thu, 3 Feb 2000 13:41:38 +0000 Subject: [PATCH] Add debugger support to muttbug. --- acconfig.h | 3 +++ configure.in | 16 ++++++++++++++ muttbug.sh.in | 61 ++++++++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 75 insertions(+), 5 deletions(-) diff --git a/acconfig.h b/acconfig.h index ed84a2be..0b19d122 100644 --- a/acconfig.h +++ b/acconfig.h @@ -164,3 +164,6 @@ /* define when your system has the setrlimit function */ #undef HAVE_SETRLIMIT + +/* where can we find a debugger */ +#undef DEBUGGER diff --git a/configure.in b/configure.in index c5915b4e..97a62b75 100644 --- a/configure.in +++ b/configure.in @@ -38,6 +38,22 @@ esac AC_C_INLINE AC_C_CONST +AC_PATH_PROG(DBX, dbx, no) +AC_PATH_PROG(GDB, gdb, no) +AC_PATH_PROG(SDB, sdb, no) + +if test $GDB != no ; then + DEBUGGER=$GDB +elif test $DBX != no ; then + DEBUGGER=$DBX +elif test $SDB != no ; then + DEBUGGER=$SDB +else + DEBUGGER=no +fi + +AC_SUBST(DEBUGGER) + ac_aux_path_sendmail=/usr/sbin:/usr/lib AC_PATH_PROG(SENDMAIL, sendmail, no, $PATH:$ac_aux_path_sendmail) diff --git a/muttbug.sh.in b/muttbug.sh.in index 99e12bda..4897b56a 100644 --- a/muttbug.sh.in +++ b/muttbug.sh.in @@ -40,6 +40,36 @@ include_file () echo } +debug_gdb () +{ + cat << EOF > $SCRATCH/gdb.rc +bt +list +quit +EOF + @DEBUGGER@ -n -x $SCRATCH/gdb.rc -c $CORE mutt +} + +debug_dbx () +{ + cat << EOF > $SCRATCH/dbx.rc +where +list +quit +EOF + @DEBUGGER@ -s $SCRATCH/dbx.rc mutt $CORE +} + +debug_sdb () +{ + cat << EOF > $SCRATCH/sdb.rc +t +w +q +EOF + @DEBUGGER@ mutt $CORE < $SCRATCH/sdb.rc +} + case `echo -n` in "") n=-n; c= ;; *) n=; c='\c' ;; @@ -98,16 +128,22 @@ case "$severity" in *) severity=normal ;; esac +if test -x @DEBUGGER@ ; then + test -f core && CORE=core + echo "Do you want to include information gathered from a core file?" + echo -n "If yes, please enter the path - otherwise just say no: [$CORE] $c" + read _CORE + test "$_CORE" && CORE="$_CORE" +fi - -echo $n "Do you want to include your personal mutt configuration files? [Y|n]$c" +echo $n "Do you want to include your personal mutt configuration files? [Y|n] $c" read personal case "$personal" in [nN]*) personal=no ;; *) personal=yes ;; esac -echo $n "Do you want to include your system's global mutt configuration file? [Y|n]$c" +echo $n "Do you want to include your system's global mutt configuration file? [Y|n] $c" read global case "$global" in [nN]*) global=no ;; @@ -125,7 +161,7 @@ if test -f /etc/debian_version ; then fi echo "$DPKG" if test "$DPKG" = "no" ; then - echo $n "File this bug with Debian? [Y|n]$c" + echo $n "File this bug with Debian? [Y|n] $c" read $DPKG case "$DPKG" in [nN]) DPKG=no ;; @@ -172,6 +208,20 @@ echo "-- Mutt Version Information" echo mutt -v +if test "$CORE" && test -f "$CORE" ; then + echo + echo "-- Core Dump Analysis Output" + echo + + case "@DEBUGGER@" in + *sdb) debug_sdb $CORE ;; + *dbx) debug_dbx $CORE ;; + *gdb) debug_gdb $CORE ;; + esac + + echo +fi + if test "$personal" = "yes" ; then CANDIDATES=".muttrc-${MUTTVERSION} .muttrc .mutt/muttrc-${MUTTVERSION} .mutt/muttrc" MATCHED="none" @@ -189,6 +239,7 @@ if test "$personal" = "yes" ; then fi fi + if test "$global" = "yes" ; then CANDIDATES="Muttrc-${MUTTVERSION} Muttrc" DIRECTORIES="@sysconfdir@ @sharedir@" @@ -225,7 +276,7 @@ while : ; do fi fi - echo $n "Submit, Edit, View, Quit? [S|e|v|q]$c" + echo $n "Submit, Edit, View, Quit? [S|e|v|q] $c" read _input input="`echo $_input | tr EVSQ evsq`" case $input in -- 2.40.0