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>
10 namespace BinaryAnalysis {
11 namespace Partitioner2 {
44 std::map<std::string, SgAsmGenericFile*> classes_;
47 std::map<std::string, rose_addr_t> functions_;
50 std::map<std::string, rose_addr_t> unresolvedFunctions_;
52 static constexpr rose_addr_t vaDefaultIncrement{4*1024};
53 rose_addr_t nextFunctionVa_;
65 explicit EngineJvm(
const Settings &settings);
76 virtual bool matchFactory(
const std::vector<std::string> &specimen)
const override;
77 virtual EnginePtr instanceFromFactory(
const Settings&)
override;
108 const std::string &purpose,
const std::string &description)
override;
120 virtual std::pair<std::string, std::string> specimenNameDocumentation()
override;
231 boost::filesystem::path
pathToClass(
const std::string &);
259 virtual PartitionerPtr partition(
const std::vector<std::string> &fileNames = std::vector<std::string>())
override;
355 virtual SgAsmBlock*
buildAst(
const std::vector<std::string> &fileNames = std::vector<std::string>())
override;
368 const std::string&
isaName() const ;
387 virtual
SgProject* roseFrontendReplacement(const
std::vector<
boost::filesystem::path> &fileNames) override;
395 namespace ModulesJvm {
virtual void discoverFunctions(const PartitionerPtr &, const ByteCode::Class *)
Discover as many functions as possible.
virtual void runPartitionerInit(const PartitionerPtr &) override
Finds interesting things to work on initially.
virtual SgAsmBlock * frontend(const std::vector< std::string > &args, const std::string &purpose, const std::string &description) override
Most basic usage of the partitioner.
EngineJvmPtr Ptr
Shared ownership pointer.
Base class for engines driving the partitioner.
virtual MemoryMapPtr loadSpecimens(const std::vector< std::string > &fileNames=std::vector< std::string >()) override
Load interpretation.
virtual void runPartitionerFinal(const PartitionerPtr &) override
Runs the final parts of partitioning.
virtual bool areSpecimensLoaded() const override
Returns true if specimens are loaded.
boost::filesystem::path pathToClass(const std::string &)
Path to the given class.
virtual bool areContainersParsed() const override
Returns true if containers are parsed.
Represents an JVM constant pool.
static Ptr factory()
Allocate a factory.
Main namespace for the ROSE library.
virtual SgAsmInterpretation * parseContainers(const std::vector< std::string > &fileNames) override
Parse specimen binary containers.
rose_addr_t loadSuperClasses(const std::string &, SgAsmGenericFileList *, rose_addr_t)
Recursively find and load all super classes starting at the given address.
const std::vector< rose_addr_t > & functionStartingVas() const
Property: Starting addresses for disassembly.
List of AST file node pointers.
rose_addr_t loadClass(uint16_t, SgAsmJvmConstantPool *, SgAsmGenericFileList *, rose_addr_t)
Load class and super class starting at the given address.
void discoverFunctionCalls(SgAsmJvmMethod *, SgAsmJvmConstantPool *, std::map< std::string, rose_addr_t > &)
Discover function calls (invoke instructions) made from a method.
rose_addr_t loadDiscoverableClasses(SgAsmGenericFileList *, rose_addr_t)
Load classes discoverable from the file list starting at the given address.
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.
rose_addr_t loadClassFile(boost::filesystem::path, SgAsmGenericFileList *, rose_addr_t)
Load a class file by parsing its contents at the given address.
const std::string & isaName() const
Property: Instruction set architecture name.
virtual void discoverBasicBlocks(const PartitionerPtr &, const ByteCode::Method *)
Discover as many basic blocks as possible.
virtual bool isNonContainer(const std::string &) override
Determine whether a specimen name is a non-container.
EngineJvm()=delete
Default constructor.
Sawyer::SharedPointer< EngineJvm > EngineJvmPtr
Shared-ownership pointer for EngineJvm.
static Ptr instance(const Settings &)
Allocating constructor with settings.
This class represents a source project, with a list of SgFile objects and global information about th...
virtual SgAsmBlock * buildAst(const std::vector< std::string > &fileNames=std::vector< std::string >()) override
Obtain an abstract syntax tree.
PartitionerPtr createJvmTunedPartitioner()
Create a partitioner for JVM.
Base class for all ROSE exceptions.
bool isJavaClassFile(const boost::filesystem::path &)
True if named file is a Java class file.
virtual void runPartitionerRecursive(const PartitionerPtr &) override
Runs the recursive part of partioning.
Represents an interpretation of a binary container.
Engine for Java Virtual Machine (JVM) specimens.
virtual PartitionerPtr createPartitioner() override
Create partitioner.