Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Binary.Generic
Synopsis
- data SectionsInfo = SectionsInfo {
- si_sections :: ![(String, String, Word64, Word64, Word64)]
- si_min_address :: !Word64
- si_max_address :: !Word64
- data SymbolTable = SymbolTable {
- symboltable_symbols :: !(IntMap Symbol)
- symboltable_exterbals :: !(Set String)
- data Relocation = Relocation Word64 Word64
- class BinaryClass a where
- binary_read_bytestring :: a -> Word64 -> Int -> Maybe ByteString
- binary_read_ro_data :: a -> Word64 -> Int -> Maybe [Word8]
- binary_read_data :: a -> Word64 -> Int -> Maybe [Word8]
- binary_get_sections_info :: a -> SectionsInfo
- binary_get_symbols :: a -> SymbolTable
- binary_get_relocations :: a -> Set Relocation
- binary_pp :: a -> String
- binary_entry :: a -> Word64
- binary_text_section_size :: a -> Int
- binary_dir_name :: a -> String
- binary_file_name :: a -> String
- data Binary = forall b.BinaryClass b => Binary b
- binary_get_symbol_table :: BinaryClass a => a -> IntMap Symbol
- binary_get_global_symbols :: BinaryClass a => a -> Set String
- symbol_to_name :: Symbol -> String
- is_roughly_an_address :: BinaryClass bin => bin -> Word64 -> Bool
- find_section_for_address :: BinaryClass bin => bin -> Word64 -> Maybe (String, String, Word64, Word64, Word64)
- read_from_ro_datasection :: BinaryClass bin => bin -> Word64 -> Int -> Maybe Word64
- find_section_ending_at :: BinaryClass bin => bin -> Word64 -> Maybe (String, String, Word64, Word64, Word64)
- fetch_instruction :: BinaryClass bin => bin -> Word64 -> Maybe Instruction
- address_has_instruction :: BinaryClass bin => bin -> Word64 -> Bool
Documentation
data SectionsInfo Source #
Information on the sections in the binary
Constructors
SectionsInfo | |
Fields
|
Instances
Generic SectionsInfo Source # | |
Defined in Binary.Generic Associated Types type Rep SectionsInfo :: Type -> Type # | |
Show SectionsInfo Source # | |
Defined in Binary.Generic Methods showsPrec :: Int -> SectionsInfo -> ShowS # show :: SectionsInfo -> String # showList :: [SectionsInfo] -> ShowS # | |
Serialize SectionsInfo Source # | |
Defined in Binary.Generic | |
Eq SectionsInfo Source # | |
Defined in Binary.Generic | |
type Rep SectionsInfo Source # | |
Defined in Binary.Generic type Rep SectionsInfo = D1 ('MetaData "SectionsInfo" "Binary.Generic" "foxdec-0.1.0.0-DGuc5MMkhbvOBLAebyTd5" 'False) (C1 ('MetaCons "SectionsInfo" 'PrefixI 'True) (S1 ('MetaSel ('Just "si_sections") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [(String, String, Word64, Word64, Word64)]) :*: (S1 ('MetaSel ('Just "si_min_address") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Just "si_max_address") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64)))) |
data SymbolTable Source #
Constructors
SymbolTable | |
Fields
|
Instances
Generic SymbolTable Source # | |
Defined in Binary.Generic Associated Types type Rep SymbolTable :: Type -> Type # | |
Show SymbolTable Source # | |
Defined in Binary.Generic Methods showsPrec :: Int -> SymbolTable -> ShowS # show :: SymbolTable -> String # showList :: [SymbolTable] -> ShowS # | |
Serialize SymbolTable Source # | |
Defined in Binary.Generic | |
Eq SymbolTable Source # | |
Defined in Binary.Generic | |
type Rep SymbolTable Source # | |
Defined in Binary.Generic type Rep SymbolTable = D1 ('MetaData "SymbolTable" "Binary.Generic" "foxdec-0.1.0.0-DGuc5MMkhbvOBLAebyTd5" 'False) (C1 ('MetaCons "SymbolTable" 'PrefixI 'True) (S1 ('MetaSel ('Just "symboltable_symbols") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (IntMap Symbol)) :*: S1 ('MetaSel ('Just "symboltable_exterbals") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Set String)))) |
data Relocation Source #
Constructors
Relocation Word64 Word64 | 8: At address a0, address a1 has been written, i.e., qword ptr[a0] == a1 |
Instances
class BinaryClass a where Source #
Methods
binary_read_bytestring :: a -> Word64 -> Int -> Maybe ByteString Source #
binary_read_ro_data :: a -> Word64 -> Int -> Maybe [Word8] Source #
binary_read_data :: a -> Word64 -> Int -> Maybe [Word8] Source #
binary_get_sections_info :: a -> SectionsInfo Source #
binary_get_symbols :: a -> SymbolTable Source #
binary_get_relocations :: a -> Set Relocation Source #
binary_pp :: a -> String Source #
binary_entry :: a -> Word64 Source #
binary_text_section_size :: a -> Int Source #
binary_dir_name :: a -> String Source #
binary_file_name :: a -> String Source #
Instances
Constructors
forall b.BinaryClass b => Binary b |
Instances
BinaryClass Binary Source # | |
Defined in Binary.Generic Methods binary_read_bytestring :: Binary -> Word64 -> Int -> Maybe ByteString Source # binary_read_ro_data :: Binary -> Word64 -> Int -> Maybe [Word8] Source # binary_read_data :: Binary -> Word64 -> Int -> Maybe [Word8] Source # binary_get_sections_info :: Binary -> SectionsInfo Source # binary_get_symbols :: Binary -> SymbolTable Source # binary_get_relocations :: Binary -> Set Relocation Source # binary_pp :: Binary -> String Source # binary_entry :: Binary -> Word64 Source # binary_text_section_size :: Binary -> Int Source # binary_dir_name :: Binary -> String Source # binary_file_name :: Binary -> String Source # |
binary_get_symbol_table :: BinaryClass a => a -> IntMap Symbol Source #
binary_get_global_symbols :: BinaryClass a => a -> Set String Source #
symbol_to_name :: Symbol -> String Source #
is_roughly_an_address Source #
Arguments
:: BinaryClass bin | |
=> bin | The binary |
-> Word64 | An address |
-> Bool |
Is the immediate roughly in range to be an address?
find_section_for_address Source #
Arguments
:: BinaryClass bin | |
=> bin | The binary |
-> Word64 | An address |
-> Maybe (String, String, Word64, Word64, Word64) |
Find a section for an address (see
)SectionsInfo
read_from_ro_datasection Source #
Arguments
:: BinaryClass bin | |
=> bin | The binary |
-> Word64 | An address |
-> Int | Size, i.e., the number of bytes to read |
-> Maybe Word64 |
Reading from a read-only data section.
Reads maximally up to 8 bytes. Returns Nothing
if the given address is out-of-range.
find_section_ending_at Source #
Arguments
:: BinaryClass bin | |
=> bin | The binary |
-> Word64 | An address |
-> Maybe (String, String, Word64, Word64, Word64) |
Find a section ending at address (see
)SectionsInfo
Arguments
:: BinaryClass bin | |
=> bin | |
-> Word64 | An address |
-> Maybe Instruction |
Fetching an instruction
Returns Nothing
if the given address is out-of-range.
address_has_instruction Source #
Arguments
:: BinaryClass bin | |
=> bin | |
-> Word64 | An address |
-> Bool |
Returns true iff an instruction can be fetched from the address.