summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/nativeGen/Dwarf.hs6
-rw-r--r--compiler/nativeGen/Dwarf/Types.hs9
2 files changed, 13 insertions, 2 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
diff --git a/compiler/nativeGen/Dwarf/Types.hs b/compiler/nativeGen/Dwarf/Types.hs
index f9262b4e83..9a600bd610 100644
--- a/compiler/nativeGen/Dwarf/Types.hs
+++ b/compiler/nativeGen/Dwarf/Types.hs
@@ -44,6 +44,8 @@ data DwarfInfo
, dwName :: String
, dwProducer :: String
, dwCompDir :: String
+ , dwLowLabel :: CLabel
+ , dwHighLabel :: CLabel
, dwLineLabel :: LitString }
| DwarfSubprogram { dwChildren :: [DwarfInfo]
, dwName :: String
@@ -82,6 +84,8 @@ pprAbbrevDecls haveDebugLine =
, (dW_AT_language, dW_FORM_data4)
, (dW_AT_comp_dir, dW_FORM_string)
, (dW_AT_use_UTF8, dW_FORM_flag_present) -- not represented in body
+ , (dW_AT_low_pc, dW_FORM_addr)
+ , (dW_AT_high_pc, dW_FORM_addr)
] ++
(if haveDebugLine
then [ (dW_AT_stmt_list, dW_FORM_data4) ]
@@ -112,12 +116,15 @@ pprDwarfInfo haveSrc d
-- that the binary format of this is paramterized in @abbrevDecls@ and
-- has to be kept in synch.
pprDwarfInfoOpen :: Bool -> DwarfInfo -> SDoc
-pprDwarfInfoOpen haveSrc (DwarfCompileUnit _ name producer compDir lineLbl) =
+pprDwarfInfoOpen haveSrc (DwarfCompileUnit _ name producer compDir lowLabel
+ highLabel lineLbl) =
pprAbbrev DwAbbrCompileUnit
$$ pprString name
$$ pprString producer
$$ pprData4 dW_LANG_Haskell
$$ pprString compDir
+ $$ pprWord (ppr lowLabel)
+ $$ pprWord (ppr highLabel)
$$ if haveSrc
then sectionOffset lineLbl dwarfLineLabel
else empty