commit 69c775de213b2867eb30ff07b6c98be02ce1a033
parent 6fcdfc6d4fab67f50a8f9e26a4f9a4cf9e1550dc
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Wed, 30 May 2012 13:40:05 -0300
update of 'lua_checkmemory'
Diffstat:
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/ltests.c b/ltests.c
@@ -1,5 +1,5 @@
/*
-** $Id: ltests.c,v 2.126 2012/01/25 21:05:40 roberto Exp roberto $
+** $Id: ltests.c,v 2.127 2012/05/08 13:53:33 roberto Exp roberto $
** Internal Module for Debugging of the Lua Implementation
** See Copyright Notice in lua.h
*/
@@ -189,10 +189,15 @@ static int testobjref1 (global_State *g, GCObject *f, GCObject *t) {
static void printobj (global_State *g, GCObject *o) {
- int i = 0;
+ int i = 1;
GCObject *p;
for (p = g->allgc; p != o && p != NULL; p = gch(p)->next) i++;
- if (p == NULL) i = -1;
+ if (p == NULL) {
+ i = 1;
+ for (p = g->finobj; p != o && p != NULL; p = gch(p)->next) i++;
+ if (p == NULL) i = 0; /* zero means 'not found' */
+ else i = -i; /* negative means 'found in findobj list */
+ }
printf("%d:%s(%p)-%c(%02X)", i, ttypename(gch(o)->tt), (void *)o,
isdead(g,o)?'d':isblack(o)?'b':iswhite(o)?'w':'g', gch(o)->marked);
}
@@ -376,7 +381,8 @@ static void checkgraylist (GCObject *l) {
l_setbit(l->gch.marked, TESTGRAYBIT);
switch (gch(l)->tt) {
case LUA_TTABLE: l = gco2t(l)->gclist; break;
- case LUA_TFUNCTION: l = gco2cl(l)->c.gclist; break;
+ case LUA_TLCL: l = gco2lcl(l)->gclist; break;
+ case LUA_TCCL: l = gco2ccl(l)->gclist; break;
case LUA_TTHREAD: l = gco2th(l)->gclist; break;
case LUA_TPROTO: l = gco2p(l)->gclist; break;
default: lua_assert(0); /* other objects cannot be gray */