StackTracePlus icon indicating copy to clipboard operation
StackTracePlus copied to clipboard

Dump locals of C functions

Open devurandom opened this issue 9 years ago • 1 comments

STP currently does not dump locals of C functions. When debugging those written using the Lua C API, it sometimes happens that the stacks looks different from what I expected. In these cases I would love to use STP to tell me about the stack.

The fix is simple:

--- a/src/StackTracePlus.lua
+++ b/src/StackTracePlus.lua
@@ -355,6 +355,7 @@ Stack Traceback
                        local function_name = m_user_known_functions[info.func] or m_known_functions[info.func] or info.name or tostring(info.func)
                        dumper:add_f("(%d) %s C function '%s'\r\n", level_to_show, info.namewhat, function_name)
                        --dumper:add_f("%s%s = C %s\r\n", prefix, name, (m_known_functions[value] and ("function: " .. m_known_functions[value]) or tostring(value)))
+                       dumper:DumpLocals(level)
                elseif info.what == "tail" then
                        --print("tail")
                        --for k,v in pairs(info) do print(k,v, type(v)) end--print(info.namewhat, info.name)

devurandom avatar Nov 12 '15 18:11 devurandom

Locals of C functions? Do you have an example of this change in action? I don't really understand how would that work.

ignacio avatar Nov 12 '15 19:11 ignacio