summaryrefslogtreecommitdiffstats
path: root/libthread_db/libthread_db.c
diff options
context:
space:
mode:
authorChris Dearman <chris@mips.com>2012-05-01 17:45:53 -0700
committerRaghu Gandham <raghu@mips.com>2012-05-04 11:34:40 -0700
commit726800e8f42f25a1bf7a36b1603ded29266e8ac6 (patch)
tree20a3971ce514a9c0a163662df988ce7fbcef5317 /libthread_db/libthread_db.c
parent10579fc43d3ade285eed7318aee062a999f2784d (diff)
downloadbionic-726800e8f42f25a1bf7a36b1603ded29266e8ac6.zip
bionic-726800e8f42f25a1bf7a36b1603ded29266e8ac6.tar.gz
bionic-726800e8f42f25a1bf7a36b1603ded29266e8ac6.tar.bz2
MIPS support to libm, libdl and libthread_db
Change-Id: I9106721af7fe0cd45df82976250db0d300a20117 Signed-off-by: Raghu Gandham <raghu@mips.com>
Diffstat (limited to 'libthread_db/libthread_db.c')
-rw-r--r--libthread_db/libthread_db.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libthread_db/libthread_db.c b/libthread_db/libthread_db.c
index 86e1cf4..e749377 100644
--- a/libthread_db/libthread_db.c
+++ b/libthread_db/libthread_db.c
@@ -99,7 +99,7 @@ _event_getmsg_helper(td_thrhandle_t const * handle, void * bkpt_addr)
gEventMsgHandle.tid = gEventMsgHandle.pid;
return 0x42;
}
-#else
+#elif defined(__arm__)
pc = (void *)ptrace(PTRACE_PEEKUSR, handle->tid, (void *)60 /* r15/pc */, NULL);
if (pc == bkpt_addr) {
@@ -109,6 +109,15 @@ _event_getmsg_helper(td_thrhandle_t const * handle, void * bkpt_addr)
gEventMsgHandle.tid = gEventMsgHandle.pid;
return 0x42;
}
+#elif defined(__mips__)
+ pc = (void *)ptrace(PTRACE_PEEKUSR, handle->tid, (void *)(64*4) /* pc */, NULL);
+ if (pc == bkpt_addr) {
+ // The hook function takes the id of the new thread as it's first param,
+ // so grab it from a0
+ gEventMsgHandle.pid = ptrace(PTRACE_PEEKUSR, handle->tid, (void *)(4*4) /* a0 */, NULL);
+ gEventMsgHandle.tid = gEventMsgHandle.pid;
+ return 0x42;
+ }
#endif
return 0;
}