ROSE  0.11.109.0
Classes | Public Member Functions | Static Public Member Functions | List of all members
Rose::BinaryAnalysis::Partitioner2::Engine Class Reference

Description

Base class for engines driving the partitioner.

An engine serves these main purposes:

Use of an engine is entirely optional. All of the engine's actions are implemented in terms of public APIs on other objects such as Disassembler and Partitioner. In fact, this particular engine base class is designed so that users can pick and choose to use only those steps they need, or perhaps to call the main actions one step at a time with the user making adjustments between steps.

Customization

The actions taken by an engine can be customized in a number of ways:

Basic usage

The most basic use case for the engine is to pass it the command-line arguments and have it do everything, eventually returning an abstract syntax tree.

#include <rose.h>
#include <Rose/BinaryAnalysis/Partitioner2/Engine.h>
using namespace Rose;
int main(int argc, char *argv[]) {
std::string purpose = "disassembles a binary specimen";
std::string description =
"This tool disassembles the specified specimen and presents the "
"results as a pseudo assembly listing, that is, a listing intended "
"for human consumption rather than assembly.";
SgAsmBlock *gblock = P2::Engine().frontend(argc, argv, purpose, description);

High level operations

While frontend does everything, it's often useful to break it down to individual steps so that adjustments can be made along the way. This next level of steps are:

Definition at line 114 of file Partitioner2/Engine.h.

#include <Rose/BinaryAnalysis/Partitioner2/Engine.h>

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

Classes

class  Exception
 Errors from the engine. More...
 
struct  Settings
 Settings for the engine. More...
 

Public Member Functions

void reset ()
 Reset the engine to its initial state. More...
 
virtual void savePartitioner (const Partitioner &, const boost::filesystem::path &, SerialIo::Format fmt=SerialIo::BINARY)
 Save a partitioner and AST to a file. More...
 
virtual Partitioner loadPartitioner (const boost::filesystem::path &, SerialIo::Format fmt=SerialIo::BINARY)
 Load a partitioner and an AST from a file. More...
 
virtual Sawyer::CommandLine::Parser commandLineParser (const std::string &purpose, const std::string &description)
 Creates a command-line parser. More...
 
virtual void checkSettings ()
 Check settings after command-line is processed. More...
 
virtual bool isRbaFile (const std::string &)
 Determine whether a specimen is an RBA file. More...
 
virtual bool isNonContainer (const std::string &)
 Determine whether a specimen name is a non-container. More...
 
virtual bool areContainersParsed () const
 Returns true if containers are parsed. More...
 
virtual void loadVxCore (const std::string &spec)
 Parses a vxcore specification and initializes memory. More...
 
virtual bool areSpecimensLoaded () const
 Returns true if specimens are loaded. More...
 
virtual BinaryLoader::Ptr obtainLoader (const BinaryLoader::Ptr &hint=BinaryLoader::Ptr())
 Obtain a binary loader. More...
 
virtual void loadContainers (const std::vector< std::string > &fileNames)
 Loads memory from binary containers. More...
 
virtual void loadNonContainers (const std::vector< std::string > &names)
 Loads memory from non-containers. More...
 
virtual void adjustMemoryMap ()
 Adjust memory map post-loading. More...
 
virtual Disassembler::BasePtr obtainDisassembler ()
 Obtain a disassembler. More...
 
virtual Disassembler::BasePtr obtainDisassembler (const Disassembler::BasePtr &hint)
 
virtual void checkCreatePartitionerPrerequisites () const
 Check that we have everything necessary to create a partitioner. More...
 
virtual Partitioner createBarePartitioner ()
 Create a bare partitioner. More...
 
virtual Partitioner createGenericPartitioner ()
 Create a generic partitioner. More...
 
virtual Partitioner createTunedPartitioner ()
 Create a tuned partitioner. More...
 
virtual Partitioner createPartitionerFromAst (SgAsmInterpretation *)
 Create a partitioner from an AST. More...
 
virtual Partitioner createPartitioner ()
 Create partitioner. More...
 
virtual void runPartitionerInit (Partitioner &)
 Finds interesting things to work on initially. More...
 
virtual void runPartitionerRecursive (Partitioner &)
 Runs the recursive part of partioning. More...
 
virtual void runPartitionerFinal (Partitioner &)
 Runs the final parts of partitioning. More...
 
virtual void runPartitioner (Partitioner &)
 Partitions instructions into basic blocks and functions. More...
 
virtual void labelAddresses (Partitioner &, const Configuration &)
 Label addresses. More...
 
virtual std::vector< DataBlock::PtrmakeConfiguredDataBlocks (Partitioner &, const Configuration &)
 Make data blocks based on configuration. More...
 
virtual std::vector< Function::PtrmakeConfiguredFunctions (Partitioner &, const Configuration &)
 Make functions based on configuration information. More...
 
virtual std::vector< Function::PtrmakeEntryFunctions (Partitioner &, SgAsmInterpretation *)
 Make functions at specimen entry addresses. More...
 
virtual std::vector< Function::PtrmakeErrorHandlingFunctions (Partitioner &, SgAsmInterpretation *)
 Make functions at error handling addresses. More...
 
virtual std::vector< Function::PtrmakeImportFunctions (Partitioner &, SgAsmInterpretation *)
 Make functions at import trampolines. More...
 
virtual std::vector< Function::PtrmakeExportFunctions (Partitioner &, SgAsmInterpretation *)
 Make functions at export addresses. More...
 
virtual std::vector< Function::PtrmakeSymbolFunctions (Partitioner &, SgAsmInterpretation *)
 Make functions for symbols. More...
 
virtual std::vector< Function::PtrmakeContainerFunctions (Partitioner &, SgAsmInterpretation *)
 Make functions based on specimen container. More...
 
virtual std::vector< Function::PtrmakeInterruptVectorFunctions (Partitioner &, const AddressInterval &vector)
 Make functions from an interrupt vector. More...
 
virtual std::vector< Function::PtrmakeUserFunctions (Partitioner &, const std::vector< rose_addr_t > &)
 Make a function at each specified address. More...
 
virtual void discoverBasicBlocks (Partitioner &)
 Discover as many basic blocks as possible. More...
 
virtual Function::Ptr makeNextDataReferencedFunction (const Partitioner &, rose_addr_t &startVa)
 Scan read-only data to find function pointers. More...
 
virtual Function::Ptr makeNextCodeReferencedFunction (const Partitioner &)
 Scan instruction ASTs to function pointers. More...
 
virtual std::vector< Function::PtrmakeCalledFunctions (Partitioner &)
 Make functions for function call edges. More...
 
virtual std::vector< Function::PtrmakeFunctionFromInterFunctionCalls (Partitioner &partitioner, rose_addr_t &startVa)
 Make functions from inter-function calls. More...
 
virtual void discoverFunctions (Partitioner &)
 Discover as many functions as possible. More...
 
virtual std::set< rose_addr_t > attachDeadCodeToFunction (Partitioner &, const Function::Ptr &, size_t maxIterations=size_t(-1))
 Attach dead code to function. More...
 
virtual DataBlock::Ptr attachPaddingToFunction (Partitioner &, const Function::Ptr &)
 Attach function padding to function. More...
 
virtual std::vector< DataBlock::PtrattachPaddingToFunctions (Partitioner &)
 Attach padding to all functions. More...
 
virtual size_t attachAllSurroundedCodeToFunctions (Partitioner &)
 Attach all possible intra-function basic blocks to functions. More...
 
virtual size_t attachSurroundedCodeToFunctions (Partitioner &)
 Attach intra-function basic blocks to functions. More...
 
virtual void attachBlocksToFunctions (Partitioner &)
 Attach basic blocks to functions. More...
 
virtual std::set< rose_addr_t > attachDeadCodeToFunctions (Partitioner &, size_t maxIterations=size_t(-1))
 Attach dead code to functions. More...
 
virtual std::vector< DataBlock::PtrattachSurroundedDataToFunctions (Partitioner &)
 Attach intra-function data to functions. More...
 
virtual void updateAnalysisResults (Partitioner &)
 Runs various analysis passes. More...
 
virtual bool makeNextCallReturnEdge (Partitioner &, boost::logic::tribool assumeCallReturns)
 Insert a call-return edge and discover its basic block. More...
 
virtual BasicBlock::Ptr makeNextBasicBlockFromPlaceholder (Partitioner &)
 Discover basic block at next placeholder. More...
 
virtual BasicBlock::Ptr makeNextBasicBlock (Partitioner &)
 Discover a basic block. More...
 
SgAsmBlockfrontend (int argc, char *argv[], const std::string &purpose, const std::string &description)
 Most basic usage of the partitioner. More...
 
virtual SgAsmBlockfrontend (const std::vector< std::string > &args, const std::string &purpose, const std::string &description)
 Most basic usage of the partitioner. More...
 
Sawyer::CommandLine::ParserResult parseCommandLine (int argc, char *argv[], const std::string &purpose, const std::string &description)
 Parse the command-line. More...
 
virtual Sawyer::CommandLine::ParserResult parseCommandLine (const std::vector< std::string > &args, const std::string &purpose, const std::string &description)
 Parse the command-line. More...
 
virtual SgAsmInterpretationparseContainers (const std::vector< std::string > &fileNames)
 Parse specimen binary containers. More...
 
SgAsmInterpretationparseContainers (const std::string &fileName)
 Parse specimen binary containers. More...
 
virtual MemoryMap::Ptr loadSpecimens (const std::vector< std::string > &fileNames=std::vector< std::string >())
 Load and/or link interpretation. More...
 
MemoryMap::Ptr loadSpecimens (const std::string &fileName)
 Load and/or link interpretation. More...
 
virtual Partitioner partition (const std::vector< std::string > &fileNames=std::vector< std::string >())
 Partition instructions into basic blocks and functions. More...
 
Partitioner partition (const std::string &fileName)
 Partition instructions into basic blocks and functions. More...
 
SgAsmBlockbuildAst (const std::vector< std::string > &fileNames=std::vector< std::string >())
 Obtain an abstract syntax tree. More...
 
SgAsmBlockbuildAst (const std::string &fileName)
 Obtain an abstract syntax tree. More...
 
MemoryMap::Ptr memoryMap () const
 Property: memory map. More...
 
virtual void memoryMap (const MemoryMap::Ptr &m)
 Property: memory map. More...
 
virtual std::vector< Function::PtrmakeNextPrologueFunction (Partitioner &, rose_addr_t startVa)
 Make function at prologue pattern. More...
 
virtual std::vector< Function::PtrmakeNextPrologueFunction (Partitioner &, rose_addr_t startVa, rose_addr_t &lastSearchedVa)
 Make function at prologue pattern. More...
 
const Settingssettings () const
 Property: All settings. More...
 
Settingssettings ()
 Property: All settings. More...
 
Disassembler::BasePtr disassembler () const
 Property: Disassembler. More...
 
virtual void disassembler (const Disassembler::BasePtr &)
 Property: Disassembler. More...
 
SgAsmInterpretationinterpretation () const
 Property: interpretation. More...
 
virtual void interpretation (SgAsmInterpretation *interp)
 Property: interpretation. More...
 
Progress::Ptr progress () const
 Property: progress reporting. More...
 
virtual void progress (const Progress::Ptr &progress)
 Property: progress reporting. More...
 

Static Public Member Functions

static Engineinstance ()
 Factory method returning an Engine instance of type EngineBinary. More...
 
static Engineinstance (const Settings &settings)
 Factory method returning an Engine instance of type based on settings. More...
 
static std::string specimenNameDocumentation ()
 Documentation for specimen names. More...
 
static void disassembleForRoseFrontend (SgAsmInterpretation *)
 
virtual Sawyer::CommandLine::SwitchGroup loaderSwitches ()
 Command-line switches related to the loader.
 
static Sawyer::CommandLine::SwitchGroup loaderSwitches (LoaderSettings &)
 Command-line switches related to the loader.
 
virtual Sawyer::CommandLine::SwitchGroup disassemblerSwitches ()
 Command-line switches related to the disassembler.
 
static Sawyer::CommandLine::SwitchGroup disassemblerSwitches (DisassemblerSettings &)
 Command-line switches related to the disassembler.
 
virtual Sawyer::CommandLine::SwitchGroup partitionerSwitches ()
 Command-line switches related to the partitioner.
 
static Sawyer::CommandLine::SwitchGroup partitionerSwitches (PartitionerSettings &)
 Command-line switches related to the partitioner.
 
virtual Sawyer::CommandLine::SwitchGroup engineSwitches ()
 Command-line switches related to engine behavior.
 
static Sawyer::CommandLine::SwitchGroup engineSwitches (EngineSettings &)
 Command-line switches related to engine behavior.
 
virtual Sawyer::CommandLine::SwitchGroup astConstructionSwitches ()
 Command-line switches related to AST construction.
 
static Sawyer::CommandLine::SwitchGroup astConstructionSwitches (AstConstructionSettings &)
 Command-line switches related to AST construction.
 

Member Function Documentation

static Engine* Rose::BinaryAnalysis::Partitioner2::Engine::instance ( )
inlinestatic

Factory method returning an Engine instance of type EngineBinary.

Definition at line 262 of file Partitioner2/Engine.h.

static Engine* Rose::BinaryAnalysis::Partitioner2::Engine::instance ( const Settings settings)
inlinestatic

Factory method returning an Engine instance of type based on settings.

Definition at line 265 of file Partitioner2/Engine.h.

SgAsmBlock* Rose::BinaryAnalysis::Partitioner2::Engine::frontend ( int  argc,
char *  argv[],
const std::string &  purpose,
const std::string &  description 
)

Most basic usage of the partitioner.

This method does everything from parsing the command-line to generating an abstract syntax tree. If all is successful, then an abstract syntax tree is returned. The return value is a SgAsmBlock node that contains all the detected functions. If the specimen consisted of an ELF or PE container then the parent nodes of the returned AST will lead eventually to an SgProject node.

The command-line can be provided as a typical argc and argv pair, or as a vector of arguments. In the latter case, the vector should not include argv[0] or argv[argc] (which is always a null pointer).

The command-line supports a "--help" (or "-h") switch to describe all other switches and arguments, essentially generating output like a Unix man(1) page.

The purpose should be a single line string that will be shown in the title of the man page and should not start with an upper-case letter, a hyphen, white space, or the name of the command. E.g., a disassembler tool might specify the purpose as "disassembles a binary specimen".

The description is a full, multi-line description written in the Sawyer markup language where "@" characters have special meaning.

If an std::runtime_exception occurs and the exitOnError property is set, then the exception is caught, its text is emitted to the partitioner's fatal error stream, and exit(1) is invoked.

virtual SgAsmBlock* Rose::BinaryAnalysis::Partitioner2::Engine::frontend ( const std::vector< std::string > &  args,
const std::string &  purpose,
const std::string &  description 
)
virtual

Most basic usage of the partitioner.

This method does everything from parsing the command-line to generating an abstract syntax tree. If all is successful, then an abstract syntax tree is returned. The return value is a SgAsmBlock node that contains all the detected functions. If the specimen consisted of an ELF or PE container then the parent nodes of the returned AST will lead eventually to an SgProject node.

The command-line can be provided as a typical argc and argv pair, or as a vector of arguments. In the latter case, the vector should not include argv[0] or argv[argc] (which is always a null pointer).

The command-line supports a "--help" (or "-h") switch to describe all other switches and arguments, essentially generating output like a Unix man(1) page.

The purpose should be a single line string that will be shown in the title of the man page and should not start with an upper-case letter, a hyphen, white space, or the name of the command. E.g., a disassembler tool might specify the purpose as "disassembles a binary specimen".

The description is a full, multi-line description written in the Sawyer markup language where "@" characters have special meaning.

If an std::runtime_exception occurs and the exitOnError property is set, then the exception is caught, its text is emitted to the partitioner's fatal error stream, and exit(1) is invoked.

void Rose::BinaryAnalysis::Partitioner2::Engine::reset ( )

Reset the engine to its initial state.

This does not reset the settings properties since that can be done easily by constructing a new engine. It only resets the interpretation, binary loader, disassembler, and memory map so all the top-level steps get executed again. This is a useful way to re-use the same partitioner to process multiple specimens.

Sawyer::CommandLine::ParserResult Rose::BinaryAnalysis::Partitioner2::Engine::parseCommandLine ( int  argc,
char *  argv[],
const std::string &  purpose,
const std::string &  description 
)

Parse the command-line.

This method parses the command-line and uses it to update this engine's settings. Since a command line is usually more than just engine-related switches, the more usual approach is for the user to obtain engine-related command-line switch declarations and parse the command-line in user code.

This function automatically applies the command-line when it's successfully parsed, thereby updating this engine's settings. If something goes wrong with the command-line then an std::runtime_error is thrown.

The command-line can be provided as a typical argc and argv pair, or as a vector of arguments. In the latter case, the vector should not include argv[0] or argv[argc] (which is always a null pointer).

The purpose should be a single line string that will be shown in the title of the man page and should not start with an upper-case letter, a hyphen, white space, or the name of the command. E.g., a disassembler tool might specify the purpose as "disassembles a binary specimen".

The description is a full, multi-line description written in the Sawyer markup language where "@" characters have special meaning.

If the tool requires additional switches, an opportunity to adjust the parser, or other special handling, it can call commandLineParser to obtain a parser and then call its parse and apply methods explicitly.

If an std::runtime_exception occurs and the exitOnError property is set, then the exception is caught, its text is emitted to the partitioner's fatal error stream, and exit(1) is invoked.

virtual Sawyer::CommandLine::ParserResult Rose::BinaryAnalysis::Partitioner2::Engine::parseCommandLine ( const std::vector< std::string > &  args,
const std::string &  purpose,
const std::string &  description 
)
virtual

Parse the command-line.

This method parses the command-line and uses it to update this engine's settings. Since a command line is usually more than just engine-related switches, the more usual approach is for the user to obtain engine-related command-line switch declarations and parse the command-line in user code.

This function automatically applies the command-line when it's successfully parsed, thereby updating this engine's settings. If something goes wrong with the command-line then an std::runtime_error is thrown.

The command-line can be provided as a typical argc and argv pair, or as a vector of arguments. In the latter case, the vector should not include argv[0] or argv[argc] (which is always a null pointer).

The purpose should be a single line string that will be shown in the title of the man page and should not start with an upper-case letter, a hyphen, white space, or the name of the command. E.g., a disassembler tool might specify the purpose as "disassembles a binary specimen".

The description is a full, multi-line description written in the Sawyer markup language where "@" characters have special meaning.

If the tool requires additional switches, an opportunity to adjust the parser, or other special handling, it can call commandLineParser to obtain a parser and then call its parse and apply methods explicitly.

If an std::runtime_exception occurs and the exitOnError property is set, then the exception is caught, its text is emitted to the partitioner's fatal error stream, and exit(1) is invoked.

virtual SgAsmInterpretation* Rose::BinaryAnalysis::Partitioner2::Engine::parseContainers ( const std::vector< std::string > &  fileNames)
virtual

Parse specimen binary containers.

Parses the ELF and PE binary containers to create an abstract syntax tree (AST). If fileNames contains names that are recognized as raw data or other non-containers then they are skipped over at this stage but processed during the loadSpecimens stage.

This method tries to allocate a disassember if none is set and an ISA name is specified in the settings, otherwise the disassembler is chosen later. It also resets the interpretation to be the return value (see below), and clears the memory map.

Returns a binary interpretation (perhaps one of many). ELF files have only one interpretation; PE files have a DOS and a PE interpretation and this method will return the PE interpretation. The user may, at this point, select a different interpretation. If the list of names has nothing suitable for ROSE's frontend function (the thing that does the container parsing) then the null pointer is returned.

If an std::runtime_exception occurs and the exitOnError property is set, then the exception is caught, its text is emitted to the partitioner's fatal error stream, and exit(1) is invoked.

SgAsmInterpretation* Rose::BinaryAnalysis::Partitioner2::Engine::parseContainers ( const std::string &  fileName)

Parse specimen binary containers.

Parses the ELF and PE binary containers to create an abstract syntax tree (AST). If fileNames contains names that are recognized as raw data or other non-containers then they are skipped over at this stage but processed during the loadSpecimens stage.

This method tries to allocate a disassember if none is set and an ISA name is specified in the settings, otherwise the disassembler is chosen later. It also resets the interpretation to be the return value (see below), and clears the memory map.

Returns a binary interpretation (perhaps one of many). ELF files have only one interpretation; PE files have a DOS and a PE interpretation and this method will return the PE interpretation. The user may, at this point, select a different interpretation. If the list of names has nothing suitable for ROSE's frontend function (the thing that does the container parsing) then the null pointer is returned.

If an std::runtime_exception occurs and the exitOnError property is set, then the exception is caught, its text is emitted to the partitioner's fatal error stream, and exit(1) is invoked.

virtual MemoryMap::Ptr Rose::BinaryAnalysis::Partitioner2::Engine::loadSpecimens ( const std::vector< std::string > &  fileNames = std::vector< std::string >())
virtual

Load and/or link interpretation.

Loads and/or links the engine's interpretation according to the engine's binary loader with these steps:

  • Clears any existing memory map in the engine.
  • If the binary containers have not been parsed (areContainersParsed returns false, i.e., engine has a null binary interpretation) then parseContainers is called with the same arguments.
  • If binary containers are present but the chosen binary interpretation's memory map is null or empty, then initialize the memory map by calling loadContainers with the same arguments.
  • Continue initializing the memory map by processing all non-container arguments via loadNonContainers.

Returns a reference to the engine's memory map.

If an std::runtime_exception occurs and the exitOnError property is set, then the exception is caught, its text is emitted to the partitioner's fatal error stream, and exit(1) is invoked.

MemoryMap::Ptr Rose::BinaryAnalysis::Partitioner2::Engine::loadSpecimens ( const std::string &  fileName)

Load and/or link interpretation.

Loads and/or links the engine's interpretation according to the engine's binary loader with these steps:

  • Clears any existing memory map in the engine.
  • If the binary containers have not been parsed (areContainersParsed returns false, i.e., engine has a null binary interpretation) then parseContainers is called with the same arguments.
  • If binary containers are present but the chosen binary interpretation's memory map is null or empty, then initialize the memory map by calling loadContainers with the same arguments.
  • Continue initializing the memory map by processing all non-container arguments via loadNonContainers.

Returns a reference to the engine's memory map.

If an std::runtime_exception occurs and the exitOnError property is set, then the exception is caught, its text is emitted to the partitioner's fatal error stream, and exit(1) is invoked.

virtual Partitioner Rose::BinaryAnalysis::Partitioner2::Engine::partition ( const std::vector< std::string > &  fileNames = std::vector< std::string >())
virtual

Partition instructions into basic blocks and functions.

Disassembles and organizes instructions into basic blocks and functions with these steps:

  • If the specimen is not loaded (areSpecimensLoaded) then call loadSpecimens. The no-argument version of this function requires that specimens have already been loaded.

Returns the partitioner that was used and which contains the results.

If an std::runtime_exception occurs and the exitOnError property is set, then the exception is caught, its text is emitted to the partitioner's fatal error stream, and exit(1) is invoked.

Partitioner Rose::BinaryAnalysis::Partitioner2::Engine::partition ( const std::string &  fileName)

Partition instructions into basic blocks and functions.

Disassembles and organizes instructions into basic blocks and functions with these steps:

  • If the specimen is not loaded (areSpecimensLoaded) then call loadSpecimens. The no-argument version of this function requires that specimens have already been loaded.

Returns the partitioner that was used and which contains the results.

If an std::runtime_exception occurs and the exitOnError property is set, then the exception is caught, its text is emitted to the partitioner's fatal error stream, and exit(1) is invoked.

SgAsmBlock* Rose::BinaryAnalysis::Partitioner2::Engine::buildAst ( const std::vector< std::string > &  fileNames = std::vector< std::string >())

Obtain an abstract syntax tree.

Constructs a new abstract syntax tree (AST) from partitioner information with these steps:

  • If the partitioner has not been run yet, then do that now with the same arguments. The zero-argument version invokes the zero-argument partition, which requires that the specimen has already been loaded by loadSpecimens.

If an std::runtime_exception occurs and the exitOnError property is set, then the exception is caught, its text is emitted to the partitioner's fatal error stream, and exit(1) is invoked.

SgAsmBlock* Rose::BinaryAnalysis::Partitioner2::Engine::buildAst ( const std::string &  fileName)

Obtain an abstract syntax tree.

Constructs a new abstract syntax tree (AST) from partitioner information with these steps:

  • If the partitioner has not been run yet, then do that now with the same arguments. The zero-argument version invokes the zero-argument partition, which requires that the specimen has already been loaded by loadSpecimens.

If an std::runtime_exception occurs and the exitOnError property is set, then the exception is caught, its text is emitted to the partitioner's fatal error stream, and exit(1) is invoked.

virtual void Rose::BinaryAnalysis::Partitioner2::Engine::savePartitioner ( const Partitioner ,
const boost::filesystem::path &  ,
SerialIo::Format  fmt = SerialIo::BINARY 
)
virtual

Save a partitioner and AST to a file.

The specified partitioner and the binary analysis components of the AST are saved into the specified file, which is created if it doesn't exist and truncated if it does exist. The name should end with a ".rba" extension. The file can be loaded by passing its name to the partition function or by calling loadPartitioner.

virtual Partitioner Rose::BinaryAnalysis::Partitioner2::Engine::loadPartitioner ( const boost::filesystem::path &  ,
SerialIo::Format  fmt = SerialIo::BINARY 
)
virtual

Load a partitioner and an AST from a file.

The specified RBA file is opened and read to create a new Partitioner object and associated AST. The partition function also understands how to open RBA files.

static std::string Rose::BinaryAnalysis::Partitioner2::Engine::specimenNameDocumentation ( )
static

Documentation for specimen names.

virtual Sawyer::CommandLine::Parser Rose::BinaryAnalysis::Partitioner2::Engine::commandLineParser ( const std::string &  purpose,
const std::string &  description 
)
virtual

Creates a command-line parser.

Creates and returns a command-line parser suitable for parsing command-line switches and arguments needed by the disassembler.

The purpose should be a single line string that will be shown in the title of the man page and should not start with an upper-case letter, a hyphen, white space, or the name of the command. E.g., a disassembler tool might specify the purpose as "disassembles a binary specimen".

The description is a full, multi-line description written in the Sawyer markup language where "@" characters have special meaning.

virtual void Rose::BinaryAnalysis::Partitioner2::Engine::checkSettings ( )
virtual

Check settings after command-line is processed.

This does some checks and further configuration immediately after processing the command line. It's also called by most of the top-level operations.

If an ISA name is specified in the settings and no disassembler has been set yet, then a disassembler is allocated.

virtual bool Rose::BinaryAnalysis::Partitioner2::Engine::isRbaFile ( const std::string &  )
virtual

Determine whether a specimen is an RBA file.

Returns true if the name looks like a ROSE Binary Analysis file. Such files are not intended to be passed to ROSE's global ::frontend function but may be passed to this Engine's Engine::frontend method.

virtual bool Rose::BinaryAnalysis::Partitioner2::Engine::isNonContainer ( const std::string &  )
virtual

Determine whether a specimen name is a non-container.

Certain strings are recognized as special instructions for how to adjust a memory map and are not intended to be passed to ROSE's frontend function. This predicate returns true for such strings.

virtual bool Rose::BinaryAnalysis::Partitioner2::Engine::areContainersParsed ( ) const
virtual

Returns true if containers are parsed.

Specifically, returns true if the engine has a non-null interpretation. If it has a null interpretation then parseContainers might have already been called but no binary containers specified, in which case calling it again with the same file names will have no effect.

virtual void Rose::BinaryAnalysis::Partitioner2::Engine::loadVxCore ( const std::string &  spec)
virtual

Parses a vxcore specification and initializes memory.

Parses a VxWorks core dump in the format defined by Jim Leek and loads the data into ROSE's analysis memory. The argument should be everything after the first colon in the URL "vxcore:[MEMORY_ATTRS]:[FILE_ATTRS]:FILE_NAME".

virtual bool Rose::BinaryAnalysis::Partitioner2::Engine::areSpecimensLoaded ( ) const
virtual

Returns true if specimens are loaded.

Specifically, returns true if the memory map is non-empty.

virtual BinaryLoader::Ptr Rose::BinaryAnalysis::Partitioner2::Engine::obtainLoader ( const BinaryLoader::Ptr hint = BinaryLoader::Ptr())
virtual

Obtain a binary loader.

Find a suitable binary loader by one of the following methods (in this order):

  • If this engine's binaryLoader property is non-null, then return that loader.
  • If a binary container was parsed (areContainersParsed returns true and interpretation is non-null) then a loader is chosen based on the interpretation, and configured to map container sections into memory but not perform any linking or relocation fixups.
  • If a hint is supplied, use it.
  • Fail by throwing an std::runtime_error.

In any case, the binaryLoader property is set to this method's return value.

virtual void Rose::BinaryAnalysis::Partitioner2::Engine::loadContainers ( const std::vector< std::string > &  fileNames)
virtual

Loads memory from binary containers.

If the engine has an interpretation whose memory map is missing or empty, then the engine obtains a binary loader via obtainLoader and invokes its load method on the interpretation. It then copies the interpretation's memory map into the engine (if present, or leaves it as is).

virtual void Rose::BinaryAnalysis::Partitioner2::Engine::loadNonContainers ( const std::vector< std::string > &  names)
virtual

Loads memory from non-containers.

Processes each non-container string (as determined by isNonContainer) and modifies the memory map according to the string.

virtual void Rose::BinaryAnalysis::Partitioner2::Engine::adjustMemoryMap ( )
virtual

Adjust memory map post-loading.

Make adjustments to the memory map after the specimen is loaded.

MemoryMap::Ptr Rose::BinaryAnalysis::Partitioner2::Engine::memoryMap ( ) const
inline

Property: memory map.

Returns the memory map resulting from the loadSpecimens step. This is a combination of the memory map created by the BinaryLoader (via loadContainers) and stored in the interpretation, and the application of any memory map resources (via loadNonContainers). During partitioning operations the memory map comes from the partitioner itself. See loadSpecimens.

Definition at line 595 of file Partitioner2/Engine.h.

virtual void Rose::BinaryAnalysis::Partitioner2::Engine::memoryMap ( const MemoryMap::Ptr m)
inlinevirtual

Property: memory map.

Returns the memory map resulting from the loadSpecimens step. This is a combination of the memory map created by the BinaryLoader (via loadContainers) and stored in the interpretation, and the application of any memory map resources (via loadNonContainers). During partitioning operations the memory map comes from the partitioner itself. See loadSpecimens.

Definition at line 596 of file Partitioner2/Engine.h.

virtual Disassembler::BasePtr Rose::BinaryAnalysis::Partitioner2::Engine::obtainDisassembler ( )
virtual

Obtain a disassembler.

Chooses a disassembler based on one of the following (in this order):

  • If this engine's disassembler property is non-null, then return that disassembler.
  • If this engine's ISA name setting is non-empty, then use it to obtain a disassembler.
  • If a hint is supplied, then use it.
  • If the engine doDisassemble property is false, return no disassembler (nullptr).
  • Fail by throwing an std::runtime_error.

In any case, the disassembler property is set to this method's return value.

virtual void Rose::BinaryAnalysis::Partitioner2::Engine::checkCreatePartitionerPrerequisites ( ) const
virtual

Check that we have everything necessary to create a partitioner.

virtual Partitioner Rose::BinaryAnalysis::Partitioner2::Engine::createBarePartitioner ( )
virtual

Create a bare partitioner.

A bare partitioner, as far as the engine is concerned, is one that has characteristics that are common across all architectures but which is missing all architecture-specific functionality. Using the partitioner's own constructor is not quite the same–that would produce an even more bare partitioner! The engine must have disassembler (if doDisassemble is set) and memoryMap properties already either assigned explicitly or as the result of earlier steps.

virtual Partitioner Rose::BinaryAnalysis::Partitioner2::Engine::createGenericPartitioner ( )
virtual

Create a generic partitioner.

A generic partitioner should work for any architecture but is not fine-tuned for any particular architecture. The engine must have disassembler (if doDisassemble property is set) and memoryMap properties assigned already, either explicitly or as the result of earlier steps.

virtual Partitioner Rose::BinaryAnalysis::Partitioner2::Engine::createTunedPartitioner ( )
virtual

Create a tuned partitioner.

Returns a partitioner that is tuned to operate on a specific instruction set architecture. The engine must have disassembler (if doDisassemble property is set) and memoryMap properties assigned already, either explicitly or as the result of earlier steps.

virtual Partitioner Rose::BinaryAnalysis::Partitioner2::Engine::createPartitionerFromAst ( SgAsmInterpretation )
virtual

Create a partitioner from an AST.

Partitioner data structures are often more useful and more efficient for analysis than an AST. This method initializes the engine and a new partitioner with information from the AST.

virtual Partitioner Rose::BinaryAnalysis::Partitioner2::Engine::createPartitioner ( )
virtual

Create partitioner.

This is the method usually called to create a new partitioner. The base class just calls createTunedPartitioner.

virtual void Rose::BinaryAnalysis::Partitioner2::Engine::runPartitionerInit ( Partitioner )
virtual

Finds interesting things to work on initially.

Seeds the partitioner with addresses and functions where recursive disassembly should begin.

virtual void Rose::BinaryAnalysis::Partitioner2::Engine::runPartitionerRecursive ( Partitioner )
virtual

Runs the recursive part of partioning.

This is the long-running guts of the partitioner.

virtual void Rose::BinaryAnalysis::Partitioner2::Engine::runPartitionerFinal ( Partitioner )
virtual

Runs the final parts of partitioning.

This does anything necessary after the main part of partitioning is finished. For instance, it might give names to some functions that don't have names yet.

virtual void Rose::BinaryAnalysis::Partitioner2::Engine::runPartitioner ( Partitioner )
virtual

Partitions instructions into basic blocks and functions.

This method is a wrapper around a number of lower-level partitioning steps that uses the specified interpretation to instantiate functions and then uses the specified partitioner to discover basic blocks and use the CFG to assign basic blocks to functions. It is often overridden by subclasses.

virtual void Rose::BinaryAnalysis::Partitioner2::Engine::labelAddresses ( Partitioner ,
const Configuration  
)
virtual

Label addresses.

Labels addresses according to symbols, etc. Address labels are used for things like giving an unnamed function a name when it's attached to the partitioner's CFG/AUM.

virtual std::vector<DataBlock::Ptr> Rose::BinaryAnalysis::Partitioner2::Engine::makeConfiguredDataBlocks ( Partitioner ,
const Configuration  
)
virtual

Make data blocks based on configuration.

NOTE: for now, all this does is label the datablock addresses. FIXME[Robb P. Matzke 2015-05-12]

virtual std::vector<Function::Ptr> Rose::BinaryAnalysis::Partitioner2::Engine::makeConfiguredFunctions ( Partitioner ,
const Configuration  
)
virtual

Make functions based on configuration information.

Uses the supplied function configuration information to make functions.

virtual std::vector<Function::Ptr> Rose::BinaryAnalysis::Partitioner2::Engine::makeEntryFunctions ( Partitioner ,
SgAsmInterpretation  
)
virtual

Make functions at specimen entry addresses.

A function is created at each specimen entry address for all headers in the specified interpretation and adds them to the specified partitioner's CFG/AUM.

Returns a list of such functions, some of which may have existed prior to this call.

virtual std::vector<Function::Ptr> Rose::BinaryAnalysis::Partitioner2::Engine::makeErrorHandlingFunctions ( Partitioner ,
SgAsmInterpretation  
)
virtual

Make functions at error handling addresses.

Makes a function at each error handling address in the specified interpratation and inserts the function into the specified partitioner's CFG/AUM.

Returns the list of such functions, some of which may have existed prior to this call.

virtual std::vector<Function::Ptr> Rose::BinaryAnalysis::Partitioner2::Engine::makeImportFunctions ( Partitioner ,
SgAsmInterpretation  
)
virtual

Make functions at import trampolines.

Makes a function at each import trampoline and inserts them into the specified partitioner's CFG/AUM. An import trampoline is a thunk that branches to a dynamically loaded/linked function. Since ROSE does not necessarily load/link dynamic functions, they often don't appear in the executable. Therefore, this function can be called to create functions from the trampolines and give them the same name as the function they would have called had the link step been performed.

Returns a list of such functions, some of which may have existed prior to this call.

virtual std::vector<Function::Ptr> Rose::BinaryAnalysis::Partitioner2::Engine::makeExportFunctions ( Partitioner ,
SgAsmInterpretation  
)
virtual

Make functions at export addresses.

Makes a function at each address that is indicated as being an exported function, and inserts them into the specified partitioner's CFG/AUM.

Returns a list of such functions, some of which may have existed prior to this call.

virtual std::vector<Function::Ptr> Rose::BinaryAnalysis::Partitioner2::Engine::makeSymbolFunctions ( Partitioner ,
SgAsmInterpretation  
)
virtual

Make functions for symbols.

Makes a function for each function symbol in the various symbol tables under the specified interpretation and inserts them into the specified partitioner's CFG/AUM.

Returns a list of such functions, some of which may have existed prior to this call.

virtual std::vector<Function::Ptr> Rose::BinaryAnalysis::Partitioner2::Engine::makeContainerFunctions ( Partitioner ,
SgAsmInterpretation  
)
virtual

Make functions based on specimen container.

Traverses the specified interpretation parsed from, for example, related ELF or PE containers, and make functions at certain addresses that correspond to specimen entry points, imports and exports, symbol tables, etc. This method only calls many of the other "make*Functions" methods and accumulates their results.

Returns a list of such functions, some of which may have existed prior to this call.

virtual std::vector<Function::Ptr> Rose::BinaryAnalysis::Partitioner2::Engine::makeInterruptVectorFunctions ( Partitioner ,
const AddressInterval vector 
)
virtual

Make functions from an interrupt vector.

Reads the interrupt vector and builds functions for its entries. The functions are inserted into the partitioner's CFG/AUM.

Returns the list of such functions, some of which may have existed prior to this call.

virtual std::vector<Function::Ptr> Rose::BinaryAnalysis::Partitioner2::Engine::makeUserFunctions ( Partitioner ,
const std::vector< rose_addr_t > &   
)
virtual

Make a function at each specified address.

A function is created at each address and is attached to the partitioner's CFG/AUM. Returns a list of such functions, some of which may have existed prior to this call.

virtual void Rose::BinaryAnalysis::Partitioner2::Engine::discoverBasicBlocks ( Partitioner )
virtual

Discover as many basic blocks as possible.

Processes the "undiscovered" work list until the list becomes empty. This list is the list of basic block placeholders for which no attempt has been made to discover instructions. This method implements a recursive descent disassembler, although it does not process the control flow edges in any particular order. Subclasses are expected to override this to implement a more directed approach to discovering basic blocks.

virtual Function::Ptr Rose::BinaryAnalysis::Partitioner2::Engine::makeNextDataReferencedFunction ( const Partitioner ,
rose_addr_t &  startVa 
)
virtual

Scan read-only data to find function pointers.

Scans read-only data beginning at the specified address in order to find pointers to code, and makes a new function at when found. The pointer must be word aligned and located in memory that's mapped read-only (not writable and not executable), and it must not point to an unknown instruction or an instruction that overlaps with any instruction that's already in the CFG/AUM.

Returns a pointer to a newly-allocated function that has not yet been attached to the CFG/AUM, or a null pointer if no function was found. In any case, the startVa is updated so it points to the next read-only address to check.

Functions created in this manner have the SgAsmFunction::FUNC_SCAN_RO_DATA reason.

virtual Function::Ptr Rose::BinaryAnalysis::Partitioner2::Engine::makeNextCodeReferencedFunction ( const Partitioner )
virtual

Scan instruction ASTs to function pointers.

Scans each instruction to find pointers to code and makes a new function when found. The pointer must be word aligned and located in memory that's mapped read-only (not writable and not executable), and it most not point to an unknown instruction of an instruction that overlaps with any instruction that's already in the CFG/AUM.

This function requires that the partitioner has been initialized to track instruction ASTs as they are added to and removed from the CFG/AUM.

Returns a pointer to a newly-allocated function that has not yet been attached to the CFG/AUM, or a null pointer if no function was found.

Functions created in this manner have the SgAsmFunction::FUNC_INSN_RO_DATA reason.

virtual std::vector<Function::Ptr> Rose::BinaryAnalysis::Partitioner2::Engine::makeCalledFunctions ( Partitioner )
virtual

Make functions for function call edges.

Scans the partitioner's CFG to find edges that are marked as function calls and makes a function at each target address that is concrete. The function is added to the specified partitioner's CFG/AUM.

Returns a list of such functions, some of which may have existed prior to this call.

virtual std::vector<Function::Ptr> Rose::BinaryAnalysis::Partitioner2::Engine::makeNextPrologueFunction ( Partitioner ,
rose_addr_t  startVa 
)
virtual

Make function at prologue pattern.

Scans executable memory starting at the specified address and which is not represented in the CFG/AUM and looks for byte patterns and/or instruction patterns that indicate the start of a function. When a pattern is found a function (or multiple functions, depending on the type of matcher) is created and inserted into the specified partitioner's CFG/AUM.

Patterns are found by calling the Partitioner::nextFunctionPrologue method, which most likely invokes a variety of predefined and user-defined callbacks to search for the next pattern.

Returns a vector of non-null function pointers pointer for the newly inserted functions, otherwise returns an empty vector. If the lastSearchedVa is provided, it will be set to the highest address at which a function prologue was searched.

virtual std::vector<Function::Ptr> Rose::BinaryAnalysis::Partitioner2::Engine::makeNextPrologueFunction ( Partitioner ,
rose_addr_t  startVa,
rose_addr_t &  lastSearchedVa 
)
virtual

Make function at prologue pattern.

Scans executable memory starting at the specified address and which is not represented in the CFG/AUM and looks for byte patterns and/or instruction patterns that indicate the start of a function. When a pattern is found a function (or multiple functions, depending on the type of matcher) is created and inserted into the specified partitioner's CFG/AUM.

Patterns are found by calling the Partitioner::nextFunctionPrologue method, which most likely invokes a variety of predefined and user-defined callbacks to search for the next pattern.

Returns a vector of non-null function pointers pointer for the newly inserted functions, otherwise returns an empty vector. If the lastSearchedVa is provided, it will be set to the highest address at which a function prologue was searched.

virtual std::vector<Function::Ptr> Rose::BinaryAnalysis::Partitioner2::Engine::makeFunctionFromInterFunctionCalls ( Partitioner partitioner,
rose_addr_t &  startVa 
)
virtual

Make functions from inter-function calls.

This method scans the unused executable areas between existing functions to look for additional function calls and creates new functions for those calls. It starts the scan at startVa which is updated upon return to be the next address that needs to be scanned. The startVa is never incremented past the end of the address space (i.e., it never wraps back around to zero), so care should be taken to not call this in an infinite loop when the end of the address space is reached.

The scanner tries to discover new basic blocks in the unused portion of the address space. These basic blocks are not allowed to overlap with existing, attached basic blocks, data blocks, or functions since that is an indication that we accidentally disassembled non-code. If the basic block looks like a function call and the target address(es) is not pointing into the middle of an existing basic block, data-block, or function then a new function is created at the target address. The basic blocks which were scanned are not explicitly attached to the partitioner's CFG since we cannot be sure we found their starting address, but they might be later attached by following the control flow from the functions we did discover.

Returns the new function(s) for the first basic block that satisfied the requirements outlined above, and updates startVa to be a greater address which is not part of the basic block that was scanned.

virtual void Rose::BinaryAnalysis::Partitioner2::Engine::discoverFunctions ( Partitioner )
virtual

Discover as many functions as possible.

Discover as many functions as possible by discovering as many basic blocks as possible (discoverBasicBlocks), Each time we run out of basic blocks to try, we look for another function prologue pattern at the lowest possible address and then recursively discover more basic blocks. When this procedure is exhausted a call to attachBlocksToFunctions tries to attach each basic block to a function.

virtual std::set<rose_addr_t> Rose::BinaryAnalysis::Partitioner2::Engine::attachDeadCodeToFunction ( Partitioner ,
const Function::Ptr ,
size_t  maxIterations = size_t(-1) 
)
virtual

Attach dead code to function.

Examines the ghost edges for the basic blocks that belong to the specified function in order to discover basic blocks that are not reachable according the CFG, adds placeholders for those basic blocks, and causes the function to own those blocks.

If maxIterations is larger than one then multiple iterations are performed. Between each iteration makeNextBasicBlock is called repeatedly to recursively discover instructions for all pending basic blocks, and then the CFG is traversed to add function-reachable basic blocks to the function. The loop terminates when the maximum number of iterations is reached, or when no more dead code can be found within this function.

Returns the set of newly discovered addresses for unreachable code. These are the ghost edge target addresses discovered at each iteration of the loop and do not include addresses of basic blocks that are reachable from the ghost target blocks.

virtual DataBlock::Ptr Rose::BinaryAnalysis::Partitioner2::Engine::attachPaddingToFunction ( Partitioner ,
const Function::Ptr  
)
virtual

Attach function padding to function.

Examines the memory immediately prior to the specified function's entry address to determine if it is alignment padding. If so, it creates a data block for the padding and adds it to the function.

Returns the padding data block, which might have existed prior to this call. Returns null if the function apparently has no padding.

virtual std::vector<DataBlock::Ptr> Rose::BinaryAnalysis::Partitioner2::Engine::attachPaddingToFunctions ( Partitioner )
virtual

Attach padding to all functions.

Invokes attachPaddingToFunction for each known function and returns the set of data blocks that were returned by the individual calls.

virtual size_t Rose::BinaryAnalysis::Partitioner2::Engine::attachAllSurroundedCodeToFunctions ( Partitioner )
virtual

Attach all possible intra-function basic blocks to functions.

This is similar to attachSurroundedCodeToFunctions except it calls that method repeatedly until it cannot do anything more. Between each call it also follows the CFG for the newly discovered blocks to discover as many blocks as possible, creates more functions by looking for function calls, and attaches additional basic blocks to functions by following the CFG for each function.

This method is called automatically by Engine::runPartitioner if the findingIntraFunctionCode property is set.

Returns the sum from all the calls to attachSurroundedCodeToFunctions.

virtual size_t Rose::BinaryAnalysis::Partitioner2::Engine::attachSurroundedCodeToFunctions ( Partitioner )
virtual

Attach intra-function basic blocks to functions.

This method scans the unused address intervals (those addresses that are not represented by the CFG/AUM). For each unused interval, if the interval is immediately surrounded by a single function then a basic block placeholder is created at the beginning of the interval and added to the function.

Returns the number of new placeholders created.

virtual void Rose::BinaryAnalysis::Partitioner2::Engine::attachBlocksToFunctions ( Partitioner )
virtual

Attach basic blocks to functions.

Calls Partitioner::discoverFunctionBasicBlocks once for each known function the partitioner's CFG/AUM in a sophomoric attempt to assign existing basic blocks to functions.

virtual std::set<rose_addr_t> Rose::BinaryAnalysis::Partitioner2::Engine::attachDeadCodeToFunctions ( Partitioner ,
size_t  maxIterations = size_t(-1) 
)
virtual

Attach dead code to functions.

Calls attachDeadCodeToFunction once for each function that exists in the specified partitioner's CFG/AUM, passing along maxIterations each time.

Returns the union of the dead code addresses discovered for each function.

virtual std::vector<DataBlock::Ptr> Rose::BinaryAnalysis::Partitioner2::Engine::attachSurroundedDataToFunctions ( Partitioner )
virtual

Attach intra-function data to functions.

Looks for addresses that are not part of the partitioner's CFG/AUM and which are surrounded immediately below and above by the same function and add that address interval as a data block to the surrounding function. Returns the list of such data blocks added.

virtual void Rose::BinaryAnalysis::Partitioner2::Engine::updateAnalysisResults ( Partitioner )
virtual

Runs various analysis passes.

Runs each analysis over all functions to ensure that results are cached. This should typically be done after functions are discovered and before the final AST is generated, otherwise the AST will not contain cached results for functions and blocks for which an analysis was not performed.

virtual bool Rose::BinaryAnalysis::Partitioner2::Engine::makeNextCallReturnEdge ( Partitioner ,
boost::logic::tribool  assumeCallReturns 
)
virtual

Insert a call-return edge and discover its basic block.

Inserts a call-return (E_CALL_RETURN) edge for some function call that lacks such an edge and for which the callee may return. The assumeCallReturns parameter determines whether a call-return edge should be added or not for callees whose may-return analysis is indeterminate. If assumeCallReturns is true then an indeterminate callee will have a call-return edge added; if false then no call-return edge is added; if indeterminate then no call-return edge is added at this time but the vertex is saved so it can be reprocessed later.

Returns true if a new call-return edge was added to some call, or false if no such edge could be added. A post condition for a false return is that the pendingCallReturn list is empty.

virtual BasicBlock::Ptr Rose::BinaryAnalysis::Partitioner2::Engine::makeNextBasicBlockFromPlaceholder ( Partitioner )
virtual

Discover basic block at next placeholder.

Discovers a basic block at some arbitrary placeholder. Returns a pointer to the new basic block if a block was discovered, or null if no block is discovered. A postcondition for a null return is that the CFG has no edges coming into the "undiscovered" vertex.

virtual BasicBlock::Ptr Rose::BinaryAnalysis::Partitioner2::Engine::makeNextBasicBlock ( Partitioner )
virtual

Discover a basic block.

Discovers another basic block if possible. A variety of methods will be used to determine where to discover the next basic block:

  • Insert a new call-return (E_CALL_RETURN) edge for a function call that may return. Insertion of such an edge may result in a new placeholder for which this method then discovers a basic block. The call-return insertion happens in two passes: the first pass only adds an edge for a callee whose may-return analysis is positive; the second pass relaxes that requirement and inserts an edge for any callee whose may-return is indeterminate (i.e., if ROSE can't prove that a callee never returns then assume it may return).

Returns the basic block that was discovered, or the null pointer if there are no pending undiscovered blocks.

const Settings& Rose::BinaryAnalysis::Partitioner2::Engine::settings ( ) const
inline

Property: All settings.

Returns a reference to the engine settings structures. Alternatively, some settings also have a corresponding engine member function to query or adjust the setting directly.

Definition at line 1022 of file Partitioner2/Engine.h.

Settings& Rose::BinaryAnalysis::Partitioner2::Engine::settings ( )
inline

Property: All settings.

Returns a reference to the engine settings structures. Alternatively, some settings also have a corresponding engine member function to query or adjust the setting directly.

Definition at line 1023 of file Partitioner2/Engine.h.

Disassembler::BasePtr Rose::BinaryAnalysis::Partitioner2::Engine::disassembler ( ) const

Property: Disassembler.

This property holds the disassembler to use whenever a new partitioner is created. If null, then the engine will choose a disassembler based on the binary container (unless doDisassemble property is clear).

virtual void Rose::BinaryAnalysis::Partitioner2::Engine::disassembler ( const Disassembler::BasePtr )
virtual

Property: Disassembler.

This property holds the disassembler to use whenever a new partitioner is created. If null, then the engine will choose a disassembler based on the binary container (unless doDisassemble property is clear).

SgAsmInterpretation* Rose::BinaryAnalysis::Partitioner2::Engine::interpretation ( ) const
inline

Property: interpretation.

The interpretation which is being analyzed. The interpretation is chosen when an ELF or PE container is parsed, and the user can set it to something else if desired. For instance, parsing a PE file will set the interpretation to PE, but the user can reset it to DOS to disassemble the DOS part of the executable.

Definition at line 1043 of file Partitioner2/Engine.h.

virtual void Rose::BinaryAnalysis::Partitioner2::Engine::interpretation ( SgAsmInterpretation interp)
inlinevirtual

Property: interpretation.

The interpretation which is being analyzed. The interpretation is chosen when an ELF or PE container is parsed, and the user can set it to something else if desired. For instance, parsing a PE file will set the interpretation to PE, but the user can reset it to DOS to disassemble the DOS part of the executable.

Definition at line 1044 of file Partitioner2/Engine.h.

Progress::Ptr Rose::BinaryAnalysis::Partitioner2::Engine::progress ( ) const
inline

Property: progress reporting.

The optional object to receive progress reports.

Definition at line 1052 of file Partitioner2/Engine.h.

virtual void Rose::BinaryAnalysis::Partitioner2::Engine::progress ( const Progress::Ptr progress)
inlinevirtual

Property: progress reporting.

The optional object to receive progress reports.

Definition at line 1053 of file Partitioner2/Engine.h.

References progress().

Referenced by progress().


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