diff options
Diffstat (limited to '')
-rw-r--r-- | src/lj_debug.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/lj_debug.c b/src/lj_debug.c index 8166fcc0..92c216f9 100644 --- a/src/lj_debug.c +++ b/src/lj_debug.c | |||
@@ -72,9 +72,18 @@ static BCPos debug_framepc(lua_State *L, GCfunc *fn, cTValue *nextframe) | |||
72 | /* Lua function below errfunc/gc/hook: find cframe to get the PC. */ | 72 | /* Lua function below errfunc/gc/hook: find cframe to get the PC. */ |
73 | void *cf = cframe_raw(L->cframe); | 73 | void *cf = cframe_raw(L->cframe); |
74 | TValue *f = L->base-1; | 74 | TValue *f = L->base-1; |
75 | if (cf == NULL) | 75 | for (;;) { |
76 | return NO_BCPOS; | 76 | if (cf == NULL) |
77 | while (f > nextframe) { | 77 | return NO_BCPOS; |
78 | while (cframe_nres(cf) < 0) { | ||
79 | if (f >= restorestack(L, -cframe_nres(cf))) | ||
80 | break; | ||
81 | cf = cframe_raw(cframe_prev(cf)); | ||
82 | if (cf == NULL) | ||
83 | return NO_BCPOS; | ||
84 | } | ||
85 | if (f < nextframe) | ||
86 | break; | ||
78 | if (frame_islua(f)) { | 87 | if (frame_islua(f)) { |
79 | f = frame_prevl(f); | 88 | f = frame_prevl(f); |
80 | } else { | 89 | } else { |
@@ -83,8 +92,6 @@ static BCPos debug_framepc(lua_State *L, GCfunc *fn, cTValue *nextframe) | |||
83 | f = frame_prevd(f); | 92 | f = frame_prevd(f); |
84 | } | 93 | } |
85 | } | 94 | } |
86 | if (cframe_prev(cf)) | ||
87 | cf = cframe_raw(cframe_prev(cf)); | ||
88 | ins = cframe_pc(cf); | 95 | ins = cframe_pc(cf); |
89 | } | 96 | } |
90 | } | 97 | } |