hapstone-0.1.0.0: Capstone bindings for Haskell

Copyright(c) Inokentiy Babushkin, 2016
LicenseBSD3
MaintainerInokentiy Babushkin <inokentiy.babushkin@googlemail.com>
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Hapstone.Capstone

Description

This module wraps all the complex and unsafe details of the capstone API to provide a simple interface to a disassembler, while retaining a reasonable level of versatility.

TODO: write a proper user guide here.

Synopsis

Documentation

disasmIO :: Disassembler a -> IO (Either CsErr [(CsInsn, a)]) Source

run a Disassembler, keeping the results of the custom action

disasmSimpleIO :: Disassembler a -> IO (Either CsErr [CsInsn]) Source

run a disassembler, throwing away the results of the custom action

data Disassembler a Source

a structure holding settings for a disassembling action

Constructors

Disassembler 

Fields

arch :: CsArch

architecture

modes :: [CsMode]

disassembling modes

buffer :: [Word8]

buffer to disassemble

addr :: Word64

address of first byte in the buffer

num :: Int

number of instructions to disassemble (0 for maximum)

detail :: Bool

include detailed information?

skip :: Maybe CsSkipdataStruct

setup SKIPDATA options

action :: Csh -> CsInsn -> IO a

action to run on each instruction

defaultSkipdataStruct :: CsSkipdataStruct Source

default setup for skipdata: ".db" string and no callback

defaultAction :: Csh -> CsInsn -> IO () Source

default action to run on each instruction (does nothing)

mkCallback :: Storable a => (Storable a => ([Word8], [Word8]) -> a -> IO CSize) -> IO CsSkipdataCallback Source

wrap a relatively safe function to get a callback "safe" in this context means that the buffer remains unmodified