Links:
Install Lua Debugger:
Just download debugger.lua
to a directory where require()
can find it:
curl -O https://raw.githubusercontent.com/slembcke/debugger.lua/master/debugger.lua
Usage:
Edit the file to debug:
local dbg = require("debugger")
Add the following anywhere (NOTE to NSE developers: this should be within the action
section):
dbg()
Debugging Lua C extensions with gdb
This is straightforward:
Load
lua
into the debugger:gdb lua Reading symbols from /usr/bin/lua...(no debugging symbols found)...done. (gdb)
Set the breakpoint in the C code:
(gdb) b my_c_function
Run the Lua script in
gdb
until the breakpoint:(gdb) run my_script.lua Starting program: /usr/bin/lua my_script.lua
Debug as any other
gdb
session.