ROSE 0.11.145.147
Classes | Typedefs | Functions | Variables
Rose::BinaryAnalysis::Variables Namespace Reference

Description

Facilities for detecting variables in binaries.

Classes

class  BaseVariable
 Describes a local or global variable. More...
 
class  GlobalVariable
 Description of a global variable. More...
 
class  StackFrame
 Information about a stack frame. More...
 
class  StackVariable
 Description of a local stack variable within a function. More...
 
class  VariableFinder
 Analysis to find variable locations. More...
 

Typedefs

using VariableFinderPtr = Sawyer::SharedPointer< VariableFinder >
 Reference counting pointer.
 
typedef Sawyer::Container::Set< rose_addr_t > AddressSet
 Set of addresses.
 
typedef std::map< int64_t, AddressSetOffsetToAddresses
 Mapping from stack offsets to address sets.
 
typedef std::map< rose_addr_t, AddressSetAddressToAddresses
 Mapping from addresses to address sets.
 
typedef Sawyer::Container::Interval< int64_t > OffsetInterval
 Interval of signed offsets.
 
using StackVariables = Sawyer::Container::IntervalMap< OffsetInterval, StackVariable >
 Collection of local variables organized by frame offsets.
 
typedef Sawyer::Container::IntervalMap< AddressInterval, GlobalVariableGlobalVariables
 Maps virtual addresses to global variables.
 

Functions

void initDiagnostics ()
 Initialize diagnostic output.
 
std::string offsetStr (int64_t offset)
 Format a stack offset as a string.
 
std::string sizeStr (uint64_t size)
 Format size as a string.
 
void print (const StackVariables &, const Partitioner2::PartitionerConstPtr &, std::ostream &out, const std::string &prefix="")
 Print info about multiple local variables.
 
void erase (GlobalVariables &, const AddressInterval &toErase)
 Erase some global variables.
 
void print (const GlobalVariables &, const Partitioner2::PartitionerConstPtr &, std::ostream &out, const std::string &prefix="")
 Print info about multiple global variables.
 
AddressInterval isInconsistent (const GlobalVariables &, Sawyer::Message::Stream &)
 Check that the map is consistent.
 

Variables

Sawyer::Message::Facility mlog
 Diagnostic facility.
 

Typedef Documentation

◆ VariableFinderPtr

Reference counting pointer.

Definition at line 122 of file Rose/BinaryAnalysis/BasicTypes.h.

◆ AddressSet

Set of addresses.

Definition at line 37 of file Variables.h.

◆ OffsetToAddresses

Mapping from stack offsets to address sets.

Definition at line 40 of file Variables.h.

◆ AddressToAddresses

Mapping from addresses to address sets.

Definition at line 43 of file Variables.h.

◆ OffsetInterval

Interval of signed offsets.

Definition at line 46 of file Variables.h.

◆ StackVariables

Collection of local variables organized by frame offsets.

Definition at line 289 of file Variables.h.

◆ GlobalVariables

Maps virtual addresses to global variables.

The global variable will be represented in the map at all addresses that the global variable could occupy. E.g., if global variable "g1" starts at 0x4000 and can be up to 1k 4-byte integers, then a record will exist in the map at all addresses from 0x4000 (inclusive) to 0x4100 (exclusive).

Definition at line 389 of file Variables.h.

Function Documentation

◆ initDiagnostics()

void Rose::BinaryAnalysis::Variables::initDiagnostics ( )

Initialize diagnostic output.

This is called automatically when ROSE is initialized.

◆ print() [1/2]

void Rose::BinaryAnalysis::Variables::print ( const StackVariables ,
const Partitioner2::PartitionerConstPtr ,
std::ostream &  out,
const std::string &  prefix = "" 
)

Print info about multiple local variables.

This output includes such things as the function to which they belong and the defining instructions. The output is multi-line, intended for debugging.

◆ erase()

void Rose::BinaryAnalysis::Variables::erase ( GlobalVariables ,
const AddressInterval toErase 
)

Erase some global variables.

Erases global variables from the specified memory region. It is not sufficient to only remove addresses from the map; the addresses stored in the variables themselves (values in the map) may need to be adjusted so they don't overlap with the erased range.

◆ print() [2/2]

void Rose::BinaryAnalysis::Variables::print ( const GlobalVariables ,
const Partitioner2::PartitionerConstPtr ,
std::ostream &  out,
const std::string &  prefix = "" 
)

Print info about multiple global variables.

This output includes such things as their addresses, sizes, and the defining instructions. The output is multi-line, intended for debugging.

◆ isInconsistent()

AddressInterval Rose::BinaryAnalysis::Variables::isInconsistent ( const GlobalVariables ,
Sawyer::Message::Stream  
)

Check that the map is consistent.

Test that the keys of the map match up with the variables contained therein. If a map node is found where the interval key for the node doesn't match the addresses of the global variable stored in that node, then the map contains an inconsistency. When an inconsistency is found, and the output stream is enabled then the map is printed and all inconsistencies are highlighted.

Returns the first address interval (key) where an inconsistency is detected, or an empty interval if there are no inconsistencies.