package bap-std
Binary Image.
Type definitions
type t = image
image
val sexp_of_t : t -> Ppx_sexp_conv_lib.Sexp.t
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_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_segment : segment Core_kernel.Bin_prot.Type_class.t
val sexp_of_segment : segment -> Ppx_sexp_conv_lib.Sexp.t
val segment_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> segment
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_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_symbol : symbol Core_kernel.Bin_prot.Type_class.t
val sexp_of_symbol : symbol -> Ppx_sexp_conv_lib.Sexp.t
val symbol_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> symbol
Constructing
type result = (t * Core_kernel.Error.t list) Core_kernel.Or_error.t
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.
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 filename : t -> string option
filename image
a name of file from which an image was loaded (if any)
Tables
words image size
returns a mapping from addresses to words of the specified size
. For example, Image.words img `r8
returns all bytes.
Tags
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
Mappings
memory_of_segment img seg
returns a memory region occupied by the segment seg
.
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).
symbols_of_segment img seg
all symbols that belong to the seg
segment.
segment_of_symbol image sym
a segment to which sym
belongs.
module Spec : sig ... end
Interface to the image specification.
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 find_loader : string -> (module Loader) option
find_loader name
lookups the loader registered under the given name
.
val register_backend : name:string -> Backend.t -> [ `Ok | `Duplicate ]
register_backend ~name backend
tries to register backend
under the specified name
.
Internals
Access to the low-level internals.
val data : t -> Core_kernel.Bigstring.t
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.
module Scheme : sig ... end
A scheme of image specification.