Module Linker.Make

Make(Machine) parametrize the Linker with the Machine.

Note that the Linker, as well as all other Primus Machine components, is stateless, i.e., the functor itself doesn't contain any non-syntactic values and thus it is purely functional. All the state is stored in the Machine state. Thus it is absolutely safe, and correct, to create multiple instances of components, as they needed. The functor instatiation is totaly side-effect free.

Parameters

Signature

type 'a m = 'a Machine.t

link ~addr ~name ~tid code links the given code fragment into the Machine. The code can be invoked by one of the provided identifier. If no idetifiers were provided, then apparently code will not be ever invoked. If an identifier was already bound to some other code fragment, then the old binding will be substituted by the new one.

unlink name removes code linked with the provided name.

Also, removes all aliases of the given name.

val lookup : name -> code option m

lookup name returns code linked with the given name.

val exec : name -> unit m

exec name executes a code fragment associated with the given name. Terminates the computation with the Linker.Unbound_name name condition, if the name is not associated with any code fragment.

val resolve_addr : name -> Bap.Std.addr option m

resolve_addr name returns the address associated with the given name.

val resolve_symbol : name -> string option m

resolve_symbol name returns the symbolic name associated with the given name.

  • since 1.5.0
val resolve_tid : name -> Bap.Std.tid option m

resolve_tid name returns the term identifier associated with the given name.

  • since 1.5.0
val is_linked : name -> bool m

is_linked name computes to true if the name is associated with some code.

  • since 1.5.0