[Git][ghc/ghc][master] rts/printClosure: Print IPE information for thunks and functions

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Thu Jan 9 22:30:54 UTC 2025



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
0161badc by Ben Gamari at 2025-01-09T17:30:05-05:00
rts/printClosure: Print IPE information for thunks and functions

This makes it considerably easier to grok the structure of the heap
when IPE information is available.

- - - - -


1 changed file:

- rts/Printer.c


Changes:

=====================================
rts/Printer.c
=====================================
@@ -151,13 +151,20 @@ printClosure( const StgClosure *obj )
     case FUN_1_0: case FUN_0_1:
     case FUN_1_1: case FUN_0_2: case FUN_2_0:
     case FUN_STATIC:
-        debugBelch("FUN/%d(",(int)itbl_to_fun_itbl(info)->f.arity);
-        printPtr((StgPtr)obj->header.info);
+        {
+            debugBelch("FUN/%d(",(int)itbl_to_fun_itbl(info)->f.arity);
+            printPtr((StgPtr)obj->header.info);
+
+            InfoProvEnt ipe;
+            if (lookupIPE(obj->header.info, &ipe)) {
+                debugBelch(", %s", ipe.prov.table_name);
+            }
 #if defined(PROFILING)
-        debugBelch(", %s", obj->header.prof.ccs->cc->label);
+            debugBelch(", %s", obj->header.prof.ccs->cc->label);
 #endif
-        printStdObjPayload(obj);
-        break;
+            printStdObjPayload(obj);
+            break;
+        }
 
     case PRIM:
         debugBelch("PRIM(");
@@ -175,13 +182,19 @@ printClosure( const StgClosure *obj )
     case THUNK_1_0: case THUNK_0_1:
     case THUNK_1_1: case THUNK_0_2: case THUNK_2_0:
     case THUNK_STATIC:
+        {
             /* ToDo: will this work for THUNK_STATIC too? */
 #if defined(PROFILING)
             printThunkObject((StgThunk *)obj,GET_PROF_DESC(info));
 #else
             printThunkObject((StgThunk *)obj,"THUNK");
+            InfoProvEnt ipe;
+            if (lookupIPE(obj->header.info, &ipe)) {
+                debugBelch(", %s", ipe.prov.table_name);
+            }
 #endif
             break;
+        }
 
     case THUNK_SELECTOR:
         printStdObjHdr(obj, "THUNK_SELECTOR");



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0161badc62318cd4476ac4c9ba128b4e3bab54bc

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0161badc62318cd4476ac4c9ba128b4e3bab54bc
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20250109/14ef57e7/attachment-0001.html>


More information about the ghc-commits mailing list