ROSE 0.11.145.192
|
Base class for debuggers.
This defines the interface and common operations for debuggers.
Definition at line 24 of file Debugger/Base.h.
#include <Rose/BinaryAnalysis/Debugger/Base.h>
Public Types | |
using | Ptr = Debugger::Ptr |
Shared ownership pointer. | |
Public Member Functions | |
virtual Disassembler::BasePtr | disassembler () |
Property: Disassembler. | |
virtual bool | isAttached ()=0 |
Tests whether this debugger is attached to a specimen. | |
virtual void | detach ()=0 |
Detach from a specimen. | |
virtual void | terminate ()=0 |
Terminate the specimen. | |
virtual bool | isTerminated ()=0 |
Returns true if the subordinate terminated. | |
virtual std::string | howTerminated ()=0 |
String describing how the subordinate process terminated. | |
virtual std::vector< ThreadId > | threadIds ()=0 |
List of subordinate threads. | |
virtual void | setBreakPoint (const AddressInterval &)=0 |
Set breakpoints. | |
virtual void | clearBreakPoint (const AddressInterval &)=0 |
Remove breakpoints. | |
virtual void | clearBreakPoints ()=0 |
Remove all breakpoints. | |
virtual void | singleStep (ThreadId)=0 |
Execute one machine instruction. | |
virtual void | runToBreakPoint (ThreadId)=0 |
Run until the next breakpoint is reached. | |
virtual Sawyer::Container::Trace< rose_addr_t > | trace () |
Run the program and return an execution trace. | |
template<class Filter > | |
Sawyer::Container::Trace< rose_addr_t > | trace (ThreadId tid, Filter &filter) |
Run the program and return an execution trace. | |
virtual RegisterDictionaryPtr | registerDictionary () |
Register dictionary for the architecture. | |
virtual std::string | registerName (RegisterDescriptor) |
Convert a register descriptor to a register name. | |
virtual Sawyer::Container::BitVector | readRegister (ThreadId, RegisterDescriptor)=0 |
Read subordinate register. | |
virtual std::vector< RegisterDescriptor > | availableRegisters ()=0 |
List of available registers. | |
virtual Sawyer::Container::BitVector | readAllRegisters (ThreadId)=0 |
Read all available register values as a single bit vector. | |
virtual void | writeAllRegisters (ThreadId, const Sawyer::Container::BitVector &)=0 |
Write all registers as a single bit vector. | |
virtual size_t | readMemory (rose_addr_t va, size_t nBytes, uint8_t *buffer)=0 |
Read subordinate memory. | |
virtual std::vector< uint8_t > | readMemory (rose_addr_t va, size_t nBytes)=0 |
Read subordinate memory as an array of bytes. | |
virtual Sawyer::Container::BitVector | readMemory (rose_addr_t va, size_t nBytes, ByteOrder::Endianness order)=0 |
Read subordinate memory as a bit vector. | |
virtual size_t | writeMemory (rose_addr_t va, size_t nBytes, const uint8_t *bytes)=0 |
Writes some bytes to subordinate memory. | |
template<typename T > | |
void | writeMemory (rose_addr_t va, const T &value) |
Write subordinate memory. | |
virtual std::string | readCString (rose_addr_t va, size_t maxBytes=UNLIMITED) |
Read C-style NUL-terminated string from subordinate. | |
virtual void | executionAddress (ThreadId, rose_addr_t) |
Execution address. | |
virtual rose_addr_t | executionAddress (ThreadId) |
Execution address. | |
virtual void | writeRegister (ThreadId, RegisterDescriptor, const Sawyer::Container::BitVector &)=0 |
Write subordinate register. | |
virtual void | writeRegister (ThreadId, RegisterDescriptor, uint64_t value)=0 |
Write subordinate register. | |
Public Member Functions inherited from Sawyer::SharedObject | |
SharedObject () | |
Default constructor. | |
SharedObject (const SharedObject &) | |
Copy constructor. | |
virtual | ~SharedObject () |
Virtual destructor. | |
SharedObject & | operator= (const SharedObject &) |
Assignment. | |
Protected Member Functions | |
Base (const Base &)=delete | |
Base (Base &&)=delete | |
Base & | operator= (const Base &)=delete |
Base & | operator= (Base &&)=delete |
Protected Attributes | |
Disassembler::BasePtr | disassembler_ |
Shared ownership pointer.
Definition at line 27 of file Debugger/Base.h.
|
pure virtual |
Tests whether this debugger is attached to a specimen.
Returns true if this debugger is debugging something, and false otherwise.
|
pure virtual |
Detach from a specimen.
This debugger detaches from the specimen. Depending on the settings, the specimen might continue to run, or it might be terminated.
|
pure virtual |
Terminate the specimen.
If a specimen is attached, terminate it.
|
pure virtual |
List of subordinate threads.
Get the list of thread IDs in the subordinate process.
|
virtual |
Execution address.
This is the value of the so-called program counter. For instance, if the specimen is i386 then this is the value stored in the EIP register.
Referenced by trace().
|
virtual |
Execution address.
This is the value of the so-called program counter. For instance, if the specimen is i386 then this is the value stored in the EIP register.
|
inline |
Run the program and return an execution trace.
At each step along the execution, the filter
functor is invoked and passed the current execution address. The return value of type FilterAction from the filter functor controls whether the address is appended to the trace and whether the tracing should continue.
Definition at line 133 of file Debugger/Base.h.
References Sawyer::Container::Trace< T, IndexTag >::append(), executionAddress(), Sawyer::BitFlags< E, V >::isClear(), Sawyer::BitFlags< E, V >::isSet(), isTerminated(), Rose::BinaryAnalysis::Debugger::REJECT, singleStep(), and Rose::BinaryAnalysis::Debugger::STOP.
|
pure virtual |
Read subordinate register.
Some registers are wider than what can be easily represented on this architecture (e.g., x86 XMM registers are 128 bits), therefore return the result as a bit vector. If you want just the low-order 64 bits, invoke it like this:
|
pure virtual |
Read all available register values as a single bit vector.
The register values are returned in the same order as described by the availableRegisters method.
|
pure virtual |
Write all registers as a single bit vector.
The bit vector is the concatenation of the values for all the registers returned by availableRegisters and in the same order, with no padding. Usually the values are simply the same vector returned by readAllRegisters.
|
pure virtual |
Read subordinate memory.
Returns the number of bytes read.
|
pure virtual |
Read subordinate memory as an array of bytes.
If the read fails then a shorter buffer is returned.
|
pure virtual |
Read subordinate memory as a bit vector.
|
pure virtual |
Writes some bytes to subordinate memory.
Returns the number of bytes written.
Referenced by writeMemory().
|
inline |
Write subordinate memory.
Writes something to memory.
Definition at line 220 of file Debugger/Base.h.
References writeMemory().
|
virtual |
Read C-style NUL-terminated string from subordinate.
Reads up to maxBytes
bytes from the subordinate or until an ASCII NUL character is read, concatenates all the characters (except the NUL) into a C++ string and returns it. The maxBytes
includes the NUL terminator although the NUL terminator is not returned as part of the string.
|
protected |
Definition at line 30 of file Debugger/Base.h.