lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

> 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.

I do the same thing, but, as you noticed, it's not reliable as there
are several cases that produce an incorrect value: error(),
pcall(load, ''), or coroutine.resume call to a function that doesn't
have any other instructions to execute (for example, when yield() was
the last instruction). There are probably other cases as well (for
example, tail call/return events), so I ended up "fixing" the stack
level in the line hook, but only traversing from the current stack
level, so the additional processing is fairly "cheap".