BinaryAnalysisPlatform/bap — pull request #28 by ivg (2014-12-01 00:17:43+00:00)
Title: A pluggable disassembler interface.

This PR introduces a new OCaml/C/C++ interface to a disassembling
facilities. It is developed in assumption that most disassemblers are
implemented in C/C++, so that adding a new disassembler to the BAP will
actually result in writing a new code in C++.

There is a thin C interface, described in `disasm.h` that is used by OCaml
to call disassemblers. This interface is implemented in a modern C++,
that delegates actual work to a backend. The backend should implement a
C++ interface `bap::disassembler_interface` described in `disasm.hpp`
file.

One implementation is provided in this PR, that uses LLVM-3.4 library to
perform disassembly. Other backends are welcome.

On top of primitive interface of `disasm.h` (that is bound in
`Bap_disasm_prim` module), a basic OCaml disassembler is implemented,
see module `Disasm.Basic`, that is implemented in
`bap_disasm/bap_disasm_basic` file. This is a target agnostic
disassembler, that provides a `run` function to perform an arbitrary
recursive parsing (i.e., folding) of binary data. This module is
developed mainly with performance considerations in mind, that's why it
may look a little bit weird.

As a proof of concept `readbin` is enhanced. Now it will disassemble all
found symbols, and then it will linear sweep through all sections, just
to check its robustness.

Also, a test suite is enhanced. Now readbin is applied to all
binaries in coreutils. (Now only for ARM).

Also, build system is enhanced. Now it is able to compile C++ files on
linux and mac os x, search for libraries etc.