使用 LDT 在 LuaLatex 中调试 Lua

使用 LDT 在 LuaLatex 中调试 Lua

LDT 是基于 eclipse 的 lua IDE。它非常好,是我见过的最好的免费 lua 调试器(我最近两天才偶然发现它)。我花了一点时间才正确设置,但由于它使用远程调试的方式,我认为它可以用于调试 lualatex。

我已经让它与 lualatex 一起工作,除了让断点工作(只是运行代码,就好像它们没有设置一样)。我在 koneki 论坛上为它开了一个帖子,看看开发人员是否能帮助解决这个问题。(我想这可能是一件简单的事情)

我相信在 latex 中调试 lua 的能力将会非常有益(至少对我来说),所以我发布这篇文章来“传播这个消息”。

以下是最新

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")
    print("\n"..socket._VERSION.."\n")
    require("debugger")()
"

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?

http://www.eclipse.org/forums/index.php/m/872983/#msg_872983

据我所知,没有办法逐步执行 lua 代码……事实上,我认为这种方法可以很容易地适应逐步执行 tex 代码(嗯,在某种意义上)。无论如何,希望有更多的人比我更有兴趣让它发挥作用,并看到它的好处。

相关内容