rts/Printer: Print forwarding pointers
authorÖmer Sinan Ağacan <omer@well-typed.com>
Tue, 5 Feb 2019 05:39:03 +0000 (00:39 -0500)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Wed, 6 Mar 2019 03:28:45 +0000 (22:28 -0500)
rts/Printer.c

index 38335aa..f4d1111 100644 (file)
@@ -111,10 +111,15 @@ printThunkObject( StgThunk *obj, char* tag )
 void
 printClosure( const StgClosure *obj )
 {
-    const StgInfoTable *info;
-
+    debugBelch("%p: ", obj);
     obj = UNTAG_CONST_CLOSURE(obj);
-    info = get_itbl(obj);
+    const StgInfoTable* info = get_itbl(obj);
+
+    while (IS_FORWARDING_PTR(info)) {
+        obj = (StgClosure*)UN_FORWARDING_PTR(obj);
+        debugBelch("(forwarding to %p) ", (void*)obj);
+        info = get_itbl(obj);
+    }
 
     switch ( info->type ) {
     case INVALID_OBJECT: