labath added inline comments.
================ Comment at: lldb/source/Plugins/ScriptInterpreter/Lua/Lua.cpp:60-78 +static int runCallback(lua_State *L) { + LuaCallback *callback = static_cast<LuaCallback *>(lua_touserdata(L, -1)); + return (*callback)(L); +} + +llvm::Error Lua::Run(LuaCallback &callback) { + lua_pushcfunction(m_lua_state, runCallback); ---------------- I'm confused. Why use lua to call a c callback, when you could just do `calllback()`? ================ Comment at: lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp:200 + Debugger &debugger = target->GetDebugger(); + ScriptInterpreterLua *lua_interpreter = + static_cast<ScriptInterpreterLua *>(debugger.GetScriptInterpreter()); ---------------- How is `lua_interpreter` different from `this`? ================ Comment at: lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp:211 + + llvm::handleAllErrors(lua.Run(callback), [&](const llvm::StringError &E) { + debugger.GetErrorStream() << E.message(); ---------------- ``` if (llvm::Error E = lua.Run(callback)) { debugger.GetErrorStream() << toString(std::move(E)); stop = true; } ``` would be less callback-y. ================ Comment at: lldb/test/Shell/ScriptInterpreter/Lua/breakpoint_oneline_callback.test:3 +b main +breakpoint command add -s lua -o 'print(1)' +run ---------------- Print something more unique so this doesn't match accidentally? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D91508/new/ https://reviews.llvm.org/D91508 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits