Try to handle the executable being a libtool wrapper.

Change-Id: I8fd2b4445707029ea24ad3c02804c0bf8fcedd15
Reviewed-on: https://code.wireshark.org/review/8406
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2015-05-11 13:29:08 -07:00
parent 1fa0e72d53
commit f1c375d006
1 changed files with 29 additions and 2 deletions

View File

@ -51,6 +51,17 @@ then
then
#
# Found the executable.
# Is it a libtool wrapper script? Look for a .libs
# directory.
#
executable_dirname=`dirname "$executable"`
if [ -d "$executable_dirname"/.libs ]
then
is_libtool_wrapper=yes
else
is_libtool_wrapper=no
fi
#
# Now, look for a debugger.
# XXX - lldb?
@ -63,10 +74,18 @@ then
# cause the stack trace to go to the standard
# error.
#
dbx "$executable" core 1>&2 <<EOF
if [ $is_libtool_wrapper = yes ]
then
$executable_dirname/libtool --mode=execute dbx "$executable" core 1>&2 <<EOF
where
quit
EOF
else
dbx "$executable" core 1>&2 <<EOF
where
quit
EOF
fi
else
gdb=`which gdb`
if [ ! -z "$gdb" ]
@ -76,10 +95,18 @@ EOF
# cause the stack trace to go to the standard
# error.
#
gdb "$executable" core 1>&2 <<EOF
if [ $is_libtool_wrapper = yes ]
then
$executable_dirname/libtool --mode=execute gdb "$executable" core 1>&2 <<EOF
backtrace
quit
EOF
else
gdb "$executable" core 1>&2 <<EOF
backtrace
quit
EOF
fi
fi
fi
fi