I'm extending an application with an embedded Lua VM. My scripts sometimes cause it to crash, and I'd like to be able to make some sense out of the resulting crash dump (Windows).
Is there already a way to decode the Lua call stack? I realize that the C call stack is not going to closely resemble the Lua one, but it's the script code that I'm trying to learn something about.
I read Lua callstack with C++ debugger (written in 2010 for Lua 5.1), and it contains a lot of useful ideas (though some of the particulars of the Lua VM are very different, between 5.1 and 5.3). I can use the "Use a stack dumping function" idea when I'm attached to a running process, but I don't know how to accomplish something like it when I'm in debugging a crash dump. Visual Studio won't let me execute anything in the Immediate window or as a Watch expression. I suspect it will not be easy to employ this method in a post-mortem situation. Am I wrong?
What options do I have? I have not been able to find any Visual Studio extensions that provide the functionality that I want. They seem to be geared toward debugging scripts (in a running process) and stepping through the code. Is there anything at all already in existence that would help me?
The only thing I can think of is to reimplement a subset of some Lua functionality in JavaScript and invoke a stack dumping function from WinDBG. Something like this answer (How can I get the lua stack trace from a core file using gdb) is perhaps the closest to what I think I want. Surely there's some existing code or project that I can adapt to my needs without actually reimplementing Lua 5.3's debug
functionality in a language that runs inside the debugger. Where can I start?