ROSE  0.11.145.0
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. More...
 
typedef Sawyer::Container::Set< rose_addr_t > AddressSet
 Set of addresses. More...
 
typedef std::map< int64_t, AddressSetOffsetToAddresses
 Mapping from stack offsets to address sets. More...
 
typedef std::map< rose_addr_t, AddressSetAddressToAddresses
 Mapping from addresses to address sets. More...
 
typedef Sawyer::Container::Interval< int64_t > OffsetInterval
 Interval of signed offsets. More...
 
using StackVariables = Sawyer::Container::IntervalMap< OffsetInterval, StackVariable >
 Collection of local variables organized by frame offsets. More...
 
typedef Sawyer::Container::IntervalMap< AddressInterval, GlobalVariableGlobalVariables
 Maps virtual addresses to global variables. More...
 

Functions

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

Variables

Sawyer::Message::Facility mlog
 Diagnostic facility. More...
 

Typedef Documentation

Reference counting pointer.

Definition at line 131 of file BinaryAnalysis/BasicTypes.h.

Set of addresses.

Definition at line 37 of file Variables.h.

Mapping from stack offsets to address sets.

Definition at line 40 of file Variables.h.

Mapping from addresses to address sets.

Definition at line 43 of file Variables.h.

Interval of signed offsets.

Definition at line 46 of file Variables.h.

Collection of local variables organized by frame offsets.

Definition at line 289 of file Variables.h.

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

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

Initialize diagnostic output.

This is called automatically when ROSE is initialized.

std::string Rose::BinaryAnalysis::Variables::offsetStr ( int64_t  offset)

Format a stack offset as a string.

std::string Rose::BinaryAnalysis::Variables::sizeStr ( uint64_t  size)

Format size as a string.

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.

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.

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.

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.

Variable Documentation

Sawyer::Message::Facility Rose::BinaryAnalysis::Variables::mlog

Diagnostic facility.