B2R2


B2R2 Namespace

Type/Module Description

Addr (Module)

Addr (Type)

Addresses are represented with a 64-bit integer in B2R2.

AddrRange

AddrRange is a tuple (min, max) that represents a range of address values that are greater or equal to the min value (inclusive) and are less than or equal to the max value (inclusive). To access the min and the max value of a range, use either getMin or getMax function.

Arch

Architecture

Architecture types.

ArchOperationMode (Module)

A helper module for ArchOperationMode.

ArchOperationMode (Type)

Some ISA, such as ARM, have their own operation mode, which can vary at runtime. For example, ARM architecture can switch between Thumb and ARM mode. ArchOperationMode decides which mode to consider at the time of parsing/lifting machine instructions.

ARMap

This is a helper class for manipulating an ARMap (AddressRangeMap), a non-overlapping interval map. We provide both F#- and C#-style APIs.

ARMap<'V>

This is a non-overlapping interval map that we call "Address Range Map" (ARMap). This map internally forms a red-black tree, which follows the implementation of the paper written by Kimball Germane and Matthew Might: "Deletion: The Curse of the Red-Black Tree", Journal of Functional Programming, vol. 24, no. 4, 2014.

Array

Extended Array.

Attribution

B2R2 project attribution.

BigInteger

Extended BigInteger.

BinReader

BinReader abstracts away the process of reading byte sequences. This is the base class for BinReader, which has two kinds of implementations: little-endian and big-endian BinReader.

BitVector

BitVector is the fundamental data type for binary code, which is essentially a bit vector. We want the size of a bit vector to be less than or equal to 64 bits because bigint operation is slow, and most arithmetics on modern architectures are in 64 bits any ways. For example, SIMD operations can also be divided into a set of 64-bit operations. N.B. Num becomes zero when the Length becomes greater than 64. We intentionally do not sync Num and BigNum.

BitVectorBig

This is a BitVector with its length less than or equal to 64. This is preferred because all the operations will be much faster than BitVectorBig.

BitVectorConstants

BitVectorSmall

This is a BitVector with its length less than or equal to 64. This is preferred because all the operations will be much faster than BitVectorBig.

ByteArray

It is sometimes convenient to consider a binary chunk as a byte array. This module provides several useful functions to deal with byte arrays.

BytePattern (Module)

BytePattern (Type)

Represents a byte pattern.

ByteValue

Color (Module)

Color (Type)

ColoredSegment (Module)

ColoredSegment (Type)

ColoredString (Module)

ColoredString (Type)

ConsoleCachedPrinter

ConsoleCachedPrinter prints out non-colored strings only when the Flush method is called. All the colored strings will be normalized to plain strings. It will simply stack up all the output candidates before Flush is called. This is useful for performance-critical applications.

ConsoleNullPrinter

ConsoleCachedPrinter does not print anything. This is the same as redirecting outputs to /dev/null.

ConsolePrinter

ConsolePrinter simply prints out strings to console whenever a print method is called. This printer does not perform any caching, so it immediately flushes out all the strings to console.

EmptyBinReader

Empty BinReader, representing a null type.

EmptyRegisterSet

Empty register set.

Endian (Module)

A helper module for Endian type.

Endian (Type)

Endianness.

ErrorCase (Module)

ErrorCase (Type)

Error cases and corresponding numbers for B2R2.

FileFormat (Module)

A helper module for FileFormat type.

FileFormat (Type)

Types of binary file format.

FileLogger

Log to a file.

ICacheableOperation<'Arg, 'V>

This is a cacheable operation, which will be executed when there's no already cached item.

ILogger

Basic logging facility.

Int64

Extended Int64.

IntervalMap

Helper module for IntervalMap.

IntervalMap<'a>

Interval-tree-based map, which maps an interval of type (AddrRange) to an IntervalMapElement ('a).

IntervalMapElem<'a>

An element for our interval map.

IntervalSet (Module)

Helper module for IntervalSet.

IntervalSet (Type)

Interval tree-based set, which stores intervals (AddrRange) that can overlap unlike ARMap.

IntervalSetElem

An element for our interval set.

InvalidAddrRangeException

Raised when an AddrRange has the same Min and Max value, i.e., for invalid interval.

InvalidEndianException

Raised when an invalid Endian value is used.

InvalidISAException

Raised when an invalid ISA is given as a parameter.

InvalidRegTypeException

This exception is raised when an invalid RegType is encountered.

InvalidTargetArchModeException

Raised when an invalid ArchOperationMode is given.

InvalidWordSizeException

This exception is raised when an invalid WordSize is encountered.

ISA

Instruction Set Architecture (ISA).

LEB128

LEB128DecodeException

Raised when LEB128 decoding failed, e.g., when the given input bytes has incorrect encoding.

LinuxSyscall (Module)

LinuxSyscall (Type)

Linux syscall type.

LogLevel (Module)

Helper module for LogLevel

LogLevel (Type)

How verbose do we want to log messages?

LRUCache<'K, 'V>

Least Recently Used Cache supporting concurrency. The capacity decides how many entries to store.

NonEmptyRegisterSet

Non-empty register set.

Option

Extended Option.

OS (Module)

A helper module for OS type.

OS (Type)

Specify OS type.

OutString (Module)

OutString (Type)

OutString represents an output string generated from rear-end applications.

PersistentQueue

PersistentQueue<'T>

Persistent queue using two lists.

Printer

Any B2R2's layers should *not* use System.Console or `printfn` to directly output strings. Instead, they should resort to the Printer to "indirectly" print out strings.

ProgramPoint

A program point (ProgramPoint) is a fine-grained location in a program, which can point to a specific IR statement. We represent it as a tuple: (Address of the instruction, Index of the IR stmt for the instruction).

RandomAccessQueue

A helper module for RandomAccessQueue<'a>.

RandomAccessQueue<'a>

Interval tree-based map: an interval of type (Addr) -> an RandomAccessQueueElement ('a).

RandomAccessQueueElem<'a>

An element for our random access queue.

RangeOverlapException

Raised when there is an overlapping intervals from the interval tree.

RegisterID (Module)

This class stores an identifier for a register. Each register in B2R2 has its own ID, which is essentially an integer value. However, one needs to go through this class to use a RegisterID.

RegisterID (Type)

RegisterID is a platform-independent representation of a register.

RegisterSet (Module)

A helper module for RegisterSet.

RegisterSet (Type)

RegisterSet is an efficient set data structure using arrays for managing a set of registers.

RegisterSetTag

A tag used in RegisterSet for identifying distinct set of registers for different ISAs.

RegisterSetTagMismatchException

Raised when two RegisterSets with two distinct tags operate.

RegType (Module)

A helper for RegType.

RegType (Type)

Types that a register can have. This essentially means how many bits are in the register.

Result

Extended Result.

rt

A unit for RegType.

SortedList

String

Extended String.

TableColumn

Define a column of a table with a specified width in bytes (# of chars).

TableConfig

Define a output configuration of a table.

UnhandledSyscallException

Raised when unhandled syscall is encountered.

UnknownOSException

Raised when unknown OS type is detected.

Utils

A set of convenient misc. functions.

WordSize (Module)

A helper module for the WordSize type.

WordSize (Type)

B2R2 represents the word size of a CPU with WordSize, which can be either 32- or 64-bit.