dumpstate: dump all threads in show_wchan
for_each_pid only finds processes and not their threads. Add
for_each_tid and call it for show_wchan so we can see where all
threads are blocked in the kernel.
Change-Id: Iffb59f7c2933cecf51cdd358a36e19932c2f24c7
diff --git a/cmds/dumpstate/dumpstate.h b/cmds/dumpstate/dumpstate.h
index 45247cd..67bbd7e 100644
--- a/cmds/dumpstate/dumpstate.h
+++ b/cmds/dumpstate/dumpstate.h
@@ -19,10 +19,14 @@
#include <time.h>
#include <unistd.h>
+#include <stdbool.h>
#include <stdio.h>
#define SU_PATH "/system/xbin/su"
+typedef void (for_each_pid_func)(int, const char *);
+typedef void (for_each_tid_func)(int, int, const char *);
+
/* prints the contents of a file */
int dump_file(const char *title, const char* path);
@@ -42,10 +46,13 @@
const char *dump_traces();
/* for each process in the system, run the specified function */
-void for_each_pid(void (*func)(int, const char *), const char *header);
+void for_each_pid(for_each_pid_func func, const char *header);
+
+/* for each thread in the system, run the specified function */
+void for_each_tid(for_each_tid_func func, const char *header);
/* Displays a blocked processes in-kernel wait channel */
-void show_wchan(int pid, const char *name);
+void show_wchan(int pid, int tid, const char *name);
/* Runs "showmap" for a process */
void do_showmap(int pid, const char *name);