package bap-std

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

Reconstructor is responsible for reconstructing symbol table from a CFG. It should partition a CFG into a set of possibly intersecting functions. See Symtab module for more information about symbol table and functions.

type t = reconstructor
val create : (cfg -> symtab) -> t

create f creates a reconstructor from a given function f

val default : (word -> string) -> word list -> t

default name roots builds a reconstructor from given a function, that maps addresses to function names (see Symbolizer) and a list of known function starts. The reconstructor will extend the list of function start with destinations of call instructions found in the CFG, and then for each function start build a function using the following definition of a function:

Function is built from the entry block and every block that is reachable from it without using calls, if the block address is greater than the entry block address and less than the address of entry block of the next symbol.

Note: this is an approximation, that works fine for most cases.

val of_blocks : (string * addr * addr) seq -> t

of_blocks produces a reconstructor from a serialized sequence of blocks. Each element of the sequence is deconstructed as (name,ba,ea), where name is a subroutine name, ba is a virtual address of a block start, and ea is an address of the block end.

val run : t -> cfg -> symtab

run reconstructor cfg reconstructs a symbol table from a given cfg

module Factory : Source.Factory.S with type t = t

a factory of reconstructors