bap-primus

The BAP Microexecution Framework
IN THIS PACKAGE
Module Bap_primus . Std . Primus . Pos
type nil

uninhabited type

type top = Bap.Std.program

the top-most program term.

type ('a, 'b) level = {
me : 'a Bap.Std.term;(*

me current position

*)
up : 'b;(*

up parent cursor

*)
}

(t,p) level a cursor pointing to a t term, that is nested in the parent cursor p.

type level3 = ( top, nil ) level

the highest level of the hierarchy - a cursor the points to the whole program. This is a starting position.

type level2 = ( Bap.Std.sub, level3 ) level

a cursor pointing to a function

type 'a level1 = ( 'a, level2 ) level

a level of arguments and basic blocks

type 'a level0 = ( 'a, Bap.Std.blk level1 ) level

a level of the basic terms, e.g., defs, jmps and phi-nodes.

type t =
| Top of level3(*

a program

*)
| Sub of level2(*

a subroutine

*)
| Arg of Bap.Std.arg level1(*

subroutine argument

*)
| Blk of Bap.Std.blk level1(*

a basic block

*)
| Phi of Bap.Std.phi level0(*

a phi-node

*)
| Def of Bap.Std.def level0(*

a definition

*)
| Jmp of Bap.Std.jmp level0(*

a jump term

*)

a program location

val tid : t -> Bap.Std.tid

tid p is term identifier of the term enclosing position p

val get : 'a Bap.Std.tag -> t -> 'a option

get a p get a value of the attribute a associated with the given position p. Example, Pos.get address p returns a machine address of the position p.

val to_string : t -> string

to_string level a textual and human readable representation of a cursor.

val next : t -> ( 'p, 't ) Bap.Std.cls -> 't Bap.Std.term -> ( t, exn ) Monads.Std.Monad.Result.result

next p cls t moves the cursor position p to the next position, that points to the term t of the class cls. Returns an error if there is no valid transition from the current program position to the specified program term.