[lldb/lua] Add scripted watchpoints for Lua

Add support for Lua scripted watchpoints, with basic tests.

Differential Revision: https://reviews.llvm.org/D105034
This commit is contained in:
Siger Yang
2021-07-04 19:38:12 -03:00
committed by Pedro Tammela
parent 3ebfeb2586
commit e81ba28313
8 changed files with 194 additions and 8 deletions

View File

@@ -1,9 +1,33 @@
# REQUIRES: lua
# XFAIL: system-netbsd
# RUN: echo "int main() { return 0; }" | %clang_host -x c - -o %t
# 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 expr 0x0
watchpoint set variable val
watchpoint command add -s lua
# CHECK: error: This script interpreter does not support watchpoint callbacks
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