use of com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessManager in project binnavi by google.
the class CDebugEventNotifier method stop.
/**
* Stops the event notifier.
*/
public void stop() {
m_debugger.removeListener(m_debuglistener);
final ProcessManager processManager = m_debugger.getProcessManager();
processManager.removeListener(m_processListener);
for (final TargetProcessThread thread : processManager.getThreads()) {
thread.removeListener(m_threadEventListener);
}
}
use of com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessManager in project binnavi by google.
the class CDebugEventNotifier method start.
/**
* Starts the event notifier.
*/
public void start() {
m_debugger.addListener(m_debuglistener);
final ProcessManager processManager = m_debugger.getProcessManager();
processManager.addListener(m_processListener);
for (final TargetProcessThread thread : processManager.getThreads()) {
thread.addListener(m_threadEventListener);
}
}
use of com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessManager in project binnavi by google.
the class ThreadCreatedSynchronizer method handleSuccess.
@Override
protected void handleSuccess(final ThreadCreatedReply reply) {
final ProcessManager processManager = getDebugger().getProcessManager();
final TargetProcessThread thread = new TargetProcessThread(reply.getThreadId(), reply.getThreadState());
processManager.addThread(thread);
}
use of com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessManager in project binnavi by google.
the class BreakpointHitSynchronizer method handleSuccess.
/**
* Handles incoming Breakpoint Hit replies.
*
* @param reply The incoming Breakpoint Hit reply to handle.
*/
@Override
protected void handleSuccess(final BreakpointHitReply reply) {
final ProcessManager processManager = getDebugger().getProcessManager();
// When the debug client notifies BinNavi that a
// breakpoint was hit, it is necessary to mark the
// breakpoint as hit.
// TODO: Check for success
RelocatedAddress eventAddress = null;
final RegisterValues registerValues = reply.getRegisterValues();
final long tid = reply.getThreadId();
for (final ThreadRegisters threadRegisters : registerValues) {
if (tid == threadRegisters.getTid()) {
for (final RegisterValue registerValue : threadRegisters) {
if (registerValue.isPc()) {
eventAddress = new RelocatedAddress(new CAddress(registerValue.getValue()));
}
}
}
}
if (eventAddress != null) {
updateHitBreakpoints(DebuggerHelpers.getBreakpointAddress(getDebugger(), eventAddress));
} else {
throw new IllegalStateException("IE00173: register reply did not include program counter");
}
try {
final TargetProcessThread thread = processManager.getThread(reply.getThreadId());
// Update the thread with the new register values.
for (final ThreadRegisters threadRegisters : registerValues) {
if (tid == threadRegisters.getTid()) {
thread.setRegisterValues(threadRegisters.getRegisters());
break;
}
}
processManager.setActiveThread(thread);
thread.setCurrentAddress(eventAddress);
} catch (final MaybeNullException exception) {
NaviLogger.info("Error: there is no thread with the specified thread id %d Exception: %s", reply.getThreadId(), exception);
}
}
use of com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessManager in project binnavi by google.
the class ExceptionOccurredSynchronizer method handleSuccess.
@Override
protected void handleSuccess(final ExceptionOccurredReply reply) {
final ProcessManager processManager = getDebugger().getProcessManager();
try {
final TargetProcessThread thread = processManager.getThread(reply.getThreadId());
processManager.setActiveThread(thread);
thread.setCurrentAddress(reply.getAddress());
processManager.addExceptionEvent(new DebuggerException(reply.getExceptionName(), reply.getExceptionCode(), DebuggerExceptionHandlingAction.Continue));
refreshRegisters();
} catch (final MaybeNullException exception) {
NaviLogger.severe("Exception occured in unknown thread %d", reply.getThreadId());
}
}
Aggregations