[Lldb-commits] [PATCH] D93649: [lldb/Lua] add support for Lua function breakpoint

Pedro Tammela via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sat Jan 9 10:44:36 PST 2021

tammela added inline comments.

Comment at: lldb/test/Shell/ScriptInterpreter/Lua/breakpoint_function_callback.test:15
+# CHECK: <userdata of type 'lldb::SBStructuredData *' at {{0x[[:xdigit:]]+}}>
+breakpoint command add -s lua -o "abc(frame, bp_loc, ...)"
JDevlieghere wrote:
> Can we unpack the SBStructuredData and check for `foo` or `123` in the output?
While I was doing this change, I noted that the `SBStructuredData` API for `GetStringValue` is quite odd.
For Lua, the auto-generated SWIG wrapper enforces code like this:
local result = "xxxx"
sd:GetStringValue(result, 3) -- 'sd' should be a value with at most 3 characters
This sort of API leaks all sorts of details to the Lua script. I think it could be improved to just return a `std::string` / `llvm::StringRef` object.

The SWIG wrapper also has some bugs for this class. For instance it's using `lua_pushnumber` where it should be `lua_pushinteger` for the `GetIntegerValue` method.

I will report this to the SWIG authors.

  rG LLVM Github Monorepo



More information about the lldb-commits mailing list