1#ifndef ROSE_BinaryAnalysis_Partitioner2_EngineJvm_H 
    2#define ROSE_BinaryAnalysis_Partitioner2_EngineJvm_H 
    3#include <featureTests.h> 
    4#ifdef ROSE_ENABLE_BINARY_ANALYSIS 
    6#include <Rose/BinaryAnalysis/ByteCode/Jvm.h> 
    7#include <Rose/BinaryAnalysis/Partitioner2/Engine.h> 
    8#include <Rose/BinaryAnalysis/Partitioner2/ModulesJvm.h> 
   11namespace BinaryAnalysis {
 
   12namespace Partitioner2 {
 
   37    std::map<std::string, SgAsmGenericFile*> classes_;
 
   40    std::map<std::string, Address> functions_;
 
   43    std::map<std::string, Address> unresolvedFunctions_;
 
   46    std::vector<ModulesJvm::Zipper*> jars_; 
 
   49    static constexpr Address vaDefaultIncrement{4*1024};
 
  117                                 const std::string &purpose, 
const std::string &description) 
override;
 
  333    virtual SgAsmBlock* 
buildAst(
const std::vector<std::string> &fileNames = std::vector<std::string>()) 
override;
 
 
  383namespace ModulesJvm {
 
  413boost::filesystem::path 
pathToClassFile(
const std::string &fqcn, 
const std::vector<std::string> &cp);
 
  427bool present(
const std::string &fqcn, 
const std::string &path);
 
 
Engine for Java Virtual Machine (JVM) specimens.
 
virtual MemoryMapPtr loadSpecimens(const std::vector< std::string > &fileNames=std::vector< std::string >()) override
Parse specimen binary containers.
 
EngineJvm()=delete
Default constructor.
 
static Ptr factory()
Allocate a factory.
 
virtual void checkSettings() override
Check settings after command-line is processed.
 
virtual void discoverBasicBlocks(const PartitionerPtr &, const ByteCode::Method *)
Discover as many basic blocks as possible.
 
virtual void runPartitionerInit(const PartitionerPtr &) override
Parse specimen binary containers.
 
virtual void runPartitionerFinal(const PartitionerPtr &) override
Parse specimen binary containers.
 
virtual std::list< Sawyer::CommandLine::SwitchGroup > commandLineSwitches() override
Command-line switches for a particular engine.
 
const std::vector< Address > & functionStartingVas() const
Property: Starting addresses for disassembly.
 
virtual SgAsmBlock * frontend(const std::vector< std::string > &args, const std::string &purpose, const std::string &description) override
Most basic usage of the partitioner.
 
virtual SgAsmBlock * buildAst(const std::vector< std::string > &fileNames=std::vector< std::string >()) override
Obtain an abstract syntax tree.
 
void discoverFunctionCalls(SgAsmJvmMethod *, SgAsmJvmConstantPool *, std::map< std::string, Address > &, std::set< std::string > &)
Discover function calls (invoke instructions) made from a method.
 
virtual SgAsmInterpretation * parseContainers(const std::vector< std::string > &fileNames) override
Parse specimen binary containers.
 
const std::vector< std::string > & classPath() const
Setting: JVM class path.
 
virtual bool isNonContainer(const std::string &) override
Determine whether a specimen name is a non-container.
 
virtual bool areSpecimensLoaded() const override
Returns true if specimens are loaded.
 
Address loadSuperClasses(const std::string &, SgAsmGenericFileList *, Address)
Recursively find and load all super classes starting at the given address.
 
PartitionerPtr createJvmTunedPartitioner()
Create a partitioner for JVM.
 
static Ptr instance(const Settings &)
Allocating constructor with settings.
 
virtual PartitionerPtr partition(const std::vector< std::string > &fileNames=std::vector< std::string >()) override
Partition instructions into basic blocks and functions.
 
const std::string & isaName() const
Property: Instruction set architecture name.
 
Address loadDiscoverableClasses(SgAsmGenericFileList *, Address)
Load classes discoverable from the file list starting at the given address.
 
virtual std::pair< std::string, std::string > specimenNameDocumentation() override
Documentation about how the specimen is specified.
 
Address loadClassFile(boost::filesystem::path, SgAsmGenericFileList *, Address)
Load a class file by parsing its contents at the given address.
 
virtual EnginePtr instanceFromFactory(const Settings &) override
Virtual constructor for factories.
 
static Sawyer::CommandLine::SwitchGroup jvmSwitches(JvmSettings &)
Command-line switches related to the JVM engine behavior.
 
Address loadClass(uint16_t, SgAsmJvmConstantPool *, SgAsmGenericFileList *, Address)
Load class and super class starting at the given address.
 
SgProject * roseFrontendReplacement(const std::vector< std::string > &fileNames)
Replacement for frontend for Jvm files only.
 
virtual void checkCreatePartitionerPrerequisites() const override
Check that we have everything necessary to create a partitioner.
 
bool loadJarFile(const std::string &)
Load a jar file by opening its contents.
 
virtual bool matchFactory(const Sawyer::CommandLine::ParserResult &result, const std::vector< std::string > &specimen) const override
Predicate for matching a concrete engine factory by command-line parser result and specimen.
 
virtual PartitionerPtr createPartitioner() override
Parse specimen binary containers.
 
boost::filesystem::path pathToClass(const std::string &fqcn)
Path to the given fully qualified class name (FQCN).
 
virtual bool areContainersParsed() const override
Returns true if containers are parsed.
 
static Ptr instance()
Allocating constructor.
 
virtual void runPartitionerRecursive(const PartitionerPtr &) override
Parse specimen binary containers.
 
Base class for engines driving the partitioner.
 
const std::vector< std::string > & specimen() const
Property: specimen.
 
Engine()=delete
Default constructor.
 
The result from parsing a command line.
 
A collection of related switch declarations.
 
Reference-counting intrusive smart pointer.
 
List of AST file node pointers.
 
Represents an interpretation of a binary container.
 
Represents an JVM constant pool.
 
This class represents a source project, with a list of SgFile objects and global information about th...
 
bool isJavaJarFile(const boost::filesystem::path &)
True if named file exists and is a Java jar file.
 
bool isJavaClassFile(const boost::filesystem::path &)
True if named file exists and is a Java class file.
 
boost::filesystem::path pathToClassFile(const std::string &fqcn, const std::vector< std::string > &cp)
Searchs the classpath setting for the path to a fully qualified class name.
 
bool present(const std::string &fqcn, const std::string &path)
Searchs the path for the presence of a fully qualified class name.
 
Sawyer::SharedPointer< EngineJvm > EngineJvmPtr
Shared-ownership pointer for EngineJvm.
 
std::uint64_t Address
Address.
 
Settings for controlling JVM partitioning behavior.