ROSE 0.11.145.277
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Rose::BinaryAnalysis::Partitioner2::JumpTable Class Reference

Description

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>

Inheritance diagram for Rose::BinaryAnalysis::Partitioner2::JumpTable:
Inheritance graph
[legend]
Collaboration diagram for Rose::BinaryAnalysis::Partitioner2::JumpTable:
Collaboration graph
[legend]

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.
 
- Public Types inherited from Rose::BinaryAnalysis::Partitioner2::MemoryTable
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< AddressuniqueTargets () 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.
 
- Public Member Functions inherited from Rose::BinaryAnalysis::Partitioner2::MemoryTable
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 Public Member Functions inherited from Rose::BinaryAnalysis::Partitioner2::MemoryTable
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)
 
- Protected Member Functions inherited from Rose::BinaryAnalysis::Partitioner2::MemoryTable
 MemoryTable (const AddressInterval &, size_t bytesPerEntry, const Entries::Ptr &entries)
 

Member Typedef Documentation

◆ Ptr

Shared ownership pointer.

Definition at line 20 of file JumpTable.h.

◆ ConstPtr

Shared ownership pointer.

Definition at line 21 of file JumpTable.h.

Member Enumeration Documentation

◆ EntryType

How target addresses are computed from entries.

Enumerator
ABSOLUTE 

Target is entry plus (nominally zero) constant offset.

TABLE_RELATIVE 

Like ABSOLUTE but add the table address.

Definition at line 25 of file JumpTable.h.

Member Function Documentation

◆ partitioner()

PartitionerConstPtr Rose::BinaryAnalysis::Partitioner2::JumpTable::partitioner ( ) const

Property: Partitioner supplied to the constructor.

This is a read-only property set during object construction.

◆ perEntryOffset()

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()

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.

◆ targetLimits() [1/2]

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.

◆ targetLimits() [2/2]

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.

◆ refineTargetLimits()

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.

◆ replaceBasicBlockSuccessors()

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.

◆ createDataBlock()

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.

◆ attachTableToBasicBlock()

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.


The documentation for this class was generated from the following file: