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

Description

Engine for Java Virtual Machine (JVM) specimens.

This engine is reponsible for creating a partitioner for a specimen that has byte code for the Java Virtual Machine.

This engine provides an instance static member function that instantiates an engine of this type on the heap and returns a shared-ownership pointer to the instance. Refer to the base class, Partitioner2::Engine, to learn how to instantiate engines from factories.

Definition at line 21 of file EngineJvm.h.

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

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

Classes

class  Exception
 Errors from the engine. More...
 

Public Types

using Ptr = EngineJvmPtr
 Shared ownership pointer.
 
- Public Types inherited from Rose::BinaryAnalysis::Partitioner2::Engine
using Ptr = EnginePtr
 Shared ownership pointer.
 

Public Member Functions

 EngineJvm ()=delete
 Default constructor.
 
 EngineJvm (const EngineJvm &)=delete
 
EngineJvmoperator= (const EngineJvm &)=delete
 
virtual bool matchFactory (const std::vector< std::string > &specimen) const override
 Predicate for matching a concrete engine factory by settings and specimen.
 
virtual EnginePtr instanceFromFactory (const Settings &) override
 Virtual constructor for factories.
 
virtual std::pair< std::string, std::string > specimenNameDocumentation () override
 Documentation about how the specimen is specified.
 
SgProjectroseFrontendReplacement (const std::vector< std::string > &fileNames)
 Replacement for frontend for Jvm files only.
 
virtual SgAsmBlockfrontend (const std::vector< std::string > &args, const std::string &purpose, const std::string &description) override
 Most basic usage of the partitioner.
 
virtual SgAsmInterpretationparseContainers (const std::vector< std::string > &fileNames) override
 Parse specimen binary containers.
 
virtual bool isNonContainer (const std::string &) override
 Determine whether a specimen name is a non-container.
 
virtual bool areContainersParsed () const override
 Returns true if containers are parsed.
 
virtual bool areSpecimensLoaded () const override
 Returns true if specimens are loaded.
 
virtual MemoryMapPtr loadSpecimens (const std::vector< std::string > &fileNames=std::vector< std::string >()) override
 Parse specimen binary containers.
 
bool loadJarFile (const std::string &)
 Load a jar file by opening its contents.
 
rose_addr_t loadClassFile (boost::filesystem::path, SgAsmGenericFileList *, rose_addr_t)
 Load a class file by parsing its contents at the given address.
 
rose_addr_t loadSuperClasses (const std::string &, SgAsmGenericFileList *, rose_addr_t)
 Recursively find and load all super classes starting at the given address.
 
rose_addr_t loadDiscoverableClasses (SgAsmGenericFileList *, rose_addr_t)
 Load classes discoverable from the file list starting at the given address.
 
rose_addr_t loadClass (uint16_t, SgAsmJvmConstantPool *, SgAsmGenericFileList *, rose_addr_t)
 Load class and super class starting at the given address.
 
boost::filesystem::path pathToClass (const std::string &)
 Path to the given class.
 
void discoverFunctionCalls (SgAsmJvmMethod *, SgAsmJvmConstantPool *, std::map< std::string, rose_addr_t > &, std::set< std::string > &)
 Discover function calls (invoke instructions) made from a method.
 
virtual PartitionerPtr partition (const std::vector< std::string > &fileNames=std::vector< std::string >()) override
 Partition instructions into basic blocks and functions.
 
virtual void checkCreatePartitionerPrerequisites () const override
 Check that we have everything necessary to create a partitioner.
 
PartitionerPtr createJvmTunedPartitioner ()
 Create a partitioner for JVM.
 
virtual PartitionerPtr createPartitioner () override
 Parse specimen binary containers.
 
virtual void runPartitionerInit (const PartitionerPtr &) override
 Parse specimen binary containers.
 
virtual void runPartitionerRecursive (const PartitionerPtr &) override
 Parse specimen binary containers.
 
virtual void runPartitionerFinal (const PartitionerPtr &) override
 Parse specimen binary containers.
 
virtual void discoverBasicBlocks (const PartitionerPtr &, const ByteCode::Method *)
 Discover as many basic blocks as possible.
 
virtual SgAsmBlockbuildAst (const std::vector< std::string > &fileNames=std::vector< std::string >()) override
 Obtain an abstract syntax tree.
 
const std::string & isaName () const
 Property: Instruction set architecture name.
 
virtual void isaName (const std::string &)
 Property: Instruction set architecture name.
 
