1 #ifndef ROSE_BinaryAnalysis_BestMapAddress_H
2 #define ROSE_BinaryAnalysis_BestMapAddress_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
6 #include <Rose/Diagnostics.h>
7 #include <Rose/BinaryAnalysis/Partitioner2/Engine.h>
8 #include <Rose/Progress.h>
9 #include <Rose/Exception.h>
10 #include <Sawyer/Set.h>
13 namespace BinaryAnalysis {
51 AddressSet targetVas_;
52 MatchedDeltas results_;
61 : upToDate_(true), maxMatches_(0), nBits_(0), progress_(
Progress::instance()) {}
116 size_t nBits()
const {
return nBits_; }
117 void nBits(
size_t n);
124 rose_addr_t
mask()
const;
149 if (targetVas_.
insert(va))
183 const std::vector<rose_addr_t>&
bestDeltas()
const;
void reset()
Clear gathered addresses.
void insertEntryAddress(rose_addr_t va)
Insert a function entry address.
static void initDiagnostics()
Initialize diagnostic streams.
void clear()
Erase all values.
Finds best address for mapping code.
bool insert(const Value &value)
Insert a value.
Base class for engines driving the partitioner.
static Diagnostics::Facility mlog
Facility for emitting diagnostics.
static MemoryMap::Ptr align(const MemoryMap::Ptr &, const Partitioner2::Engine::Settings &settings=Partitioner2::Engine::Settings(), const Progress::Ptr &progress=Progress::Ptr())
Align executable regions of a memory map.
double bestDeltaRatio() const
How well the best shift amounts performed.
const AddressSet & targetAddresses() const
Returns set of target addresses.
BestMapAddress & analyze(const AddressInterval &restrictEntryAddresses=AddressInterval::whole(), const AddressInterval &restrictTargetAddresses=AddressInterval::whole())
Analyze the addresses that have been provided.
Main namespace for the ROSE library.
Map & clear()
Remove all nodes.
const Settings & settings() const
Settings.
const std::vector< rose_addr_t > & bestDeltas() const
Return the best shift amounts.
void gatherAddresses(Partitioner2::Engine &engine)
Gather addresses for future analysis.
Sawyer::Container::Set< rose_addr_t > AddressSet
Set of addresses.
size_t nBits() const
Property: Number of bits in an address.
void progress(const Progress::Ptr &p)
Property: Progress reporter.
Exceptions for this analysis.
void insertTargetAddress(rose_addr_t va)
Insert a call target address.
static Interval whole()
Construct an interval that covers the entire domain.
Progress::Ptr progress() const
Property: Progress reporter.
Settings & settings()
Settings.
Sawyer::Optional< size_t > nThreads
Number of threads to use, overriding the global setting.
A general, thread-safe way to report progress made on some task.
Exception(const std::string &mesg)
Construct an exception with a message.
Base class for all ROSE exceptions.
const AddressSet & entryAddresses() const
Returns set of entry addresses.
Settings to control the analysis.
Container associating values with keys.
rose_addr_t mask() const
Property: Mask to use when doing address arithmetic.
BestMapAddress()
Construct an empty analysis.