-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[compiler-rt] Add
DumpAllRegisters
impl (#99049)
- Add implementation for x86_64 and linux - Add test The output is like ==XXYYZZ==Register values: rax = 0x... rbx = 0x... rcx = 0x... rdx = 0x... rdi = 0x... rsi = 0x... rbp = 0x... rsp = 0x... r8 = 0x... r9 = 0x... r10 = 0x... r11 = 0x... r12 = 0x... r13 = 0x... r14 = 0x... r15 = 0x...
- Loading branch information
Showing
3 changed files
with
151 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
compiler-rt/test/sanitizer_common/TestCases/Linux/dump_registers_i386.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-prefix=CHECK-NODUMP | ||
// RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-DUMP | ||
// | ||
// 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; | ||
} |
19 changes: 19 additions & 0 deletions
19
compiler-rt/test/sanitizer_common/TestCases/Linux/dump_registers_x86_64.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// 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-prefix=CHECK-NODUMP | ||
// RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-DUMP | ||
// | ||
// REQUIRES: x86_64-target-arch | ||
|
||
#include <signal.h> | ||
|
||
int main() { | ||
raise(SIGSEGV); | ||
// CHECK-DUMP: Register values | ||
// CHECK-DUMP-NEXT: rax = {{0x[0-9a-f]+}} rbx = {{0x[0-9a-f]+}} rcx = {{0x[0-9a-f]+}} rdx = {{0x[0-9a-f]+}} | ||
// CHECK-DUMP-NEXT: rdi = {{0x[0-9a-f]+}} rsi = {{0x[0-9a-f]+}} rbp = {{0x[0-9a-f]+}} rsp = {{0x[0-9a-f]+}} | ||
// CHECK-DUMP-NEXT: r8 = {{0x[0-9a-f]+}} r9 = {{0x[0-9a-f]+}} r10 = {{0x[0-9a-f]+}} r11 = {{0x[0-9a-f]+}} | ||
// CHECK-DUMP-NEXT: r12 = {{0x[0-9a-f]+}} r13 = {{0x[0-9a-f]+}} r14 = {{0x[0-9a-f]+}} r15 = {{0x[0-9a-f]+}} | ||
// CHECK-NODUMP-NOT: Register values | ||
return 0; | ||
} |