diff options
| author | Dan Egnor <egnor@google.com> | 2010-01-13 12:27:50 -0800 |
|---|---|---|
| committer | Dan Egnor <egnor@google.com> | 2010-01-13 14:30:33 -0800 |
| commit | 52952b1bcab28f655775efbad8f2e2b41d06a34b (patch) | |
| tree | e3a89be656d1a4c9a91585ce5a0e70b42c018203 /cmds/dumpstate/dumpstate.h | |
| parent | 96e40b4b3769a7880eca66d1955b5e5583e979c8 (diff) | |
| download | frameworks_base-52952b1bcab28f655775efbad8f2e2b41d06a34b.zip frameworks_base-52952b1bcab28f655775efbad8f2e2b41d06a34b.tar.gz frameworks_base-52952b1bcab28f655775efbad8f2e2b41d06a34b.tar.bz2 | |
Overhaul of dumpstate (aka bugreport) with cleanups & enhancements:
- include basic build & timestamp information in the header
- collect stack traces immediately at bugreport time
- *also* show stack traces from last ANR (as before), if in the last 15 minutes
- alphabetize system properties dump
- remove now-obsolete (and always questionable) "dumpcrash" functionality
- write to a .tmp file first, then rename to the final filename
- friendly usage message
- output sections include the exact file/command run
- source de-weirdification -- it's several hundred lines shorter now
The same data is present in the same order as before, and I've tried
to preserve all the grep/search targets people might use to find their
way through the file.
Diffstat (limited to 'cmds/dumpstate/dumpstate.h')
| -rw-r--r-- | cmds/dumpstate/dumpstate.h | 153 |
1 files changed, 10 insertions, 143 deletions
diff --git a/cmds/dumpstate/dumpstate.h b/cmds/dumpstate/dumpstate.h index ed1f005..6d48a85 100644 --- a/cmds/dumpstate/dumpstate.h +++ b/cmds/dumpstate/dumpstate.h @@ -18,157 +18,24 @@ #define _DUMPSTATE_H_ #include <time.h> - -// Commands time out after 60 seconds -#define TIMEOUT 60 - -#define PRINT(s) printf("%s\n", s) - -#define DUMP(file) dump_file(file) - -#define DUMP_FILES(path) dump_files(path) - -#define DUMP_PROMPT(prompt, file) \ -{ \ - printf(prompt); \ - dump_file(file); \ -} - -#define EXEC(cmd) \ -{ \ - static struct Command c = { \ - "/system/bin/" cmd, \ - { cmd, 0 } \ - }; \ - run_command(&c, TIMEOUT); \ -} - -#define EXEC_TIMEOUT(cmd, tmout)\ -{ \ - static struct Command c = { \ - "/system/bin/" cmd, \ - { cmd, 0 } \ - }; \ - run_command(&c, tmout); \ -} - -#define EXEC_XBIN(cmd) \ -{ \ - static struct Command c = { \ - "/system/xbin/" cmd, \ - { cmd, 0 } \ - }; \ - run_command(&c, TIMEOUT); \ -} - -#define EXEC1(cmd, a1) \ -{ \ - static struct Command c = { \ - "/system/bin/" cmd, \ - { cmd, a1, 0 } \ - }; \ - run_command(&c, TIMEOUT); \ -} - -#define EXEC2(cmd, a1, a2) \ -{ \ - static struct Command c = { \ - "/system/bin/" cmd, \ - { cmd, a1, a2, 0 } \ - }; \ - run_command(&c, TIMEOUT); \ -} - -#define EXEC3(cmd, a1, a2, a3) \ -{ \ - static struct Command c = { \ - "/system/bin/" cmd, \ - { cmd, a1, a2, a3, 0 } \ - }; \ - run_command(&c, TIMEOUT); \ -} - -#define EXEC4(cmd, a1, a2, a3, a4) \ -{ \ - static struct Command c = { \ - "/system/bin/" cmd, \ - { cmd, a1, a2, a3, a4, 0 } \ - }; \ - run_command(&c, TIMEOUT); \ -} - -#define EXEC6(cmd, a1, a2, a3, a4, a5, a6) \ -{ \ - static struct Command c = { \ - "/system/bin/" cmd, \ - { cmd, a1, a2, a3, a4, a5, a6, 0 } \ - }; \ - run_command(&c, TIMEOUT); \ -} - -#define EXEC7(cmd, a1, a2, a3, a4, a5, a6, a7) \ -{ \ - static struct Command c = { \ - "/system/bin/" cmd, \ - { cmd, a1, a2, a3, a4, a5, a6, a7, 0 } \ - }; \ - run_command(&c, TIMEOUT); \ -} - -#define EXEC8(cmd, a1, a2, a3, a4, a5, a6, a7, a8) \ -{ \ - static struct Command c = { \ - "/system/bin/" cmd, \ - { cmd, a1, a2, a3, a4, a5, a6, a7, a8, 0 } \ - }; \ - run_command(&c, TIMEOUT); \ -} - -#define EXEC_XBIN6(cmd, a1, a2, a3, a4, a5, a6) \ -{ \ - static struct Command c = { \ - "/system/xbin/" cmd, \ - { cmd, a1, a2, a3, a4, a5, a6, 0 } \ - }; \ - run_command(&c, TIMEOUT); \ -} - -#define PROPERTY(name) print_property(name) - -struct Command { - const char* path; - char* const args[]; -}; -typedef struct Command Command; +#include <unistd.h> /* prints the contents of a file */ -int dump_file(const char* path); - -/* prints the contents of all files in a directory */ -void dump_files(const char* path); - -/* forks a command and waits for it to finish */ -int run_command(struct Command* cmd, int timeout); - -/* reads the current time into tm */ -void get_time(struct tm *tm); - -/* prints the date in tm */ -void print_date(const char* prompt, struct tm *tm); +int dump_file(const char *title, const char* path); -/* prints the name and value of a system property */ -int print_property(const char* name); +/* forks a command and waits for it to finish -- terminate args with NULL */ +int run_command(const char *title, int timeout_seconds, const char *command, ...); /* prints all the system properties */ void print_properties(); -/* creates directories as needed for the given path */ -void create_directories(char *path); +/* redirect output to a service control socket */ +void redirect_to_socket(FILE *redirect, const char *service); -/* runs the vibrator using the given pattern */ -void vibrate_pattern(int fd, int* pattern); +/* redirect output to a file, optionally gzipping; returns gzip pid */ +pid_t redirect_to_file(FILE *redirect, char *path, int gzip_level); -/* prevents the OOM killer from killing us */ -void protect_from_oom_killer(); +/* dump Dalvik stack traces, return the trace file location (NULL if none) */ +const char *dump_vm_traces(); #endif /* _DUMPSTATE_H_ */ |
