diff options
Diffstat (limited to 'ltests.c')
-rw-r--r-- | ltests.c | 20 |
1 files changed, 9 insertions, 11 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 2.227 2017/11/02 11:28:56 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 2.228 2017/11/03 12:12:30 roberto Exp roberto $ |
3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -309,28 +309,26 @@ static void checkLclosure (global_State *g, LClosure *cl) { | |||
309 | } | 309 | } |
310 | 310 | ||
311 | 311 | ||
312 | static int lua_checkpc (CallInfo *ci) { | 312 | static int lua_checkpc (StkId func) { |
313 | if (!isLua(ci->func)) return 1; | 313 | if (!isLua(func)) return 1; |
314 | else { | 314 | else { |
315 | StkId f = ci->func; | 315 | Proto *p = clLvalue(s2v(func))->p; |
316 | Proto *p = clLvalue(s2v(f))->p; | 316 | return p->code <= func->stkci.u.l.savedpc && |
317 | return p->code <= ci->u.l.savedpc && | 317 | func->stkci.u.l.savedpc <= p->code + p->sizecode; |
318 | ci->u.l.savedpc <= p->code + p->sizecode; | ||
319 | } | 318 | } |
320 | } | 319 | } |
321 | 320 | ||
322 | 321 | ||
323 | static void checkstack (global_State *g, lua_State *L1) { | 322 | static void checkstack (global_State *g, lua_State *L1) { |
324 | StkId o; | 323 | StkId o; |
325 | CallInfo *ci; | ||
326 | UpVal *uv; | 324 | UpVal *uv; |
327 | lua_assert(!isdead(g, L1)); | 325 | lua_assert(!isdead(g, L1)); |
328 | for (uv = L1->openupval; uv != NULL; uv = uv->u.open.next) | 326 | for (uv = L1->openupval; uv != NULL; uv = uv->u.open.next) |
329 | lua_assert(upisopen(uv)); /* must be open */ | 327 | lua_assert(upisopen(uv)); /* must be open */ |
330 | for (ci = L1->ci; ci != NULL; ci = ci->previous) | 328 | for (o = L1->func; o->stkci.previous != 0; o -= o->stkci.previous) { |
331 | lua_assert(lua_checkpc(ci)); | ||
332 | for (o = L1->func; o->stkci.previous != 0; o -= o->stkci.previous) | ||
333 | lua_assert(functop(o) <= L1->stack_last); | 329 | lua_assert(functop(o) <= L1->stack_last); |
330 | lua_assert(lua_checkpc(o)); | ||
331 | } | ||
334 | lua_assert(o == L1->stack); | 332 | lua_assert(o == L1->stack); |
335 | if (L1->stack) { /* complete thread? */ | 333 | if (L1->stack) { /* complete thread? */ |
336 | for (o = L1->stack; o < L1->stack_last + EXTRA_STACK; o++) | 334 | for (o = L1->stack; o < L1->stack_last + EXTRA_STACK; o++) |