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};
115 const std::string &purpose,
const std::string &description)
override;
133 static bool loadAllClasses;
332 virtual SgAsmBlock*
buildAst(
const std::vector<std::string> &fileNames = std::vector<std::string>())
override;
375namespace ModulesJvm {
375namespace ModulesJvm {
…}
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 Sawyer::CommandLine::SwitchGroup engineSwitches(EngineSettings &)
Command-line switches related to the JVM engine behavior.
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 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.
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.
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.
virtual bool matchFactory(const std::vector< std::string > &specimen) const override
Predicate for matching a concrete engine factory by settings and specimen.
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.
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.
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.
Sawyer::SharedPointer< EngineJvm > EngineJvmPtr
Shared-ownership pointer for EngineJvm.
std::uint64_t Address
Address.
Settings for controling the engine behavior.