How can I get the lua stack trace from a core file using gdb

后端 未结 4 950
北海茫月
北海茫月 2021-02-01 18:07

I have a C++ application (for OS X) that calls lua as a scripting language. I\'m running a large number of these applications (100s) and they can run for a very long time (days

4条回答
  •  遇见更好的自我
    2021-02-01 18:15

    You could check out my Lua GDB helpers. It is a collection of macros that let you inspect the stack and values, and even print backtrace. Essentially what the article referenced by macs contains, in a simple-to-use package.

    It provides these macros:

    • luastack [L] - lists the values on the current Lua C stack.

    • luaprint < value > [verbose] - Pretty-prints a TValue passed as argument. Expects a pointer to a TValue. When verbose is 1, expands tables, metatables and userdata environments.

    • luaprinttable < table > - Pretty-prints a Lua Table. Expects a pointer to Table.

    • luavalue < index > [L] - Dumps a single value at an index.

    • luatraceback [L] - Calls debug.traceback(). Not sure if it will work on core file though...

提交回复
热议问题