[Git][ghc/ghc][wip/jeltsch/textual-bytecode-output] Improve printing of various strings
Wolfgang Jeltsch pushed to branch wip/jeltsch/textual-bytecode-output at Glasgow Haskell Compiler / GHC Commits: 5b28ba1a by Wolfgang Jeltsch at 2026-06-06T16:24:26+03:00 Improve printing of various strings - - - - - 1 changed file: - compiler/GHC/ByteCode/Show.hs Changes: ===================================== compiler/GHC/ByteCode/Show.hs ===================================== @@ -31,6 +31,7 @@ import Text.Show (show) import System.IO (IO, FilePath) import Foreign.Storable (Storable) import GHC.Data.Strict qualified as Strict (Maybe, maybe) +import GHC.Data.FastString (unpackFS) import GHC.Data.FlatBag (FlatBag, elemsFlatBag) import GHC.Fingerprint (Fingerprint) import GHC.Types.SrcLoc (noSrcSpan) @@ -41,7 +42,7 @@ import GHC.Types.SptEntry (SptEntry (..)) import GHC.Types.Error (MessageClass (MCDump)) import GHC.Utils.Logger (Logger, logMsg) import GHC.Utils.Binary (BinSrcSpan (..)) -import GHC.Utils.Encoding.UTF8 (utf8DecodeShortByteString) +import GHC.Utils.Encoding.UTF8 (utf8DecodeShortByteString, utf8DecodeByteString) import GHC.Utils.Outputable ( defaultDumpStyle, @@ -181,19 +182,26 @@ pprLiterals currentModule = entry (text "literals:") . pprLiteral :: Module -> BCONPtr -> SDoc pprLiteral currentModule literal = case literal of BCONPtrWord word - -> text "word" <+> pprFixedSizeNatural word + -> text "word" <+> + pprFixedSizeNatural word BCONPtrLbl label - -> text "label" <+> ppr label + -> text "label" <+> + ppr label BCONPtrItbl infoTableName - -> text "info table" <+> ppr infoTableName + -> text "info table" <+> + ppr infoTableName BCONPtrAddr addrName - -> text "address" <+> ppr addrName + -> text "address" <+> + ppr addrName BCONPtrStr encodedString - -> text "top-level string" <+> pprByteString encodedString + -> text "top-level string" <+> + text (show (utf8DecodeByteString encodedString)) BCONPtrFS string - -> text "top-level string" <+> ppr string + -> text "top-level string" <+> + text (show (unpackFS string)) BCONPtrFFIInfo ffiInfo - -> text "foreign function" <+> pprFFIInfo ffiInfo + -> text "foreign function" <+> + pprFFIInfo ffiInfo BCONPtrCostCentre breakpointID -> text "cost center" <+> pprInternalBreakpointID currentModule breakpointID @@ -283,7 +291,9 @@ pprPointerTag = entry (text "pointer tag:") . ppr -- | […] pprDescription :: ByteString -> SDoc -pprDescription = entry (text "description:") . pprByteString +pprDescription = entry (text "description:") . + text . + utf8DecodeByteString -- | […] pprTopLevelStrings :: [(Name, ByteString)] -> SDoc @@ -295,7 +305,10 @@ pprTopLevelStrings = entry (text "top-level strings:") . pprTopLevelString :: Name -> ByteString -> SDoc pprTopLevelString stringName encodedString = entry (text "string" <+> ppr stringName <> text ":") $ - pprByteString encodedString + text $ + show $ + utf8DecodeByteString $ + encodedString -- | […] pprBreakpoints :: Module -> Maybe InternalModBreaks -> SDoc View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5b28ba1a9973a16a7c721987736d3cd7... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5b28ba1a9973a16a7c721987736d3cd7... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Wolfgang Jeltsch (@jeltsch)