aboutsummaryrefslogtreecommitdiff
path: root/debug
diff options
context:
space:
mode:
Diffstat (limited to 'debug')
-rw-r--r--debug/Makefile3
-rwxr-xr-xdebug/catchsegv.sh16
2 files changed, 10 insertions, 9 deletions
diff --git a/debug/Makefile b/debug/Makefile
index 0826b99..ada992e 100644
--- a/debug/Makefile
+++ b/debug/Makefile
@@ -44,7 +44,8 @@ include ../Rules
$(objpfx)catchsegv: catchsegv.sh $(common-objpfx)soversions.mk \
$(common-objpfx)config.make
- sed 's/@VERSION@/$(version)/;s/@SLIB@/$(slibdir)/' $< > $@.new
+ sed -e 's|@VERSION@|$(version)|' -e 's|@SLIB@|$(slibdir)|' \
+ -e 's|@SOVER@|$(libSegFault.so-version)|' $< > $@.new
chmod 555 $@.new
mv -f $@.new $@
diff --git a/debug/catchsegv.sh b/debug/catchsegv.sh
index 765242e..26407a7 100755
--- a/debug/catchsegv.sh
+++ b/debug/catchsegv.sh
@@ -24,7 +24,7 @@ shift
args="$*"
if test $# -eq 0; then
- case "$args" in
+ case "$prog" in
--h | --he | --hel | --help)
echo 'Usage: catchsegv PROGRAM ARGS...'
echo ' --help print this help, then exit'
@@ -45,18 +45,18 @@ Written by Ulrich Drepper.'
esac
fi
-LD_PRELOAD="${LD_PRELOAD:+${LD_PRELOAD}:}@SLIB@/libSegFault.so"
+LD_PRELOAD="${LD_PRELOAD:+${LD_PRELOAD}:}@SLIB@/libSegFault.so@SOVER@"
export LD_PRELOAD
SEGFAULT_USE_ALTSTACK=1
export SEGFAULT_USE_ALTSTACK
-SEGFAULT_OUTPUT_NAME="$prog.segv.$$"
+SEGFAULT_OUTPUT_NAME="${TMPDIR:-/tmp}/`basename $prog`.segv.$$"
export SEGFAULT_OUTPUT_NAME
$prog $args
exval=$?
unset LD_PRELOAD
-# Check for an segmentation fault.
+# Check for an segmentation error.
if test $exval -eq 139; then
# We caught a segmentation error. The output is in the file with the
# name we have in SEGFAULT_OUTPUT_NAME. In the output the names of
@@ -66,10 +66,10 @@ if test $exval -eq 139; then
read line; echo "$line"
while read line; do
case "$line" in
- [*) addr="`echo $line | sed 's/^[\(.*\)]$/\1/'`"
- complete="`addr2line -f -e $prog $addr 2>/dev/null|`"
- if $? -eq 0; then
- echo "`echo $complete|sed 'N;s/\(.*\)\n\(.*\)/\2(\1)/;'`$line"
+ [*) addr="`echo $line | sed 's/^\[\(.*\)\]$/\1/'`"
+ complete="`addr2line -f -e $prog $addr 2>/dev/null`"
+ if test $? -eq 0; then
+ echo "`echo $complete|sed 's/\(.*\) \(.*\)/\2(\1)/;'`$line"
else
echo "$line"
fi