1 #ifndef ROSE_BinaryAnalysis_InstructionSemantics2_HotPatch_H
2 #define ROSE_BinaryAnalysis_InstructionSemantics2_HotPatch_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
6 #include <BaseSemanticsSValue.h>
7 #include <BinaryHotPatch.h>
8 #include <BinarySmtSolver.h>
9 #include <Sawyer/Message.h>
11 #include <boost/serialization/access.hpp>
12 #include <boost/serialization/nvp.hpp>
13 #include <boost/serialization/shared_ptr.hpp>
49 #ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
51 friend class boost::serialization::access;
54 void serialize(S &s,
const unsigned ) {
55 s & BOOST_SERIALIZATION_NVP(type_);
56 s & BOOST_SERIALIZATION_NVP(register_);
57 s & BOOST_SERIALIZATION_NVP(oldValue_);
58 s & BOOST_SERIALIZATION_NVP(newValue_);
59 s & BOOST_SERIALIZATION_NVP(behavior_);
75 ASSERT_not_null(newValue);
150 #ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
152 friend class boost::serialization::access;
155 void serialize(S &s,
const unsigned ) {
156 s & BOOST_SERIALIZATION_NVP(records_);
176 return records_.size();
189 records_.push_back(record);
190 return records_.size() - 1;
199 ASSERT_require(idx < records_.size());
200 return records_[idx];
203 ASSERT_require(idx < records_.size());
204 return records_[idx];
boost::shared_ptr< RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to a RISC operators object.
void newValue(const InstructionSemantics2::BaseSemantics::SValuePtr &v)
Property: Replacement value.
void reg(RegisterDescriptor r)
Property: Register to be matched.
Type for default-constructed records.
Describes how to modify machine state after each instruction.
Behavior behavior() const
Property: Behavior after matching.
InstructionSemantics2::BaseSemantics::SValuePtr oldValue() const
Property: Value to match.
void oldValue(const InstructionSemantics2::BaseSemantics::SValuePtr &v)
Property: Value to match.
Describes a single hot patch.
Record(RegisterDescriptor reg, const InstructionSemantics2::BaseSemantics::SValuePtr &oldValue, const InstructionSemantics2::BaseSemantics::SValuePtr &newValue, Behavior behavior=MATCH_CONTINUE)
Construct a record that substitutes a register.
Type
Type of patch record.
Main namespace for the ROSE library.
Records & records()
Property: Hot patch records.
size_t nRecords() const
Number of hot-patch records in this object.
const Records & records() const
Property: Hot patch records.
Don't try to match more records after a match is found.
void behavior(Behavior b)
Property: Behavior after matching.
Try to match additional subsequent records.
Describes (part of) a physical CPU register.
size_t operator()(const InstructionSemantics2::BaseSemantics::RiscOperatorsPtr &ops) const
Apply records to a machine state.
const Record & operator[](size_t idx) const
Reference a particular record.
RegisterDescriptor reg() const
Property: Register to be matched.
InstructionSemantics2::BaseSemantics::SValuePtr newValue() const
Property: Replacement value.
size_t append(const Record &record)
Append a hot-patch record.
Type type() const
Property: Type of record.
Record & operator[](size_t idx)
Reference a particular record.
std::vector< Record > Records
Ordered list of hot patch records.
Change the value of a register.
Record()
Construct a no-op record.
static Sawyer::Message::Facility mlog
Diagnostic output for hot patching.
size_t apply(const InstructionSemantics2::BaseSemantics::RiscOperatorsPtr &) const
Apply records to a machine state.
static void initDiagnostics()
Initialize diagnostic output.
Behavior
Behavior when a record matches.
void clear()
Remove all records from this object.