aboutsummaryrefslogtreecommitdiff
path: root/ltests.c
diff options
context:
space:
mode:
Diffstat (limited to 'ltests.c')
-rw-r--r--ltests.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/ltests.c b/ltests.c
index 6ccc5042..9e7feda2 100644
--- a/ltests.c
+++ b/ltests.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltests.c,v 2.22 2005/03/23 17:51:11 roberto Exp roberto $ 2** $Id: ltests.c,v 2.23 2005/03/28 17:17:53 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*/
@@ -281,8 +281,10 @@ static void checkstack (global_State *g, lua_State *L1) {
281 } 281 }
282 checkliveness(g, gt(L1)); 282 checkliveness(g, gt(L1));
283 if (L1->base_ci) { 283 if (L1->base_ci) {
284 for (ci = L1->base_ci; ci <= L1->ci; ci++) 284 for (ci = L1->base_ci; ci <= L1->ci; ci++) {
285 lua_assert(ci->top <= L1->stack_last); 285 lua_assert(ci->top <= L1->stack_last);
286 lua_assert(lua_checkpc(L1, ci));
287 }
286 } 288 }
287 else lua_assert(L1->size_ci == 0); 289 else lua_assert(L1->size_ci == 0);
288 if (L1->stack) { 290 if (L1->stack) {
@@ -337,6 +339,18 @@ printf(">>> %d %s %02x\n", g->gcstate, luaT_typenames[o->gch.tt], o->gch.marke
337} 339}
338 340
339 341
342int lua_checkpc (lua_State *L, pCallInfo ci) {
343 if (ci == L->base_ci || !f_isLua(ci)) return 1;
344 else {
345 Proto *p = ci_func(ci)->l.p;
346 if (ci < L->ci)
347 return p->code <= ci->savedpc && ci->savedpc <= p->code + p->sizecode;
348 else
349 return p->code <= L->savedpc && L->savedpc <= p->code + p->sizecode;
350 }
351}
352
353
340int lua_checkmemory (lua_State *L) { 354int lua_checkmemory (lua_State *L) {
341 global_State *g = G(L); 355 global_State *g = G(L);
342 GCObject *o; 356 GCObject *o;