package binsec
Install
Dune Dependency
Authors
-
AAdel Djoudi
-
BBenjamin Farinier
-
CChakib Foulani
-
DDorian Lesbre
-
FFrédéric Recoules
-
GGuillaume Girol
-
JJosselin Feist
-
LLesly-Ann Daniel
-
MManh-Dung Nguyen
-
MMathéo Vergnolle
-
MMathilde Ollivier
-
MMatthieu Lemerre
-
OOlivier Nicole
-
RRichard Bonichon
-
RRobin David
-
SSébastien Bardin
-
SSoline Ducousso
-
TTa Thanh Dinh
-
YYaëlle Vinçont
Maintainers
Sources
sha256=2f990f80ebd06b71af4fde46c6a248eb74d52c6f46be63bdf97d99f72589db13
sha512=38d93ae20ae58e10027eb0f7669d3ab960ddc640526018fc94008ccd6cb63ec99030d0ee39dfb9cbd0d5e144db4615c9027bd2adcb197fc75676c45dbb54f836
doc/binsec/Binsec/Dhunk/index.html
Module Binsec.Dhunk
DBA hunks, aka dhunk
DBA blocks
A DBA block represents a set of DBA instructions with explicit links to the next one. The first instruction of the block always has id
0. Typically, DBA a block is the translation of one binary/assembly instruction.
val empty : t
The one and only empty DBA hunk. Get it here!
val stop : t
A simple dhunk of one instruction stopping with an OK
Dba.state
val is_empty : t -> bool
val init : int -> (int -> Dba.Instr.t) -> t
val singleton : Dba.Instr.t -> t
val goto : Virtual_address.t -> t
A simple dhunk of one instruction jumping to the virtual address.
val length : t -> int
val inst : t -> int -> Dba.Instr.t option
val inst_exn : t -> int -> Dba.Instr.t
val start : t -> int
start b
is the first index of block b
val exits : t -> int list
exits b
are the instruction indexes which end the block b
val iter : f:(Dba.Instr.t -> unit) -> t -> unit
val iteri : f:(int -> Dba.Instr.t -> unit) -> t -> unit
val of_list : Dba.Instr.t list -> t
of_list l
assumes the list is sorted in increasing order inside the block
val of_labelled_list : (int * Dba.Instr.t) list -> t
of_list l
assumes the list is sorted in increasing order inside the block, i.e. the labels are contiguous starting from 0.
val mapi : f:(int -> Dba.Instr.t -> Dba.Instr.t) -> t -> t
val flatten : t -> (int * Dba.Instr.t) list
val to_list : t -> Dba.Instr.t list
val fold : ('a -> Dba.Instr.t -> 'a) -> 'a -> t -> 'a
val for_all : (Dba.Instr.t -> bool) -> t -> bool
val unlink : t -> int -> unit
unlink dh i
skips the i
th instruction. Its predecessors go to its successor.
val export_and_view : ?cmd:string -> t -> unit
view dh
Visualize dot-rendered DBA hunk dh
using cmd
.
Default value for cmd
is firefox.
val pred : t -> int -> int list
val succ : t -> int -> int list
optimize dh
Performs some "compiler" optimizations and return the simplified block.
include Sigs.PRINTABLE with type t := t
val pp : Format.formatter -> t -> unit
Dhunk properties
module Check : sig ... end
val to_stmts : t -> Virtual_address.t -> Dba_types.Statement.t list
val outer_jumps : t -> Virtual_address.Set.t
outer_jumps b
computes the set of jumps to external addresses in hunk b
. Due to dynamic jumps, this represents a syntactic under-approximation of the possible jumps from this block.
val callees : t -> Virtual_address.Set.t
callees b
computes the set of addresses this block may call
val is_return : t -> bool
is_return d
check if dhunk d
encodes a return
val has_indirect_jump : t -> bool
has_indirect_jump d
returns true
if the hunk contains an indirect jump instruction
type conditional = {
condition : Dba.Expr.t;
consequent : Virtual_address.t;
alternative : Virtual_address.t;
}
val conditional : t -> conditional option