summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/main.mk6
-rwxr-xr-xsource4/script/gdb_run17
2 files changed, 20 insertions, 3 deletions
diff --git a/source4/main.mk b/source4/main.mk
index fe68db1526..4084d7ba4b 100644
--- a/source4/main.mk
+++ b/source4/main.mk
@@ -330,15 +330,15 @@ valgrindtest-env: everything
gdbtest: gdbtest-quick
gdbtest-quick: all
- SMBD_VALGRIND="xterm -n smbd -e gdb --args " \
+ SMBD_VALGRIND="xterm -n smbd -e $(srcdir)/script/gdb_run " \
$(SELFTEST) --immediate --quick --socket-wrapper
gdbtest-all: everything
- SMBD_VALGRIND="xterm -n smbd -e gdb --args " \
+ SMBD_VALGRIND="xterm -n smbd -e $(srcdir)/script/gdb_run " \
$(SELFTEST) --immediate --socket-wrapper
gdbtest-env: everything
- SMBD_VALGRIND="xterm -n smbd -e gdb --args " \
+ SMBD_VALGRIND="xterm -n smbd -e $(srcdir)/script/gdb_run " \
$(SELFTEST) --socket-wrapper --testenv
wintest: all
diff --git a/source4/script/gdb_run b/source4/script/gdb_run
new file mode 100755
index 0000000000..bfefce1ac9
--- /dev/null
+++ b/source4/script/gdb_run
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+if test -z "$TMPDIR"; then
+ TMPDIR="/tmp"
+fi
+
+TMPFILE=$TMPDIR/gdb_run.$$
+cat << EOF > $TMPFILE
+run
+bt
+quit
+EOF
+
+trap "/bin/rm -f $TMPFILE" EXIT
+CMD="gdb -x $TMPFILE --args $@"
+echo $CMD
+eval "$CMD"