1 #ifndef ROSE_BinaryAnalysis_Partitioner2_Thunk_H
2 #define ROSE_BinaryAnalysis_Partitioner2_Thunk_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
6 #include <Rose/BinaryAnalysis/Partitioner2/BasicTypes.h>
7 #include <Sawyer/SharedObject.h>
10 namespace BinaryAnalysis {
11 namespace Partitioner2 {
31 : nInsns(nInsns), name(name) {}
36 void this_type_does_not_support_comparisons()
const {}
38 operator unspecified_bool()
const {
39 return nInsns ? &ThunkDetection::this_type_does_not_support_comparisons : 0;
88 std::vector<ThunkPredicate> predicates_;
114 const std::vector<ThunkPredicate>&
predicates()
const {
return predicates_; }
115 std::vector<ThunkPredicate>&
predicates() {
return predicates_; }
ThunkDetection isX86MovJmpThunk(const PartitionerConstPtr &, const std::vector< SgAsmInstruction * > &)
Test whether x86 instructions begin with "mov R, [ADDR]; jmp R".
void splitThunkFunctions(const PartitionerPtr &, const ThunkPredicates::Ptr &)
Split thunks off from start of functions.
std::string name
Name of the pattern that matched the instructions.
ThunkDetection(* ThunkPredicate)(const PartitionerConstPtr &, const std::vector< SgAsmInstruction * > &)
Function signature for finding thunks.
ThunkDetection(size_t nInsns, const std::string &name)
Constructor for a detected thunk.
ThunkDetection()
Constructor for detecting no thunk.
Main namespace for the ROSE library.
ThunkDetection isThunk(const PartitionerConstPtr &, const std::vector< SgAsmInstruction * > &) const
Test whether instructions begin with a thunk.
std::vector< ThunkPredicate > & predicates()
Property: The list of predicates that will test for thunks.
Sawyer::SharedPointer< Partitioner > PartitionerPtr
Shared-ownership pointer for Partitioner.
const std::vector< ThunkPredicate > & predicates() const
Property: The list of predicates that will test for thunks.
ThunkDetection isX86JmpMemThunk(const PartitionerConstPtr &, const std::vector< SgAsmInstruction * > &)
Test whether x86 instruction begin with "jmp [ADDRESS]".
static Ptr functionMatcherThunks()
Construct collective predicate for matching thunks to create functions.
Sawyer::SharedPointer< const Partitioner > PartitionerConstPtr
Shared-ownership pointer for Partitioner.
Return type for thunk detectors.
ThunkDetection isX86JmpImmThunk(const PartitionerConstPtr &, const std::vector< SgAsmInstruction * > &)
Test whether x86 instructions begin with "jmp ADDRESS".
static Ptr instance()
Allocating constructor.
ThunkDetection isX86AddJmpThunk(const PartitionerConstPtr &, const std::vector< SgAsmInstruction * > &)
Test whether x86 instructions begin with "add R, C; jmp ADDR".
Base class for reference counted objects.
static Ptr allThunks()
Construct collective predicate with all built-in predicates.
List of thunk predicates.
ThunkDetection isX86LeaJmpThunk(const PartitionerConstPtr &, const std::vector< SgAsmInstruction * > &)
Test whether x86 instructions begin with an LEA JMP pair.
size_t nInsns
Number of instructions that are part of the thunk.