diff options
Diffstat (limited to 'ltests.c')
-rw-r--r-- | ltests.c | 26 |
1 files changed, 12 insertions, 14 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 2.60 2009/04/14 19:10:17 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 2.61 2009/04/17 14:28:06 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 | */ |
@@ -285,6 +285,16 @@ static void checkclosure (global_State *g, Closure *cl) { | |||
285 | } | 285 | } |
286 | 286 | ||
287 | 287 | ||
288 | static int lua_checkpc (pCallInfo ci) { | ||
289 | if (!isLua(ci)) return 1; | ||
290 | else { | ||
291 | Proto *p = ci_func(ci)->l.p; | ||
292 | return p->code <= ci->u.l.savedpc && | ||
293 | ci->u.l.savedpc <= p->code + p->sizecode; | ||
294 | } | ||
295 | } | ||
296 | |||
297 | |||
288 | static void checkstack (global_State *g, lua_State *L1) { | 298 | static void checkstack (global_State *g, lua_State *L1) { |
289 | StkId o; | 299 | StkId o; |
290 | CallInfo *ci; | 300 | CallInfo *ci; |
@@ -298,7 +308,7 @@ static void checkstack (global_State *g, lua_State *L1) { | |||
298 | checkliveness(g, gt(L1)); | 308 | checkliveness(g, gt(L1)); |
299 | for (ci = L1->ci; ci != NULL; ci = ci->previous) { | 309 | for (ci = L1->ci; ci != NULL; ci = ci->previous) { |
300 | lua_assert(ci->top <= L1->stack_last); | 310 | lua_assert(ci->top <= L1->stack_last); |
301 | lua_assert(lua_checkpc(L1, ci)); | 311 | lua_assert(lua_checkpc(ci)); |
302 | } | 312 | } |
303 | if (L1->stack) { | 313 | if (L1->stack) { |
304 | for (o = L1->stack; o < L1->top; o++) | 314 | for (o = L1->stack; o < L1->top; o++) |
@@ -352,18 +362,6 @@ printf(">>> %d %s %02x\n", g->gcstate, luaT_typenames[gch(o)->tt], gch(o)->mar | |||
352 | } | 362 | } |
353 | 363 | ||
354 | 364 | ||
355 | int lua_checkpc (lua_State *L, pCallInfo ci) { | ||
356 | if (!isLua(ci)) return 1; | ||
357 | else { | ||
358 | Proto *p = ci_func(ci)->l.p; | ||
359 | if (ci != L->ci) | ||
360 | return p->code <= ci->savedpc && ci->savedpc <= p->code + p->sizecode; | ||
361 | else | ||
362 | return p->code <= L->savedpc && L->savedpc <= p->code + p->sizecode; | ||
363 | } | ||
364 | } | ||
365 | |||
366 | |||
367 | int lua_checkmemory (lua_State *L) { | 365 | int lua_checkmemory (lua_State *L) { |
368 | global_State *g = G(L); | 366 | global_State *g = G(L); |
369 | GCObject *o; | 367 | GCObject *o; |