aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Gao2018-06-14 17:35:53 -0500
committerJosh Gao2018-06-14 17:35:53 -0500
commitab1e09a6b001af97f1b6d8bf95d188ab2b2a761a (patch)
tree8d6cbb42d7370cb4f1bb198cc5d7d9a1adba7a33 /envsetup.sh
parentacbfc3fb947bef37dee8874bbf81acfd3239ca64 (diff)
downloadplatform-build-ab1e09a6b001af97f1b6d8bf95d188ab2b2a761a.tar.gz
platform-build-ab1e09a6b001af97f1b6d8bf95d188ab2b2a761a.tar.xz
platform-build-ab1e09a6b001af97f1b6d8bf95d188ab2b2a761a.zip
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
Diffstat (limited to 'envsetup.sh')
-rw-r--r--envsetup.sh34
1 files changed, 9 insertions, 25 deletions
diff --git a/envsetup.sh b/envsetup.sh
index bad16e23e..a7c99aa16 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -1100,32 +1100,16 @@ function stacks()
1100 fi 1100 fi
1101 1101
1102 if [ "$PID" ] ; then 1102 if [ "$PID" ] ; then
1103 # Determine whether the process is native 1103 # Use `debuggerd -j` on java processes.
1104 if adb shell ls -l /proc/$PID/exe | grep -q /system/bin/app_process ; then 1104 if adb shell readlink /proc/$PID/exe | egrep -q '^/system/bin/app_process' ; then
1105 # Dump stacks of Dalvik process 1105 # But not the zygote.
1106 local TRACES=/data/anr/traces.txt 1106 if ! adb shell cat /proc/$PID/cmdline | egrep -q '^zygote'; then
1107 local ORIG=/data/anr/traces.orig 1107 adb shell debuggerd -j $PID
1108 local TMP=/data/anr/traces.tmp 1108 return
1109 1109 fi
1110 # Keep original traces to avoid clobbering
1111 adb shell mv $TRACES $ORIG
1112
1113 # Make sure we have a usable file
1114 adb shell touch $TRACES
1115 adb shell chmod 666 $TRACES
1116
1117 # Dump stacks and wait for dump to finish
1118 adb shell kill -3 $PID
1119 adb shell notify $TRACES >/dev/null
1120
1121 # Restore original stacks, and show current output
1122 adb shell mv $TRACES $TMP
1123 adb shell mv $ORIG $TRACES
1124 adb shell cat $TMP
1125 else
1126 # Dump stacks of native process
1127 adb shell debuggerd -b $PID
1128 fi 1110 fi
1111
1112 adb shell debuggerd -b $PID
1129 fi 1113 fi
1130} 1114}
1131 1115