[commit: ghc] master: printClosure: slightly improve MVAR printing (afb686a)

git at git.haskell.org git at git.haskell.org
Sat Mar 31 08:04:22 UTC 2018


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

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

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

commit afb686a88901d7d0c93627806d7e4d0444aa17e8
Author: Ömer Sinan Ağacan <omeragacan at gmail.com>
Date:   Sat Mar 31 11:03:44 2018 +0300

    printClosure: slightly improve MVAR printing
    
    Reviewers: bgamari, erikd, simonmar
    
    Reviewed By: bgamari
    
    Subscribers: thomie, carter
    
    Differential Revision: https://phabricator.haskell.org/D4541


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

afb686a88901d7d0c93627806d7e4d0444aa17e8
 rts/Printer.c | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/rts/Printer.c b/rts/Printer.c
index 904f23a..1c9634d 100644
--- a/rts/Printer.c
+++ b/rts/Printer.c
@@ -331,7 +331,29 @@ printClosure( const StgClosure *obj )
     case MVAR_DIRTY:
         {
           StgMVar* mv = (StgMVar*)obj;
-          debugBelch("MVAR(head=%p, tail=%p, value=%p)\n", mv->head, mv->tail, mv->value);
+
+          debugBelch("MVAR(head=");
+          if ((StgClosure*)mv->head == &stg_END_TSO_QUEUE_closure) {
+              debugBelch("END_TSO_QUEUE");
+          } else {
+              debugBelch("%p", mv->head);
+          }
+
+          debugBelch(", tail=");
+          if ((StgClosure*)mv->tail == &stg_END_TSO_QUEUE_closure) {
+              debugBelch("END_TSO_QUEUE");
+          } else {
+              debugBelch("%p", mv->tail);
+          }
+
+          debugBelch(", value=");
+          if ((StgClosure*)mv->value == &stg_END_TSO_QUEUE_closure) {
+              debugBelch("END_TSO_QUEUE");
+          } else {
+              debugBelch("%p", mv->value);
+          }
+          debugBelch(")\n");
+
           break;
         }
 
@@ -358,7 +380,7 @@ printClosure( const StgClosure *obj )
 
     case WEAK:
             debugBelch("WEAK(");
-            debugBelch(" key=%p value=%p finalizer=%p",
+            debugBelch("key=%p value=%p finalizer=%p",
                     (StgPtr)(((StgWeak*)obj)->key),
                     (StgPtr)(((StgWeak*)obj)->value),
                     (StgPtr)(((StgWeak*)obj)->finalizer));



More information about the ghc-commits mailing list