LDT is an IDE for lua based on eclipse. It is quite nice and the best free lua debugger I've seen(I've just stumbled upon it the last 2 days or so). It took me a bit to get setup properly but because the way it works using remote debugging I think it can be used to debug lualatex.

I have gotten it to work with lualatex except for getting breakpoints to work(just runs through the code as if they weren't set). I've started a thread on the koneki forum for it to see if the developers can help with the issue. (it's probably something simple I'd imagine)

I believe the ability to debug lua IN latex will will be tremendously beneficial(at the very least, to me) so I'm posting this to "spread the word".

Here is the latest

The issue I get with the following test is:

"LuaSocket 2.0.2

test.tex:8: LuaTeX error debugger.lua:68: module 'socket' not found:
 no field package.preload['socket']
 [kpse lua searcher] file not found: 'socket'
 [kpse C searcher] file not found: 'socket'
stack traceback:"

with the following code(DebugTest.lua):

    socket = require("socket")

Line 68 in debugger is

    local socketcore = require"socket.core"

and I've tried changing it to

    local socketcore = require"socket"

but get the same error.

I then copied core.dll and socket.lua from my main lua distro so that lualatex could find it(same dir as my lua code). This got past that error. (I don't know why the first line worked and printed version though... should be the exact same stuff?)

Next I got an error in base_path:

"156: if not base_dir then error("Unable to determine the working directory.")end"

which I just hard coded the base_dir to the source code files.

When I ran for the first time I got a timeout trying to access the debugger. When I started the DGBT and ran everything worked BUT the breakpoints were not hit. Subsequently running the tex program without DGBT running did not cause it to time out but printed debugger_loop error msg that generally happens in LDT.

So the only real issue is getting the breakpoints working. Any ideas?


As far as I know there is no way to step through lua code... and in fact I imagine this method could be easily adapted to step through tex code(well, in some sense). Anyways, hopefully more people are interested in getting this to work than me and see the benefit.

Browse other questions tagged or ask your own question.