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