summaryrefslogtreecommitdiff
path: root/compiler/nativeGen/Dwarf.hs
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2015-08-29 12:24:54 +0200
committerBen Gamari <ben@smart-cactus.org>2015-08-29 13:08:17 +0200
commitcbf58a217785acf519a3129916a5e9bb98a7b268 (patch)
tree02d29e5d7b081830b9f141f28822eecae0f15d2c /compiler/nativeGen/Dwarf.hs
parent81ae26d3d18803ac87cf5f72b7c313793df8312c (diff)
downloadhaskell-cbf58a217785acf519a3129916a5e9bb98a7b268.tar.gz
Dwarf: Produce {low,high}_pc attributes for compilation units
Some libraries (e.g. elfutils) need these otherwise they ignore our DWARF annotations. Test Plan: Test with elfutils' `readelf --debug-dump=cu_index` Reviewers: scpmw, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1173
Diffstat (limited to 'compiler/nativeGen/Dwarf.hs')
-rw-r--r--compiler/nativeGen/Dwarf.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/nativeGen/Dwarf.hs b/compiler/nativeGen/Dwarf.hs
index 34f1ed694b..273949ecfd 100644
--- a/compiler/nativeGen/Dwarf.hs
+++ b/compiler/nativeGen/Dwarf.hs
@@ -30,6 +30,7 @@ import qualified Compiler.Hoopl as H
-- | Generate DWARF/debug information
dwarfGen :: DynFlags -> ModLocation -> UniqSupply -> [DebugBlock]
-> IO (SDoc, UniqSupply)
+dwarfGen _ _ us [] = return (empty, us)
dwarfGen df modLoc us blocks = do
-- Convert debug data structures to DWARF info records
@@ -43,6 +44,8 @@ dwarfGen df modLoc us blocks = do
, dwName = fromMaybe "" (ml_hs_file modLoc)
, dwCompDir = addTrailingPathSeparator compPath
, dwProducer = cProjectName ++ " " ++ cProjectVersion
+ , dwLowLabel = dblCLabel $ head procs
+ , dwHighLabel = mkAsmTempEndLabel $ dblCLabel $ last procs
, dwLineLabel = dwarfLineLabel
}
@@ -57,7 +60,8 @@ dwarfGen df modLoc us blocks = do
let abbrevSct = pprAbbrevDecls haveSrc
-- .debug_info section: Information records on procedures and blocks
- let (unitU, us') = takeUniqFromSupply us
+ let -- unique to identify start and end compilation unit .debug_inf
+ (unitU, us') = takeUniqFromSupply us
infoSct = vcat [ dwarfInfoSection
, compileUnitHeader unitU
, pprDwarfInfo haveSrc dwarfUnit