const std::vector< rose_addr_t > & functionStartingVas () const
 Property: Starting addresses for disassembly.
 
std::vector< rose_addr_t > & functionStartingVas ()
 Property: Starting addresses for disassembly.
 
- Public Member Functions inherited from Rose::BinaryAnalysis::Partitioner2::Engine
virtual std::list< Sawyer::CommandLine::SwitchGroupcommandLineSwitches ()
 Command-line switches for a particular engine.
 
std::list< Sawyer::CommandLine::SwitchGroupallCommandLineSwitches ()
 List of command-line switches for all engines.
 
virtual void addToParser (Sawyer::CommandLine::Parser &)
 Add switches and sections to command-line parser.
 
void addAllToParser (Sawyer::CommandLine::Parser &)
 Add switches and sections to command-line parser.
 
virtual Sawyer::CommandLine::Parser commandLineParser (const std::string &purpose, const std::string &description)
 Creates a command-line parser.
 
bool isFactory () const
 Returns true if this object is a factory.
 
virtual void reset ()
 Reset the engine to its initial state.
 
virtual void savePartitioner (const PartitionerConstPtr &, const boost::filesystem::path &, SerialIo::Format=SerialIo::BINARY)
 
virtual PartitionerPtr loadPartitioner (const boost::filesystem::path &, SerialIo::Format=SerialIo::BINARY)
 
virtual void checkSettings ()
 Check settings after command-line is processed.
 
virtual bool isRbaFile (const std::string &)
 Determine whether a specimen is an RBA file.
 
virtual void adjustMemoryMap ()
 Adjust memory map post-loading.
 
virtual PartitionerPtr createBarePartitioner ()
 Create a bare partitioner.
 
virtual void runPartitioner (const PartitionerPtr &)
 Partitions instructions into basic blocks and functions.
 
virtual void labelAddresses (const PartitionerPtr &, const Configuration &)
 Label addresses.
 
virtual std::vector< DataBlockPtrmakeConfiguredDataBlocks (const PartitionerPtr &, const Configuration &)
 Make data blocks based on configuration.
 
virtual std::vector< FunctionPtrmakeConfiguredFunctions (const PartitionerPtr &, const Configuration &)
 Make functions based on configuration information.
 
virtual void updateAnalysisResults (const PartitionerPtr &)
 Runs various analysis passes.
 
Architecture::BaseConstPtr architecture ()
 Property: Architecture.
 
SgAsmBlockfrontend (int argc, char *argv[], const std::string &purpose, const std::string &description)
 Most basic usage of the partitioner.
 
Sawyer::CommandLine::ParserResult parseCommandLine (int argc, char *argv[], const std::string &purpose, const std::string &description)
 Parse the command-line.
 
virtual Sawyer::CommandLine::ParserResult parseCommandLine (const std::vector< std::string > &args, const std::string &purpose, const std::string &description)
 Parse the command-line.
 
SgAsmBlockbuildAst (const std::string &fileName)
 Obtain an abstract syntax tree.
 
SgAsmInterpretationparseContainers (const std::string &fileName)
 Parse specimen binary containers.
 
MemoryMapPtr loadSpecimens (const std::string &fileName)
 Load and/or link interpretation.
 
PartitionerPtr partition (const std::string &fileName)
 Partition instructions into basic blocks and functions.
 
MemoryMapPtr memoryMap () const
 Property: memory map.
 
virtual void memoryMap (const MemoryMapPtr &)
 Property: memory map.
 
virtual Architecture::BaseConstPtr obtainArchitecture ()
 Determine the architecture.
 
virtual Architecture::BaseConstPtr obtainArchitecture (const Architecture::BaseConstPtr &hint)
 Determine the architecture.
 
const std::string & name () const
 Property: Name.
 
void name (const std::string &)
 Property: Name.
 
const Settingssettings () const
 Property: All settings.
 
Settingssettings ()
 Property: All settings.
 
void settings (const Settings &)
 Property: All settings.
 
BasicBlockWorkList::Ptr basicBlockWorkList () const
 Property: BasicBlock work list.
 
void basicBlockWorkList (const BasicBlockWorkList::Ptr &)
 Property: BasicBlock work list.
 
CodeConstants::Ptr codeFunctionPointers () const
 Property: Instruction AST constants.
 
void codeFunctionPointers (const CodeConstants::Ptr &)
 Property: BasicBlock work list.
 
SgAsmInterpretationinterpretation () const
 Property: interpretation.
 
virtual void interpretation (SgAsmInterpretation *)
 Property: interpretation.
 
