1#ifndef ROSE_BinaryAnalysis_Debugger_Base_H
2#define ROSE_BinaryAnalysis_Debugger_Base_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_BINARY_ANALYSIS
5#include <Rose/BinaryAnalysis/Debugger/BasicTypes.h>
7#include <Rose/BinaryAnalysis/AddressInterval.h>
8#include <Rose/BinaryAnalysis/BasicTypes.h>
9#include <Rose/BinaryAnalysis/ByteOrder.h>
10#include <Rose/BinaryAnalysis/Debugger/ThreadId.h>
11#include <Rose/Constants.h>
13#include <Sawyer/BitVector.h>
14#include <Sawyer/SharedObject.h>
15#include <Sawyer/Trace.h>
18namespace BinaryAnalysis {
38 Base& operator=(
const Base&) =
delete;
132 template<
class Filter>
197 virtual size_t readMemory(rose_addr_t va,
size_t nBytes, uint8_t *buffer) = 0;
202 virtual std::vector<uint8_t>
readMemory(rose_addr_t va,
size_t nBytes) = 0;
214 virtual size_t writeMemory(rose_addr_t va,
size_t nBytes,
const uint8_t *bytes) = 0;
221 size_t n =
writeMemory(va,
sizeof(T), (
const uint8_t*)&value);
222 ASSERT_always_require(n ==
sizeof(T));
Base class for debuggers.
virtual void runToBreakPoint(ThreadId)=0
Run until the next breakpoint is reached.
virtual void clearBreakPoint(const AddressInterval &)=0
Remove breakpoints.
virtual void writeAllRegisters(ThreadId, const Sawyer::Container::BitVector &)=0
Write all registers as a single bit vector.
virtual Sawyer::Container::BitVector readMemory(rose_addr_t va, size_t nBytes, ByteOrder::Endianness order)=0
Read subordinate memory as a bit vector.
Sawyer::Container::Trace< rose_addr_t > trace(ThreadId tid, Filter &filter)
Run the program and return an execution trace.
virtual rose_addr_t executionAddress(ThreadId)
Execution address.
virtual std::string registerName(RegisterDescriptor)
Convert a register descriptor to a register name.
virtual bool isAttached()=0
Tests whether this debugger is attached to a specimen.
virtual void singleStep(ThreadId)=0
Execute one machine instruction.
virtual void writeRegister(ThreadId, RegisterDescriptor, uint64_t value)=0
Write subordinate register.
virtual Sawyer::Container::BitVector readRegister(ThreadId, RegisterDescriptor)=0
Read subordinate register.
virtual std::string howTerminated()=0
String describing how the subordinate process terminated.
virtual void executionAddress(ThreadId, rose_addr_t)
Execution address.
virtual std::vector< ThreadId > threadIds()=0
List of subordinate threads.
virtual void writeRegister(ThreadId, RegisterDescriptor, const Sawyer::Container::BitVector &)=0
Write subordinate register.
virtual void setBreakPoint(const AddressInterval &)=0
Set breakpoints.
virtual bool isTerminated()=0
Returns true if the subordinate terminated.
virtual size_t writeMemory(rose_addr_t va, size_t nBytes, const uint8_t *bytes)=0
Writes some bytes to subordinate memory.
virtual size_t readMemory(rose_addr_t va, size_t nBytes, uint8_t *buffer)=0
Read subordinate memory.
void writeMemory(rose_addr_t va, const T &value)
Write subordinate memory.
virtual void terminate()=0
Terminate the specimen.
virtual std::vector< RegisterDescriptor > availableRegisters()=0
List of available registers.
virtual void detach()=0
Detach from a specimen.
virtual std::string readCString(rose_addr_t va, size_t maxBytes=UNLIMITED)
Read C-style NUL-terminated string from subordinate.
virtual Disassembler::BasePtr disassembler()
Property: Disassembler.
virtual Sawyer::Container::BitVector readAllRegisters(ThreadId)=0
Read all available register values as a single bit vector.
virtual Sawyer::Container::Trace< rose_addr_t > trace()
Run the program and return an execution trace.
virtual RegisterDictionaryPtr registerDictionary()
Register dictionary for the architecture.
virtual void clearBreakPoints()=0
Remove all breakpoints.
virtual std::vector< uint8_t > readMemory(rose_addr_t va, size_t nBytes)=0
Read subordinate memory as an array of bytes.
Describes (part of) a physical CPU register.
Stores a vector of enum bit flags.
bool isClear(Enum e) const
Test whether a bit is clear.
bool isSet(Enum e) const
Test whether a bit is set.
Records and replays traces.
void append(const Label &label)
Append a label to a trace.
Base class for reference counted objects.
@ REJECT
Reject the current address, not appending it to the trace.
@ STOP
Abort tracing, either appending or rejecting the current address.
const size_t UNLIMITED
Effectively unlimited size.