Skip to content

Commit 01bee96

Browse files
committed
TASK-214337 additional debug
1 parent 53b84ba commit 01bee96

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

src/lgc.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1968,6 +1968,7 @@ static int is_bad_gc_ptr(uintptr_t p)
19681968
static void validate_heap_objects(lua_State *L, const char *where)
19691969
{
19701970
GCheader *o;
1971+
GCheader *prev = NULL;
19711972
int count = 0;
19721973

19731974
TAILQ_FOREACH(o, &L->heap->objects, allocd) {
@@ -1977,23 +1978,29 @@ static void validate_heap_objects(lua_State *L, const char *where)
19771978
if (!is_bad_gc_ptr((uintptr_t)o))
19781979
thrlua_log(L, DCRITICAL,
19791980
"thrlua HEAP CORRUPT [%s] L=%p heap=%p count=%d bad_node=%p"
1980-
" tt=%d marked=0x%x\n",
1981+
" prev=%p tt=%d marked=0x%x\n",
19811982
where, (void*)L, (void*)L->heap, count, (void*)o,
1982-
o->tt, o->marked);
1983+
(void*)prev, o->tt, o->marked);
19831984
else
19841985
thrlua_log(L, DCRITICAL,
1985-
"thrlua HEAP CORRUPT [%s] L=%p heap=%p count=%d bad_node=%p\n",
1986-
where, (void*)L, (void*)L->heap, count, (void*)o);
1986+
"thrlua HEAP CORRUPT [%s] L=%p heap=%p count=%d bad_node=%p"
1987+
" prev=%p\n",
1988+
where, (void*)L, (void*)L->heap, count, (void*)o,
1989+
(void*)prev);
19871990
abort();
19881991
}
19891992
if (o->owner != L->heap) {
19901993
thrlua_log(L, DCRITICAL,
19911994
"thrlua HEAP CORRUPT [%s] L=%p heap=%p count=%d node=%p"
1992-
" owner=%p (expected %p) tt=%d\n",
1995+
" prev=%p owner=%p owner->L=%p (expected heap %p) tt=%d"
1996+
" marked=0x%x xref=%u ref=%u\n",
19931997
where, (void*)L, (void*)L->heap, count, (void*)o,
1994-
(void*)o->owner, (void*)L->heap, o->tt);
1998+
(void*)prev, (void*)o->owner, (void*)o->owner->owner,
1999+
(void*)L->heap, o->tt, o->marked,
2000+
o->xref, o->ref);
19952001
abort();
19962002
}
2003+
prev = o;
19972004
count++;
19982005
}
19992006
}

0 commit comments

Comments
 (0)