[commit: ghc] master: Fix a debug print in disassembler (#14905) (8e34101)

git at git.haskell.org git at git.haskell.org
Sat Mar 10 07:00:07 UTC 2018


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

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

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

commit 8e3410134bd7419db638988d74fcc600b03e2a1a
Author: Ömer Sinan Ağacan <omeragacan at gmail.com>
Date:   Fri Mar 9 15:38:58 2018 +0300

    Fix a debug print in disassembler (#14905)
    
    When interpreter is not profiled (see `interpreterProfiled` in
    `DynFlags`) bytecode generator generates a NULL pointer as the cost
    centre of a `BRK_FUN` instruction:
    
        let cc | interpreterProfiled dflags = cc_arr ! tick_no
               | otherwise = toRemotePtr nullPtr
        let breakInstr = BRK_FUN (fromIntegral tick_no) (getUnique this_mod) cc
        return $ breakInstr `consOL` code
    
    We now take this into account when disassembling `BRK_FUN`.
    
    Reviewers: bgamari, simonmar, erikd
    
    Subscribers: rwbarton, thomie, carter
    
    Differential Revision: https://phabricator.haskell.org/D4490


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

8e3410134bd7419db638988d74fcc600b03e2a1a
 rts/Disassembler.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/rts/Disassembler.c b/rts/Disassembler.c
index 8c84e13..01d6c3b 100644
--- a/rts/Disassembler.c
+++ b/rts/Disassembler.c
@@ -68,7 +68,11 @@ disInstr ( StgBCO *bco, int pc )
       case bci_BRK_FUN:
          debugBelch ("BRK_FUN  " );  printPtr( ptrs[instrs[pc]] );
          debugBelch (" %d ", instrs[pc+1]); printPtr( ptrs[instrs[pc+2]] );
-         debugBelch(" %s\n", ((CostCentre*)(literals[instrs[pc+3]]))->label);
+         CostCentre* cc = (CostCentre*)literals[instrs[pc+3]];
+         if (cc) {
+           debugBelch(" %s", cc->label);
+         }
+         debugBelch("\n");
          pc += 4;
          break;
       case bci_SWIZZLE:



More information about the ghc-commits mailing list