[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Extensions made by the Tilde debugger
- From: liam mail <liam.list@...>
- Date: Sun, 28 Aug 2011 13:01:10 +0100
On 28 August 2011 04:03, Should Pain <pengzhicheng1986@gmail.com> wrote:
> 于 2011-8-28 9:11, HyperHacker 写道:
>>
>> On Sat, Aug 27, 2011 at 17:03, Joshua Jensen<josh.jjensen@gmail.com>
>> wrote:
>>>
>>> * A hook to catch errors, allowing the debugger to break at the point of
>>> error in the code and allow the user to investigate further.
>>> * The ability to expand varargs.
>>>
>>> The patch is below. Does Lua 5.2 expose facilities for this now?
>>>
>>>
>>>
>>> static void funcinfo (lua_Debug *ar, Closure *cl) {
>>> if (cl->c.isC) {
>>> @@ -608,6 +626,8 @@
>>> incr_top(L);
>>> luaD_call(L, L->top - 2, 1); /* call it */
>>> }
>>> + if (L->hookmask& LUA_MASKERROR)
>>> + luaD_callhook(L, LUA_HOOKERROR, -1);
>>> luaD_throw(L, LUA_ERRRUN);
>>> }
>>>
>>>
>>>
>>>
>>>
>> These seem like quite useful extensions, although I'm not sure what
>> the difference is between the error hook and the handler set by
>> xpcall...
>>
>
> according to the patch, the hook is called before the error is thrown out,
> while the handler of xpcall is called after the error thrown.
> or in another word, this hook is called at the error point, while the
> handler of xpcall is called at the recover point.
>
> although it seems trivial, I think it does make diffrences to a debugger,
> e.g., to examine the detailed status and environment of the error.
>
> so I think this hook is useful, especially for a debugger.
>
> Joshua might also use this feature for other uses in his debugger.
>
>
>
>
>
>
A more useful hook in the core would be for breakpoints, so a
breakpoint instruction can overwrite the instruction at the location.
As for catching an error before the error is thrown, this is something
I already do without modifying the core per say via the use of
trampolines.
Liam