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

  • From: "Jim Hall" <j.hall@xxxxxxxxxxx>
  • To: <zerobrane@xxxxxxxxxxxxx>
  • Date: Tue, 16 Sep 2014 14:44:14 -0400

Hi Paul,

 

I appreciate the quick reply.

I did try ZBS ver 0.80 along with mobdebug ver 0.60 – no help.

I also tried the require(“mobdebug”).on() – also no help.

 

I added some print statements to modbebug to do some tracing.

I found that when my script hits the breakpoint, execution stops with a  call 
to is_pending()

                Mobdebug line 597  ->  if is_pending(server) then 
handle_breakpoint(server) end

Is_pending does not return until ZBS sends something – in this case the SUSPEND 
message when I click ‘pause’

 

Is mobdebug supposed to send ZBS the pause message before calling is_pending()?

 

Thanks

 

Jim Hall                     <mailto:j.hall@xxxxxxxxxxx> j.hall@xxxxxxxxxxx

781-254-4579           <http://www.air2app.com> www.air2app.com

 

      

 

Monitor and Control Your Remote Application

 

From: zerobrane-bounce@xxxxxxxxxxxxx [mailto:zerobrane-bounce@xxxxxxxxxxxxx] On 
Behalf Of Paul K
Sent: Monday, September 15, 2014 4:26 PM
To: zerobrane@xxxxxxxxxxxxx
Subject: [ZeroBrane Studio] Re: debug lua on an embedded micro

 

Hi Jim,

> 1.       Does Zerobrane require mobdebug to run a server. If so do I also add 
> -require("mobdebug").listen?

No; mobdebug includes both the client and the server side and you only need to 
use the client side; the server side (the "listen" call) is only used by the 
controller (which is ZBS in this case). This also means that you can reduce the 
amount of memory taken by ZBS if you remove those parts of the library from 
your client code.

> 2.       When the script hits a breakpoint the script stops but the IDE 
> doesn’t indicate the script is stopped. If I click the ‘pause’ symbol the IDE 
> then changes state showing the brake point in the script. I have looked at 
> FAQs. I have added - require('mobdebug').coro() – no help

coro() call has some limitations. It just sets a wrapper around 
coroutine.create() to enable debugging in created coroutines, which means that 
if your coroutines are created before coro() is called or created using C API, 
this won't work.

You can always call require('mobdebug').on() to enable debugging from a 
coroutine (it only needs to be done once per coroutine, but doesn't hurt to do 
more than once; if the debugging is not started, it's a noop call, so you can 
leave it even when you don't debug). See this FAQ answer for more details: 
http://studio.zerobrane.com/doc-faq.html#why-breakpoints-are-not-triggered

> When the script hits a breakpoint the script stops but the IDE doesn’t 
> indicate the script is stopped.

I re-read the question and realized that I might have misunderstood your 
situation. I still keep the "original" answer (above) as it may provide some 
useful information for you, but I don't have a good answer a to why the app may 
be stopped in the debugger, but the IDE doesn't react to it; I've never seen 
this to happen before. All I can suggest is to try with the latest ZBS (0.80) 
and enable verbose debugging by setting debugger.verbose=true in the config 
file. You should see details of the debugger interaction in the Output window.

If you end up modifying mobdebug to make it work better for your case, please 
share the modifications as I've been considering making similar changes (but 
don't have hardware to test it on) to allow modebug to be used in the 
environments with limited memory, even if the changes are at the level of 
marking code fragments that can be removed to limit memory use.

Paul.

PNG image

Other related posts: