summaryrefslogtreecommitdiff
path: root/test/sanitizer_common/TestCases/Linux/ptrace.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/sanitizer_common/TestCases/Linux/ptrace.cc')
-rw-r--r--test/sanitizer_common/TestCases/Linux/ptrace.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/test/sanitizer_common/TestCases/Linux/ptrace.cc b/test/sanitizer_common/TestCases/Linux/ptrace.cc
index 2bf0fd2f0f356..ba318169ee7d5 100644
--- a/test/sanitizer_common/TestCases/Linux/ptrace.cc
+++ b/test/sanitizer_common/TestCases/Linux/ptrace.cc
@@ -8,6 +8,10 @@
#include <sys/user.h>
#include <sys/wait.h>
#include <unistd.h>
+#if __mips64
+ #include <asm/ptrace.h>
+ #include <sys/procfs.h>
+#endif
int main(void) {
pid_t pid;
@@ -33,19 +37,23 @@ int main(void) {
printf("%x\n", fpregs.mxcsr);
#endif // __x86_64__
-#if __powerpc64__
+#if (__powerpc64__ || __mips64)
struct pt_regs regs;
res = ptrace((enum __ptrace_request)PTRACE_GETREGS, pid, NULL, &regs);
assert(!res);
+#if (__powerpc64__)
if (regs.nip)
printf("%lx\n", regs.nip);
-
+#else
+ if (regs.cp0_epc)
+ printf("%lx\n", regs.cp0_epc);
+#endif
elf_fpregset_t fpregs;
res = ptrace((enum __ptrace_request)PTRACE_GETFPREGS, pid, NULL, &fpregs);
assert(!res);
if ((elf_greg_t)fpregs[32]) // fpscr
printf("%lx\n", (elf_greg_t)fpregs[32]);
-#endif // __powerpc64__
+#endif // (__powerpc64__ || __mips64)
siginfo_t siginfo;
res = ptrace(PTRACE_GETSIGINFO, pid, NULL, &siginfo);