ROSE 0.11.145.277
|
Utilities for working with jump tables.
A jump table is a table that has addresses (direct or computed) that can be used as targets for computed jumps, i.e., indirect control flow.
Definition at line 15 of file JumpTable.h.
#include <Rose/BinaryAnalysis/Partitioner2/JumpTable.h>
Classes | |
class | Entries |
Entries in a jump table. More... | |
Public Types | |
enum class | EntryType { ABSOLUTE , TABLE_RELATIVE } |
How target addresses are computed from entries. More... | |
using | Ptr = JumpTablePtr |
Shared ownership pointer. | |
using | ConstPtr = JumpTableConstPtr |
Shared ownership pointer. | |
![]() | |
using | Ptr = MemoryTablePtr |
Shared ownership pointer. | |
using | ConstPtr = MemoryTableConstPtr |
Shared ownership pointer. | |
Public Member Functions | |
PartitionerConstPtr | partitioner () const |
Property: Partitioner supplied to the constructor. | |
Address | perEntryOffset () const |
Property: Offset added to each table entry when calculating the target address. | |
EntryType | entryType () const |
Property: Entry type. | |
const std::vector< Address > & | targets () const |
Result: Target addresses parsed from the table. | |
std::set< Address > | uniqueTargets () const |
Result: Unique target addresses parsed from the table. | |
void | refineLocationLimits (const BasicBlockPtr &, Address probableTableAddr) |
Refine the table limits based on a particular basic block. | |
void | refineTargetLimits (const BasicBlockPtr &) |
Refine target limits based on a particular basic block. | |
void | replaceBasicBlockSuccessors (const PartitionerConstPtr &, const BasicBlockPtr &) const |
Change basic block successors to be the table's targets. | |
DataBlockPtr | createDataBlock () const |
Build a data block to represent the table. | |
void | attachTableToBasicBlock (const BasicBlockPtr &) const |
Create a data block and attach it to the specified basic block. | |
AddressInterval | targetLimits () const |
Property: Predicate to determine whether a target is valid. | |
void | targetLimits (const AddressInterval &) |
Property: Predicate to determine whether a target is valid. | |
![]() | |
size_t | bytesPerEntry () const |
Property: Bytes per entry. | |
Entries::Ptr | entries () const |
Property: Table entries. | |
AddressInterval | location () const |
Result: Table location in memory. | |
bool | empty () const |
Result: True if the table has no valid entries. | |
size_t | nEntries () const |
Result: Total number of valid entries scanned into the table. | |
size_t | nPreEntries () const |
Result: Number of entries detected before the start of table. | |
size_t | maxInitialSkip () const |
Property: Max initial invalid entries. | |
void | maxInitialSkip (size_t) |
Property: Max initial invalid entries. | |
size_t | maxPreEntries () const |
Property: Max number of entries to prepend before the original start of the table. | |
void | maxPreEntries (size_t) |
Property: Max number of entries to prepend before the original start of the table. | |
AddressInterval | tableLimits () const |
Property: Limits for table location. | |
void | tableLimits (const AddressInterval &) |
Property: Limits for table location. | |
AddressInterval | scan (const MemoryMap::Constraints &, Address probableTableAddr) |
Scan the table and return its location. | |
AddressInterval | scan (const PartitionerConstPtr &, const InstructionSemantics::BaseSemantics::RiscOperatorsPtr &, Address probableTableAddr) |
Scan the table and return its location. | |
AddressInterval | scan (const Storage::Ptr &, Address probableTableAddr) |
Scan the table and return its location. | |
Static Public Member Functions | |
static Ptr | instance (const PartitionerConstPtr &, const AddressInterval &tableLimits, size_t bytesPerEntry, Address perEntryOffset, EntryType) |
Allocating constructor. | |
![]() | |
static Ptr | instance (const AddressInterval &tableLimits, size_t bytesPerEntry, const Entries::Ptr &entries) |
Allocating constructor. | |
Protected Member Functions | |
JumpTable (const PartitionerConstPtr &, const AddressInterval &tableLimits, size_t bytesPerEntry, Address perEntryOffset, EntryType) | |
![]() | |
MemoryTable (const AddressInterval &, size_t bytesPerEntry, const Entries::Ptr &entries) | |
Shared ownership pointer.
Definition at line 20 of file JumpTable.h.
Shared ownership pointer.
Definition at line 21 of file JumpTable.h.
|
strong |
How target addresses are computed from entries.
Enumerator | |
---|---|
ABSOLUTE | Target is entry plus (nominally zero) constant offset. |
TABLE_RELATIVE | Like |
Definition at line 25 of file JumpTable.h.
PartitionerConstPtr Rose::BinaryAnalysis::Partitioner2::JumpTable::partitioner | ( | ) | const |
Property: Partitioner supplied to the constructor.
This is a read-only property set during object construction.
Address Rose::BinaryAnalysis::Partitioner2::JumpTable::perEntryOffset | ( | ) | const |
Property: Offset added to each table entry when calculating the target address.
This is a read-only property set during object construction.
EntryType Rose::BinaryAnalysis::Partitioner2::JumpTable::entryType | ( | ) | const |
Property: Entry type.
Describes how to calculate a target address from the raw bytes stored in the table entry.
This is a read-only property set during object construction.
AddressInterval Rose::BinaryAnalysis::Partitioner2::JumpTable::targetLimits | ( | ) | const |
Property: Predicate to determine whether a target is valid.
A target computed from the raw bytes of a table entry is valid only if the target is within this specified range.
void Rose::BinaryAnalysis::Partitioner2::JumpTable::targetLimits | ( | const AddressInterval & | ) |
Property: Predicate to determine whether a target is valid.
A target computed from the raw bytes of a table entry is valid only if the target is within this specified range.
void Rose::BinaryAnalysis::Partitioner2::JumpTable::refineTargetLimits | ( | const BasicBlockPtr & | ) |
Refine target limits based on a particular basic block.
The jump table targets should be within the function that owns the basic block.
void Rose::BinaryAnalysis::Partitioner2::JumpTable::replaceBasicBlockSuccessors | ( | const PartitionerConstPtr & | , |
const BasicBlockPtr & | |||
) | const |
Change basic block successors to be the table's targets.
The basic blocks current successors are removed, and replaced with the target addresses scanned from this table.
DataBlockPtr Rose::BinaryAnalysis::Partitioner2::JumpTable::createDataBlock | ( | ) | const |
Build a data block to represent the table.
Returns a new detached basic block if this jump table is non-empty, otherwise returns a null pointer.
void Rose::BinaryAnalysis::Partitioner2::JumpTable::attachTableToBasicBlock | ( | const BasicBlockPtr & | ) | const |
Create a data block and attach it to the specified basic block.
The data block is created by createDataBlock. Calling this function more than once will cause multiple identical data blocks to be attached to the basic block.