aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2010-02-15 22:44:23 +0100
committerMike Pall <mike>2010-02-15 22:44:23 +0100
commitafa07e0c4645289c6c00541c653b190394b150a1 (patch)
tree4d010f76bb00fa88d4fb95989c606e387486124d /src
parente664945e0bc26b5c6c3860a1d63913d56833c173 (diff)
downloadluajit-afa07e0c4645289c6c00541c653b190394b150a1.tar.gz
luajit-afa07e0c4645289c6c00541c653b190394b150a1.tar.bz2
luajit-afa07e0c4645289c6c00541c653b190394b150a1.zip
Improve error reporting for traces aborted in non-Lua functions.
Diffstat (limited to 'src')
-rw-r--r--src/lj_trace.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/lj_trace.c b/src/lj_trace.c
index 8cbbf0f3..ae88f844 100644
--- a/src/lj_trace.c
+++ b/src/lj_trace.c
@@ -441,10 +441,21 @@ static int trace_abort(jit_State *J)
441 if (J->curtrace) { /* Is there anything to abort? */ 441 if (J->curtrace) { /* Is there anything to abort? */
442 ptrdiff_t errobj = savestack(L, L->top-1); /* Stack may be resized. */ 442 ptrdiff_t errobj = savestack(L, L->top-1); /* Stack may be resized. */
443 lj_vmevent_send(L, TRACE, 443 lj_vmevent_send(L, TRACE,
444 TValue *frame;
445 const BCIns *pc;
446 GCfunc *fn;
444 setstrV(L, L->top++, lj_str_newlit(L, "abort")); 447 setstrV(L, L->top++, lj_str_newlit(L, "abort"));
445 setintV(L->top++, J->curtrace); 448 setintV(L->top++, J->curtrace);
446 setfuncV(L, L->top++, J->fn); 449 /* Find original Lua function call to generate a better error message. */
447 setintV(L->top++, proto_bcpos(J->pt, J->pc)); 450 frame = J->L->base-1;
451 pc = J->pc;
452 while (!isluafunc(frame_func(frame))) {
453 pc = frame_pc(frame) - 1;
454 frame = frame_prev(frame);
455 }
456 fn = frame_func(frame);
457 setfuncV(L, L->top++, fn);
458 setintV(L->top++, proto_bcpos(funcproto(fn), pc));
448 copyTV(L, L->top++, restorestack(L, errobj)); 459 copyTV(L, L->top++, restorestack(L, errobj));
449 copyTV(L, L->top++, &J->errinfo); 460 copyTV(L, L->top++, &J->errinfo);
450 ); 461 );