package binsec

  1. Overview
  2. Docs

doc/binsec.sse/Binsec_sse/Image/index.html

Module Binsec_sse.ImageSource

include module type of struct include Binsec_sse_loader.Image end
type buffer = Binsec_sse_loader.Image.buffer =
  1. | Zero
  2. | Data of {
    1. offset : int;
    2. len : int;
    3. value : Binsec_kernel.Loader_types.buffer;
    }
val crop_buffer : lo:Z.t -> hi:Z.t -> buffer -> buffer

crop_buffer ~lo ~hi buf creates a new buffer view containing the buf bytes from lo to hi.

content_reader addr size ~endianness content returns a new Reader of size bytes of content starting from addr.

Sequential accesses are optimized with a cache.

  • raises Not_found

    if the reader tries to access a non-mapped address.

type protection = Binsec_sse_loader.Image.protection =
  1. | R
  2. | RW
  3. | RX
  4. | RWX
type symbol = Binsec_sse_loader.Image.symbol = {
  1. base : Binsec_kernel.Virtual_address.t;
  2. name : string;
  3. origin : string;
}
type section = Binsec_sse_loader.Image.section = {
  1. base : Binsec_kernel.Virtual_address.t;
  2. name : string;
  3. origin : string;
  4. symbols : symbol Binsec_kernel.Zmap.t;
}
type t = private Binsec_sse_loader.Image.t = {
  1. content : buffer Binsec_kernel.Zmap.t;
    (*

    set of initialized data

    *)
  2. protection : protection Binsec_kernel.Zmap.t;
    (*

    set of mappings

    *)
  3. symbols : (Z.t * string) list Binsec_kernel.Dba.Var.Tag.Attribute.Map.t Binsec_kernel.Basic_types.String.Map.t;
    (*

    set of symbol attributes

    *)
  4. layout : section Binsec_kernel.Zmap.t;
    (*

    reverse memory paving

    *)
}
val load : fs:(string -> Binsec_kernel.Loader_types.buffer) -> string -> Binsec_kernel.Loader.Img.t -> t

load ~fs filename img builds a process image for the file filename with the content, permission and symbols from the loader image img.

It uses the virtual file system fs to access extra file contents (e.g. for separated debug or coredump).

layout_with_cache image returns two mapping functions. The first one maps an address to a section while the second maps an address to the symbol it belongs.

Sequential accesses are optimized with a cache.

  • raises Not_found

    if the address is not mapped.