Commit 81ae26d3 authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari
Browse files

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
parent 1b56c405
......@@ -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,
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment