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 {
45 std::map<std::string, SgAsmGenericFile*> classes_;
48 std::map<std::string, rose_addr_t> functions_;
51 std::map<std::string, rose_addr_t> unresolvedFunctions_;
54 std::vector<ModulesJvm::Zipper*> jars_;
57 static constexpr rose_addr_t vaDefaultIncrement{4*1024};
58 rose_addr_t nextFunctionVa_;
116 const std::string &purpose,
const std::string &description)
override;
237 std::map<std::string,rose_addr_t> &, std::set<std::string> &);
328 virtual SgAsmBlock*
buildAst(
const std::vector<std::string> &fileNames = std::vector<std::string>())
override;
371namespace ModulesJvm {
386bool loadClassFile(
const std::string &,
const std::vector<ModulesJvm::Zipper*> &, rose_addr_t);
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.
void discoverFunctionCalls(SgAsmJvmMethod *, SgAsmJvmConstantPool *, std::map< std::string, rose_addr_t > &, std::set< std::string > &)
Discover function calls (invoke instructions) made from a method.
static Ptr factory()
Allocate a factory.
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 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.
virtual SgAsmInterpretation * parseContainers(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 areSpecimensLoaded() const override
Returns true if specimens are loaded.
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.
virtual std::pair< std::string, std::string > specimenNameDocumentation() override
Documentation about how the specimen is specified.
rose_addr_t loadDiscoverableClasses(SgAsmGenericFileList *, rose_addr_t)
Load classes discoverable from the file list starting at the given address.
virtual EnginePtr instanceFromFactory(const Settings &) override
Virtual constructor for factories.
const std::vector< rose_addr_t > & functionStartingVas() const
Property: Starting addresses for disassembly.
SgProject * roseFrontendReplacement(const std::vector< std::string > &fileNames)
Replacement for frontend for Jvm files only.
rose_addr_t loadSuperClasses(const std::string &, SgAsmGenericFileList *, rose_addr_t)
Recursively find and load all super classes starting at the given address.
virtual void checkCreatePartitionerPrerequisites() const override
Check that we have everything necessary to create a partitioner.
virtual bool matchFactory(const std::vector< std::string > &specimen) const override
Predicate for matching a concrete engine factory by settings and specimen.
rose_addr_t loadClass(uint16_t, SgAsmJvmConstantPool *, SgAsmGenericFileList *, rose_addr_t)
Load class and super class starting at the given address.
bool loadJarFile(const std::string &)
Load a jar file by opening its contents.
boost::filesystem::path pathToClass(const std::string &)
Path to the given class.
virtual PartitionerPtr createPartitioner() override
Parse specimen binary containers.
rose_addr_t loadClassFile(boost::filesystem::path, SgAsmGenericFileList *, rose_addr_t)
Load a class file by parsing its contents at the given address.
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.
Base class for all ROSE exceptions.
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 is a Java jar file.
bool isJavaClassFile(const boost::filesystem::path &)
True if named file is a Java class file.
Sawyer::SharedPointer< EngineJvm > EngineJvmPtr
Shared-ownership pointer for EngineJvm.