|
@@ -102,9 +102,12 @@ static BCPos debug_framepc(lua_State *L, GCfunc *fn, cTValue *nextframe)
|
|
|
pos = proto_bcpos(pt, ins) - 1;
|
|
|
#if LJ_HASJIT
|
|
|
if (pos > pt->sizebc) { /* Undo the effects of lj_trace_exit for JLOOP. */
|
|
|
- GCtrace *T = (GCtrace *)((char *)(ins-1) - offsetof(GCtrace, startins));
|
|
|
- lua_assert(bc_isret(bc_op(ins[-1])));
|
|
|
- pos = proto_bcpos(pt, mref(T->startpc, const BCIns));
|
|
|
+ if (bc_isret(bc_op(ins[-1]))) {
|
|
|
+ GCtrace *T = (GCtrace *)((char *)(ins-1) - offsetof(GCtrace, startins));
|
|
|
+ pos = proto_bcpos(pt, mref(T->startpc, const BCIns));
|
|
|
+ } else {
|
|
|
+ pos = NO_BCPOS; /* Punt in case of stack overflow. */
|
|
|
+ }
|
|
|
}
|
|
|
#endif
|
|
|
return pos;
|