s3:smbd: use passed in ev in smbd_smb2_query_directory_send()
[garming/samba-autobuild/.git] / selftest / gdb_backtrace
index 91637ec40c8d1f49d6e89c712e8a5ba905cb4abd..ef02e784efc926277ab88664f588b3a2a587f97a 100755 (executable)
@@ -58,26 +58,48 @@ 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 "/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 "${BINARY}" || {
-       echo "${BASENAME}: ERROR: Cannot find binary '${BINARY}'."
+BATCHFILE_PRE=`mktemp --tmpdir gdb_backtrace_pre.XXXXXXXXXX`
+test -n "${BATCHFILE_PRE}" || {
+       echo "mktemp doesn't work" 1>&2
+       exit 1
+}
+BATCHFILE_MAIN=`mktemp --tmpdir gdb_backtrace_main.XXXXXXXXXX`
+test -n "${BATCHFILE_MAIN}" || {
+       echo "mktemp doesn't work" 1>&2
        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}
@@ -102,12 +124,13 @@ EOF
        ;;
        gdb)
 cat << EOF  > ${BATCHFILE_MAIN}
-set height 1000
+set height 0
 bt full
+thread apply all bt full
 info locals
 quit
 EOF
-       ${DB_BIN} -x "${BATCHFILE_MAIN}" "${BINARY}" "${PID}"
+       ${DB_BIN} -batch -x "${BATCHFILE_MAIN}" --pid "${PID}" < /dev/null
        ;;
 dbx)
        ${DB_BIN} "where;dump;kill;quit" "${BINARY}" "${PID}"