MIPS support to libm, libdl and libthread_db
Change-Id: I9106721af7fe0cd45df82976250db0d300a20117
Signed-off-by: Raghu Gandham <raghu@mips.com>
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 @@
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 @@
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;
}