Public Member Functions

BinNavi.API.debug.Debugger Class Reference

Used to debug a target process. More...

Inherits BinNavi::APIHelpers::ApiObject< IDebugger >.

List of all members.

Public Member Functions

void addListener (final IDebuggerListener listener)
 Adds a debugger listener.
void cancelTargetSelection () throws DebugException
void connect () throws DebugException
 Connects to the target process.
void detach () throws DebugException
 Detaches from the target process.
BookmarkManager getBookmarkManager ()
 The bookmark manager of the debugger.
BreakpointManager getBreakpointManager ()
 The breakpoint manager of the debugger.
Process getProcess ()
 The process debugged by the debugger.
boolean isConnected ()
 Checks if the debugger is connected.
void readMemory (final Address address, final int size) throws DebugException
 Reads memory of the target process.
void readRegisters () throws DebugException
 Reads the registers of all threads.
void removeListener (final IDebuggerListener listener)
 Removes a debugger listener.
void requestFileSystem (final String path) throws DebugException
void requestFileSystem () throws DebugException
void resume () throws DebugException
 Resumes the active thread thread in the target process.
void selectFile (final String file) throws DebugException
void singleStep () throws DebugException
 Single-steps thread in the target process.
void terminate () throws DebugException
 Terminates the target process.
Address toFilebase (final Module module, final Address address)
 Converts memory addresses to file addresses.
Address toImagebase (final Module module, final Address address)
 Converts file addresses to memory addresses.
String toString ()
 Printable representation of the debugger.
void writeMemory (final Address address, final byte[] data) throws DebugException
 Writes target process memory.
void writeRegister (final long tid, final String register, final long value) throws DebugException
 Writes a register value.

Detailed Description

Debugger object that can be used to debug modules or projects.


Member Function Documentation

void BinNavi.API.debug.Debugger.addListener ( final IDebuggerListener  listener  ) 

Adds a debugger listener object that is notified about incoming debug messages and changes in the debugger state.

Note that this function adds very low-level listeners. If possible you should use higher-level listeners like IThreadListener or IProcessListener.

Parameters:
listener The listener object to add.
void BinNavi.API.debug.Debugger.cancelTargetSelection (  )  throws DebugException

Cancels the target selection of the debugger and closes the connection.

Exceptions:
DebugException Thrown if an error occurred during cancellation.
void BinNavi.API.debug.Debugger.connect (  )  throws DebugException

Connects to the target process.

Exceptions:
DebugException Thrown if the debugger could not connect to the target process.
void BinNavi.API.debug.Debugger.detach (  )  throws DebugException

Detaches from the target process.

Exceptions:
DebugException Thrown if the debug command could not be executed.
BookmarkManager BinNavi.API.debug.Debugger.getBookmarkManager (  ) 

Returns the bookmark manager of the debugger. This manager can be used to set and remove memory bookmarks.

Returns:
The bookmark manager of the debugger.
BreakpointManager BinNavi.API.debug.Debugger.getBreakpointManager (  ) 

Returns the breakpoint manager of the debugger. This manager can be used to set and remove breakpoints.

Returns:
The breakpoint manager of the debugger.
Process BinNavi.API.debug.Debugger.getProcess (  ) 

Returns the target process debugged by the debugger.

Returns:
The target process of the debugger.
boolean BinNavi.API.debug.Debugger.isConnected (  ) 

Returns a flag that indicates whether the debugger is active or not.

Returns:
True, if the debugger is debugging a target. False, otherwise.
void BinNavi.API.debug.Debugger.readMemory ( final Address  address,
final int  size 
) throws DebugException

Reads memory of the target process.

Parameters:
address Start address of the memory read operation.
size Number of bytes to read.
Exceptions:
IllegalArgumentException Thrown if the address argument is null.
DebugException Thrown if the debug command could not be executed.
void BinNavi.API.debug.Debugger.readRegisters (  )  throws DebugException

Reads the current register values of all threads of the target process.

Exceptions:
DebugException Thrown if the debug command could not be executed.
void BinNavi.API.debug.Debugger.removeListener ( final IDebuggerListener  listener  ) 

Removes a debugger listener from the debugger.

Parameters:
listener The debugger listener to remove.
void BinNavi.API.debug.Debugger.requestFileSystem (  )  throws DebugException

Request the file system listing from the debug client.

Exceptions:
DebugException Thrown if the debug command could not be executed.
void BinNavi.API.debug.Debugger.requestFileSystem ( final String  path  )  throws DebugException

Request the file system listing for the given path.

Parameters:
path The base directory to be listed.
Exceptions:
DebugException Thrown if the debug command could not be executed.
void BinNavi.API.debug.Debugger.resume (  )  throws DebugException

Executes a resume command in the active thread.

Exceptions:
DebugException Thrown if the debug command could not be executed.
void BinNavi.API.debug.Debugger.selectFile ( final String  file  )  throws DebugException

Tells the debug client to select the given file as the target process executable file.

Parameters:
file The path to the target file.
Exceptions:
DebugException Thrown if the debug command could not be executed.
void BinNavi.API.debug.Debugger.singleStep (  )  throws DebugException

Executes a single step operation in the active thread.

Exceptions:
DebugException Thrown if the debug command could not be executed.
void BinNavi.API.debug.Debugger.terminate (  )  throws DebugException

Terminates the target process and the debug client.

Exceptions:
DebugException Thrown if the debug command could not be executed.
Address BinNavi.API.debug.Debugger.toFilebase ( final Module  module,
final Address  address 
)

Converts a memory-relocated address to the same address in the unrelocated module.

Parameters:
module The module the relocated address belongs to.
address The memory-relocated address to convert.
Returns:
The converted file address.
Address BinNavi.API.debug.Debugger.toImagebase ( final Module  module,
final Address  address 
)

Converts a file address to the same address in the relocated module.

Parameters:
module The module the file address address belongs to.
address The file address to convert.
Returns:
The converted memory-relocated address.
String BinNavi.API.debug.Debugger.toString (  ) 

Returns a string representation of the debugger.

Returns:
A string representation of the debugger.
void BinNavi.API.debug.Debugger.writeMemory ( final Address  address,
final byte[]  data 
) throws DebugException

Writes to the memory of the target process.

Parameters:
address Start address of the memory write operation.
data Data to be written to the target memory.
Exceptions:
DebugException Thrown if the message could not be sent to the debug client.
void BinNavi.API.debug.Debugger.writeRegister ( final long  tid,
final String  register,
final long  value 
) throws DebugException

Changes the value of a register in the given thread.

Parameters:
tid Thread ID of the thread whose register value is changed.
register Name of the register to change.
value The new value of the register.
Exceptions:
DebugException Thrown if the message could not be sent to the debug client.