summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2015-08-29 12:24:14 +0200
committerBen Gamari <ben@smart-cactus.org>2015-08-29 13:08:17 +0200
commit81ae26d3d18803ac87cf5f72b7c313793df8312c (patch)
tree687c83a49ff7a2c202868705070cff3da558ba81 /compiler
parent1b56c40578374a15b4a2593895710c68b0e2a717 (diff)
downloadhaskell-81ae26d3d18803ac87cf5f72b7c313793df8312c.tar.gz
Dwarf: Fix DW_AT_use_UTF8 attribute
Previously this was given in the body but not in the abbreviation table. Who knows what sort of havoc this was wrecking. Test Plan: Verify against DWARF4 specification Reviewers: scpmw, austin Subscribers: Tarrasch, thomie Differential Revision: https://phabricator.haskell.org/D1172
Diffstat (limited to 'compiler')
-rw-r--r--compiler/nativeGen/Dwarf/Constants.hs3
-rw-r--r--compiler/nativeGen/Dwarf/Types.hs8
2 files changed, 6 insertions, 5 deletions
diff --git a/compiler/nativeGen/Dwarf/Constants.hs b/compiler/nativeGen/Dwarf/Constants.hs
index 4b334fca3d..333d670914 100644
--- a/compiler/nativeGen/Dwarf/Constants.hs
+++ b/compiler/nativeGen/Dwarf/Constants.hs
@@ -60,13 +60,14 @@ dW_CHILDREN_no = 0
dW_CHILDREN_yes = 1
dW_FORM_addr, dW_FORM_data4, dW_FORM_string, dW_FORM_flag,
- dW_FORM_block1, dW_FORM_ref4 :: Word
+ dW_FORM_block1, dW_FORM_ref4, dW_FORM_flag_present :: Word
dW_FORM_addr = 0x01
dW_FORM_data4 = 0x06
dW_FORM_string = 0x08
dW_FORM_flag = 0x0c
dW_FORM_block1 = 0x0a
dW_FORM_ref4 = 0x13
+dW_FORM_flag_present = 0x19
-- | Dwarf native types
dW_ATE_address, dW_ATE_boolean, dW_ATE_float, dW_ATE_signed,
diff --git a/compiler/nativeGen/Dwarf/Types.hs b/compiler/nativeGen/Dwarf/Types.hs
index 00d0535a07..f9262b4e83 100644
--- a/compiler/nativeGen/Dwarf/Types.hs
+++ b/compiler/nativeGen/Dwarf/Types.hs
@@ -66,7 +66,8 @@ pprAbbrev :: DwarfAbbrev -> SDoc
pprAbbrev = pprLEBWord . fromIntegral . fromEnum
-- | Abbreviation declaration. This explains the binary encoding we
--- use for representing @DwarfInfo@.
+-- use for representing 'DwarfInfo'. Be aware that this must be updated
+-- along with 'pprDwarfInfo'.
pprAbbrevDecls :: Bool -> SDoc
pprAbbrevDecls haveDebugLine =
let mkAbbrev abbr tag chld flds =
@@ -76,11 +77,11 @@ pprAbbrevDecls haveDebugLine =
in dwarfAbbrevSection $$
ptext dwarfAbbrevLabel <> colon $$
mkAbbrev DwAbbrCompileUnit dW_TAG_compile_unit dW_CHILDREN_yes
- ([ (dW_AT_name, dW_FORM_string)
+ ([(dW_AT_name, dW_FORM_string)
, (dW_AT_producer, dW_FORM_string)
, (dW_AT_language, dW_FORM_data4)
, (dW_AT_comp_dir, dW_FORM_string)
- , (dW_AT_use_UTF8, dW_FORM_flag)
+ , (dW_AT_use_UTF8, dW_FORM_flag_present) -- not represented in body
] ++
(if haveDebugLine
then [ (dW_AT_stmt_list, dW_FORM_data4) ]
@@ -117,7 +118,6 @@ pprDwarfInfoOpen haveSrc (DwarfCompileUnit _ name producer compDir lineLbl) =
$$ pprString producer
$$ pprData4 dW_LANG_Haskell
$$ pprString compDir
- $$ pprFlag True -- use UTF8
$$ if haveSrc
then sectionOffset lineLbl dwarfLineLabel
else empty