diff options
Diffstat (limited to 'compiler/nativeGen/Dwarf')
-rw-r--r-- | compiler/nativeGen/Dwarf/Constants.hs | 2 | ||||
-rw-r--r-- | compiler/nativeGen/Dwarf/Types.hs | 16 |
2 files changed, 15 insertions, 3 deletions
diff --git a/compiler/nativeGen/Dwarf/Constants.hs b/compiler/nativeGen/Dwarf/Constants.hs index a8034ef295..db5395af35 100644 --- a/compiler/nativeGen/Dwarf/Constants.hs +++ b/compiler/nativeGen/Dwarf/Constants.hs @@ -3,6 +3,8 @@ module Dwarf.Constants where +import GhcPrelude + import AsmUtils import FastString import Platform diff --git a/compiler/nativeGen/Dwarf/Types.hs b/compiler/nativeGen/Dwarf/Types.hs index 3c4501f613..25629448dd 100644 --- a/compiler/nativeGen/Dwarf/Types.hs +++ b/compiler/nativeGen/Dwarf/Types.hs @@ -22,6 +22,8 @@ module Dwarf.Types ) where +import GhcPrelude + import Debug import CLabel import CmmExpr ( GlobalReg(..) ) @@ -344,7 +346,7 @@ pprFrameProc frameLbl initUw (DwarfFrameProc procLbl hasInfo blocks) procEnd = mkAsmTempEndLabel procLbl ifInfo str = if hasInfo then text str else empty -- see [Note: Info Offset] - in vcat [ ifPprDebug $ text "# Unwinding for" <+> ppr procLbl <> colon + in vcat [ whenPprDebug $ text "# Unwinding for" <+> ppr procLbl <> colon , pprData4' (ppr fdeEndLabel <> char '-' <> ppr fdeLabel) , ppr fdeLabel <> colon , pprData4' (ppr frameLbl <> char '-' <> @@ -413,6 +415,12 @@ pprFrameBlock (DwarfFrameBlock hasInfo uws0) = -- Note that this will not prevent GDB from failing to look-up the -- correct function name for the frame, as that uses the symbol table, -- which we can not manipulate as easily. +-- +-- There's a GDB patch to address this at [1]. At the moment of writing +-- it's not merged, so I recommend building GDB with the patch if you +-- care about unwinding. The hack above doesn't cover every case. +-- +-- [1] https://sourceware.org/ml/gdb-patches/2018-02/msg00055.html -- | Get DWARF register ID for a given GlobalReg dwarfGlobalRegNo :: Platform -> GlobalReg -> Word8 @@ -490,9 +498,11 @@ pprUnwindExpr spIsCFA expr pprE (UwPlus u1 u2) = pprE u1 $$ pprE u2 $$ pprByte dW_OP_plus pprE (UwMinus u1 u2) = pprE u1 $$ pprE u2 $$ pprByte dW_OP_minus pprE (UwTimes u1 u2) = pprE u1 $$ pprE u2 $$ pprByte dW_OP_mul - in text "\t.uleb128 1f-.-1" $$ -- DW_FORM_block length + in text "\t.uleb128 2f-1f" $$ -- DW_FORM_block length + -- computed as the difference of the following local labels 2: and 1: + text "1:" $$ pprE expr $$ - text "1:" + text "2:" -- | Generate code for re-setting the unwind information for a -- register to @undefined@ |