diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-12-26 23:41:04 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-11-15 03:35:45 -0500 |
commit | 1e19183d08a3312ac2331b8284d17bc17170a51e (patch) | |
tree | a823cc90a072513d725b1f237b87d5451fe89023 /compiler/GHC/CmmToAsm | |
parent | 0a7e592cb1883824a14639372ba284766849ff3a (diff) | |
download | haskell-1e19183d08a3312ac2331b8284d17bc17170a51e.tar.gz |
nativeGen/dwarf: Only produce DW_AT_source_note DIEs in -g3
Standard debugging tools don't know how to understand these so let's not
produce them unless asked.
Diffstat (limited to 'compiler/GHC/CmmToAsm')
-rw-r--r-- | compiler/GHC/CmmToAsm/Config.hs | 1 | ||||
-rw-r--r-- | compiler/GHC/CmmToAsm/Dwarf.hs | 13 |
2 files changed, 9 insertions, 5 deletions
diff --git a/compiler/GHC/CmmToAsm/Config.hs b/compiler/GHC/CmmToAsm/Config.hs index 141f1168be..8acd089757 100644 --- a/compiler/GHC/CmmToAsm/Config.hs +++ b/compiler/GHC/CmmToAsm/Config.hs @@ -40,6 +40,7 @@ data NCGConfig = NCGConfig , ncgDwarfUnwindings :: !Bool -- ^ Enable unwindings , ncgDwarfStripBlockInfo :: !Bool -- ^ Strip out block information from generated Dwarf , ncgExposeInternalSymbols :: !Bool -- ^ Expose symbol table entries for internal symbols + , ncgDwarfSourceNotes :: !Bool -- ^ Enable GHC-specific source note DIEs } -- | Return Word size diff --git a/compiler/GHC/CmmToAsm/Dwarf.hs b/compiler/GHC/CmmToAsm/Dwarf.hs index d81bcd4f2e..7e03549b24 100644 --- a/compiler/GHC/CmmToAsm/Dwarf.hs +++ b/compiler/GHC/CmmToAsm/Dwarf.hs @@ -176,7 +176,7 @@ parent, B. -- | Generate DWARF info for a procedure debug block procToDwarf :: NCGConfig -> DebugBlock -> DwarfInfo procToDwarf config prc - = DwarfSubprogram { dwChildren = map blockToDwarf (dblBlocks prc) + = DwarfSubprogram { dwChildren = map (blockToDwarf config) (dblBlocks prc) , dwName = case dblSourceTick prc of Just s@SourceNote{} -> sourceName s _otherwise -> show (dblLabel prc) @@ -195,14 +195,17 @@ procToDwarf config prc goodParent _ = True -- | Generate DWARF info for a block -blockToDwarf :: DebugBlock -> DwarfInfo -blockToDwarf blk - = DwarfBlock { dwChildren = concatMap tickToDwarf (dblTicks blk) - ++ map blockToDwarf (dblBlocks blk) +blockToDwarf :: NCGConfig -> DebugBlock -> DwarfInfo +blockToDwarf config blk + = DwarfBlock { dwChildren = map (blockToDwarf config) (dblBlocks blk) ++ srcNotes , dwLabel = dblCLabel blk , dwMarker = marker } where + srcNotes + | ncgDwarfSourceNotes config = concatMap tickToDwarf (dblTicks blk) + | otherwise = [] + marker | Just _ <- dblPosition blk = Just $ mkAsmTempLabel $ dblLabel blk | otherwise = Nothing -- block was optimized out |