forked from openkylin/platform_build
Fix stacks for Java processes.
Fix stacks for the change in ANR trace location by using `debuggerd -j` instead of manually fetching the traces file. Also, dump zygote/zygote64 as native processes, since they don't respond to SIGQUIT. Test: stacks zygote Test: stacks adbd Test: stacks com.android.settings Change-Id: I015458bdc2dd45624940204d42614365aacf8304
This commit is contained in:
parent
acbfc3fb94
commit
ab1e09a6b0
34
envsetup.sh
34
envsetup.sh
|
@ -1100,32 +1100,16 @@ function stacks()
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$PID" ] ; then
|
if [ "$PID" ] ; then
|
||||||
# Determine whether the process is native
|
# Use `debuggerd -j` on java processes.
|
||||||
if adb shell ls -l /proc/$PID/exe | grep -q /system/bin/app_process ; then
|
if adb shell readlink /proc/$PID/exe | egrep -q '^/system/bin/app_process' ; then
|
||||||
# Dump stacks of Dalvik process
|
# But not the zygote.
|
||||||
local TRACES=/data/anr/traces.txt
|
if ! adb shell cat /proc/$PID/cmdline | egrep -q '^zygote'; then
|
||||||
local ORIG=/data/anr/traces.orig
|
adb shell debuggerd -j $PID
|
||||||
local TMP=/data/anr/traces.tmp
|
return
|
||||||
|
fi
|
||||||
# Keep original traces to avoid clobbering
|
|
||||||
adb shell mv $TRACES $ORIG
|
|
||||||
|
|
||||||
# Make sure we have a usable file
|
|
||||||
adb shell touch $TRACES
|
|
||||||
adb shell chmod 666 $TRACES
|
|
||||||
|
|
||||||
# Dump stacks and wait for dump to finish
|
|
||||||
adb shell kill -3 $PID
|
|
||||||
adb shell notify $TRACES >/dev/null
|
|
||||||
|
|
||||||
# Restore original stacks, and show current output
|
|
||||||
adb shell mv $TRACES $TMP
|
|
||||||
adb shell mv $ORIG $TRACES
|
|
||||||
adb shell cat $TMP
|
|
||||||
else
|
|
||||||
# Dump stacks of native process
|
|
||||||
adb shell debuggerd -b $PID
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
adb shell debuggerd -b $PID
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue