diff --git a/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp b/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp --- a/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp @@ -117,8 +117,8 @@ io_handler.SetIsDone(true); } break; case eIOHandlerWatchpoint: { - auto *wp_options = static_cast( - io_handler.GetUserData()); + auto *wp_options = + static_cast(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 BoolOrErr = lua.CallWatchpointCallback(baton, - stop_frame_sp, - wp_sp); + llvm::Expected 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); diff --git a/lldb/test/Shell/ScriptInterpreter/Lua/watchpoint_callback.test b/lldb/test/Shell/ScriptInterpreter/Lua/watchpoint_callback.test --- a/lldb/test/Shell/ScriptInterpreter/Lua/watchpoint_callback.test +++ b/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