ProgressPtr progress () const
 Property: progress reporting.
 
virtual void progress (const ProgressPtr &)
 Property: progress reporting.
 
const std::vector< std::string > & specimen () const
 Property: specimen.
 
virtual void specimen (const std::vector< std::string > &)
 Property: specimen.
 
- Public Member Functions inherited from Sawyer::SharedObject
 SharedObject ()
 Default constructor.
 
 SharedObject (const SharedObject &)
 Copy constructor.
 
virtual ~SharedObject ()
 Virtual destructor.
 
SharedObjectoperator= (const SharedObject &)
 Assignment.
 
- Public Member Functions inherited from Sawyer::SharedFromThis< Engine >
SharedPointer< Engine > sharedFromThis ()
 Create a shared pointer from this.
 
SharedPointer< const Engine > sharedFromThis () const
 Create a shared pointer from this.
 

Static Public Member Functions

static Ptr instance ()
 Allocating constructor.
 
static Ptr instance (const Settings &)
 Allocating constructor with settings.
 
static Ptr factory ()
 Allocate a factory.
 
- Static Public Member Functions inherited from Rose::BinaryAnalysis::Partitioner2::Engine
static EngineBinaryPtr instance ()
 
static std::list< std::pair< std::string, std::string > > allSpecimenNameDocumentation ()
 Documentation for all specimen specifications.
 
static void registerFactory (const EnginePtr &factory)
 Register an engine as a factory.
 
static bool deregisterFactory (const EnginePtr &factory)
 Remove a concrete engine factory from the registry.
 
static std::vector< EnginePtrregisteredFactories ()
 List of all registered factories.
 
static void disassembleForRoseFrontend (SgAsmInterpretation *)
 
static EnginePtr forge (const std::vector< std::string > &specimen)
 Creates a suitable engine based on the specimen.
 
static EnginePtr forge (const std::string &specimen)
 Creates a suitable engine based on the specimen.
 
static EnginePtr forge (const std::vector< std::string > &arguments, Sawyer::CommandLine::Parser &, const PositionalArgumentParser &, const Settings &)
 Creates a suitable engine based on the specimen.
 
static EnginePtr forge (const std::vector< std::string > &arguments, Sawyer::CommandLine::Parser &, const PositionalArgumentParser &)
 Creates a suitable engine based on the specimen.
 
static EnginePtr forge (const std::vector< std::string > &arguments, Sawyer::CommandLine::Parser &, const Settings &)
 Creates a suitable engine based on the specimen.
 
static EnginePtr forge (const std::vector< std::string > &arguments, Sawyer::CommandLine::Parser &)
 Creates a suitable engine based on the specimen.
 
static EnginePtr forge (int argc, char *argv[], Sawyer::CommandLine::Parser &, const PositionalArgumentParser &, const Settings &)
 Creates a suitable engine based on the specimen.
 
static EnginePtr forge (int argc, char *argv[], Sawyer::CommandLine::Parser &, const PositionalArgumentParser &)
 Creates a suitable engine based on the specimen.
 
static EnginePtr forge (int argc, char *argv[], Sawyer::CommandLine::Parser &, const Settings &)
 Creates a suitable engine based on the specimen.
 
static EnginePtr forge (int argc, char *argv[], Sawyer::CommandLine::Parser &)
 Creates a suitable engine based on the specimen.
 

Protected Member Functions

 EngineJvm (const Settings &)
 
virtual SgProjectroseFrontendReplacement (const std::vector< boost::filesystem::path > &fileNames) override
 
- Protected Member Functions inherited from Rose::BinaryAnalysis::Partitioner2::Engine
 Engine ()=delete
 Default constructor.
 
 Engine (const Engine &)=delete
 
Engineoperator= (const Engine &)=delete
 
 Engine (const std::string &name, const Settings &settings)
 Allocating instance constructors are implemented by the non-abstract subclasses.
 

Member Typedef Documentation

◆ Ptr

Shared ownership pointer.

Definition at line 24 of file EngineJvm.h.

Constructor & Destructor Documentation

◆ EngineJvm()

Rose::BinaryAnalysis::Partitioner2::EngineJvm::EngineJvm ( )
delete

Default constructor.

Constructor is deleted and class noncopyable.

Member Function Documentation

◆ matchFactory()

virtual bool Rose::BinaryAnalysis::Partitioner2::EngineJvm::matchFactory ( const std::vector< std::string > &  specimen) const
overridevirtual

Predicate for matching a concrete engine factory by settings and specimen.

