mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 15:14:08 +00:00
Improve error reporting for traces aborted in non-Lua functions.
This commit is contained in:
parent
e664945e0b
commit
afa07e0c46
@ -441,10 +441,21 @@ static int trace_abort(jit_State *J)
|
||||
if (J->curtrace) { /* Is there anything to abort? */
|
||||
ptrdiff_t errobj = savestack(L, L->top-1); /* Stack may be resized. */
|
||||
lj_vmevent_send(L, TRACE,
|
||||
TValue *frame;
|
||||
const BCIns *pc;
|
||||
GCfunc *fn;
|
||||
setstrV(L, L->top++, lj_str_newlit(L, "abort"));
|
||||
setintV(L->top++, J->curtrace);
|
||||
setfuncV(L, L->top++, J->fn);
|
||||
setintV(L->top++, proto_bcpos(J->pt, J->pc));
|
||||
/* Find original Lua function call to generate a better error message. */
|
||||
frame = J->L->base-1;
|
||||
pc = J->pc;
|
||||
while (!isluafunc(frame_func(frame))) {
|
||||
pc = frame_pc(frame) - 1;
|
||||
frame = frame_prev(frame);
|
||||
}
|
||||
fn = frame_func(frame);
|
||||
setfuncV(L, L->top++, fn);
|
||||
setintV(L->top++, proto_bcpos(funcproto(fn), pc));
|
||||
copyTV(L, L->top++, restorestack(L, errobj));
|
||||
copyTV(L, L->top++, &J->errinfo);
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user