Understanding the Debugging Process
<div class="IPBDescription">Attaching Decoda to a Lua Process</div>I am attempting to attach Decoda to a Lua script I've got running as a FastCGI program. The (messy) way my Lua code is invoked is as follows:<ul><li>Running "cgi-fcgi.exe -start -connect :3333 invoke.exe" starts an executable "invoke.exe"</li><li>Invoke.exe does a system("lua5.1 web.lua");</li><li>Lua5.1 (standard binaries from luaforge) happily runs my CGI application.</li></ul>As of yet, I've been unable to figure out how to break into web.lua with this process. When I attach Decoda to the invoke.exe process, I get the following message (after using the CGI script for a bit, and then killing it).
<!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->Debugging session started
Warning 1000: Lua functions were not found during debugging session
Debugging session ended<!--QuoteEnd--></div><!--QuoteEEnd-->
Does anyone have any idea how I might go about successfully attaching to this process?
Unrelated to this - I was really surprised to find that the guys who wrote Decoda are the Natural Selection team. Natural Selection being one of my favourite games, and coming across Decoda unrelated to this on the Lua mailing list.
<!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->Debugging session started
Warning 1000: Lua functions were not found during debugging session
Debugging session ended<!--QuoteEnd--></div><!--QuoteEEnd-->
Does anyone have any idea how I might go about successfully attaching to this process?
Unrelated to this - I was really surprised to find that the guys who wrote Decoda are the Natural Selection team. Natural Selection being one of my favourite games, and coming across Decoda unrelated to this on the Lua mailing list.
Comments
Does anyone have any idea how I might go about successfully attaching to this process?
Unrelated to this - I was really surprised to find that the guys who wrote Decoda are the Natural Selection team. Natural Selection being one of my favourite games, and coming across Decoda unrelated to this on the Lua mailing list.<!--QuoteEnd--></div><!--QuoteEEnd-->
At a guess I would say that you need to attach Decoda to the lua5.1 exe that is spawned from Invoke.exe, not the Invoke itself.
Most likely the problem is that the Lua executable you are using statically links with Lua and you don't have the PDB files. Decoda requires one of these two things so that it can locate the Lua API functions in memory. I downloaded the latest version from Lua forge (http://luaforge.net/frs/download.php/2218/lua5_1_2_Win32_bin.zip) which does dynamically link with the Lua DLL. I tested it with Decoda and it works correctly. Is this is the same version you are using?
Most likely the problem is that the Lua executable you are using statically links with Lua and you don't have the PDB files. Decoda requires one of these two things so that it can locate the Lua API functions in memory. I downloaded the latest version from Lua forge (http://luaforge.net/frs/download.php/2218/lua5_1_2_Win32_bin.zip) which does dynamically link with the Lua DLL. I tested it with Decoda and it works correctly. Is this is the same version you are using?<!--QuoteEnd--></div><!--QuoteEEnd-->
I'm using that version (although I've also compiled a version of Lua with a massive pause at the start so I can attach Decoda before lua_open, in case that makes a difference). I think somehow the way I've set up my FastCGI is causing the problem, as Decoda has worked great for all my other programs. I'll play with it a little bit more, and if I can't get anywhere, I'll throw away the abomination that FastCGI seems to be, and move to SCGI (although that means writing a lot more code for me). I really do think that Decoda seems like a potentially extremely handy tool for debugging long-lived CGI processes (i.e. FastCGI/SCGI).
Unrelated to this issue, it would be somewhat handy if there was an option in Decoda to pass through the name of the current file being edited as a parameter to an External Tool (although I wouldn't be surprised if this was already built in, and I just hadn't come across it) - allowing it to also be used as an IDE for the standard Lua interpreter, which is a fairly common scenario for me.
Unrelated to this issue, it would be somewhat handy if there was an option in Decoda to pass through the name of the current file being edited as a parameter to an External Tool (although I wouldn't be surprised if this was already built in, and I just hadn't come across it) - allowing it to also be used as an IDE for the standard Lua interpreter, which is a fairly common scenario for me.<!--QuoteEnd--></div><!--QuoteEEnd-->
If you send me your exe, dlls (and pdbs if they exist) I'll take a look at it (max@unknownworlds.com).
As for the external tools, there's currently a way to do what you want. It basically works the same as MSVC where you can use "macros" in the command line. These are the ones that exist with their meaning:
$(ItemPath) - Complete directory, file name and extension.
$(ItemDir) - Directory the file is in (no trailing backslash)
$(ItemFileName) - Name of the file with no directory
$(ItemExt) - File extension (no preceding period)
Now I'm able to break into my web application and check tree-structured variable contents without having to trawl through massive logs (logs get annoying very quickly).