lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Hi guys,

The recent version of scite-debug allowed for stepping from Lua to
C/C++ code. And the question was, can this be done with Emacs? This is
at least the beginning of the answer to that question ;)

luagdb is a Lua program which harnesses GDB and mimics it sufficiently
so that Emacs will happily consume its output. For instance, if you
were debugging lfs, then after M+x gdb you would type 'luagdb
testlfs.lua :lua' where the second parameter is the _host_ Lua
instance which will run in GDB. If your local version of lfs has
debugging information, then you can single step from Lua into the lfs
source. The lua program does not itself have to have debug information
(in this case gdb picks up the global) but you can supply a fullpath
to a debug version of lua after the colon.

It is also possible to use the packaged clidebugger.lua directly in
Emacs with 'luagdb script.lua'.

Put the contents of the lua-gdb directory on your Lua package path,
and create a shell/batch luagdb pointing to luagdb.lua - e.g., I have
'\stuff\lua\lua \stuff\lua\lua-gdb\luagdb %*' and 'lua
~/lua-gdb/luagdb.lua $*' depending on my current religion.

luagdb relies on lexpect.lua, which is a mini version of the famous
Expect package - this requires a small C extension that does the
actual pseudoterminal stuff on Unix and the spawn-with-pipes on

steve d.