Copyright | (c) Aleksey Makarov 2021 |
---|---|
License | BSD 3-Clause License |
Maintainer | aleksey.makarov@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Pretty print the data parsed by Data.Elf
. Basically these functions are used for golden testing.
Synopsis
- printHeaders :: forall (a :: ElfClass). SingElfClassI a => HeaderXX a -> [SectionXX a] -> [SegmentXX a] -> Doc ()
- printLayout :: MonadCatch m => Headers -> ByteString -> m (Doc ())
- printElf_ :: MonadThrow m => Bool -> Elf -> m (Doc ())
- printElf :: MonadThrow m => Elf -> m (Doc ())
- printStringTable :: MonadThrow m => ByteString -> m (Doc ())
- printHeader :: forall (a :: ElfClass). SingElfClassI a => HeaderXX a -> Doc ()
- readFileLazy :: FilePath -> IO ByteString
- writeElfDump :: FilePath -> FilePath -> IO ()
- writeElfLayout :: FilePath -> FilePath -> IO ()
- splitBits :: (Num w, FiniteBits w) => w -> [w]
Documentation
printHeaders :: forall (a :: ElfClass). SingElfClassI a => HeaderXX a -> [SectionXX a] -> [SegmentXX a] -> Doc () Source #
Print parsed header, section table and segment table. It's used in golden tests
printLayout :: MonadCatch m => Headers -> ByteString -> m (Doc ()) Source #
Print ELF layout. First parse ELF with parseHeaders
, then use this function to
format the layout.
printElf_ :: MonadThrow m => Bool -> Elf -> m (Doc ()) Source #
Print ELF. If first argument is False, don't dump all the data, print just the first two and the last lines.
printStringTable :: MonadThrow m => ByteString -> m (Doc ()) Source #
Print string table. It's used in golden tests
printHeader :: forall (a :: ElfClass). SingElfClassI a => HeaderXX a -> Doc () Source #
Print ELF header. It's used in golden tests
readFileLazy :: FilePath -> IO ByteString Source #
Read the file strictly but return lazy bytestring
writeElfDump :: FilePath -> FilePath -> IO () Source #
Read ELF from one file, printElf
it into another.
writeElfLayout :: FilePath -> FilePath -> IO () Source #
Read ELF from one file, printLayout
it into another.
splitBits :: (Num w, FiniteBits w) => w -> [w] Source #
Splits an integer into list of integers such that its sum equals to the argument,
and each element of the list is of the form (1 << x)
for some x
.
splitBits 5
produces [ 1, 4 ]