Public Types | Public Member Functions | List of all members
Rose::BinaryAnalysis::Partitioner2::InstructionMatcher Class Referenceabstract


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.

Definition at line 78 of file Modules.h.

#include <Rose/BinaryAnalysis/Partitioner2/Modules.h>

Inheritance diagram for Rose::BinaryAnalysis::Partitioner2::InstructionMatcher:
Inheritance graph
Collaboration diagram for Rose::BinaryAnalysis::Partitioner2::InstructionMatcher:
Collaboration graph

Public Types

typedef Sawyer::SharedPointer< InstructionMatcherPtr
 Shared-ownership pointer to an InstructionMatcher. More...

Public Member Functions

virtual bool match (const PartitionerConstPtr &, rose_addr_t anchor)=0
 Attempt to match an instruction pattern. More...
- Public Member Functions inherited from Sawyer::SharedObject
 SharedObject ()
 Default constructor. More...
 SharedObject (const SharedObject &)
 Copy constructor. More...
virtual ~SharedObject ()
 Virtual destructor. More...
SharedObjectoperator= (const SharedObject &)
 Assignment. More...

Member Typedef Documentation

Shared-ownership pointer to an InstructionMatcher.

See Shared ownership.

Definition at line 81 of file Modules.h.

Member Function Documentation

virtual bool Rose::BinaryAnalysis::Partitioner2::InstructionMatcher::match ( const PartitionerConstPtr ,
rose_addr_t  anchor 
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::Modules::MatchThunk, Rose::BinaryAnalysis::Partitioner2::ModulesElf::PltEntryMatcher, Rose::BinaryAnalysis::Partitioner2::ModulesX86::MatchRetPadPush, Rose::BinaryAnalysis::Partitioner2::ModulesX86::MatchEnterPrologue, Rose::BinaryAnalysis::Partitioner2::ModulesX86::MatchAbbreviatedPrologue, Rose::BinaryAnalysis::Partitioner2::ModulesX86::MatchHotPatchPrologue, Rose::BinaryAnalysis::Partitioner2::ModulesX86::MatchStandardPrologue, Rose::BinaryAnalysis::Partitioner2::ModulesM68k::MatchLink, Rose::BinaryAnalysis::Partitioner2::ModulesPowerpc::MatchStwuPrologue, and Rose::BinaryAnalysis::Partitioner2::ModulesMips::MatchRetAddiu.

The documentation for this class was generated from the following file: