Theory.Unit
A unit of code.
A unit of code is a generic piece of code, i.e., a set of instructions that share some common properties, such as the instruction set architecture. The whole set of instructions in the knowledge base is partitioned into units, so that each instruction belongs to at most one code unit, see the Label.unit
property.
type t = cls KB.Object.t
the meta type of the unit object
val cls : (cls, unit) KB.Class.t
the base class for all units.
Right now we have only one sort of units, indexed with the unit
type. But later we may introduce more unit sorts.
val for_file : string -> t Bap_knowledge.knowledge
for_file name
creates a new unit denoting a file with the given name
.
This function creates a symbol that interns name
in the file
package and sets the path
property to name
.
val for_region : lower:word -> upper:word -> t Bap_knowledge.knowledge
for_region ~lower ~upper
creates a new unit denoting an anonymous memory region.
The lower
and upper
labels are interned in the current package and the symbol, built from their concatenation, is interned in the region
package. That enables distinguishing between anonymous memory regions that belong to different projects/files but having intersecting set of addresses, provided that every project is setting the current package to some unique name.
bias
is the bias of all addresses in the unit.
If a unit is biased, then all addresses in this unit have Some bias
with respect to the real addresses in the unit representation. To obtain the real address the bias
shall be subtracted from the address that is stored in the knowledge base. To get the biased address the bias
shall be added to the real address.
Any knowledge provider that also operates with the real view on the program must take bias
into account.
compiler
the program that translated the unit from the source
.
include Bap_knowledge.Knowledge.Object.S with type t := t
include Base.Comparable.S with type t := t
val comparator : (t, comparator_witness) Base__.Comparator.comparator
include Core_kernel.Binable.S with type t := t
val bin_size_t : t Bin_prot.Size.sizer
val bin_write_t : t Bin_prot.Write.writer
val bin_read_t : t Bin_prot.Read.reader
val __bin_read_t__ : (int -> t) Bin_prot.Read.reader
val bin_writer_t : t Bin_prot.Type_class.writer
val bin_reader_t : t Bin_prot.Type_class.reader
val bin_t : t Bin_prot.Type_class.t