ROSE 0.11.145.147
|
Base class for matching an instruction pattern.
Instruction matchers are generally reference from the partitioner via shared-ownership pointers. Subclasses must implement a match method that performs the actual matching.
#include <Rose/BinaryAnalysis/Partitioner2/Modules.h>
Public Types | |
typedef Sawyer::SharedPointer< InstructionMatcher > | Ptr |
Shared-ownership pointer to an InstructionMatcher. | |
Public Member Functions | |
virtual bool | match (const PartitionerConstPtr &, rose_addr_t anchor)=0 |
Attempt to match an instruction pattern. | |
Public Member Functions inherited from Sawyer::SharedObject | |
SharedObject () | |
Default constructor. | |
SharedObject (const SharedObject &) | |
Copy constructor. | |
virtual | ~SharedObject () |
Virtual destructor. | |
SharedObject & | operator= (const SharedObject &) |
Assignment. | |
typedef Sawyer::SharedPointer<InstructionMatcher> Rose::BinaryAnalysis::Partitioner2::InstructionMatcher::Ptr |
Shared-ownership pointer to an InstructionMatcher.
See Shared ownership.
|
pure virtual |
Attempt to match an instruction pattern.
If the subclass implementation is able to match instructions, bytes, etc. anchored at the anchor
address then it should return true, otherwise false. The anchor address will always be valid for the situation (e.g., if the partitioner is trying to match something anchored at an address that is not in the CFG, then the anchor
will be such an address; if it is trying to match something that is definitely an instruction then the address will be mapped with execute permission; etc.). This precondition makes writing matchers that match against a single address easier to write, but matchers that match at additional locations must explicitly check those other locations with the same conditions (FIXME[Robb P. Matzke 2014-08-04]: perhaps we should pass those conditions as an argument).
Implemented in Rose::BinaryAnalysis::Partitioner2::ModulesElf::PltEntryMatcher, Rose::BinaryAnalysis::Partitioner2::Modules::MatchThunk, Rose::BinaryAnalysis::Partitioner2::ModulesM68k::MatchLink, Rose::BinaryAnalysis::Partitioner2::ModulesMips::MatchRetAddiu, Rose::BinaryAnalysis::Partitioner2::ModulesPowerpc::MatchStwuPrologue, Rose::BinaryAnalysis::Partitioner2::ModulesX86::MatchStandardPrologue, Rose::BinaryAnalysis::Partitioner2::ModulesX86::MatchHotPatchPrologue, Rose::BinaryAnalysis::Partitioner2::ModulesX86::MatchAbbreviatedPrologue, Rose::BinaryAnalysis::Partitioner2::ModulesX86::MatchEnterPrologue, and Rose::BinaryAnalysis::Partitioner2::ModulesX86::MatchRetPadPush.