Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2262,6 +2262,18 @@ void SignalContext::DumpAllRegisters(void *context) {
Printf("r14 = 0x%016llx ", ucontext->uc_mcontext.mc_r14);
Printf("r15 = 0x%016llx ", ucontext->uc_mcontext.mc_r15);
Printf("\n");
# elif defined(__i386__)
Report("Register values:\n");
Printf("eax = 0x%08x ", ucontext->uc_mcontext.mc_eax);
Printf("ebx = 0x%08x ", ucontext->uc_mcontext.mc_ebx);
Printf("ecx = 0x%08x ", ucontext->uc_mcontext.mc_ecx);
Printf("edx = 0x%08x ", ucontext->uc_mcontext.mc_edx);
Printf("\n");
Printf("edi = 0x%08x ", ucontext->uc_mcontext.mc_edi);
Printf("esi = 0x%08x ", ucontext->uc_mcontext.mc_esi);
Printf("ebp = 0x%08x ", ucontext->uc_mcontext.mc_ebp);
Printf("esp = 0x%08x ", ucontext->uc_mcontext.mc_esp);
Printf("\n");
# else
(void)ucontext;
# endif
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Check that sanitizer prints registers dump_registers on dump_registers=1
// RUN: %clangxx %s -o %t
// RUN: %env_tool_opts=dump_registers=0 not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK-NODUMP --strict-whitespace
// RUN: not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK-DUMP --strict-whitespace
//
// REQUIRES: i386-target-arch

#include <signal.h>

int main() {
raise(SIGSEGV);
// CHECK-DUMP: Register values
// CHECK-DUMP-NEXT: eax = {{0x[0-9a-f]+}} ebx = {{0x[0-9a-f]+}} ecx = {{0x[0-9a-f]+}} edx = {{0x[0-9a-f]+}}
// CHECK-DUMP-NEXT: edi = {{0x[0-9a-f]+}} esi = {{0x[0-9a-f]+}} ebp = {{0x[0-9a-f]+}} esp = {{0x[0-9a-f]+}}
// CHECK-NODUMP-NOT: Register values
return 0;
}