lldbg(local lua debugger) modified from RLdb(http://luaforge.net/projects/rldb/). Major changes:
- Add ability to attach to other process that runs lua scripts(like gdb --pid)
- Multiple lua_State support(although multithreading is not supported)
- Faster breakpoint check
- Add ability to view source code, precompiled(lua/luajit) bytecode support
- Now support n/s/o/c debug command(for Next line/Step in/Step out/Continue)
cd lldb && make;
cd lldbg && make
MSVC build - Create a project and compile lldb/*.c to lldb.dll and lldbg/*.c to lldbg.exe. Remember to add -DOS_WIN to projects.
require "lldb" and everything is ready, this line will NOT slow down your script, lldb works on SIGUSR2 signal(default in linux), and EventObject in windows, so debugger will keep deactived till lldbg starts.
shoud run lldbg --help to see more.
shoud type 'h' when debugging to see more, sorry :-(.
- In linux, send SIGUSR2 to a process will terminate it(so be careful using lldbg -p)
- Embeded lua-engine program can use code below to setup lldb support while create a new state(nobody want to care about the debugger):
lua_getglobal(L, "require");
lua_pushliteral(L, "lldb");
if (lua_pcall(L, 1, 0, 0)) {
lua_pop(L, 1);
}