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>
12namespace BinaryAnalysis {
13namespace Partitioner2 {
38 void this_type_does_not_support_comparisons()
const {}
40 operator unspecified_bool()
const {
41 return nInsns ? &ThunkDetection::this_type_does_not_support_comparisons : 0;
90 std::vector<ThunkPredicate> predicates_;
116 const std::vector<ThunkPredicate>&
predicates()
const {
return predicates_; }
117 std::vector<ThunkPredicate>&
predicates() {
return predicates_; }
List of thunk predicates.
std::vector< ThunkPredicate > & predicates()
Property: The list of predicates that will test for thunks.
static Ptr functionMatcherThunks()
Construct collective predicate for matching thunks to create functions.
static Ptr allThunks()
Construct collective predicate with all built-in predicates.
static Ptr instance()
Allocating constructor.
const std::vector< ThunkPredicate > & predicates() const
Property: The list of predicates that will test for thunks.
ThunkDetection isThunk(const PartitionerConstPtr &, const std::vector< SgAsmInstruction * > &) const
Test whether instructions begin with a thunk.
Base class for reference counted objects.
Base class for machine instructions.
ThunkDetection isX86JmpMemThunk(const PartitionerConstPtr &, const std::vector< SgAsmInstruction * > &)
Test whether x86 instruction begin with "jmp [ADDRESS]".
void splitThunkFunctions(const PartitionerPtr &, const ThunkPredicates::Ptr &)
Split thunks off from start of functions.
ThunkDetection isX86MovJmpThunk(const PartitionerConstPtr &, const std::vector< SgAsmInstruction * > &)
Test whether x86 instructions begin with "mov R, [ADDR]; jmp R".
ThunkDetection isX86JmpImmThunk(const PartitionerConstPtr &, const std::vector< SgAsmInstruction * > &)
Test whether x86 instructions begin with "jmp ADDRESS".
ThunkDetection(* ThunkPredicate)(const PartitionerConstPtr &, const std::vector< SgAsmInstruction * > &)
Function signature for finding thunks.
ThunkDetection isX86LeaJmpThunk(const PartitionerConstPtr &, const std::vector< SgAsmInstruction * > &)
Test whether x86 instructions begin with an LEA JMP pair.
ThunkDetection isX86AddJmpThunk(const PartitionerConstPtr &, const std::vector< SgAsmInstruction * > &)
Test whether x86 instructions begin with "add R, C; jmp ADDR".
Return type for thunk detectors.
size_t nInsns
Number of instructions that are part of the thunk.
ThunkDetection()
Constructor for detecting no thunk.
std::string name
Name of the pattern that matched the instructions.
ThunkDetection(size_t nInsns, const std::string &name)
Constructor for a detected thunk.