summaryrefslogtreecommitdiffstats
path: root/cmds/dumpstate
diff options
context:
space:
mode:
Diffstat (limited to 'cmds/dumpstate')
-rw-r--r--cmds/dumpstate/dumpstate.c82
-rw-r--r--cmds/dumpstate/dumpstate.h3
-rw-r--r--cmds/dumpstate/utils.c7
3 files changed, 76 insertions, 16 deletions
diff --git a/cmds/dumpstate/dumpstate.c b/cmds/dumpstate/dumpstate.c
index 0723f67..ccc4fd7 100644
--- a/cmds/dumpstate/dumpstate.c
+++ b/cmds/dumpstate/dumpstate.c
@@ -39,6 +39,8 @@
static char cmdline_buf[16384] = "(unknown)";
static const char *dump_traces_path = NULL;
+static char screenshot_path[PATH_MAX] = "";
+
/* dumps the current system state to stdout */
static void dumpstate() {
time_t now = time(NULL);
@@ -76,7 +78,13 @@ static void dumpstate() {
dump_file("SLAB INFO", "/proc/slabinfo");
dump_file("ZONEINFO", "/proc/zoneinfo");
- run_command("SYSTEM LOG", 20, "logcat", "-v", "time", "-d", "*:v", NULL);
+ if (screenshot_path[0]) {
+ LOGI("taking screenshot\n");
+ run_command(NULL, 5, "su", "root", "screenshot", screenshot_path, NULL);
+ LOGI("wrote screenshot: %s\n", screenshot_path);
+ }
+
+ run_command("SYSTEM LOG", 20, "logcat", "-v", "threadtime", "-d", "*:v", NULL);
/* show the traces we collected in main(), if that was done */
if (dump_traces_path != NULL) {
@@ -96,18 +104,33 @@ static void dumpstate() {
}
// dump_file("EVENT LOG TAGS", "/etc/event-log-tags");
- run_command("EVENT LOG", 20, "logcat", "-b", "events", "-v", "time", "-d", "*:v", NULL);
- run_command("RADIO LOG", 20, "logcat", "-b", "radio", "-v", "time", "-d", "*:v", NULL);
+ run_command("EVENT LOG", 20, "logcat", "-b", "events", "-v", "threadtime", "-d", "*:v", NULL);
+ run_command("RADIO LOG", 20, "logcat", "-b", "radio", "-v", "threadtime", "-d", "*:v", NULL);
- run_command("NETWORK INTERFACES", 10, "netcfg", NULL);
+ run_command("NETWORK INTERFACES", 10, "su", "root", "netcfg", NULL);
dump_file("NETWORK ROUTES", "/proc/net/route");
+ dump_file("NETWORK ROUTES IPV6", "/proc/net/ipv6_route");
dump_file("ARP CACHE", "/proc/net/arp");
+ run_command("IPTABLES", 10, "su", "root", "iptables", "-L", NULL);
+ run_command("IPTABLE NAT", 10, "su", "root", "iptables", "-t", "nat", "-L", NULL);
+
+ run_command("WIFI NETWORKS", 20,
+ "su", "root", "wpa_cli", "list_networks", NULL);
#ifdef FWDUMP_bcm4329
- run_command("DUMP WIFI FIRMWARE LOG", 60,
- "su", "root", "dhdutil", "-i", "eth0", "upload", "/data/local/tmp/wlan_crash.dump", NULL);
+ run_command("DUMP WIFI STATUS", 20,
+ "su", "root", "dhdutil", "-i", "wlan0", "dump", NULL);
+ run_command("DUMP WIFI INTERNAL COUNTERS", 20,
+ "su", "root", "wlutil", "counters", NULL);
#endif
+ char ril_dumpstate_timeout[PROPERTY_VALUE_MAX] = {0};
+ property_get("ril.dumpstate.timeout", ril_dumpstate_timeout, "30");
+ if (strlen(ril_dumpstate_timeout) > 0) {
+ run_command("DUMP VENDOR RIL LOGS", atoi(ril_dumpstate_timeout),
+ "su", "root", "vril-dump", NULL);
+ }
+
print_properties();
run_command("KERNEL LOG", 20, "dmesg", NULL);
@@ -128,7 +151,7 @@ static void dumpstate() {
dump_file("BINDER STATS", "/sys/kernel/debug/binder/stats");
dump_file("BINDER STATE", "/sys/kernel/debug/binder/state");
- run_command("FILESYSTEMS & FREE SPACE", 10, "df", NULL);
+ run_command("FILESYSTEMS & FREE SPACE", 10, "su", "root", "df", NULL);
dump_file("PACKAGE SETTINGS", "/data/system/packages.xml");
dump_file("PACKAGE UID ERRORS", "/data/system/uiderrors.txt");
@@ -161,21 +184,41 @@ static void dumpstate() {
to increase its timeout. we really need to do the timeouts in
dumpsys itself... */
run_command("DUMPSYS", 60, "dumpsys", NULL);
+
+ printf("========================================================\n");
+ printf("== Running Application Activities\n");
+ printf("========================================================\n");
+
+ run_command("APP ACTIVITIES", 30, "dumpsys", "activity", "all", NULL);
+
+ printf("========================================================\n");
+ printf("== Running Application Services\n");
+ printf("========================================================\n");
+
+ run_command("APP SERVICES", 30, "dumpsys", "activity", "service", "all", NULL);
+
}
static void usage() {
- fprintf(stderr, "usage: dumpstate [-d] [-o file] [-s] [-z]\n"
- " -d: append date to filename (requires -o)\n"
+ fprintf(stderr, "usage: dumpstate [-b soundfile] [-e soundfile] [-o file [-d] [-p] [-z]] [-s]\n"
" -o: write to file (instead of stdout)\n"
+ " -d: append date to filename (requires -o)\n"
+ " -z: gzip output (requires -o)\n"
+ " -p: capture screenshot to filename.png (requires -o)\n"
" -s: write output to control socket (for init)\n"
- " -z: gzip output (requires -o)\n");
+ " -b: play sound file instead of vibrate, at beginning of job\n"
+ " -e: play sound file instead of vibrate, at end of job\n"
+ );
}
int main(int argc, char *argv[]) {
int do_add_date = 0;
int do_compress = 0;
char* use_outfile = 0;
+ char* begin_sound = 0;
+ char* end_sound = 0;
int use_socket = 0;
+ int do_fb = 0;
LOGI("begin\n");
@@ -191,13 +234,16 @@ int main(int argc, char *argv[]) {
dump_traces_path = dump_vm_traces();
int c;
- while ((c = getopt(argc, argv, "dho:svz")) != -1) {
+ while ((c = getopt(argc, argv, "b:de:ho:svzp")) != -1) {
switch (c) {
+ case 'b': begin_sound = optarg; break;
case 'd': do_add_date = 1; break;
+ case 'e': end_sound = optarg; break;
case 'o': use_outfile = optarg; break;
case 's': use_socket = 1; break;
case 'v': break; // compatibility no-op
case 'z': do_compress = 6; break;
+ case 'p': do_fb = 1; break;
case '?': printf("\n");
case 'h':
usage();
@@ -246,6 +292,10 @@ int main(int argc, char *argv[]) {
strftime(date, sizeof(date), "-%Y-%m-%d-%H-%M-%S", localtime(&now));
strlcat(path, date, sizeof(path));
}
+ if (do_fb) {
+ strlcpy(screenshot_path, path, sizeof(screenshot_path));
+ strlcat(screenshot_path, ".png", sizeof(screenshot_path));
+ }
strlcat(path, ".txt", sizeof(path));
if (do_compress) strlcat(path, ".gz", sizeof(path));
strlcpy(tmp_path, path, sizeof(tmp_path));
@@ -253,16 +303,18 @@ int main(int argc, char *argv[]) {
gzip_pid = redirect_to_file(stdout, tmp_path, do_compress);
}
- /* bzzzzzz */
- if (vibrator) {
+ if (begin_sound) {
+ play_sound(begin_sound);
+ } else if (vibrator) {
fputs("150", vibrator);
fflush(vibrator);
}
dumpstate();
- /* bzzz bzzz bzzz */
- if (vibrator) {
+ if (end_sound) {
+ play_sound(end_sound);
+ } else if (vibrator) {
int i;
for (i = 0; i < 3; i++) {
fputs("75\n", vibrator);
diff --git a/cmds/dumpstate/dumpstate.h b/cmds/dumpstate/dumpstate.h
index 682eafd..83b1d11 100644
--- a/cmds/dumpstate/dumpstate.h
+++ b/cmds/dumpstate/dumpstate.h
@@ -44,4 +44,7 @@ void for_each_pid(void (*func)(int, const char *), const char *header);
/* Displays a blocked processes in-kernel wait channel */
void show_wchan(int pid, const char *name);
+/* Play a sound via Stagefright */
+void play_sound(const char* path);
+
#endif /* _DUMPSTATE_H_ */
diff --git a/cmds/dumpstate/utils.c b/cmds/dumpstate/utils.c
index c7a78cc..b2f9e80 100644
--- a/cmds/dumpstate/utils.c
+++ b/cmds/dumpstate/utils.c
@@ -167,6 +167,7 @@ int run_command(const char *title, int timeout_seconds, const char *command, ...
execvp(command, (char**) args);
printf("*** exec(%s): %s\n", command, strerror(errno));
+ fflush(stdout);
_exit(-1);
}
@@ -178,7 +179,7 @@ int run_command(const char *title, int timeout_seconds, const char *command, ...
if (p == pid) {
if (WIFSIGNALED(status)) {
printf("*** %s: Killed by signal %d\n", command, WTERMSIG(status));
- } else if (WEXITSTATUS(status) > 0) {
+ } else if (WIFEXITED(status) && WEXITSTATUS(status) > 0) {
printf("*** %s: Exit code %d\n", command, WEXITSTATUS(status));
}
if (title) printf("[%s: %.1fs elapsed]\n\n", command, elapsed);
@@ -429,3 +430,7 @@ const char *dump_vm_traces() {
rename(anr_traces_path, traces_path);
return dump_traces_path;
}
+
+void play_sound(const char* path) {
+ run_command(NULL, 5, "/system/bin/stagefright", "-o", "-a", path, NULL);
+}