Something went wrong. Try again.
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041-- | Serialise a DWARF 5 @.debug_str_offsets@ contribution.---- Format: initial_length, version=5, padding=0, then an array of-- format-word-sized offsets into @.debug_str@.-- Inverse of "Data.Dwarf.Read.StrOffsets".module Data.Dwarf.Write.StrOffsets ( writeStrOffsetsTable ) where
import Data.ByteString (ByteString)import Data.Word (Word64)
import Data.Dwarf.Encoding (Endianness, Format(..))import Data.Dwarf.Write.Writer
-- | Serialise a @.debug_str_offsets@ contribution from a list of-- offsets into @.debug_str@.---- Produces the complete contribution bytes: initial_length + version(2) +-- padding(2) + offset entries.writeStrOffsetsTable :: Endianness -> Format -> [Word64] -> ByteStringwriteStrOffsetsTable e fmt offsets = let n = length offsets ws = formatOffSize fmt
-- Content: version(2) + padding(2) + entries contentLen = 4 + fromIntegral (n * ws) :: Word64
body = putInitialLength e fmt contentLen <> putU16 e 5 -- version <> putU16 e 0 -- padding <> foldMap (putOffset e fmt) offsets
in toStrict body
-- | Offset entry size in bytes.formatOffSize :: Format -> IntformatOffSize Dwarf32 = 4formatOffSize Dwarf64 = 8