[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: Tue, 31 May 2016 00:06:37 +0100
On 30 May 2016 at 13:18, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
>> As mentioned before I am thinking of tagging each CallInfo instance
>> with a stack level. I notice that Lua already maintains a field named
>> 'nci' in the Lua State. So tagging new CallInfo instances is simply a
>> matter of assigning a newly allocated CallInfo with the current value
>> of 'nci' I think.
>
> Sure.
>
Thanks Roberto. In my Lua implementation I have added a field in
Callinfo to track stack level, and I have amended the line hook to
pass this level in the lua_Debug structure as a public field. This has
made it quite simple to implement the 'step out' and 'step over'
commands in a debugger which otherwise is quite difficult if not
impossible to implement reliably and efficiently. Of course my
debugger is implemented in C so I am not yet sure whether this
enhancement would translate to an improvement in the debuggers
written in Lua - I have not looked at that. The C implementation also
has the advantage of being able to detect a change in lua_State (i.e.
thread).
I think an enhancement along these lines would be welcome to folks
implementing Lua Debuggers.
Regards