mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 15:14:08 +00:00
Handle all stack layouts in (delayed) TRACE vmevent.
Thanks to Sergey Bronnikov and Peter Cawley. #1087
This commit is contained in:
parent
92b89d005a
commit
b138ccfa91
@ -524,21 +524,27 @@ static int trace_abort(jit_State *J)
|
|||||||
J->cur.link = 0;
|
J->cur.link = 0;
|
||||||
J->cur.linktype = LJ_TRLINK_NONE;
|
J->cur.linktype = LJ_TRLINK_NONE;
|
||||||
lj_vmevent_send(L, TRACE,
|
lj_vmevent_send(L, TRACE,
|
||||||
TValue *frame;
|
cTValue *bot = tvref(L->stack);
|
||||||
|
cTValue *frame;
|
||||||
const BCIns *pc;
|
const BCIns *pc;
|
||||||
GCfunc *fn;
|
BCPos pos = 0;
|
||||||
setstrV(L, L->top++, lj_str_newlit(L, "abort"));
|
setstrV(L, L->top++, lj_str_newlit(L, "abort"));
|
||||||
setintV(L->top++, traceno);
|
setintV(L->top++, traceno);
|
||||||
/* Find original Lua function call to generate a better error message. */
|
/* Find original Lua function call to generate a better error message. */
|
||||||
frame = J->L->base-1;
|
for (frame = J->L->base-1, pc = J->pc; ; frame = frame_prev(frame)) {
|
||||||
pc = J->pc;
|
if (isluafunc(frame_func(frame))) {
|
||||||
while (!isluafunc(frame_func(frame))) {
|
pos = proto_bcpos(funcproto(frame_func(frame)), pc);
|
||||||
pc = (frame_iscont(frame) ? frame_contpc(frame) : frame_pc(frame)) - 1;
|
break;
|
||||||
frame = frame_prev(frame);
|
} else if (frame_prev(frame) <= bot) {
|
||||||
|
break;
|
||||||
|
} else if (frame_iscont(frame)) {
|
||||||
|
pc = frame_contpc(frame) - 1;
|
||||||
|
} else {
|
||||||
|
pc = frame_pc(frame) - 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fn = frame_func(frame);
|
setfuncV(L, L->top++, frame_func(frame));
|
||||||
setfuncV(L, L->top++, fn);
|
setintV(L->top++, pos);
|
||||||
setintV(L->top++, proto_bcpos(funcproto(fn), pc));
|
|
||||||
copyTV(L, L->top++, restorestack(L, errobj));
|
copyTV(L, L->top++, restorestack(L, errobj));
|
||||||
copyTV(L, L->top++, &J->errinfo);
|
copyTV(L, L->top++, &J->errinfo);
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user