Implements Rose::BinaryAnalysis::Partitioner2::Engine.

◆ instanceFromFactory()

virtual EnginePtr Rose::BinaryAnalysis::Partitioner2::EngineJvm::instanceFromFactory ( const Settings )
overridevirtual

Virtual constructor for factories.

This creates a new object by calling the class method instance for the class of which this is a type. All arguments are passed to instance.

Implements Rose::BinaryAnalysis::Partitioner2::Engine.

◆ frontend()

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

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 EngineSettings::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.

Implements Rose::BinaryAnalysis::Partitioner2::Engine.

◆ specimenNameDocumentation()

virtual std::pair< std::string, std::string > Rose::BinaryAnalysis::Partitioner2::EngineJvm::specimenNameDocumentation ( )
overridevirtual

Documentation about how the specimen is specified.

The documentation string that's returned is expected to be used in a command-line parser description and thus may contain special formatting constructs. For most engine subclasses, this will be a description of those command-line positional arguments that describe the specimen. For instance, the EngineJvm subclass would probably document that the specimen consists of one or more file names ending with the string ".class".

In order to support the –help switch that generates the man page, it must be possible to include the documentation for all subclasses concurrently. Therefore, each subclass returns both a section title and the section documentation string. The section title and documentation string should make it clear that this part of the documentation applies only to that particular subclass.

Implements Rose::BinaryAnalysis::Partitioner2::Engine.

◆ parseContainers()

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

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 disassembler 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 EngineSettings::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.

Implements Rose::BinaryAnalysis::Partitioner2::Engine.

◆ isNonContainer()

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

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.

Implements Rose::BinaryAnalysis::Partitioner2::Engine.

◆ areContainersParsed()

virtual bool Rose::BinaryAnalysis::Partitioner2::EngineJvm::areContainersParsed ( ) const
overridevirtual

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.

Implements Rose::BinaryAnalysis::Partitioner2::Engine.

◆ areSpecimensLoaded()

virtual bool Rose::BinaryAnalysis::Partitioner2::EngineJvm::areSpecimensLoaded ( ) const
overridevirtual

Returns true if specimens are loaded.

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

Reimplemented from Rose::BinaryAnalysis::Partitioner2::Engine.

◆ loadSpecimens()

virtual MemoryMapPtr Rose::BinaryAnalysis::Partitioner2::EngineJvm::loadSpecimens ( const std::vector< std::string > &  fileNames = std::vector< std::string >())
overridevirtual

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 disassembler 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 EngineSettings::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.

Implements Rose::BinaryAnalysis::Partitioner2::Engine.

◆ loadJarFile()

bool Rose::BinaryAnalysis::Partitioner2::EngineJvm::loadJarFile ( const std::string &  )

Load a jar file by opening its contents.

Stores the location of class files found as offsets into the jar file

Returns true if jar file is loaded

◆ loadClassFile()

rose_addr_t Rose::BinaryAnalysis::Partitioner2::EngineJvm::loadClassFile ( boost::filesystem::path  ,
SgAsmGenericFileList ,
rose_addr_t   
)

Load a class file by parsing its contents at the given address.

Returns the AST node representing the file.

◆ loadSuperClasses()

rose_addr_t Rose::BinaryAnalysis::Partitioner2::EngineJvm::loadSuperClasses ( const std::string &  ,
SgAsmGenericFileList ,
rose_addr_t   
)

Recursively find and load all super classes starting at the given address.

Returns the address of the last preloaded class.

◆ loadDiscoverableClasses()

rose_addr_t Rose::BinaryAnalysis::Partitioner2::EngineJvm::loadDiscoverableClasses ( SgAsmGenericFileList ,
rose_addr_t   
)

Load classes discoverable from the file list starting at the given address.

Loads all classes and superclasses discovered by examining instructions.

Returns the next available address.

◆ loadClass()

rose_addr_t Rose::BinaryAnalysis::Partitioner2::EngineJvm::loadClass ( uint16_t  ,
SgAsmJvmConstantPool ,
SgAsmGenericFileList ,
rose_addr_t   
)

Load class and super class starting at the given address.

Loads the class and super class from the file header and adds new files to the file list.

Returns the next available address.

◆ pathToClass()

boost::filesystem::path Rose::BinaryAnalysis::Partitioner2::EngineJvm::pathToClass ( const std::string &  )

Path to the given class.

Returns the path to the class (may not exist).

◆ discoverFunctionCalls()

