aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ltests.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/ltests.c b/ltests.c
index 656e4b6a..2b0f345d 100644
--- a/ltests.c
+++ b/ltests.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltests.c,v 2.126 2012/01/25 21:05:40 roberto Exp roberto $ 2** $Id: ltests.c,v 2.127 2012/05/08 13:53:33 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*/
@@ -189,10 +189,15 @@ static int testobjref1 (global_State *g, GCObject *f, GCObject *t) {
189 189
190 190
191static void printobj (global_State *g, GCObject *o) { 191static void printobj (global_State *g, GCObject *o) {
192 int i = 0; 192 int i = 1;
193 GCObject *p; 193 GCObject *p;
194 for (p = g->allgc; p != o && p != NULL; p = gch(p)->next) i++; 194 for (p = g->allgc; p != o && p != NULL; p = gch(p)->next) i++;
195 if (p == NULL) i = -1; 195 if (p == NULL) {
196 i = 1;
197 for (p = g->finobj; p != o && p != NULL; p = gch(p)->next) i++;
198 if (p == NULL) i = 0; /* zero means 'not found' */
199 else i = -i; /* negative means 'found in findobj list */
200 }
196 printf("%d:%s(%p)-%c(%02X)", i, ttypename(gch(o)->tt), (void *)o, 201 printf("%d:%s(%p)-%c(%02X)", i, ttypename(gch(o)->tt), (void *)o,
197 isdead(g,o)?'d':isblack(o)?'b':iswhite(o)?'w':'g', gch(o)->marked); 202 isdead(g,o)?'d':isblack(o)?'b':iswhite(o)?'w':'g', gch(o)->marked);
198} 203}
@@ -376,7 +381,8 @@ static void checkgraylist (GCObject *l) {
376 l_setbit(l->gch.marked, TESTGRAYBIT); 381 l_setbit(l->gch.marked, TESTGRAYBIT);
377 switch (gch(l)->tt) { 382 switch (gch(l)->tt) {
378 case LUA_TTABLE: l = gco2t(l)->gclist; break; 383 case LUA_TTABLE: l = gco2t(l)->gclist; break;
379 case LUA_TFUNCTION: l = gco2cl(l)->c.gclist; break; 384 case LUA_TLCL: l = gco2lcl(l)->gclist; break;
385 case LUA_TCCL: l = gco2ccl(l)->gclist; break;
380 case LUA_TTHREAD: l = gco2th(l)->gclist; break; 386 case LUA_TTHREAD: l = gco2th(l)->gclist; break;
381 case LUA_TPROTO: l = gco2p(l)->gclist; break; 387 case LUA_TPROTO: l = gco2p(l)->gclist; break;
382 default: lua_assert(0); /* other objects cannot be gray */ 388 default: lua_assert(0); /* other objects cannot be gray */