From 6bc9fb887fa685a595b019c5ad6fc77f2fa3e914 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 28 Oct 2008 12:20:59 +0100 Subject: selftest: move gdb_* and valgrind_* scripts to selftest/ metze --- source4/script/gdb_backtrace | 87 ------------------------------------- source4/script/gdb_backtrace_test.c | 42 ------------------ source4/script/gdb_run | 20 --------- source4/script/valgrind_run | 9 ---- 4 files changed, 158 deletions(-) delete mode 100755 source4/script/gdb_backtrace delete mode 100644 source4/script/gdb_backtrace_test.c delete mode 100755 source4/script/gdb_run delete mode 100755 source4/script/valgrind_run (limited to 'source4/script') diff --git a/source4/script/gdb_backtrace b/source4/script/gdb_backtrace deleted file mode 100755 index 826381e900..0000000000 --- a/source4/script/gdb_backtrace +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/sh - -BASENAME=`basename $0` - -if [ -n "$VALGRIND" -o -n "$SMBD_VALGRIND" ]; then - echo "${BASENAME}: Not running debugger under valgrind" - exit 1 -fi - -# we want everything on stderr, so the program is not disturbed -exec 1>&2 - -BASENAME=`basename $0` -UNAME=`uname` - -PID=$1 -BINARY=$2 - -test x"${PID}" = x"" && { - echo "Usage: ${BASENAME} []" - exit 1 -} - -DB_LIST="gdb" -case "${UNAME}" in - # - # on Tru64 we need to try ladebug first - # because gdb crashes itself... - # - OSF1) - DB_LIST="ladebug ${DB_LIST}" - ;; -esac - -for DB in ${DB_LIST}; do - DB_BIN=`which ${DB} 2>/dev/null | grep '^/'` - test x"${DB_BIN}" != x"" && { - break - } -done - -test x"${DB_BIN}" = x"" && { - echo "${BASENAME}: ERROR: No debugger found." - exit 1 -} - -# -# we first try to use /proc/${PID}/exe -# then fallback to the binary from the commandline -# then we search for the commandline argument with -# 'which' -# -test -f "/proc/${PID}/exe" && BINARY="/proc/${PID}/exe" -test x"${BINARY}" = x"" && BINARY="/proc/${PID}/exe" -test -f "${BINARY}" || BINARY=`which ${BINARY}` - -test -f "${BINARY}" || { - echo "${BASENAME}: ERROR: Cannot find binary '${BINARY}'." - exit 1 -} - -echo "${BASENAME}: Trying to use ${DB_BIN} on ${BINARY} on PID ${PID}" - -BATCHFILE_PRE=/tmp/gdb_backtrace_pre.$$ -BATCHFILE_MAIN=/tmp/gdb_backtrace_main.$$ -case "${DB}" in - ladebug) -cat << EOF > ${BATCHFILE_PRE} -set \$stoponattach -EOF - -cat << EOF > ${BATCHFILE_MAIN} -where -quit -EOF - ${DB_BIN} -c "${BATCHFILE_MAIN}" -i "${BATCHFILE_PRE}" -pid "${PID}" "${BINARY}" - ;; - gdb) -cat << EOF > ${BATCHFILE_MAIN} -set height 1000 -bt full -quit -EOF - ${DB_BIN} -x "${BATCHFILE_MAIN}" "${BINARY}" "${PID}" - ;; -esac -/bin/rm -f ${BATCHFILE_PRE} ${BATCHFILE_MAIN} diff --git a/source4/script/gdb_backtrace_test.c b/source4/script/gdb_backtrace_test.c deleted file mode 100644 index 506784f675..0000000000 --- a/source4/script/gdb_backtrace_test.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - -add a usefull tool to test the gdb_backtrace script - -just compile it with -cc -g -o gdb_backtrace_test gdb_backtrace_test.c - -and run it in the same directory where your gdb_backtrace script is. - -2006 - Stefan Metzmacher - -*/ -#include -#include -#include -#include -#include - -static const char *prog; - -static void sig_fault(int sig) -{ - int ret; - char cmdstr[200]; - - snprintf(cmdstr, sizeof(cmdstr), - "./gdb_backtrace %u %s", - getpid(), prog); - printf("sig_fault start: %s\n", cmdstr); - ret = system(cmdstr); - printf("sig_fault end: %d\n", ret); -} - -int main(int argc, const char **argv) -{ - prog = argv[0]; - - signal(SIGABRT, sig_fault); - - abort(); - return 0; -} diff --git a/source4/script/gdb_run b/source4/script/gdb_run deleted file mode 100755 index 8ad101ed60..0000000000 --- a/source4/script/gdb_run +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -ENV="$1" - -shift 1 - -if test -z "$TMPDIR"; then - TMPDIR="/tmp" -fi - -TMPFILE=$TMPDIR/gdb_run.$$ -cat << EOF > $TMPFILE -run -bt -EOF - -trap "/bin/rm -f $TMPFILE" EXIT -CMD="gdb -x $TMPFILE --args $@" -echo $CMD -eval $ENV "$CMD" diff --git a/source4/script/valgrind_run b/source4/script/valgrind_run deleted file mode 100755 index 5171d171a7..0000000000 --- a/source4/script/valgrind_run +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -ENV="$1" - -shift 1 - -CMD="$ENV valgrind -q --db-attach=yes --num-callers=30 $@" -echo $CMD -eval $CMD -- cgit