From 089cc5e679d0daf1507b68467d4bd99b9d8e06e4 Mon Sep 17 00:00:00 2001 From: jhb Date: Tue, 24 Apr 2018 05:33:17 +0000 Subject: [PATCH] Report proper signal codes for SIGTRAP traps on MIPS. - Use TRAP_TRACE for traps after stepping via PT_STEP. - Use TRAP_BRKPT for software breakpoint traps and watchpoint traps. This was tested via the recently added siginfo ptrace() tests. PT_STEP on MIPS has several bugs that prevent it from working yet, but this does fix the ptrace__breakpoint_siginfo test on MIPS. --- sys/mips/mips/trap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/mips/mips/trap.c b/sys/mips/mips/trap.c index 0938cf2f06da..492134073ea3 100644 --- a/sys/mips/mips/trap.c +++ b/sys/mips/mips/trap.c @@ -840,6 +840,7 @@ dofault: if (td->td_md.md_ss_addr != va || instr != MIPS_BREAK_SSTEP) { i = SIGTRAP; + ucode = TRAP_BRKPT; addr = trapframe->pc; break; } @@ -851,6 +852,7 @@ dofault: */ addr = trapframe->pc; i = SIGTRAP; + ucode = TRAP_TRACE; break; } @@ -865,6 +867,7 @@ dofault: va += sizeof(int); printf("watch exception @ %p\n", (void *)va); i = SIGTRAP; + ucode = TRAP_BRKPT; addr = va; break; }