[lldb] Fix Lua/watchpoint_callback.test on Apple Silicon

As Pavel pointed out, on Apple Silicon "b main" stops at a point after
the variable has already been initialized. This patch updates the test
case to avoids that. I've also split the test into separate files so its
easier to reproduce the individual scenarios without having to build any
shared state.
This commit is contained in:
Jonas Devlieghere 2022-02-07 12:06:30 -08:00
parent 9b0d324154
commit a5a71b139c
5 changed files with 39 additions and 31 deletions

View File

@ -0,0 +1,7 @@
int main() {
int val = 0;
// Break here
val++;
val++;
return 0;
}

View File

@ -0,0 +1,9 @@
breakpoint set -p "Break here"
r
watchpoint set variable val
watchpoint command add -s lua
print("val=" .. tostring(frame:FindVariable("val"):GetValue()))
quit
c
# CHECK: val=1
# CHECK: val=2

View File

@ -0,0 +1,11 @@
breakpoint set -p "Break here"
r
watchpoint set variable val
watchpoint modify 1 -c "(val == 1)"
watchpoint command add -s lua
print("conditional watchpoint")
wp:SetEnabled(false)
quit
c
# CHECK-COUNT-1: conditional watchpoint
# CHECK-NOT: conditional watchpoint

View File

@ -0,0 +1,8 @@
breakpoint set -p "Break here"
r
watchpoint set expr 0x00
watchpoint command add -s lua
print("never triggers")
quit
c
# CHECK-NOT: never triggers

View File

@ -1,32 +1,5 @@
# XFAIL: system-netbsd
# RUN: echo "int main() { int val = 1; val++; return 0; }" | %clang_host -x c - -g -o %t
# RUN: %lldb -s %s --script-language lua %t 2>&1 | FileCheck %s
b main
r
watchpoint set variable val
watchpoint command add -s lua
print("val=" .. tostring(frame:FindVariable("val"):GetValue()))
quit
c
# CHECK: val=1
# CHECK: val=2
# CHECK: Process {{[0-9]+}} exited
r
watchpoint set variable val
watchpoint modify 1 -c "(val == 1)"
watchpoint command add -s lua
print("conditional watchpoint")
wp:SetEnabled(false)
quit
c
# CHECK-COUNT-1: conditional watchpoint
# CHECK-NOT: conditional watchpoint
# CHECK: Process {{[0-9]+}} exited
r
watchpoint set expr 0x00
watchpoint command add -s lua
print("never triggers")
quit
c
# CHECK-NOT: never triggers
# CHECK: Process {{[0-9]+}} exited
# RUN: %clang_host -x c %S/Inputs/val.c -g -o %t
# RUN: %lldb -b -s %S/Inputs/watchpoint1.in --script-language lua %t 2>&1 | FileCheck %S/Inputs/watchpoint1.in
# RUN: %lldb -b -s %S/Inputs/watchpoint2.in --script-language lua %t 2>&1 | FileCheck %S/Inputs/watchpoint2.in
# RUN: %lldb -b -s %S/Inputs/watchpoint3.in --script-language lua %t 2>&1 | FileCheck %S/Inputs/watchpoint3.in