1 #ifndef ROSE_BinaryAnalysis_PointerDetection_H
2 #define ROSE_BinaryAnalysis_PointerDetection_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
6 #include <Rose/BinaryAnalysis/Disassembler/BasicTypes.h>
7 #include <Rose/BinaryAnalysis/Partitioner2/BasicTypes.h>
8 #include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics.h>
9 #include <Sawyer/Set.h>
12 namespace BinaryAnalysis {
106 namespace PointerDetection {
189 : insnVa(insnVa), direction(direction), value(value) {}
191 bool operator<(
const Access &other)
const {
192 if (insnVa != other.
insnVa)
193 return insnVa < other.
insnVa;
196 if (value && other.
value) {
197 return value->hash() < other.
value->hash();
199 return !value && other.
value;
211 : pointerVa(pointerVa), nBits(nBits) {
212 pointerAccesses.insert(
Access(insnVa, dir, pointerValue));
247 : hasResults_(false), didConverge_(false) {}
253 : settings_(
settings), hasResults_(false), didConverge_(false) {
265 : settings_(
settings), cpu_(cpu), hasResults_(false), didConverge_(false) {}
308 return codePointers_;
316 return dataPointers_;
325 return initialState_;
bool saveDataPointers
Save information about data pointers.
InstructionSemantics::BaseSemantics::StatePtr finalState() const
Final state for analysis.
Analysis(const InstructionSemantics::BaseSemantics::DispatcherPtr &cpu, const Settings &settings=Settings())
Construct an analysis using a specified dispatcher.
Direction
Information about how a pointer is dereferenced.
InstructionSemantics::BaseSemantics::StatePtr initialState() const
Initial state for analysis.
boost::shared_ptr< RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to a RISC operators object.
Pointer is used to read from memory.
bool didConverge() const
Whether the analysis results are valid.
const Settings & settings() const
Property: Analysis settings.
rose_addr_t insnVa
Instruction location where memory is accessed.
bool ignoreConstIp
Whether to ignore branches to concrete addresses.
bool ignoreStrangeSizes
Whether to ignore strange-sized pointers.
Pointer is used to write to memory.
Settings to control the pointer analysis.
void clearNonResults()
Clears everything but results.
Main namespace for the ROSE library.
bool savePointerAccesses
Save information about where pointer variables are accessed.
boost::shared_ptr< State > StatePtr
Shared-ownership pointer to a semantic state.
SymbolicExpression::Ptr pointerVa
Symbolic address where pointer variable is stored.
std::set< Access > pointerAccesses
Where pointer variable's value was accessed.
boost::shared_ptr< Dispatcher > DispatcherPtr
Shared-ownership pointer to a semantics instruction dispatcher.
std::set< Access > dereferences
Where pointer was dereferenced.
bool savePointerVas
Save the pointer variable addresses in the results.
Direction direction
Whether memory is read or written.
bool savePointerDereferences
Save information about where pointer values are dereferenced.
Description of accessing memory.
Sawyer::Message::Facility mlog
Facility for diagnostic output.
void initDiagnostics()
Initialize diagnostics.
void clearResults()
Clear analysis results.
void analyzeFunction(const Partitioner2::PartitionerConstPtr &, const Sawyer::SharedPointer< Partitioner2::Function > &)
Analyze one function.
SymbolicExpression::Ptr value
Value read or written.
bool savePointerAccessValues
Save pointer accessed values if pointer accesses are saved.
size_t maximumDataFlowIterationFactor
Maximum data-flow iteration factor.
Description of one pointer.
size_t nBits
Width of pointer in bits.
const PointerDescriptors & codePointers() const
Property: Code pointers.
Analysis()
Default constructor.
Analysis(const Disassembler::BasePtr &d, const Settings &settings=Settings())
Construct an analysis using a specific disassembler.
const PointerDescriptors & dataPointers() const
Property: Data pointers.
bool hasResults() const
Whether a function has been analyzed.
bool saveCodePointers
Save information about code pointers.
uint64_t symbolicTrimThreshold
Threshold for replacing large symbolic expressions with new variables.
std::list< PointerDescriptor > PointerDescriptors
Set of pointers.
bool savePointerDereferenceValues
Save pointer dereferenced values if dereferences are saved.