Skip to content
Pretty printer from GTIRB to assembly code
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.ci Remove boost isntall from .ci dockerfile Apr 12, 2019
doc/doxy
driver Add version and CMake install target Apr 12, 2019
src add new forbidden symbol name Apr 24, 2019
.clang-format Switch .clang-format to match gtirb\'s settings Feb 26, 2019
.gitignore
CMakeLists.boost
CMakeLists.googletest Initial commit May 7, 2018
CMakeLists.txt
CODE_OF_CONDUCT.md Add and reference a code of conduct Apr 15, 2019
CONTRIBUTING.md Now CONTRIBUTING references gtirb/CONTRIBUTING Apr 15, 2019
LICENSE.txt
README.md
gtirb-pprinter.md Update options from the current datalogDisasm exe Oct 12, 2018
version.txt

README.md

GTIRB Pretty Printer

A pretty printer from the GTIRB intermediate representation for binary analysis and reverse engineering to gas-syntax assembly code.

Building

The pretty-printer uses C++17, and requires a compiler which supports that standard such as gcc 7, clang 6, or MSVC 2017.

Boost (1.67 or later) and GTIRB are required.

Use the following options to configure cmake:

  • You can tell CMake which compiler to use with -DCMAKE_CXX_COMPILER=<compiler>.
  • Normally CMake will find GTIRB automatically, but if it does not you can pass -Dgtirb_DIR=<path-to-gtirb-build>.

Once the dependencies are installed, you can configure and build as follows:

cmake ./ -Bbuild
cd build
make

Usage

Pretty print the GTIRB for a simple hello world executable to an assembly file named hello.S, assemble this file with the GNU assembler to an object file named hello.o, and link this object file into an executable.

gtirb-pp hello.gtirb -o hello.S
as hello.S -o hello.o
ld hello.o -o hello
./hello

AuxData Used by the Pretty Printer

Generating assembly depends on a number of additional pieces of information beyond the symbols and instruction/data bytes in the IR. The pretty printer expects this information to be available in a number of AuxData objects stored with the IR. We document the expected keys along with the associated types and contents in this table.

Key Type Purpose
comments std::map<gtirb::Addr, std::string> Per-instruction comments.
functionEntries std::map<gtirb::UUID, std::set<gtirb::UUID>> UUIDs of the blocks that are entry points of functions.
symbolForwarding std::map<gtirb::UUID, gtirb::UUID> Map from symbols to other symbols. This table is used to forward symbols due to relocations or due to the use of plt and got tables.
types std::map<gtirb::UUID,std::string> Map from (typed) data objects to the type of the data, expressed as a std::string containing a C++ type specifier.
You can’t perform that action at this time.