From 744ee8025a238866de1648a0d7afe84b954e988a Mon Sep 17 00:00:00 2001 From: Christopher Tate Date: Thu, 12 Nov 2009 15:33:08 -0800 Subject: [PATCH] Add a host shell function to generate system_server stack traces For debugging non-ANR weird states in the system server, it is incredibly handy to be able to force a complete thread-stack dump of that process. Here's a shell function that does so (creating the /data/anr/traces.txt file with the usual permissions if it does not yet exist). Depends on adb having been configured to run as root. Change-Id: I01d9d733ef08ffefb00cb61968df36ecf62087f0 --- envsetup.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/envsetup.sh b/envsetup.sh index a32d0b2c22..6dc2aa943b 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -687,6 +687,13 @@ function pid() fi } +# systemstack - dump the current stack trace of all threads in the system process +# to the usual ANR traces file +function systemstack() +{ + adb shell echo '""' '>>' /data/anr/traces.txt && adb shell chmod 776 /data/anr/traces.txt && adb shell kill -3 $(pid system_server) +} + function gdbclient() { local OUT_ROOT=$(get_abs_build_var PRODUCT_OUT)