diff options
author | Jeff Brown <jeffbrown@google.com> | 2012-06-08 15:33:31 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-06-08 15:33:31 -0700 |
commit | f41855949d5f19e0fc1f8873278ae21c52dd5676 (patch) | |
tree | adec664ec6957a7263b04a6bbc94cc21cc24b14c /linker | |
parent | ec8addcc8af1dc2a1ae606af8a16362bf5471a63 (diff) | |
parent | e4db460a54e4f024b83a7df9a3f9920d695da9f3 (diff) | |
download | bionic-f41855949d5f19e0fc1f8873278ae21c52dd5676.zip bionic-f41855949d5f19e0fc1f8873278ae21c52dd5676.tar.gz bionic-f41855949d5f19e0fc1f8873278ae21c52dd5676.tar.bz2 |
am e4db460a: am b7630f01: Use new debuggerd protocol.
* commit 'e4db460a54e4f024b83a7df9a3f9920d695da9f3':
Use new debuggerd protocol.
Diffstat (limited to 'linker')
-rw-r--r-- | linker/debugger.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/linker/debugger.c b/linker/debugger.c index 899a5b2..756b5cf 100644 --- a/linker/debugger.c +++ b/linker/debugger.c @@ -44,6 +44,23 @@ extern int tgkill(int tgid, int tid, int sig); void notify_gdb_of_libraries(); +#define DEBUGGER_SOCKET_NAME "android:debuggerd" + +typedef enum { + // dump a crash + DEBUGGER_ACTION_CRASH, + // dump a tombstone file + DEBUGGER_ACTION_DUMP_TOMBSTONE, + // dump a backtrace only back to the socket + DEBUGGER_ACTION_DUMP_BACKTRACE, +} debugger_action_t; + +/* message sent over the socket */ +typedef struct { + debugger_action_t action; + pid_t tid; +} debugger_msg_t; + #define RETRY_ON_EINTR(ret,cond) \ do { \ ret = (cond); \ @@ -146,7 +163,7 @@ void debugger_signal_handler(int n, siginfo_t* info, void* unused) logSignalSummary(n, info); tid = gettid(); - s = socket_abstract_client("android:debuggerd", SOCK_STREAM); + s = socket_abstract_client(DEBUGGER_SOCKET_NAME, SOCK_STREAM); if (s >= 0) { /* debugger knows our pid from the credentials on the @@ -155,9 +172,11 @@ void debugger_signal_handler(int n, siginfo_t* info, void* unused) * that's actually in our process */ int ret; - - RETRY_ON_EINTR(ret, write(s, &tid, sizeof(unsigned))); - if (ret == sizeof(unsigned)) { + debugger_msg_t msg; + msg.action = DEBUGGER_ACTION_CRASH; + msg.tid = tid; + RETRY_ON_EINTR(ret, write(s, &msg, sizeof(msg))); + if (ret == sizeof(msg)) { /* if the write failed, there is no point to read on * the file descriptor. */ RETRY_ON_EINTR(ret, read(s, &tid, 1)); |