diff options
author | Mike Pall <mike> | 2013-09-03 15:53:21 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2013-09-03 15:53:21 +0200 |
commit | fffe75a03b16e11327040d36f2769f763d1c29c6 (patch) | |
tree | f067409a7f69fc5d9a62ee96854c9bea2973f3e2 /src | |
parent | a6936be814adee5d4d61e729d91b2c3dd8e16e6e (diff) | |
download | luajit-fffe75a03b16e11327040d36f2769f763d1c29c6.tar.gz luajit-fffe75a03b16e11327040d36f2769f763d1c29c6.tar.bz2 luajit-fffe75a03b16e11327040d36f2769f763d1c29c6.zip |
Fix frame traversal for backtraces.
Diffstat (limited to 'src')
-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 be7fb2b1..09896462 100644 --- a/src/lj_debug.c +++ b/src/lj_debug.c | |||
@@ -71,9 +71,18 @@ static BCPos debug_framepc(lua_State *L, GCfunc *fn, cTValue *nextframe) | |||
71 | /* Lua function below errfunc/gc/hook: find cframe to get the PC. */ | 71 | /* Lua function below errfunc/gc/hook: find cframe to get the PC. */ |
72 | void *cf = cframe_raw(L->cframe); | 72 | void *cf = cframe_raw(L->cframe); |
73 | TValue *f = L->base-1; | 73 | TValue *f = L->base-1; |
74 | if (cf == NULL) | 74 | for (;;) { |
75 | return NO_BCPOS; | 75 | if (cf == NULL) |
76 | while (f > nextframe) { | 76 | return NO_BCPOS; |
77 | while (cframe_nres(cf) < 0) { | ||
78 | if (f >= restorestack(L, -cframe_nres(cf))) | ||
79 | break; | ||
80 | cf = cframe_raw(cframe_prev(cf)); | ||
81 | if (cf == NULL) | ||
82 | return NO_BCPOS; | ||
83 | } | ||
84 | if (f < nextframe) | ||
85 | break; | ||
77 | if (frame_islua(f)) { | 86 | if (frame_islua(f)) { |
78 | f = frame_prevl(f); | 87 | f = frame_prevl(f); |
79 | } else { | 88 | } else { |
@@ -82,8 +91,6 @@ static BCPos debug_framepc(lua_State *L, GCfunc *fn, cTValue *nextframe) | |||
82 | f = frame_prevd(f); | 91 | f = frame_prevd(f); |
83 | } | 92 | } |
84 | } | 93 | } |
85 | if (cframe_prev(cf)) | ||
86 | cf = cframe_raw(cframe_prev(cf)); | ||
87 | ins = cframe_pc(cf); | 94 | ins = cframe_pc(cf); |
88 | } | 95 | } |
89 | } | 96 | } |