package binsec

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
include Binsec.Term.S with type a := string and type b := Memory.t
type nonrec size = Binsec.Term.size
type nonrec 'a interval = 'a Binsec.Term.interval = {
  1. lo : 'a;
  2. hi : 'a;
}
type nonrec endianness = Binsec.Term.endianness =
  1. | LittleEndian
  2. | BigEndian
type ('k, 'a, 'b) term = private ('k, 'a, 'b) Binsec.Term.t =
  1. | Var : {
    1. hash : int;
    2. size : size;
    3. name : string;
    4. label : 'a;
    } -> ([< `Var | `Loc | `Exp ], 'a, _) term
  2. | Load : {
    1. hash : int;
    2. len : size;
    3. dir : endianness;
    4. addr : ([ `Exp ], 'a, 'b) term;
    5. label : 'b;
    } -> ([< `Mem | `Loc | `Exp ], 'a, 'b) term
  3. | Cst : Binsec.Bitvector.t -> ([< `Cst | `Exp ], _, _) term
  4. | Unary : {
    1. hash : int;
    2. size : size;
    3. f : Binsec.Term.unary Binsec.Term.operator;
    4. x : ([ `Exp ], 'a, 'b) term;
    } -> ([ `Exp ], 'a, 'b) term
  5. | Binary : {
    1. hash : int;
    2. size : size;
    3. f : Binsec.Term.binary Binsec.Term.operator;
    4. x : ([ `Exp ], 'a, 'b) term;
    5. y : ([ `Exp ], 'a, 'b) term;
    } -> ([ `Exp ], 'a, 'b) term
  6. | Ite : {
    1. hash : int;
    2. size : size;
    3. c : ([ `Exp ], 'a, 'b) term;
    4. t : ([ `Exp ], 'a, 'b) term;
    5. e : ([ `Exp ], 'a, 'b) term;
    } -> ([ `Exp ], 'a, 'b) term
type t = ([ `Exp ], string, Memory.t) term

Constructors

val var : string -> size -> string -> t

var name bitsize label

val load : size -> endianness -> t -> Memory.t -> t

load nbytes endianness addr label

val constant : Binsec.Bitvector.t -> t

constant bv creates a constant expression from the bitvector bv.

val unary : Binsec.Term.unary op -> t -> t

unary f x creates a unary application of f on x.

val binary : Binsec.Term.binary op -> t -> t -> t

binary f x y creates a binary application of f on x and y.

val ite : t -> t -> t -> t

ite c t e creates an if-then-else expression c ? t : e.

val uminus : t -> t
val add : t -> t -> t
val sub : t -> t -> t
val mul : t -> t -> t
val smod : t -> t -> t
val umod : t -> t -> t
val udiv : t -> t -> t
val sdiv : t -> t -> t
val append : t -> t -> t
val equal : t -> t -> t
val diff : t -> t -> t
val ule : t -> t -> t
val uge : t -> t -> t
val ult : t -> t -> t
val ugt : t -> t -> t
val sle : t -> t -> t
val sge : t -> t -> t
val slt : t -> t -> t
val sgt : t -> t -> t
val logand : t -> t -> t
val logor : t -> t -> t
val lognot : t -> t
val logxor : t -> t -> t
val shift_left : t -> t -> t
val shift_right : t -> t -> t
val shift_right_signed : t -> t -> t

shift_(left|right) e q shifts expression e by quantity q, padding with zeroes

val rotate_left : t -> t -> t
val rotate_right : t -> t -> t

rotate_(left|right) e q rotates expression e by quantity q

val sext : size -> t -> t

sext sz e performs a signed extension of expression e to size sz

val uext : size -> t -> t

uext sz e performs an unsigned extension expression e to size sz

val restrict : lo:int -> hi:int -> t -> t

restrict lo hi e creates Dba.ExprUnary(Restrict(lo, hi), e) if hi >= lo && lo >=0 .

val bit_restrict : int -> t -> t

bit_restrict o e is restrict o o e

Specific constants

val zeros : int -> t

zeros n creates a constant expression of value 0 with length n

val ones : int -> t

ones n creates a constant expression of value 1 with length n. I.e.; it has (n - 1) zeros in binary.

val one : t
val zero : t
val addi : t -> int -> t
val addz : t -> Z.t -> t
Utils

*

val hash : t -> int

hash t returns the hash of t in constant time.

val is_equal : t -> t -> bool
val compare : t -> t -> int
val sizeof : t -> size

sizeof t returns the bit size of t in constant time.

val map : (string -> int -> 'a -> t) -> (int -> Binsec.Machine.endianness -> t -> 'b -> t) -> (_, 'a, 'b) term -> t
OCaml

Innovation. Community. Security.