[ZeroBrane Studio] Re: debug lua on an embedded micro

  • From: "Steve Russell" <steve.russell@xxxxxxxxxxxxxxxxxxxxx>
  • To: <zerobrane@xxxxxxxxxxxxx>
  • Date: Wed, 17 Sep 2014 11:20:58 +0100

Hi Paul,

 

Is it possible to get ZB debug multiple Lua scripts?  My app has many running 
in separate threads.  It appears if ZB has scripts open then it will try to 
debug them.  Then I’m not sure if moddebug/ZB knows which script to debug. Is 
it the one at the front tab? Should all other scripts be closed in ZB?

 

Regards,

Steve

 

From: zerobrane-bounce@xxxxxxxxxxxxx [mailto:zerobrane-bounce@xxxxxxxxxxxxx] On 
Behalf Of Paul K
Sent: 16 September 2014 19:01
To: zerobrane@xxxxxxxxxxxxx
Subject: [ZeroBrane Studio] Re: debug lua on an embedded micro

 

Hi Steve,

 

> Is there a correct procedure for stopping a debug session.  I was mid 
> debugging a Lua function call run() but when I stop debugging (Shift+F5) or 
> stop the server in ZB, my application crashes.  I think Lua is calling 
> os_exit() and causing my app to quit unceremoniously (which I can probably 
> tidy up).  But why would Lua try to quit?

 

Yes, starting from v0.70 ZBS includes "Project | Detach process" (also on the 
toolbar on the right side next to Stop). This will stop debugging, but will 
continue the process without "killing" it.

 

Another option that I use for environments like this is to set "os.exit = 
require('mobdebug').done" in your application after "require('mobdebug')", 
which will have the same effect as described above when you hit "Stop 
debugging" in the IDE.

 

In a similar way you can change os.exit to some more complex code that will 
stop debugging (using done() and then do whatever graceful shutdown you need to 
do in your application).

 

Paul.

 

Other related posts: