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

  • From: "Jim Hall" <j.hall@xxxxxxxxxxx>
  • To: <zerobrane@xxxxxxxxxxxxx>
  • Date: Thu, 16 Oct 2014 06:04:28 -0400

Hi Paul,

 

Crash problem update.

 

The callback causing the crash was initiated in a different OS task. That task 
did not have enough stack space allocated for Lua use. Fixed and all is well.

 

Thank you for your help. 

 

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: Friday, September 19, 2014 3:17 PM
To: zerobrane@xxxxxxxxxxxxx
Subject: [ZeroBrane Studio] Re: debug lua on an embedded micro

 

Hi Jim,

 

> Fixed that and now breakpoints work as expected. Thanks for your help.

 

Ok; that's good. Thank you for the update.

 

> I have a callback function in my script that is called from a low level 
> hardware interrupt. The function processes data and saves to a table for 
> later use. I am seeing two problems

> 1.       Break points don’t work in the callback. I added a print(line) to 
> debug_hook. I never see the this function’s line numbers. It is being called 
> and does its job. Just not visible to mobdebug.

If the callback is called as a coroutine, you may need to enable debugging for 
coroutines (it's off by default). The easiest way to try is to add 
require('mobdebug').on() to the callback code to see if it fixes that issue. 
You mentioned trying on() earlier, but I don't know if you added it to the code 
of the callback function itself. As I mentioned earlier in this thread, there 
are other options to enable breakpoints for coroutines, but you need to watch 
for several gotchas listed here: 
http://studio.zerobrane.com/doc-faq.html#why-breakpoints-are-not-triggered (see 
items 1 and 2).

> 2.       With the callback function enabled, the application crashes after a 
> few cycles.

You are using your own Lua engine, right? I presume it doesn't crash without 
debugging. Could it be running out of memory? Anything useful in the crash 
stack trace? If the debugging is not triggered for the callback function (as 
you don't see the hook being called), it should not have any impact on that 
code (other than memory being used when you debug other parts of your code).

Paul.

PNG image

Other related posts: