Invoke debuggerd64 when appropriate with stacks.

Read out the ELF header to see if the executable is 64-bit or 32-bit,
then call the appropriate debuggerd. In bash. Ugh.

Change-Id: I6550fe92e775659cd0370bcb70f40dd59238ad8f
This commit is contained in:
Michael Wright
2014-06-19 19:58:12 -07:00
parent e0be9135a2
commit aeed721fcc

View File

@@ -932,7 +932,8 @@ function stacks()
adb shell cat $TMP adb shell cat $TMP
else else
# Dump stacks of native process # Dump stacks of native process
adb shell debuggerd -b $PID local USE64BIT="$(is64bit $PID)"
adb shell debuggerd$USE64BIT -b $PID
fi fi
fi fi
} }
@@ -949,17 +950,13 @@ function get_symbols_directory()
echo $(get_abs_build_var TARGET_OUT_UNSTRIPPED) echo $(get_abs_build_var TARGET_OUT_UNSTRIPPED)
} }
# process the symbolic link of /proc/$PID/exe and use the host file tool to # Read the ELF header from /proc/$PID/exe to determine if the process is
# determine whether it is a 32-bit or 64-bit executable. It returns "" or "64" # 64-bit.
# which can be conveniently used as suffix.
function is64bit() function is64bit()
{ {
local PID="$1" local PID="$1"
if [ "$PID" ] ; then if [ "$PID" ] ; then
local EXE=`adb shell readlink /proc/$PID/exe` if [[ "$(adb shell cat /proc/$PID/exe | xxd -l 1 -s 4 -ps)" -eq "02" ]] ; then
local EXE_DIR=`get_abs_build_var PRODUCT_OUT`
local IS64BIT=`file "$EXE_DIR$EXE" | grep "64-bit"`
if [ "$IS64BIT" != "" ]; then
echo "64" echo "64"
else else
echo "" echo ""