void Rose::BinaryAnalysis::Partitioner2::EngineJvm::discoverFunctionCalls ( SgAsmJvmMethod ,
SgAsmJvmConstantPool ,
std::map< std::string, rose_addr_t > &  ,
std::set< std::string > &   
)

Discover function calls (invoke instructions) made from a method.

Stores results in a map of fully resolved function names to unique virtual addresses. Also stores the class names of the discovered functions.

◆ partition()

virtual PartitionerPtr Rose::BinaryAnalysis::Partitioner2::EngineJvm::partition ( const std::vector< std::string > &  fileNames = std::vector< std::string >())
overridevirtual

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.
  • Obtain a disassembler.

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

If an std::runtime_exception occurs and the EngineSettings::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.

Implements Rose::BinaryAnalysis::Partitioner2::Engine.

◆ checkCreatePartitionerPrerequisites()

virtual void Rose::BinaryAnalysis::Partitioner2::EngineJvm::checkCreatePartitionerPrerequisites ( ) const
overridevirtual

Check that we have everything necessary to create a partitioner.

Reimplemented from Rose::BinaryAnalysis::Partitioner2::Engine.

◆ createJvmTunedPartitioner()

PartitionerPtr Rose::BinaryAnalysis::Partitioner2::EngineJvm::createJvmTunedPartitioner ( )

Create a partitioner for JVM.

Returns a partitioner that is tuned to operate on a JVM instruction set architecture. The memoryMap must be assigned already, either explicitly or as the result of earlier steps.

◆ createPartitioner()

virtual PartitionerPtr Rose::BinaryAnalysis::Partitioner2::EngineJvm::createPartitioner ( )
overridevirtual

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 disassembler 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 EngineSettings::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.

Implements Rose::BinaryAnalysis::Partitioner2::Engine.

◆ runPartitionerInit()

virtual void Rose::BinaryAnalysis::Partitioner2::EngineJvm::runPartitionerInit ( const PartitionerPtr )
overridevirtual

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 disassembler 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 EngineSettings::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.

Implements Rose::BinaryAnalysis::Partitioner2::Engine.

◆ runPartitionerRecursive()

virtual void Rose::BinaryAnalysis::Partitioner2::EngineJvm::runPartitionerRecursive ( const PartitionerPtr )
overridevirtual

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 disassembler 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 EngineSettings::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.

Implements Rose::BinaryAnalysis::Partitioner2::Engine.

◆ runPartitionerFinal()

virtual void Rose::BinaryAnalysis::Partitioner2::EngineJvm::runPartitionerFinal ( const PartitionerPtr )
overridevirtual

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 disassembler 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 EngineSettings::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.

Implements Rose::BinaryAnalysis::Partitioner2::Engine.

◆ discoverBasicBlocks()

virtual void Rose::BinaryAnalysis::Partitioner2::EngineJvm::discoverBasicBlocks ( const PartitionerPtr ,
const ByteCode::Method  
)
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.

◆ buildAst()

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

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 EngineSettings::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.

Implements Rose::BinaryAnalysis::Partitioner2::Engine.

◆ isaName() [1/2]

const std::string & Rose::BinaryAnalysis::Partitioner2::EngineJvm::isaName ( ) const

Property: Instruction set architecture name.

The instruction set architecture name is used to obtain a disassembler and overrides the disassembler that would otherwise be found by examining the binary container.

◆ isaName() [2/2]

virtual void Rose::BinaryAnalysis::Partitioner2::EngineJvm::isaName ( const std::string &  )
virtual

Property: Instruction set architecture name.

The instruction set architecture name is used to obtain a disassembler and overrides the disassembler that would otherwise be found by examining the binary container.

◆ functionStartingVas() [1/2]

const std::vector< rose_addr_t > & Rose::BinaryAnalysis::Partitioner2::EngineJvm::functionStartingVas ( ) const

Property: Starting addresses for disassembly.

This is a list of addresses where functions will be created in addition to those functions discovered by examining the binary container.

◆ functionStartingVas() [2/2]

std::vector< rose_addr_t > & Rose::BinaryAnalysis::Partitioner2::EngineJvm::functionStartingVas ( )

Property: Starting addresses for disassembly.

This is a list of addresses where functions will be created in addition to those functions discovered by examining the binary container.

◆ roseFrontendReplacement()

virtual SgProject * Rose::BinaryAnalysis::Partitioner2::EngineJvm::roseFrontendReplacement ( const std::vector< boost::filesystem::path > &  fileNames)
overrideprotectedvirtual

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