package binsec

  1. Overview
  2. Docs

doc/binsec.base/Binsec_base/Term/Make/index.html

Module Term.MakeSource

Parameters

module A : Sigs.HASHABLE
module B : Sigs.HASHABLE

Signature

Sourcetype nonrec size = size
Sourcetype nonrec 'a interval = 'a interval = {
  1. lo : 'a;
  2. hi : 'a;
}
Sourcetype nonrec endianness = endianness =
  1. | LittleEndian
  2. | BigEndian
Sourcetype 'a op = 'a operator =
  1. | Not : unary op
  2. | Sext : size -> unary op
  3. | Uext : size -> unary op
  4. | Restrict : int interval -> unary op
  5. | Plus : binary op
  6. | Minus : _ op
  7. | Mul : binary op
  8. | Udiv : binary op
  9. | Urem : binary op
  10. | Sdiv : binary op
  11. | Srem : binary op
  12. | Or : binary op
  13. | And : binary op
  14. | Xor : binary op
  15. | Concat : binary op
  16. | Lsl : binary op
  17. | Lsr : binary op
  18. | Asr : binary op
  19. | Rol : binary op
  20. | Ror : binary op
  21. | Eq : binary op
  22. | Diff : binary op
  23. | Ule : binary op
  24. | Ult : binary op
  25. | Uge : binary op
  26. | Ugt : binary op
  27. | Sle : binary op
  28. | Slt : binary op
  29. | Sge : binary op
  30. | Sgt : binary op
Sourcetype ('k, 'a, 'b) term = private ('k, 'a, 'b) 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. mutable addr : ([ `Exp ], 'a, 'b) term;
    5. label : 'b;
    } -> ([< `Mem | `Loc | `Exp ], 'a, 'b) term
  3. | Cst : Bitvector.t -> ([< `Cst | `Exp ], _, _) term
  4. | Unary : {
    1. hash : int;
    2. size : size;
    3. f : unary operator;
    4. mutable x : ([ `Exp ], 'a, 'b) term;
    } -> ([< `Unary | `Exp ], 'a, 'b) term
  5. | Binary : {
    1. hash : int;
    2. size : size;
    3. f : binary operator;
    4. mutable x : ([ `Exp ], 'a, 'b) term;
    5. mutable y : ([ `Exp ], 'a, 'b) term;
    } -> ([< `Binary | `Exp ], 'a, 'b) term
  6. | Ite : {
    1. hash : int;
    2. size : size;
    3. mutable c : ([ `Exp ], 'a, 'b) term;
    4. mutable t : ([ `Exp ], 'a, 'b) term;
    5. mutable e : ([ `Exp ], 'a, 'b) term;
    } -> ([< `Ite | `Exp ], 'a, 'b) term
Sourcetype t = ([ `Exp ], A.t, B.t) term

Smart constructors

Sourceval var : string -> size -> A.t -> t

var name bitsize label

Sourceval load : size -> endianness -> t -> B.t -> t

load nbytes endianness addr label

Sourceval constant : Bitvector.t -> t

constant bv creates a constant expression from the bitvector bv.

Sourceval unary : unary op -> t -> t

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

Sourceval binary : binary op -> t -> t -> t

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

Sourceval ite : t -> t -> t -> t

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

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

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

Sourceval rotate_left : t -> t -> t
Sourceval rotate_right : t -> t -> t

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

Sourceval sext : size -> t -> t

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

Sourceval uext : size -> t -> t

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

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

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

Sourceval bit_restrict : int -> t -> t

bit_restrict o e is restrict o o e

Sourceval byte_swap : t -> t

byte_swap e reverses the byte order of the expression e

Specific constants

Sourceval zeros : int -> t

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

Sourceval ones : int -> t

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

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

hash t returns the hash of t in constant time.

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

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

Sourceval map : (string -> int -> 'a -> t) -> (int -> Machine.endianness -> t -> 'b -> t) -> (_, 'a, 'b) term -> t
Sourceval _unary : unary op -> t -> t

Raw constructors

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

Sourceval _binary : binary op -> t -> t -> t

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

Sourceval _ite : t -> t -> t -> t

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