summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-06-24 13:17:19 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-06-24 13:17:19 +1000
commit0ddafeba6968759d290ee0489c5b2bf4108c8aef (patch)
treeaa767a0090af85300ebfcf28b796afb14a138246
parentabb72170e4c8b7a31d8466ac0959f8953267612a (diff)
downloadsamba-0ddafeba6968759d290ee0489c5b2bf4108c8aef.tar.gz
samba-0ddafeba6968759d290ee0489c5b2bf4108c8aef.tar.bz2
samba-0ddafeba6968759d290ee0489c5b2bf4108c8aef.zip
selftest: Cope with no binary argument being supplied to gdb_backtrace
Modern versions of gdb are better than us at working out what binary is running, and so it is more reliable to omit the binary argument. This change is required because samba4 no longer supplies this argument. Andrew Bartlett
-rwxr-xr-xselftest/gdb_backtrace36
1 files changed, 25 insertions, 11 deletions
diff --git a/selftest/gdb_backtrace b/selftest/gdb_backtrace
index 5531814149..28ac064bcd 100755
--- a/selftest/gdb_backtrace
+++ b/selftest/gdb_backtrace
@@ -58,24 +58,38 @@ test x"${DB_BIN}" = x"" && {
exit 1
}
-#
+need_binary="no"
+case "${DB}" in
+# These debuggers need the process binary specified:
+ ladebug)
+ need_binary="yes"
+ ;;
+ gdb66)
+ need_binary="yes"
+ ;;
+ dbx)
+ need_binary="yes"
+ ;;
+esac
+
+test x"${need_binary}" = x"yes" && {
+
# we first try to use /proc/${PID}/exe or /proc/{$PID}/path for solaris
# 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 -f "/proc/${PID}/path/a.out" && BINARY=`ls -l /proc/${PID}/path/a.out |sed 's/.*-> //'`
-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
+ test -f "/proc/${PID}/exe" && BINARY="/proc/${PID}/exe"
+ test -f "/proc/${PID}/path/a.out" && BINARY=`ls -l /proc/${PID}/path/a.out |sed 's/.*-> //'`
+ 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