[commit: ghc] master: In rts/Printer.c, print exact UPDATE_FRAME type (d1712db)

git at git.haskell.org git at git.haskell.org
Wed Jan 15 20:28:31 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/d1712dbd2b4c5d23a60d8a369e17045a397bf4f5/ghc

>---------------------------------------------------------------

commit d1712dbd2b4c5d23a60d8a369e17045a397bf4f5
Author: Arash Rouhani <rarash at student.chalmers.se>
Date:   Thu Dec 26 14:57:35 2013 +0100

    In rts/Printer.c, print exact UPDATE_FRAME type
    
    When printing an update frame in printClosure(), it will not print
    the unspecific UPDATE_FRAME, instead it prints BH_UPDATE_FRAME,
    NORMAL_UPDATE_FRAME or MARKED_UPDATE_FRAME.
    
    Signed-off-by: Austin Seipp <austin at well-typed.com>


>---------------------------------------------------------------

d1712dbd2b4c5d23a60d8a369e17045a397bf4f5
 rts/Printer.c |   20 +++++++++++++++++++-
 rts/Printer.h |    1 +
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/rts/Printer.c b/rts/Printer.c
index db2e7be..ca9ca49 100644
--- a/rts/Printer.c
+++ b/rts/Printer.c
@@ -263,7 +263,7 @@ printClosure( StgClosure *obj )
     case UPDATE_FRAME:
         {
             StgUpdateFrame* u = (StgUpdateFrame*)obj;
-            debugBelch("UPDATE_FRAME(");
+            debugBelch("%s(", info_update_frame(obj));
             printPtr((StgPtr)GET_INFO((StgClosure *)u));
             debugBelch(",");
             printPtr((StgPtr)u->updatee);
@@ -389,6 +389,24 @@ printClosure( StgClosure *obj )
     }
 }
 
+// If you know you have an UPDATE_FRAME, but want to know exactly which.
+char *info_update_frame(StgClosure *closure) {
+    // Note: We intentionally don't take the info table pointer as
+    // an argument. As it will be confusing whether one should pass
+    // it pointing to the code or struct members when compiling with
+    // TABLES_NEXT_TO_CODE.
+    const StgInfoTable *info = closure->header.info;
+    if (info == &stg_upd_frame_info) {
+        return "NORMAL_UPDATE_FRAME";
+    } else if (info == &stg_bh_upd_frame_info) {
+        return "BH_UPDATE_FRAME";
+    } else if (info == &stg_marked_upd_frame_info) {
+        return "MARKED_UPDATE_FRAME";
+    } else {
+        return "ERROR: Not an update frame!!!";
+    }
+}
+
 /*
 void printGraph( StgClosure *obj )
 {
diff --git a/rts/Printer.h b/rts/Printer.h
index 7b51ce5..0dae896 100644
--- a/rts/Printer.h
+++ b/rts/Printer.h
@@ -19,6 +19,7 @@ extern char *      closure_type_names[];
 void   	           info_hdr_type   ( StgClosure *closure, char *res );
 char  *	           info_type       ( StgClosure *closure );
 char  *	           info_type_by_ip ( StgInfoTable *ip );
+char  *            info_update_frame ( StgClosure *closure );
 
 #ifdef DEBUG
 extern void        prettyPrintClosure (StgClosure *obj);



More information about the ghc-commits mailing list