[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua hook and debugger implementation questions
- From: Dibyendu Majumdar <mobile@...>
- Date: Fri, 20 May 2016 23:32:08 +0100
Hi Paul
On 20 May 2016 at 23:07, Paul K <paul@zerobrane.com> wrote:
>> First - at present there isn't an ability to invoke the hook when an
>> error is thrown or caught. Is it possible / good idea to add support
>> for this? From a debugger perspective the throwing or catching of an
>> error is similar to function call / return.
>
> This has been discussed briefly in the past; for example,
> http://lua-users.org/lists/lua-l/2014-03/msg00457.html, which
> references another discussion on lujit maillist:
> http://www.freelists.org/post/luajit/Overriding-debugtraceback. There
> is also a patch to the Tilde debugger that adds the error hook to lua
> 5.1: https://github.com/jjensen/lua-tilde/blob/master/lib/lua/lua_5.1.3.patch.
>
> I'd be interested in this hook as well.
Thank you for the reply and the pointers to previous discussion. I
didn't think of yield/resume (as I have not yet started using this
feature of Lua!) but it makes sense that a hook would be useful in
this case also.
Debuggers typically need to allow users to break automatically when an
error is thrown - I am not sure what the alternative method of
implementation would be other than a hook.
>> A simple tracking of call / return statements will fail if an error is thrown
>
> Do you have a script that demonstrates when this tracking is not working?
>
Not yet as I am still wondering how to implement 'step out' and 'step
over'. I see that other implementations basically maintain a stack
level indicator that is incremented when a Call is encountered and
decremented when a Return is encountered, but thinking about it I
cannot see how this would work when errors are thrown.
Regards
Dibyendu