package bap-std

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Binary Image.

Type definitions

type t = image

image

val sexp_of_t : t -> Ppx_sexp_conv_lib.Sexp.t
type segment

segment

symbol

val bin_segment : segment Core_kernel.Bin_prot.Type_class.t
val bin_read_segment : segment Core_kernel.Bin_prot.Read.reader
val __bin_read_segment__ : (int -> segment) Core_kernel.Bin_prot.Read.reader
val bin_reader_segment : segment Core_kernel.Bin_prot.Type_class.reader
val bin_size_segment : segment Core_kernel.Bin_prot.Size.sizer
val bin_write_segment : segment Core_kernel.Bin_prot.Write.writer
val bin_writer_segment : segment Core_kernel.Bin_prot.Type_class.writer
val bin_shape_segment : Core_kernel.Bin_prot.Shape.t
val compare_segment : segment -> segment -> int
val segment_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> segment
val sexp_of_segment : segment -> Ppx_sexp_conv_lib.Sexp.t
type symbol

symbol

val bin_symbol : symbol Core_kernel.Bin_prot.Type_class.t
val bin_read_symbol : symbol Core_kernel.Bin_prot.Read.reader
val __bin_read_symbol__ : (int -> symbol) Core_kernel.Bin_prot.Read.reader
val bin_reader_symbol : symbol Core_kernel.Bin_prot.Type_class.reader
val bin_size_symbol : symbol Core_kernel.Bin_prot.Size.sizer
val bin_write_symbol : symbol Core_kernel.Bin_prot.Write.writer
val bin_writer_symbol : symbol Core_kernel.Bin_prot.Type_class.writer
val bin_shape_symbol : Core_kernel.Bin_prot.Shape.t
val compare_symbol : symbol -> symbol -> int
val symbol_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> symbol
val sexp_of_symbol : symbol -> Ppx_sexp_conv_lib.Sexp.t
type path = string

Constructing

constructing an image can result in actual image and a set (hopefully empty) of errors occurred in a process of decoding an image, that do not prevent us from actually creating an image. So, this information messages can be considered as warnings.

val create : ?backend:string -> path -> result

create ?backend filename creates an image of the file specified specified by the filename. If backend is equal to "auto", then all backends are tried in order. If only one backend can read this file (i.e., there is no ambiguity), then image is returned. If backend is not specified, then the LLVM backend is used.

val of_string : ?backend:string -> string -> result

of_string ?backend ~data creates an image from the specified data. See create for backend parameter.

val of_bigstring : ?backend:string -> Core_kernel.Bigstring.t -> result

of_bigstring ?backend ~data creates an image from the specified data. See create for backend parameter.

Attributes

val entry_point : t -> addr

entry_point addr is an address from which a kernel should start

filename image a name of file from which an image was loaded (if any)

val filename : t -> string option

filename image a name of file from which an image was loaded (if any)

val arch : t -> arch

arch image code architecture

val addr_size : t -> addr_size

addr_size image same as Arch.addr_size (Image.arch image)

val endian : t -> endian

endian image same as Arch.endian (Image.arch image)

Tables

val words : t -> size -> word table

words image size returns a mapping from addresses to words of the specified size. For example, Image.words img `r8 returns all bytes.

val segments : t -> segment table

segments image returns a mapping from addresses to segments

val symbols : t -> symbol table

symbols image returns a mapping from addresses to symbols

Tags

val segment : segment tag

tags a segment

val symbol : string tag

tags a symbol

val section : string tag

tags a section

val code_region : unit tag

tags a code region

val specification : Ogre.doc tag

an image specification in OGRE

val memory : t -> value memmap

returns memory, annotated with tags

Mappings

val memory_of_segment : t -> segment -> mem

memory_of_segment img seg returns a memory region occupied by the segment seg.

val memory_of_symbol : t -> symbol -> mem * mem seq

memory_of_symbol sym returns a sequence of memory regions that belong to the sym symbol. The sequence is represented as a pair, where the first element is the starting memory region, and the second elemnt is (a possible empty) sequence of the rest memory regions (in case if a symbol occupies a non-contigious region of memory).

val symbols_of_segment : t -> segment -> symbol seq

symbols_of_segment img seg all symbols that belong to the seg segment.

val segment_of_symbol : t -> symbol -> segment

segment_of_symbol image sym a segment to which sym belongs.

module Segment : sig ... end

Image Segments. Segment is a contiguous region of memory that has permissions. The same as segment in ELF.

module Symbol : sig ... end

Symbol.

Backend Interface

module type Loader = sig ... end

An interface that a backend shall implement.

val register_loader : name:string -> (module Loader) -> unit

register_loader ~name backend registers new loader.

val available_backends : unit -> string list

lists all registered backends

val register_backend : name:string -> Backend.t -> [ `Ok | `Duplicate ]

register_backend ~name backend tries to register backend under the specified name.

  • deprecated

    use register_loader instead

Internals

Access to the low-level internals.

data image returns image data. Usually it is a memory mapped input file, or it is whatever was passed to of_[big]string.

val spec : t -> Ogre.doc

spec image returns the image specification.

  • since 1.3
module Scheme : sig ... end

A scheme of image specification.

OCaml

Innovation. Community. Security.