package binsec

  1. Overview
  2. Docs

doc/binsec_kernel_loader/Binsec_kernel_loader/Loader_utils/index.html

Module Binsec_kernel_loader.Loader_utilsSource

Loader utility functions

Sourceval find_section_by_name : string -> Loader.Img.t -> Loader.Section.t

section_slice section_name img returns the interval lo, hi of virtual addresses defining the section section_name.

Sourceval find_section_by_address : address:Binsec_base.Virtual_address.t -> Loader.Img.t -> Loader.Section.t option
Sourceval find_section_by_address_exn : address:Binsec_base.Virtual_address.t -> Loader.Img.t -> Loader.Section.t
  • raises Failure

    exception if no such section exists

Sourceval find_section : p:(Loader.Section.t -> bool) -> Loader.Img.t -> Loader.Section.t option

Manipulation of symbols

Functions that are of the form f_by_name call the function symbol_by_name which is costly because it compares all the symbols in the image to the requested name. Use them with parcimony and cache the symbols if they are requested multiple times.

Sourceval symbol_by_name : name:Stdlib.String.t -> Loader.Img.t -> Loader.Symbol.t option

symbol_by_name ~name img Returns Some symbol name in img. If img contains no symbol name, returns None.

address_of_symbol symbol finds Some address where the symbole is defined. Otherwise returns None.

Sourceval address_of_symbol_by_name : name:string -> Loader.Img.t -> Binsec_base.Virtual_address.t option
Sourceval size_of_symbol : Loader.Symbol.t -> int
Sourceval size_of_symbol_by_name : name:string -> Loader.Img.t -> int option

symbol_interval symbol Returns the address range corresponding to symbol

Sourceval symbol_interval_by_name : name:string -> Loader.Img.t -> (Binsec_base.Virtual_address.t * Binsec_base.Virtual_address.t) option
Sourceval belongs_to_symbol : Loader.Symbol.t -> Binsec_base.Virtual_address.t -> bool

belongs_to_symbol symbol addr Returns true if the address addr is locate in the symbol (i.e. in the range address_of_symbol symbol (included) and address_of_symbol symbol + size_of_symbol symbol_interval (excluded)).

Sourceval belongs_to_symbol_by_name : name:string -> Loader.Img.t -> Binsec_base.Virtual_address.t -> bool
Sourceval address_of_symbol_or_section_by_name : name:string -> Loader.Img.t -> Binsec_base.Virtual_address.t option
Sourceval size_of_symbol_or_section_by_name : name:string -> Loader.Img.t -> int option
Sourceval interval_of_symbol_or_section_by_name : name:string -> Loader.Img.t -> (Binsec_base.Virtual_address.t * Binsec_base.Virtual_address.t) option
Sourceval get_byte_at : Loader.Img.t -> Binsec_base.Bitvector.t -> int
Sourcemodule Binary_loc : sig ... end