[LLDB/Lua] add support for one-liner breakpoint callback
authorPedro Tammela <pctammela@gmail.com>
Sun, 15 Nov 2020 19:39:16 +0000 (19:39 +0000)
committerPedro Tammela <pctammela@gmail.com>
Mon, 30 Nov 2020 14:12:26 +0000 (14:12 +0000)
commita0d7406ae800c45dd9cb438c7ae1f55329d198e2
tree8db3f5ff0f91bb858481bea5bc5570a2557f094d
parent8e504615e9f1b27c06237a56ee786a16568851f1
[LLDB/Lua] add support for one-liner breakpoint callback

These callbacks are set using the following:
   breakpoint command add -s lua -o "print('hello world!')"

The user supplied script is executed as:
   function (frame, bp_loc, ...)
      <body>
   end

So the local variables 'frame', 'bp_loc' and vararg are all accessible.
Any global variables declared will persist in the Lua interpreter.
A user should never hold 'frame' and 'bp_loc' in a global variable as
these userdatas are context dependent.

Differential Revision: https://reviews.llvm.org/D91508
lldb/bindings/lua/lua-swigsafecast.swig [new file with mode: 0644]
lldb/bindings/lua/lua-wrapper.swig [new file with mode: 0644]
lldb/bindings/lua/lua.swig
lldb/source/Plugins/ScriptInterpreter/Lua/Lua.cpp
lldb/source/Plugins/ScriptInterpreter/Lua/Lua.h
lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp
lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.h
lldb/test/Shell/ScriptInterpreter/Lua/breakpoint_oneline_callback.test [new file with mode: 0644]
lldb/unittests/ScriptInterpreter/Lua/LuaTests.cpp