ROSE  0.11.145.0
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Rose::BinaryAnalysis::Debugger::Base Class Referenceabstract

Description

Base class for debuggers.

This defines the interface and common operations for debuggers.

Definition at line 20 of file Debugger/Base.h.

#include <Rose/BinaryAnalysis/Debugger/Base.h>

Inheritance diagram for Rose::BinaryAnalysis::Debugger::Base:
Inheritance graph
[legend]
Collaboration diagram for Rose::BinaryAnalysis::Debugger::Base:
Collaboration graph
[legend]

Public Types

using Ptr = Debugger::Ptr
 Shared ownership pointer. More...
 

Public Member Functions

virtual Disassembler::BasePtr disassembler ()
 Property: Disassembler. More...
 
virtual bool isAttached ()=0
 Tests whether this debugger is attached to a specimen. More...
 
virtual void detach ()=0
 Detach from a specimen. More...
 
virtual void terminate ()=0
 Terminate the specimen. More...
 
virtual bool isTerminated ()=0
 Returns true if the subordinate terminated. More...
 
virtual std::string howTerminated ()=0
 String describing how the subordinate process terminated. More...
 
virtual std::vector< ThreadIdthreadIds ()=0
 List of subordinate threads. More...
 
virtual void setBreakPoint (const AddressInterval &)=0
 Set breakpoints. More...
 
virtual void clearBreakPoint (const AddressInterval &)=0
 Remove breakpoints. More...
 
virtual void clearBreakPoints ()=0
 Remove all breakpoints. More...
 
virtual void singleStep (ThreadId)=0
 Execute one machine instruction. More...
 
virtual void runToBreakPoint (ThreadId)=0
 Run until the next breakpoint is reached. More...
 
virtual Sawyer::Container::Trace< rose_addr_t > trace ()
 Run the program and return an execution trace. More...
 
template<class Filter >
Sawyer::Container::Trace< rose_addr_t > trace (ThreadId tid, Filter &filter)
 Run the program and return an execution trace. More...
 
virtual RegisterDictionaryPtr registerDictionary ()
 Register dictionary for the architecture. More...
 
virtual std::string registerName (RegisterDescriptor)
 Convert a register descriptor to a register name. More...
 
virtual Sawyer::Container::BitVector readRegister (ThreadId, RegisterDescriptor)=0
 Read subordinate register. More...
 
virtual std::vector< RegisterDescriptoravailableRegisters ()=0
 
virtual Sawyer::Container::BitVector readAllRegisters (ThreadId)=0
 Read all available register values as a single bit vector. More...
 
virtual void writeAllRegisters (ThreadId, const Sawyer::Container::BitVector &)=0
 Write all registers as a single bit vector. More...
 
virtual size_t readMemory (rose_addr_t va, size_t nBytes, uint8_t *buffer)=0
 Read subordinate memory. More...
 
virtual std::vector< uint8_t > readMemory (rose_addr_t va, size_t nBytes)=0
 Read subordinate memory as an array of bytes. More...
 
virtual Sawyer::Container::BitVector readMemory (rose_addr_t va, size_t nBytes, ByteOrder::Endianness order)=0
 Read subordinate memory as a bit vector. More...
 
virtual size_t writeMemory (rose_addr_t va, size_t nBytes, const uint8_t *bytes)=0
 Writes some bytes to subordinate memory. More...
 
template<typename T >
void writeMemory (rose_addr_t va, const T &value)
 Write subordinate memory. More...
 
virtual std::string readCString (rose_addr_t va, size_t maxBytes=UNLIMITED)
 Read C-style NUL-terminated string from subordinate. More...
 
virtual void executionAddress (ThreadId, rose_addr_t)
 Execution address. More...
 
virtual rose_addr_t executionAddress (ThreadId)
 Execution address. More...
 
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. More...
 
 SharedObject (const SharedObject &)
 Copy constructor. More...
 
virtual ~SharedObject ()
 Virtual destructor. More...
 
SharedObjectoperator= (const SharedObject &)
 Assignment. More...
 

Protected Member Functions

 Base (const Base &)=delete
 
 Base (Base &&)=delete
 
Baseoperator= (const Base &)=delete
 
Baseoperator= (Base &&)=delete
 

Protected Attributes

Disassembler::BasePtr disassembler_
 

Member Typedef Documentation

Shared ownership pointer.

Definition at line 23 of file Debugger/Base.h.

Member Function Documentation

virtual Disassembler::BasePtr Rose::BinaryAnalysis::Debugger::Base::disassembler ( )
virtual

Property: Disassembler.

virtual bool Rose::BinaryAnalysis::Debugger::Base::isAttached ( )
pure virtual

Tests whether this debugger is attached to a specimen.

Returns true if this debugger is debugging something, and false otherwise.

virtual void Rose::BinaryAnalysis::Debugger::Base::detach ( )
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.

virtual void Rose::BinaryAnalysis::Debugger::Base::terminate ( )
pure virtual

Terminate the specimen.

If a specimen is attached, terminate it.

virtual bool Rose::BinaryAnalysis::Debugger::Base::isTerminated ( )
pure virtual

Returns true if the subordinate terminated.

Referenced by trace().

virtual std::string Rose::BinaryAnalysis::Debugger::Base::howTerminated ( )
pure virtual

String describing how the subordinate process terminated.

virtual std::vector<ThreadId> Rose::BinaryAnalysis::Debugger::Base::threadIds ( )
pure virtual

List of subordinate threads.

Get the list of thread IDs in the subordinate process.

virtual void Rose::BinaryAnalysis::Debugger::Base::setBreakPoint ( const AddressInterval )
pure virtual

Set breakpoints.

virtual void Rose::BinaryAnalysis::Debugger::Base::clearBreakPoint ( const AddressInterval )
pure virtual

Remove breakpoints.

virtual void Rose::BinaryAnalysis::Debugger::Base::clearBreakPoints ( )
pure virtual

Remove all breakpoints.

virtual void Rose::BinaryAnalysis::Debugger::Base::executionAddress ( ThreadId  ,
rose_addr_t   
)
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 rose_addr_t Rose::BinaryAnalysis::Debugger::Base::executionAddress ( ThreadId  )
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.

virtual void Rose::BinaryAnalysis::Debugger::Base::singleStep ( ThreadId  )
pure virtual

Execute one machine instruction.

Referenced by trace().

virtual void Rose::BinaryAnalysis::Debugger::Base::runToBreakPoint ( ThreadId  )
pure virtual

Run until the next breakpoint is reached.

virtual Sawyer::Container::Trace<rose_addr_t> Rose::BinaryAnalysis::Debugger::Base::trace ( )
virtual

Run the program and return an execution trace.

template<class Filter >
Sawyer::Container::Trace<rose_addr_t> Rose::BinaryAnalysis::Debugger::Base::trace ( ThreadId  tid,
Filter &  filter 
)
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 129 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.

virtual RegisterDictionaryPtr Rose::BinaryAnalysis::Debugger::Base::registerDictionary ( )
virtual

Register dictionary for the architecture.

virtual std::string Rose::BinaryAnalysis::Debugger::Base::registerName ( RegisterDescriptor  )
virtual

Convert a register descriptor to a register name.

virtual Sawyer::Container::BitVector Rose::BinaryAnalysis::Debugger::Base::readRegister ( ThreadId  ,
RegisterDescriptor   
)
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:

uint64_t value = debugger->readRegister(RIP).toInteger();
virtual Sawyer::Container::BitVector Rose::BinaryAnalysis::Debugger::Base::readAllRegisters ( ThreadId  )
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.

virtual void Rose::BinaryAnalysis::Debugger::Base::writeAllRegisters ( ThreadId  ,
const Sawyer::Container::BitVector  
)
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.

virtual size_t Rose::BinaryAnalysis::Debugger::Base::readMemory ( rose_addr_t  va,
size_t  nBytes,
uint8_t *  buffer 
)
pure virtual

Read subordinate memory.

Returns the number of bytes read.

virtual std::vector<uint8_t> Rose::BinaryAnalysis::Debugger::Base::readMemory ( rose_addr_t  va,
size_t  nBytes 
)
pure virtual

Read subordinate memory as an array of bytes.

If the read fails then a shorter buffer is returned.

virtual Sawyer::Container::BitVector Rose::BinaryAnalysis::Debugger::Base::readMemory ( rose_addr_t  va,
size_t  nBytes,
ByteOrder::Endianness  order 
)
pure virtual

Read subordinate memory as a bit vector.

uint64_t value = debugger->readMemory(0x12345678, 4, ByteOrder::ORDER_LSB).toInteger();
virtual size_t Rose::BinaryAnalysis::Debugger::Base::writeMemory ( rose_addr_t  va,
size_t  nBytes,
const uint8_t *  bytes 
)
pure virtual

Writes some bytes to subordinate memory.

Returns the number of bytes written.

Referenced by writeMemory().

template<typename T >
void Rose::BinaryAnalysis::Debugger::Base::writeMemory ( rose_addr_t  va,
const T &  value 
)
inline

Write subordinate memory.

Writes something to memory.

Definition at line 215 of file Debugger/Base.h.

References writeMemory().

virtual std::string Rose::BinaryAnalysis::Debugger::Base::readCString ( rose_addr_t  va,
size_t  maxBytes = UNLIMITED 
)
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.


The documentation for this class was generated from the following file: