[Lldb-commits] [PATCH] D105034: [lldb/lua] Add scripted watchpoints for Lua
Siger Young via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Jun 29 20:03:47 PDT 2021
siger-young updated this revision to Diff 355428.
siger-young added a comment.
This patch mainly adds two extra tests for Lua scripted watchpoints.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105034/new/
https://reviews.llvm.org/D105034
Files:
lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp
lldb/test/Shell/ScriptInterpreter/Lua/watchpoint_callback.test
Index: lldb/test/Shell/ScriptInterpreter/Lua/watchpoint_callback.test
===================================================================
--- lldb/test/Shell/ScriptInterpreter/Lua/watchpoint_callback.test
+++ lldb/test/Shell/ScriptInterpreter/Lua/watchpoint_callback.test
@@ -6,10 +6,28 @@
r
watchpoint set variable val
watchpoint command add -s lua
-print("val="..tostring(frame:FindVariable("val"):GetValue()))
+print("val=" .. tostring(frame:FindVariable("val"):GetValue()))
quit
c
# CHECK: val=1
# CHECK: val=2
-# CHECK: val=nil
+# 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: 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
Index: lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp
===================================================================
--- lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp
@@ -117,8 +117,8 @@
io_handler.SetIsDone(true);
} break;
case eIOHandlerWatchpoint: {
- auto *wp_options = static_cast<WatchpointOptions *>(
- io_handler.GetUserData());
+ auto *wp_options =
+ static_cast<WatchpointOptions *>(io_handler.GetUserData());
m_script_interpreter.SetWatchpointCommandCallback(wp_options,
data.c_str());
io_handler.SetIsDone(true);
@@ -304,9 +304,8 @@
debugger.GetScriptInterpreter(true, eScriptLanguageLua));
Lua &lua = lua_interpreter->GetLua();
- llvm::Expected<bool> BoolOrErr = lua.CallWatchpointCallback(baton,
- stop_frame_sp,
- wp_sp);
+ llvm::Expected<bool> BoolOrErr =
+ lua.CallWatchpointCallback(baton, stop_frame_sp, wp_sp);
if (llvm::Error E = BoolOrErr.takeError()) {
debugger.GetErrorStream() << toString(std::move(E));
return true;
@@ -325,8 +324,7 @@
}
void ScriptInterpreterLua::CollectDataForWatchpointCommandCallback(
- WatchpointOptions *wp_options,
- CommandReturnObject &result) {
+ WatchpointOptions *wp_options, CommandReturnObject &result) {
IOHandlerSP io_handler_sp(
new IOHandlerLuaInterpreter(m_debugger, *this, eIOHandlerWatchpoint));
io_handler_sp->SetUserData(wp_options);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105034.355428.patch
Type: text/x-patch
Size: 2718 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210630/249c7b86/attachment-0001.bin>
More information about the lldb-commits
mailing list