Wolfgang Jeltsch pushed to branch wip/jeltsch/textual-bytecode-output at Glasgow Haskell Compiler / GHC

Commits:

1 changed file:

Changes:

  • compiler/GHC/ByteCode/Show.hs
    ... ... @@ -11,19 +11,19 @@ import GHC.Prelude
    11 11
     -- Bytecode
    
    12 12
     import GHC.ByteCode.Types
    
    13 13
            (
    
    14
    -           FFIInfo (..),
    
    15
    -           BCONPtr (..),
    
    16
    -           BCOPtr (..),
    
    17
    -           UnlinkedBCO (..),
    
    18
    -           ByteCodeHpcInfo (..),
    
    19
    -           CompiledByteCode (..)
    
    14
    +         FFIInfo (..),
    
    15
    +         BCONPtr (..),
    
    16
    +         BCOPtr (..),
    
    17
    +         UnlinkedBCO (..),
    
    18
    +         ByteCodeHpcInfo (..),
    
    19
    +         CompiledByteCode (..)
    
    20 20
            )
    
    21 21
     import GHC.ByteCode.Breakpoints
    
    22 22
            (
    
    23
    -           InternalBreakpointId (..),
    
    24
    -           InternalBreakLoc (..),
    
    25
    -           CgBreakInfo (..),
    
    26
    -           InternalModBreaks (..)
    
    23
    +         InternalBreakpointId (..),
    
    24
    +         InternalBreakLoc (..),
    
    25
    +         CgBreakInfo (..),
    
    26
    +         InternalModBreaks (..)
    
    27 27
            )
    
    28 28
     import GHC.ByteCode.Binary (OnDiskModuleByteCode (..))
    
    29 29
     import GHC.ByteCode.Serialize (readOnDiskModuleByteCode)
    
    ... ... @@ -45,17 +45,17 @@ import GHC.Utils.Binary (BinSrcSpan (..))
    45 45
     import GHC.Utils.Encoding.UTF8 (utf8DecodeShortByteString, utf8DecodeByteString)
    
    46 46
     import GHC.Utils.Outputable
    
    47 47
            (
    
    48
    -           defaultDumpStyle,
    
    49
    -           SDoc,
    
    50
    -           text,
    
    51
    -           (<>),
    
    52
    -           (<+>),
    
    53
    -           quotes,
    
    54
    -           hsep,
    
    55
    -           vcat,
    
    56
    -           hang,
    
    57
    -           withPprStyle,
    
    58
    -           ppr
    
    48
    +         defaultDumpStyle,
    
    49
    +         SDoc,
    
    50
    +         text,
    
    51
    +         (<>),
    
    52
    +         (<+>),
    
    53
    +         quotes,
    
    54
    +         hsep,
    
    55
    +         vcat,
    
    56
    +         hang,
    
    57
    +         withPprStyle,
    
    58
    +         ppr
    
    59 59
            )
    
    60 60
     import GHC.Unit.Types (Module)
    
    61 61
     import GHC.Iface.Type (IfaceType, IfaceTvBndr, IfaceIdBndr)
    
    ... ... @@ -77,20 +77,20 @@ import Numeric (showHex)
    77 77
     -- | Outputs textual information about the contents of a bytecode file.
    
    78 78
     showByteCode :: Logger -> HscEnv -> FilePath -> IO ()
    
    79 79
     showByteCode logger env path = do
    
    80
    -    byteCode <- readOnDiskModuleByteCode env path
    
    81
    -    logMsg logger
    
    82
    -           MCDump
    
    83
    -           noSrcSpan
    
    84
    -           (withPprStyle defaultDumpStyle $ pprOnDiskModuleByteCode byteCode)
    
    80
    +  byteCode <- readOnDiskModuleByteCode env path
    
    81
    +  logMsg logger
    
    82
    +         MCDump
    
    83
    +         noSrcSpan
    
    84
    +         (withPprStyle defaultDumpStyle $ pprOnDiskModuleByteCode byteCode)
    
    85 85
     
    
    86 86
     -- | Constructs textual information about the contents of a bytecode file.
    
    87 87
     pprOnDiskModuleByteCode :: OnDiskModuleByteCode -> SDoc
    
    88 88
     pprOnDiskModuleByteCode OnDiskModuleByteCode {..}
    
    89
    -    = vcat [
    
    90
    -               pprModuleIdent                   $ odgbc_module,
    
    91
    -               pprOnDiskModuleByteCodeHash      $ odgbc_hash,
    
    92
    -               pprCompiledByteCode odgbc_module $ odgbc_compiled_byte_code
    
    93
    -           ]
    
    89
    +  = vcat [
    
    90
    +           pprModuleIdent                   $ odgbc_module,
    
    91
    +           pprOnDiskModuleByteCodeHash      $ odgbc_hash,
    
    92
    +           pprCompiledByteCode odgbc_module $ odgbc_compiled_byte_code
    
    93
    +         ]
    
    94 94
     
    
    95 95
     -- | Constructs textual information about the name of a module.
    
    96 96
     pprModuleIdent :: Module -> SDoc
    
    ... ... @@ -105,14 +105,14 @@ pprCompiledByteCode :: Module -- ^ The enclosing module
    105 105
                         -> CompiledByteCode -- ^ The bytecode
    
    106 106
                         -> SDoc             -- ^ The textual information
    
    107 107
     pprCompiledByteCode current_module CompiledByteCode {..}
    
    108
    -    = vcat [
    
    109
    -               pprByteCodeObjects current_module $ bc_bcos,
    
    110
    -               pprDataConstructorInfoTables      $ bc_itbls,
    
    111
    -               pprTopLevelStrings                $ bc_strs,
    
    112
    -               pprBreakpoints current_module     $ bc_breaks,
    
    113
    -               pprStaticPointerTableEntries      $ bc_spt_entries,
    
    114
    -               pprHPCInfo                        $ bc_hpc_info
    
    115
    -           ]
    
    108
    +  = vcat [
    
    109
    +           pprByteCodeObjects current_module $ bc_bcos,
    
    110
    +           pprDataConstructorInfoTables      $ bc_itbls,
    
    111
    +           pprTopLevelStrings                $ bc_strs,
    
    112
    +           pprBreakpoints current_module     $ bc_breaks,
    
    113
    +           pprStaticPointerTableEntries      $ bc_spt_entries,
    
    114
    +           pprHPCInfo                        $ bc_hpc_info
    
    115
    +         ]
    
    116 116
     
    
    117 117
     -- | Constructs textual information about bytecode objects.
    
    118 118
     pprByteCodeObjects :: Module              -- ^ The enlosing module
    
    ... ... @@ -128,29 +128,25 @@ pprByteCodeObject :: Module -- ^ The enclosing module
    128 128
                       -> UnlinkedBCO -- ^ The bytecode object
    
    129 129
                       -> SDoc        -- ^ The textual information
    
    130 130
     pprByteCodeObject current_module byte_code_object = case byte_code_object of
    
    131
    -    UnlinkedBCO {..}
    
    132
    -        -> entry (text "ordinary object" <+> quotes (ppr unlinkedBCOName)) $
    
    133
    -           vcat [
    
    134
    -                    pprArity                    $ unlinkedBCOArity,
    
    135
    -                    pprLiterals current_module  $ unlinkedBCOLits,
    
    136
    -                    pprUsedItems current_module $ unlinkedBCOPtrs
    
    137
    -                ]
    
    138
    -    UnlinkedStaticCon {..}
    
    139
    -        -> entry (
    
    140
    -                     text "static-construction object"  <+>
    
    141
    -                     quotes (ppr unlinkedStaticConName)
    
    142
    -                 )
    
    143
    -           $
    
    144
    -           vcat [
    
    145
    -                    pprDataConstructorName      $ unlinkedStaticConDataConName,
    
    146
    -                    pprLiftedness               $ isLifted,
    
    147
    -                    pprLiterals current_module  $ unlinkedStaticConLits,
    
    148
    -                    pprUsedItems current_module $ unlinkedStaticConPtrs
    
    149
    -                ]
    
    150
    -        where
    
    151
    -
    
    152
    -        isLifted :: Bool
    
    153
    -        isLifted = not unlinkedStaticConIsUnlifted
    
    131
    +  UnlinkedBCO {..}
    
    132
    +    -> entry (text "ordinary object" <+> quotes (ppr unlinkedBCOName)) $
    
    133
    +       vcat [
    
    134
    +              pprArity                    $ unlinkedBCOArity,
    
    135
    +              pprLiterals current_module  $ unlinkedBCOLits,
    
    136
    +              pprUsedItems current_module $ unlinkedBCOPtrs
    
    137
    +            ]
    
    138
    +  UnlinkedStaticCon {..}
    
    139
    +    -> entry (
    
    140
    +               text "static-construction object"  <+>
    
    141
    +               quotes (ppr unlinkedStaticConName)
    
    142
    +             )
    
    143
    +       $
    
    144
    +       vcat [
    
    145
    +              pprDataConstructorName      $ unlinkedStaticConDataConName,
    
    146
    +              pprLiftedness               $ not unlinkedStaticConIsUnlifted,
    
    147
    +              pprLiterals current_module  $ unlinkedStaticConLits,
    
    148
    +              pprUsedItems current_module $ unlinkedStaticConPtrs
    
    149
    +            ]
    
    154 150
     
    
    155 151
     -- | Constructs textual information about the arity of an ordinary bytecode
    
    156 152
     --   object.
    
    ... ... @@ -181,63 +177,61 @@ pprLiteral :: Module -- ^ The enclosing module
    181 177
                -> BCONPtr -- ^ The literal
    
    182 178
                -> SDoc    -- ^ The textual information
    
    183 179
     pprLiteral current_module literal = case literal of
    
    184
    -    BCONPtrWord word
    
    185
    -        -> text "word" <+>
    
    186
    -           ppr word
    
    187
    -    BCONPtrLbl label
    
    188
    -        -> text "label" <+>
    
    189
    -           quotes (ppr label)
    
    190
    -    BCONPtrItbl infoTableName
    
    191
    -        -> text "info table of" <+>
    
    192
    -           quotes (ppr infoTableName)
    
    193
    -    BCONPtrAddr addrName
    
    194
    -        -> text "address" <+>
    
    195
    -           quotes (ppr addrName)
    
    196
    -    BCONPtrStr encoded_string
    
    197
    -        -> text "top-level string" <+>
    
    198
    -           text (show (utf8DecodeByteString encoded_string))
    
    199
    -    BCONPtrFS string
    
    200
    -        -> text "top-level string" <+>
    
    201
    -           text (show (unpackFS string))
    
    202
    -    BCONPtrFFIInfo ffiInfo
    
    203
    -        -> text "foreign function" <+>
    
    204
    -           quotes (pprFFIInfo ffiInfo)
    
    205
    -    BCONPtrCostCentre breakpointID
    
    206
    -        -> text "cost center of breakpoint" <+>
    
    207
    -           pprInternalBreakpointID current_module breakpointID
    
    180
    +  BCONPtrWord word
    
    181
    +    -> text "word" <+>
    
    182
    +       ppr word
    
    183
    +  BCONPtrLbl label
    
    184
    +    -> text "label" <+>
    
    185
    +       quotes (ppr label)
    
    186
    +  BCONPtrItbl infoTableName
    
    187
    +    -> text "info table of" <+>
    
    188
    +       quotes (ppr infoTableName)
    
    189
    +  BCONPtrAddr addrName
    
    190
    +    -> text "address" <+>
    
    191
    +       quotes (ppr addrName)
    
    192
    +  BCONPtrStr encoded_string
    
    193
    +    -> text "top-level string" <+>
    
    194
    +       text (show (utf8DecodeByteString encoded_string))
    
    195
    +  BCONPtrFS string
    
    196
    +    -> text "top-level string" <+>
    
    197
    +       text (show (unpackFS string))
    
    198
    +  BCONPtrFFIInfo ffiInfo
    
    199
    +    -> text "foreign function" <+>
    
    200
    +       quotes (pprFFIInfo ffiInfo)
    
    201
    +  BCONPtrCostCentre breakpointID
    
    202
    +    -> text "cost center of breakpoint" <+>
    
    203
    +       pprInternalBreakpointID current_module breakpointID
    
    208 204
     
    
    209 205
     -- | Constructs textual information about FFI info.
    
    210 206
     pprFFIInfo :: FFIInfo -> SDoc
    
    211 207
     pprFFIInfo FFIInfo {..}
    
    212
    -    = hsep (map (pprFFIType >>> (<+> text "->")) ffiInfoArgs) <+>
    
    213
    -      pprFFIType ffiInfoRet
    
    208
    +  = hsep (map (pprFFIType >>> (<+> text "->")) ffiInfoArgs) <+>
    
    209
    +    pprFFIType ffiInfoRet
    
    214 210
     
    
    215 211
     -- | Constructs textual information about an FFI type.
    
    216 212
     pprFFIType :: FFIType -> SDoc
    
    217 213
     pprFFIType ffi_type = assert (take 3 ident == "FFI") $ text (drop 3 ident) where
    
    218 214
     
    
    219
    -    ident :: String
    
    220
    -    ident = show ffi_type
    
    215
    +  ident :: String
    
    216
    +  ident = show ffi_type
    
    221 217
     
    
    222 218
     -- | Constructs textual information about the ID of a bytecode breakpoint.
    
    223 219
     pprInternalBreakpointID
    
    224
    -    :: Module               -- ^ The enclosing module
    
    225
    -    -> InternalBreakpointId -- ^ The ID of the bytecode breakpoint
    
    226
    -    -> SDoc                 -- ^ The textual information
    
    220
    +  :: Module               -- ^ The enclosing module
    
    221
    +  -> InternalBreakpointId -- ^ The ID of the bytecode breakpoint
    
    222
    +  -> SDoc                 -- ^ The textual information
    
    227 223
     pprInternalBreakpointID current_module InternalBreakpointId {..}
    
    228
    -    | ibi_info_mod == current_module = indexDoc
    
    229
    -    | otherwise                      = indexDoc         <+>
    
    230
    -                                       text "in"        <+>
    
    231
    -                                       ppr ibi_info_mod
    
    232
    -    where
    
    224
    +  | ibi_info_mod == current_module = indexDoc
    
    225
    +  | otherwise                      = indexDoc <+> text "in" <+> ppr ibi_info_mod
    
    226
    +  where
    
    233 227
     
    
    234
    -    indexDoc :: SDoc
    
    235
    -    indexDoc = ppr ibi_info_index
    
    228
    +  indexDoc :: SDoc
    
    229
    +  indexDoc = ppr ibi_info_index
    
    236 230
     
    
    237 231
     -- | Constructs textual information about used items.
    
    238
    -pprUsedItems :: Module         -- ^ The enclosing module
    
    239
    -            -> FlatBag BCOPtr  -- ^ The used items
    
    240
    -            -> SDoc            -- ^ The textual information
    
    232
    +pprUsedItems :: Module          -- ^ The enclosing module
    
    233
    +             -> FlatBag BCOPtr  -- ^ The used items
    
    234
    +             -> SDoc            -- ^ The textual information
    
    241 235
     pprUsedItems current_module = entry (text "used items")        .
    
    242 236
                                   vcatOrNone                       .
    
    243 237
                                   map (pprUsedItem current_module) .
    
    ... ... @@ -248,14 +242,14 @@ pprUsedItem :: Module -- ^ The enclosing module
    248 242
                 -> BCOPtr -- ^ The used item
    
    249 243
                 -> SDoc   -- ^ The textual information
    
    250 244
     pprUsedItem current_module usedItem = case usedItem of
    
    251
    -    BCOPtrName name
    
    252
    -        -> text "named item" <+> quotes (ppr name)
    
    253
    -    BCOPtrPrimOp primOp
    
    254
    -        -> text "primitive operation" <+> quotes (ppr primOp)
    
    255
    -    BCOPtrBCO byte_code_object
    
    256
    -        -> pprByteCodeObject current_module byte_code_object
    
    257
    -    BCOPtrBreakArray breakArrayModule
    
    258
    -        -> text "break array of module" <+> quotes (ppr breakArrayModule)
    
    245
    +  BCOPtrName name
    
    246
    +    -> text "named item" <+> quotes (ppr name)
    
    247
    +  BCOPtrPrimOp primOp
    
    248
    +    -> text "primitive operation" <+> quotes (ppr primOp)
    
    249
    +  BCOPtrBCO byte_code_object
    
    250
    +    -> pprByteCodeObject current_module byte_code_object
    
    251
    +  BCOPtrBreakArray breakArrayModule
    
    252
    +    -> text "break array of module" <+> quotes (ppr breakArrayModule)
    
    259 253
     
    
    260 254
     -- | Constructs textual information about data constructor info tables.
    
    261 255
     pprDataConstructorInfoTables :: [(Name, ConInfoTable)] -> SDoc
    
    ... ... @@ -266,11 +260,11 @@ pprDataConstructorInfoTables = entry (text "data constructor info tables") .
    266 260
     -- | Constructs textual information about a single data constructor info table.
    
    267 261
     pprDataConstructorInfoTable :: Name -> ConInfoTable -> SDoc
    
    268 262
     pprDataConstructorInfoTable dataConstrName ConInfoTable {..}
    
    269
    -    = entry (text "info table of" <+> quotes (ppr dataConstrName)) $
    
    270
    -      vcat [
    
    271
    -               pprPointerWordCount    $ conItblPtrs,
    
    272
    -               pprNonPointerWordCount $ conItblNPtrs
    
    273
    -           ]
    
    263
    +  = entry (text "info table of" <+> quotes (ppr dataConstrName)) $
    
    264
    +    vcat [
    
    265
    +           pprPointerWordCount    $ conItblPtrs,
    
    266
    +           pprNonPointerWordCount $ conItblNPtrs
    
    267
    +         ]
    
    274 268
     
    
    275 269
     -- | Constructs textual information about a number of pointer words.
    
    276 270
     pprPointerWordCount :: Int -> SDoc
    
    ... ... @@ -299,37 +293,36 @@ pprBreakpoints :: Module -- ^ The enclosing module
    299 293
                    -> Maybe InternalModBreaks -- ^ The breakpoints
    
    300 294
                    -> SDoc                    -- ^ The textual information
    
    301 295
     pprBreakpoints current_module
    
    302
    -    = entry (text "breakpoints") .
    
    303
    -      maybe (text "<none>") (pprActualBreakpoints current_module)
    
    296
    +  = entry (text "breakpoints") .
    
    297
    +    maybe (text "<none>") (pprActualBreakpoints current_module)
    
    304 298
     
    
    305 299
     -- | Constructs textual information about actual breakpoints.
    
    306 300
     pprActualBreakpoints :: Module            -- ^ The enclosing module
    
    307 301
                          -> InternalModBreaks -- ^ The actual breakpoints
    
    308 302
                          -> SDoc              -- ^ The textual information
    
    309 303
     pprActualBreakpoints current_module InternalModBreaks {..}
    
    310
    -    = vcat [
    
    311
    -               pprSourceBreakpoints current_module   $ imodBreaks_modBreaks,
    
    312
    -               pprByteCodeBreakpoints current_module $ imodBreaks_breakInfo
    
    313
    -           ]
    
    304
    +  = vcat [
    
    305
    +           pprSourceBreakpoints current_module   $ imodBreaks_modBreaks,
    
    306
    +           pprByteCodeBreakpoints current_module $ imodBreaks_breakInfo
    
    307
    +         ]
    
    314 308
     
    
    315 309
     -- | Constructs textual information about source breakpoints.
    
    316 310
     pprSourceBreakpoints :: Module    -- ^ The enclosing module
    
    317 311
                          -> ModBreaks -- ^ The source breakpoints
    
    318 312
                          -> SDoc      -- ^ The textual information
    
    319 313
     pprSourceBreakpoints current_module ModBreaks {..}
    
    320
    -    = entry (text "source breakpoints")                         $
    
    321
    -      assert (modBreaks_module == current_module)               $
    
    322
    -      assert (bounds modBreaks_locs_ == bounds modBreaks_decls) $
    
    323
    -      assert (bounds modBreaks_locs_ == bounds modBreaks_vars)  $
    
    324
    -      vcatOrNone                                                $
    
    325
    -      zipWith4 pprSourceBreakpoint (indices modBreaks_locs_)
    
    326
    -                                   (elems modBreaks_locs_)
    
    327
    -                                   (elems modBreaks_decls)
    
    328
    -                                   (elems modBreaks_vars)
    
    329
    -      -- The cost center infos in 'modBreaks_ccs', when present, just contain
    
    330
    -      -- textual representations of the declaration paths in 'modBreaks_decls'
    
    331
    -      -- and the source spans in 'modBreaks_locs_' and are therefore never
    
    332
    -      -- shown.
    
    314
    +  = entry (text "source breakpoints")                         $
    
    315
    +    assert (modBreaks_module == current_module)               $
    
    316
    +    assert (bounds modBreaks_locs_ == bounds modBreaks_decls) $
    
    317
    +    assert (bounds modBreaks_locs_ == bounds modBreaks_vars)  $
    
    318
    +    vcatOrNone                                                $
    
    319
    +    zipWith4 pprSourceBreakpoint (indices modBreaks_locs_)
    
    320
    +                                 (elems modBreaks_locs_)
    
    321
    +                                 (elems modBreaks_decls)
    
    322
    +                                 (elems modBreaks_vars)
    
    323
    +    -- The cost center infos in 'modBreaks_ccs', when present, just contain
    
    324
    +    -- textual representations of the declaration paths in 'modBreaks_decls' and
    
    325
    +    -- the source spans in 'modBreaks_locs_' and are therefore never shown.
    
    333 326
     
    
    334 327
     -- | Constructs textual information about a single source breakpoint.
    
    335 328
     pprSourceBreakpoint :: BreakTickIndex
    
    ... ... @@ -338,12 +331,12 @@ pprSourceBreakpoint :: BreakTickIndex
    338 331
                         -> [OccName]
    
    339 332
                         -> SDoc
    
    340 333
     pprSourceBreakpoint ix srcSpan declarationPath freeVars
    
    341
    -    = entry (text "source breakpoint" <+> ppr ix) $
    
    342
    -      vcat [
    
    343
    -               pprSrcSpan         $ srcSpan,
    
    344
    -               pprDeclarationPath $ declarationPath,
    
    345
    -               pprFreeVariables   $ freeVars
    
    346
    -           ]
    
    334
    +  = entry (text "source breakpoint" <+> ppr ix) $
    
    335
    +    vcat [
    
    336
    +           pprSrcSpan         $ srcSpan,
    
    337
    +           pprDeclarationPath $ declarationPath,
    
    338
    +           pprFreeVariables   $ freeVars
    
    339
    +         ]
    
    347 340
     
    
    348 341
     -- | Constructs textual information about a source span.
    
    349 342
     pprSrcSpan :: BinSrcSpan -> SDoc
    
    ... ... @@ -362,10 +355,10 @@ pprByteCodeBreakpoints :: Module -- ^ The enclosing module
    362 355
                            -> IntMap CgBreakInfo -- ^ The bytecode breakpoints
    
    363 356
                            -> SDoc               -- ^ The textual information
    
    364 357
     pprByteCodeBreakpoints current_module
    
    365
    -    = entry (text "bytecode breakpoints")                  .
    
    366
    -      vcatOrNone                                           .
    
    367
    -      map (uncurry (pprByteCodeBreakpoint current_module)) .
    
    368
    -      IntMap.toList
    
    358
    +  = entry (text "bytecode breakpoints")                  .
    
    359
    +    vcatOrNone                                           .
    
    360
    +    map (uncurry (pprByteCodeBreakpoint current_module)) .
    
    361
    +    IntMap.toList
    
    369 362
     
    
    370 363
     -- | Constructs textual information about a single bytecode breakpoint.
    
    371 364
     pprByteCodeBreakpoint :: Module      -- ^ The enclosing module
    
    ... ... @@ -373,20 +366,20 @@ pprByteCodeBreakpoint :: Module -- ^ The enclosing module
    373 366
                           -> CgBreakInfo -- ^ The bytecode breakpoint
    
    374 367
                           -> SDoc        -- ^ The textual information
    
    375 368
     pprByteCodeBreakpoint current_module ix CgBreakInfo {..}
    
    376
    -    = entry (text "bytecode breakpoint" <+> ppr ix) $
    
    377
    -      vcat [
    
    378
    -               pprType                                         $ cgb_resty,
    
    379
    -               pprTypeVariables                                $ cgb_tyvars,
    
    380
    -               pprVariables                                    $ cgb_vars,
    
    381
    -               pprCorrespondingSourceBreakpoint current_module $ cgb_tick_id
    
    382
    -           ]
    
    383
    -    -- That the 'cgb_resty' field holds the type of the breakpoint is apparent
    
    384
    -    -- from the fact that this field is set by
    
    385
    -    -- 'GHC.StgToByteCode.dehydrateCgBreakInfo' using one of its arguments and
    
    386
    -    -- 'GHC.StgToByteCode.dehydrateCgBreakInfo' is always invoked with this
    
    387
    -    -- argument set to the extension field of 'Breakpoint', which in turn holds
    
    388
    -    -- the type of the breakpoint according to Note [Tickish passes] and the
    
    389
    -    -- comment on the instance declaration of @XBreakpoint 'TickishPassStg@.
    
    369
    +  = entry (text "bytecode breakpoint" <+> ppr ix) $
    
    370
    +    vcat [
    
    371
    +           pprType                                         $ cgb_resty,
    
    372
    +           pprTypeVariables                                $ cgb_tyvars,
    
    373
    +           pprVariables                                    $ cgb_vars,
    
    374
    +           pprCorrespondingSourceBreakpoint current_module $ cgb_tick_id
    
    375
    +         ]
    
    376
    +  -- That the 'cgb_resty' field holds the type of the breakpoint is apparent
    
    377
    +  -- from the fact that this field is set by
    
    378
    +  -- 'GHC.StgToByteCode.dehydrateCgBreakInfo' using one of its arguments and
    
    379
    +  -- 'GHC.StgToByteCode.dehydrateCgBreakInfo' is always invoked with this
    
    380
    +  -- argument set to the extension field of 'Breakpoint', which in turn holds
    
    381
    +  -- the type of the breakpoint according to Note [Tickish passes] and the
    
    382
    +  -- comment on the instance declaration of @XBreakpoint 'TickishPassStg@.
    
    390 383
     
    
    391 384
     -- | Constructs textual information about a type.
    
    392 385
     pprType :: IfaceType -> SDoc
    
    ... ... @@ -413,8 +406,8 @@ pprVariable = maybe (text "<unknown>") (pprVariableBinder . fst)
    413 406
     -- | Constructs textual information about a variable binder.
    
    414 407
     pprVariableBinder :: IfaceIdBndr -> SDoc
    
    415 408
     pprVariableBinder (multiplicity, name, type_)
    
    416
    -    = text "%" <> ppr multiplicity <+>
    
    417
    -      ppr name <+> text "::" <+> ppr type_
    
    409
    +  = text "%" <> ppr multiplicity <+>
    
    410
    +    ppr name <+> text "::" <+> ppr type_
    
    418 411
     
    
    419 412
     -- | Constructs textual information about a source breakpoint corresponding to a
    
    420 413
     --   bytecode breakpoint.
    
    ... ... @@ -425,9 +418,9 @@ pprCorrespondingSourceBreakpoint :: Module
    425 418
                                      -> SDoc
    
    426 419
                                         -- ^ The textual information
    
    427 420
     pprCorrespondingSourceBreakpoint current_module
    
    428
    -    = entry (text "corresponding source breakpoint") .
    
    429
    -      pprBreakpointID current_module                 .
    
    430
    -      either internalBreakLoc id
    
    421
    +  = entry (text "corresponding source breakpoint") .
    
    422
    +    pprBreakpointID current_module                 .
    
    423
    +    either internalBreakLoc id
    
    431 424
     
    
    432 425
     -- | Constructs textual information about the ID of a source breakpoint.
    
    433 426
     pprBreakpointID :: Module       -- ^ The enclosing module
    
    ... ... @@ -452,7 +445,7 @@ pprStaticPointerTableEntries = entry (text "static-pointer table entries") .
    452 445
     -- | Constructs textual information about a single static-pointer table entry.
    
    453 446
     pprStaticPointerTableEntry :: SptEntry -> SDoc
    
    454 447
     pprStaticPointerTableEntry (SptEntry name fingerprint)
    
    455
    -    = ppr fingerprint <> text ":" <+> ppr name
    
    448
    +  = ppr fingerprint <> text ":" <+> ppr name
    
    456 449
     
    
    457 450
     -- | Constructs textual information about HPC info.
    
    458 451
     pprHPCInfo :: Strict.Maybe ByteCodeHpcInfo -> SDoc
    
    ... ... @@ -462,12 +455,12 @@ pprHPCInfo = entry (text "HPC information") .
    462 455
     -- | Constructs textual information about actual HPC info.
    
    463 456
     pprActualHPCInfo :: ByteCodeHpcInfo -> SDoc
    
    464 457
     pprActualHPCInfo ByteCodeHpcInfo {..}
    
    465
    -    = vcat [
    
    466
    -               pprHPCInfoHash $ bchi_hash,
    
    467
    -               pprModuleName  $ bchi_module_name,
    
    468
    -               pprTickBoxName $ bchi_tickbox_name,
    
    469
    -               pprTickCount   $ bchi_tick_count
    
    470
    -           ]
    
    458
    +  = vcat [
    
    459
    +           pprHPCInfoHash $ bchi_hash,
    
    460
    +           pprModuleName  $ bchi_module_name,
    
    461
    +           pprTickBoxName $ bchi_tickbox_name,
    
    462
    +           pprTickCount   $ bchi_tick_count
    
    463
    +         ]
    
    471 464
     
    
    472 465
     -- | Constructs textual information about the hash of HPC info.
    
    473 466
     pprHPCInfoHash :: Int -> SDoc
    
    ... ... @@ -494,15 +487,15 @@ pprTickCount = entry (text "number of ticks") . ppr
    494 487
     --   natural number.
    
    495 488
     pprFixedSizeNatural :: (Integral a, FiniteBits a) => a -> SDoc
    
    496 489
     pprFixedSizeNatural num
    
    497
    -    = assert (num >= 0) $
    
    498
    -      text $ replicate (digitCount - length unpadded) '0' ++ unpadded
    
    499
    -    where
    
    490
    +  = assert (num >= 0) $
    
    491
    +    text $ replicate (digitCount - length unpadded) '0' ++ unpadded
    
    492
    +  where
    
    500 493
     
    
    501
    -    digitCount :: Int
    
    502
    -    digitCount = (finiteBitSize num + 3) `div` 4
    
    494
    +  digitCount :: Int
    
    495
    +  digitCount = (finiteBitSize num + 3) `div` 4
    
    503 496
     
    
    504
    -    unpadded :: String
    
    505
    -    unpadded = showHex num ""
    
    497
    +  unpadded :: String
    
    498
    +  unpadded = showHex num ""
    
    506 499
     
    
    507 500
     -- | Constructs a textual representation of a boolean, interpreting 'True' and
    
    508 501
     --   'False' as “yes” and “no”, respectively.