Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[lldb] [test] Add a minimal test for x86 dbreg reading
Add a test verifying that after the 'watchpoint' command, new values of x86 debug registers can be read back correctly. The primary purpose of this test is to catch broken DRn reading and help debugging it. Differential Revision: https://reviews.llvm.org/D91264
- Loading branch information
Showing
2 changed files
with
48 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include <cstdint> | ||
#include <csignal> | ||
|
||
uint8_t g_8w; | ||
uint16_t g_16rw; | ||
uint32_t g_32w; | ||
uint32_t g_32rw; | ||
|
||
int main() { | ||
::raise(SIGSTOP); | ||
return 0; | ||
} |
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,36 @@ | ||
# Debug registers are currently printed only on FreeBSD. | ||
# REQUIRES: system-freebsd | ||
# REQUIRES: native && (target-x86 || target-x86_64) && dbregs-set | ||
# RUN: %clangxx_host -g %p/Inputs/x86-db-read.cpp -o %t | ||
# RUN: %lldb -b -s %s %t | FileCheck %s | ||
process launch | ||
# CHECK: Process {{[0-9]+}} stopped | ||
|
||
watchpoint set variable -w write g_8w | ||
# CHECK: Watchpoint created: Watchpoint 1: addr = 0x{{[0-9a-f]*}} size = 1 state = enabled type = w | ||
watchpoint set variable -w read_write g_16rw | ||
# CHECK: Watchpoint created: Watchpoint 2: addr = 0x{{[0-9a-f]*}} size = 2 state = enabled type = rw | ||
watchpoint set variable -w write g_32w | ||
# CHECK: Watchpoint created: Watchpoint 3: addr = 0x{{[0-9a-f]*}} size = 4 state = enabled type = w | ||
watchpoint set variable -w read_write g_32rw | ||
# CHECK: Watchpoint created: Watchpoint 4: addr = 0x{{[0-9a-f]*}} size = 4 state = enabled type = rw | ||
|
||
print &g_8w | ||
# CHECK: (uint8_t *) $0 = [[VAR8W:0x[0-9a-f]*]] | ||
print &g_16rw | ||
# CHECK: (uint16_t *) $1 = [[VAR16RW:0x[0-9a-f]*]] | ||
print &g_32w | ||
# CHECK: (uint32_t *) $2 = [[VAR32W:0x[0-9a-f]*]] | ||
print &g_32rw | ||
# CHECK: (uint32_t *) $3 = [[VAR64RW:0x[0-9a-f]*]] | ||
|
||
register read --all | ||
# CHECK-DAG: dr0 = [[VAR8W]] | ||
# CHECK-DAG: dr1 = [[VAR16RW]] | ||
# CHECK-DAG: dr2 = [[VAR32W]] | ||
# CHECK-DAG: dr3 = [[VAR64RW]] | ||
# CHECK-DAG: dr6 = 0x{{(00000000)?}}ffff0ff0 | ||
# CHECK-DAG: dr7 = 0x{{(00000000)?}}fd7104aa | ||
|
||
process continue | ||
# CHECK: Process {{[0-9]+}} exited with status = 0 |