bulbazord created this revision. bulbazord added reviewers: kparzysz, JDevlieghere, mib. Herald added a project: All. bulbazord requested review of this revision. Herald added a project: LLDB. Herald added a subscriber: lldb-commits.
This applies the same trick for Lua that I did for python in 27b6a4e63afe <https://reviews.llvm.org/rG27b6a4e63afe62f6258379a61177c67a670593c6>. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D150624 Files: lldb/bindings/lua/lua-wrapper.swig lldb/include/lldb/API/SBBreakpointLocation.h lldb/include/lldb/API/SBFrame.h lldb/include/lldb/API/SBStructuredData.h lldb/include/lldb/API/SBWatchpoint.h lldb/source/Plugins/ScriptInterpreter/Lua/Lua.cpp lldb/source/Plugins/ScriptInterpreter/Lua/SWIGLuaBridge.h lldb/unittests/ScriptInterpreter/Lua/LuaTests.cpp
Index: lldb/unittests/ScriptInterpreter/Lua/LuaTests.cpp =================================================================== --- lldb/unittests/ScriptInterpreter/Lua/LuaTests.cpp +++ lldb/unittests/ScriptInterpreter/Lua/LuaTests.cpp @@ -14,14 +14,16 @@ extern "C" int luaopen_lldb(lua_State *L) { return 0; } -llvm::Expected<bool> lldb_private::LLDBSwigLuaBreakpointCallbackFunction( +llvm::Expected<bool> +lldb_private::lua::SWIGBridge::LLDBSwigLuaBreakpointCallbackFunction( lua_State *L, lldb::StackFrameSP stop_frame_sp, lldb::BreakpointLocationSP bp_loc_sp, const StructuredDataImpl &extra_args_impl) { return false; } -llvm::Expected<bool> lldb_private::LLDBSwigLuaWatchpointCallbackFunction( +llvm::Expected<bool> +lldb_private::lua::SWIGBridge::LLDBSwigLuaWatchpointCallbackFunction( lua_State *L, lldb::StackFrameSP stop_frame_sp, lldb::WatchpointSP wp_sp) { return false; } Index: lldb/source/Plugins/ScriptInterpreter/Lua/SWIGLuaBridge.h =================================================================== --- lldb/source/Plugins/ScriptInterpreter/Lua/SWIGLuaBridge.h +++ lldb/source/Plugins/ScriptInterpreter/Lua/SWIGLuaBridge.h @@ -15,13 +15,20 @@ namespace lldb_private { -llvm::Expected<bool> LLDBSwigLuaBreakpointCallbackFunction( - lua_State *L, lldb::StackFrameSP stop_frame_sp, - lldb::BreakpointLocationSP bp_loc_sp, - const StructuredDataImpl &extra_args_impl); +namespace lua { -llvm::Expected<bool> LLDBSwigLuaWatchpointCallbackFunction( - lua_State *L, lldb::StackFrameSP stop_frame_sp, lldb::WatchpointSP wp_sp); +class SWIGBridge { +public: + static llvm::Expected<bool> LLDBSwigLuaBreakpointCallbackFunction( + lua_State *L, lldb::StackFrameSP stop_frame_sp, + lldb::BreakpointLocationSP bp_loc_sp, + const StructuredDataImpl &extra_args_impl); + + static llvm::Expected<bool> LLDBSwigLuaWatchpointCallbackFunction( + lua_State *L, lldb::StackFrameSP stop_frame_sp, lldb::WatchpointSP wp_sp); +}; + +} // namespace lua } // namespace lldb_private Index: lldb/source/Plugins/ScriptInterpreter/Lua/Lua.cpp =================================================================== --- lldb/source/Plugins/ScriptInterpreter/Lua/Lua.cpp +++ lldb/source/Plugins/ScriptInterpreter/Lua/Lua.cpp @@ -83,8 +83,8 @@ lua_pushlightuserdata(m_lua_state, baton); lua_gettable(m_lua_state, LUA_REGISTRYINDEX); StructuredDataImpl extra_args_impl(std::move(extra_args_sp)); - return LLDBSwigLuaBreakpointCallbackFunction(m_lua_state, stop_frame_sp, - bp_loc_sp, extra_args_impl); + return lua::SWIGBridge::LLDBSwigLuaBreakpointCallbackFunction( + m_lua_state, stop_frame_sp, bp_loc_sp, extra_args_impl); } llvm::Error Lua::RegisterWatchpointCallback(void *baton, const char *body) { @@ -109,8 +109,8 @@ lua_pushlightuserdata(m_lua_state, baton); lua_gettable(m_lua_state, LUA_REGISTRYINDEX); - return LLDBSwigLuaWatchpointCallbackFunction(m_lua_state, stop_frame_sp, - wp_sp); + return lua::SWIGBridge::LLDBSwigLuaWatchpointCallbackFunction( + m_lua_state, stop_frame_sp, wp_sp); } llvm::Error Lua::CheckSyntax(llvm::StringRef buffer) { Index: lldb/include/lldb/API/SBWatchpoint.h =================================================================== --- lldb/include/lldb/API/SBWatchpoint.h +++ lldb/include/lldb/API/SBWatchpoint.h @@ -13,7 +13,10 @@ #include "lldb/API/SBType.h" namespace lldb_private { -namespace ptyhon { +namespace python { +class SWIGBridge; +} +namespace lua { class SWIGBridge; } } // namespace lldb_private @@ -86,6 +89,7 @@ protected: friend class lldb_private::python::SWIGBridge; + friend class lldb_private::lua::SWIGBridge; SBWatchpoint(const lldb::WatchpointSP &wp_sp); Index: lldb/include/lldb/API/SBStructuredData.h =================================================================== --- lldb/include/lldb/API/SBStructuredData.h +++ lldb/include/lldb/API/SBStructuredData.h @@ -16,6 +16,9 @@ namespace python { class SWIGBridge; } +namespace lua { +class SWIGBridge; +} } // namespace lldb_private namespace lldb { @@ -104,6 +107,7 @@ friend class SBBreakpointName; friend class SBTrace; friend class lldb_private::python::SWIGBridge; + friend class lldb_private::lua::SWIGBridge; SBStructuredData(const lldb_private::StructuredDataImpl &impl); Index: lldb/include/lldb/API/SBFrame.h =================================================================== --- lldb/include/lldb/API/SBFrame.h +++ lldb/include/lldb/API/SBFrame.h @@ -16,6 +16,9 @@ namespace python { class SWIGBridge; } +namespace lua { +class SWIGBridge; +} } // namespace lldb_private namespace lldb { @@ -198,6 +201,7 @@ friend class SBValue; friend class lldb_private::python::SWIGBridge; + friend class lldb_private::lua::SWIGBridge; SBFrame(const lldb::StackFrameSP &lldb_object_sp); Index: lldb/include/lldb/API/SBBreakpointLocation.h =================================================================== --- lldb/include/lldb/API/SBBreakpointLocation.h +++ lldb/include/lldb/API/SBBreakpointLocation.h @@ -16,6 +16,9 @@ namespace python { class SWIGBridge; } +namespace lua { +class SWIGBridge; +} } // namespace lldb_private namespace lldb { @@ -98,6 +101,7 @@ protected: friend class lldb_private::python::SWIGBridge; + friend class lldb_private::lua::SWIGBridge; SBBreakpointLocation(const lldb::BreakpointLocationSP &break_loc_sp); private: Index: lldb/bindings/lua/lua-wrapper.swig =================================================================== --- lldb/bindings/lua/lua-wrapper.swig +++ lldb/bindings/lua/lua-wrapper.swig @@ -3,7 +3,8 @@ template <typename T> void PushSBClass(lua_State * L, T * obj); // This function is called from Lua::CallBreakpointCallback -llvm::Expected<bool> lldb_private::LLDBSwigLuaBreakpointCallbackFunction( +llvm::Expected<bool> +lldb_private::lua::SWIGBridge::LLDBSwigLuaBreakpointCallbackFunction( lua_State * L, lldb::StackFrameSP stop_frame_sp, lldb::BreakpointLocationSP bp_loc_sp, const StructuredDataImpl &extra_args_impl) { @@ -41,7 +42,8 @@ } // This function is called from Lua::CallWatchpointCallback -llvm::Expected<bool> lldb_private::LLDBSwigLuaWatchpointCallbackFunction( +llvm::Expected<bool> +lldb_private::lua::SWIGBridge::LLDBSwigLuaWatchpointCallbackFunction( lua_State * L, lldb::StackFrameSP stop_frame_sp, lldb::WatchpointSP wp_sp) { lldb::SBFrame sb_frame(stop_frame_sp); lldb::SBWatchpoint sb_wp(wp_sp);
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits