ROSE 0.11.145.147
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 24 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.
 

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< ThreadIdthreadIds ()=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< RegisterDescriptoravailableRegisters ()=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.
 
SharedObjectoperator= (const SharedObject &)
 Assignment.
 

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

◆ Ptr

Shared ownership pointer.

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

Member Function Documentation

◆ isAttached()

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.

◆ detach()

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.

◆ terminate()

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

Terminate the specimen.

If a specimen is attached, terminate it.

◆ threadIds()

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.

◆ executionAddress() [1/2]

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().

◆ executionAddress() [2/2]

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.

◆ 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 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.

◆ readRegister()

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();

◆ readAllRegisters()

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.

◆ writeAllRegisters()

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.

◆ readMemory() [1/3]

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.

◆ readMemory() [2/3]

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.

◆ readMemory() [3/3]

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();
@ ORDER_LSB
Least significant byte first, i.e., little-endian.
Definition ByteOrder.h:22

◆ writeMemory() [1/2]

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().

◆ writeMemory() [2/2]

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 220 of file Debugger/Base.h.

References writeMemory().

◆ readCString()

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.

Member Data Documentation

◆ disassembler_

Disassembler::BasePtr Rose::BinaryAnalysis::Debugger::Base::disassembler_
protected

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


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