|
On 12/20/2013 07:52 PM, Paul K wrote:
Hi Thomas,I think you get the idea, it's all straight forward, a mapping of the Lua C debug API. The biggest difference is probably that I use Lua's debug API and not the Lua library.Yes, I think I get the idea. How do you "attach" the debugger to your process? Paul.
Hi Paul,the debugger on the interpreter is totally stateless regarding the connection. So there is not much of "attaching" involved here. The debugger state is totally stored internally. This way you can actually use several clients to debug a single Lua state.
The editor "attaches" to the debugger by calling a remote procedure that is always available "Lua.GetStates()" that returns all Lua states currently running. It then gets a change count variable for each state that the editor polls, every time a Lua state has executed something, the change counter increases and the editor makes an refresh of the stack.
To be able to process debug commands at any time in the execution, I have one single count hook that stops my interpreter if an external (debug-)command is pending.
-- Thomas