[commit: ghc] master: Dwarf: Fix DW_AT_use_UTF8 attribute (81ae26d)

git at git.haskell.org git at git.haskell.org
Sat Aug 29 11:25:43 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/81ae26d3d18803ac87cf5f72b7c313793df8312c/ghc

>---------------------------------------------------------------

commit 81ae26d3d18803ac87cf5f72b7c313793df8312c
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Sat Aug 29 12:24:14 2015 +0200

    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


>---------------------------------------------------------------

81ae26d3d18803ac87cf5f72b7c313793df8312c
 compiler/nativeGen/Dwarf/Constants.hs | 3 ++-
 compiler/nativeGen/Dwarf/Types.hs     | 8 ++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/compiler/nativeGen/Dwarf/Constants.hs b/compiler/nativeGen/Dwarf/Constants.hs
index 4b334fc..333d670 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 00d0535..f9262b4 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 at .
+-- 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



More information about the ghc-commits mailing list