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

  • From: Paul K <paul@xxxxxxxxxxxxx>
  • To: "zerobrane@xxxxxxxxxxxxx" <zerobrane@xxxxxxxxxxxxx>
  • Date: Mon, 15 Sep 2014 13:26:18 -0700

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.

Other related posts: