1#ifndef ROSE_BinaryAnalysis_ByteCode_Analysis_H
2#define ROSE_BinaryAnalysis_ByteCode_Analysis_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_BINARY_ANALYSIS
6#include <Rose/BinaryAnalysis/Disassembler/BasicTypes.h>
7#include <Rose/BinaryAnalysis/Partitioner2/BasicTypes.h>
8#include <Rose/Progress.h>
13namespace BinaryAnalysis {
16namespace P2 = Partitioner2;
44 virtual std::string name()
const = 0;
64 const std::string& name()
const;
70 virtual bool returnsVoid()
const;
71 virtual bool isStatic()
const = 0;
72 virtual bool isSystemReserved(
const std::string &name)
const = 0;
77 virtual std::string descriptor()
const = 0;
80 virtual std::string identity()
const;
83 virtual void annotate() = 0;
86 std::set<Address> targets()
const;
89 Class* declaringClass()
const;
90 void declaringClass(
Class *declaringClass);
97 const std::vector<BasicBlockPtr>& blocks()
const;
112 Class* class_ =
nullptr;
114 std::vector<BasicBlockPtr> blocks_;
115 InstructionMap instructionMap_;
130 virtual std::string name()
const = 0;
148 virtual std::string name()
const = 0;
171 const std::string& name()
const;
172 const std::string& baseClassName()
const;
179 virtual std::string qualifiedName()
const;
180 virtual std::string typeSeparator()
const = 0;
181 virtual const std::vector<std::string>& strings();
183 const std::vector<Field::Ptr>& fields()
const;
184 const std::vector<Method::Ptr>& methods()
const;
185 const std::vector<Attribute::Ptr>& attributes()
const;
186 const std::vector<Interface::Ptr>& interfaces()
const;
191 virtual void partition(
const PartitionerPtr &partitioner, std::map<std::string,Address> &discoveredFunctions,
193 virtual void digraph()
const;
194 virtual void dump() = 0;
206 std::string baseClassName_;
208 std::vector<Field::Ptr> fields_;
209 std::vector<Method::Ptr> methods_;
210 std::vector<Attribute::Ptr> attributes_;
211 std::vector<Interface::Ptr> interfaces_;
212 std::vector<std::string> strings_;
231 virtual std::string name()
const;
233 std::map<std::string,Address> &discoveredFunctions);
237 const std::vector<ByteCode::Class::Ptr>& classes()
const;
243 std::vector<ByteCode::Class::Ptr> classes_;
262 static Address nextSystemReservedVa();
265 virtual std::string name()
const;
266 virtual bool isSystemReserved(
const std::string &name)
const = 0;
271 const std::vector<Namespace::Ptr>& namespaces()
const;
277 std::vector<Namespace::Ptr> namespaces_;
281 static Address nextSystemReservedVa_;
318 std::map<std::string, ClassPtr> classes_;
Base class for ByteCode Attribute.
bool isAssignableTo(const ClassPtr &source, const ClassPtr &target) const
Returns true if a value of the source class can be assigned to the target.
static Ptr instance()
Allocating constructor.
ByteCode::ClassPtr findClass(const std::string &name) const
Returns the Class with the given name, null if not present.
bool insert(const Class::Ptr &cls)
Inserts a class into the repository.
bool contains(const std::string &name) const
Returns true if a class with the given name is present.
Base class for ByteCode Class.
void finalize()
Complete initialization of the class once partitioning is done.
Base class for ByteCode Container.
Base class for ByteCode Fields.
Base class for ByteCode Interface.
Base class for ByteCode Methods.
void finalize()
Complete initialization of the method once decoding is done.
Base class for ByteCode Namespace.
static Ptr instance(std::string name, ContainerPtr container)
Allocating constructor.
Creates SharedPointer from this.
Base class for reference counted objects.
Reference-counting intrusive smart pointer.
List of SgAsmInstruction nodes.
Base class for machine instructions.
Sawyer::SharedPointer< Partitioner > PartitionerPtr
Shared-ownership pointer for Partitioner.
Sawyer::SharedPointer< BasicBlock > BasicBlockPtr
Shared-ownersip pointer for BasicBlock.
Map< Address, SgAsmInstruction * > InstructionMap
Mapping from instruction addresses to instructions.
std::uint64_t Address
Address.