use of com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerException 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());
}
}
use of com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerException in project binnavi by google.
the class DebuggerTest method writeRegister4.
@Test(expected = IllegalArgumentException.class)
public void writeRegister4() throws DebugException {
debugger.connect();
debugger.getNative().getProcessManager().setTargetInformation(new TargetInformation(5, Lists.newArrayList(new RegisterDescription("eax", 4, true), new RegisterDescription("ebx", 4, false)), new DebuggerOptions(false, false, false, false, false, false, false, false, false, false, 12, 0, new ArrayList<DebuggerException>(), false, false, false)));
debugger.writeRegister(0, "ebx", 0);
}
use of com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerException in project binnavi by google.
the class DebuggerTest method writeRegister5.
@Test(expected = IllegalArgumentException.class)
public void writeRegister5() throws DebugException {
debugger.connect();
debugger.getNative().getProcessManager().setTargetInformation(new TargetInformation(5, Lists.newArrayList(new RegisterDescription("eax", 4, true), new RegisterDescription("ebx", 4, false)), new DebuggerOptions(false, false, false, false, false, false, false, false, false, false, 12, 0, new ArrayList<DebuggerException>(), false, false, false)));
debugger.writeRegister(0, "ecx", 0);
}
use of com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerException in project binnavi by google.
the class DebuggerTest method testlisteners0.
@Test
public void testlisteners0() throws DebugExceptionWrapper, MaybeNullException, ParserConfigurationException, SAXException, IOException {
mockDebugger.connect();
mockDebugger.getProcessManager().addThread(new TargetProcessThread(0, ThreadState.RUNNING));
mockDebugger.getProcessManager().setTargetInformation(new TargetInformation(5, Lists.newArrayList(new RegisterDescription("eax", 4, true), new RegisterDescription("ebx", 4, false)), new DebuggerOptions(false, false, false, false, false, false, false, false, false, false, 12, 0, new ArrayList<DebuggerException>(), false, false, false)));
mockDebugger.connection.m_synchronizer.receivedEvent(DebuggerMessageBuilder.buildProcessStartReply(CommonTestObjects.MEMORY_MODULE));
mockDebugger.getProcessManager().getThread(0).setCurrentAddress(new RelocatedAddress(new CAddress(0)));
mockDebugger.getBreakpointManager().addBreakpoints(BreakpointType.ECHO, CommonTestObjects.BP_ADDRESS_123_SET);
final ArrayList<Pair<RelocatedAddress, Integer>> list = new ArrayList<Pair<RelocatedAddress, Integer>>();
mockDebugger.connection.m_synchronizer.receivedEvent(new EchoBreakpointSetReply(0, 0, list));
mockDebugger.connection.m_synchronizer.receivedEvent(new EchoBreakpointSetReply(0, 0, list));
mockDebugger.connection.m_synchronizer.receivedEvent(new EchoBreakpointsRemovedReply(0, 0, list));
mockDebugger.connection.m_synchronizer.receivedEvent(new EchoBreakpointsRemovedReply(0, 0, list));
mockDebugger.connection.m_synchronizer.receivedEvent(new ExceptionOccurredReply(0, 0, 0, 0, new RelocatedAddress(new CAddress(0)), "Test exception"));
mockDebugger.connection.m_synchronizer.receivedEvent(new HaltReply(0, 0, 0));
mockDebugger.connection.m_synchronizer.receivedEvent(new HaltReply(0, 0, 1));
mockDebugger.connection.m_synchronizer.receivedEvent(new ListFilesReply(0, 0, RemoteFileSystem.parse("<foo></foo>".getBytes())));
mockDebugger.connection.m_synchronizer.receivedEvent(new ListFilesReply(0, 1, null));
mockDebugger.connection.m_synchronizer.receivedEvent(new ListProcessesReply(0, 0, ProcessList.parse("<foo></foo>".getBytes())));
mockDebugger.connection.m_synchronizer.receivedEvent(new ListProcessesReply(0, 1, null));
mockDebugger.connection.m_synchronizer.receivedEvent(new MemoryMapReply(0, 0, new MemoryMap(new ArrayList<MemorySection>())));
mockDebugger.connection.m_synchronizer.receivedEvent(new MemoryMapReply(0, 1, null));
mockDebugger.connection.m_synchronizer.receivedEvent(new ModuleLoadedReply(0, 0, new MemoryModule("XXX", "YYYXXX", new RelocatedAddress(new CAddress(0)), 0), new TargetProcessThread(123, ThreadState.SUSPENDED)));
mockDebugger.connection.m_synchronizer.receivedEvent(new ModuleUnloadedReply(0, 0, new MemoryModule("XXX", "YYYXXX", new RelocatedAddress(new CAddress(0)), 0)));
mockDebugger.connection.m_synchronizer.receivedEvent(new ProcessClosedReply(0, 0));
mockDebugger.connection.m_synchronizer.receivedEvent(new ReadMemoryReply(0, 0, new CAddress(0), new byte[8]));
mockDebugger.connection.m_synchronizer.receivedEvent(new ReadMemoryReply(0, 1, null, null));
mockDebugger.connection.m_synchronizer.receivedEvent(new RegistersReply(0, 0, new RegisterValues(new FilledList<ThreadRegisters>())));
mockDebugger.connection.m_synchronizer.receivedEvent(new RegistersReply(0, 1, null));
mockDebugger.connection.m_synchronizer.receivedEvent(new RequestTargetReply(0, 0));
mockDebugger.connection.m_synchronizer.receivedEvent(new RequestTargetReply(0, 1));
mockDebugger.connection.m_synchronizer.receivedEvent(new ResumeReply(0, 0));
mockDebugger.connection.m_synchronizer.receivedEvent(new ResumeReply(0, 1));
}
use of com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerException in project binnavi by google.
the class ProcessTest method testLifeCycle.
@Test
public void testLifeCycle() {
final MockProcessListener listener = new MockProcessListener();
final ProcessManager manager = new ProcessManager();
final Process process = new Process(manager);
process.addListener(listener);
manager.setAttached(true);
assertEquals("attached;", listener.events);
process.removeListener(listener);
manager.setTargetInformation(new com.google.security.zynamics.binnavi.debug.models.targetinformation.TargetInformation(5, new FilledList<RegisterDescription>(), new DebuggerOptions(false, false, false, false, false, false, false, false, false, false, 12, 0, new ArrayList<DebuggerException>(), false, false, false)));
manager.addThread(new TargetProcessThread(0, ThreadState.RUNNING));
manager.addModule(new MemoryModule("Hannes", "C:\\Hannes.dll", new RelocatedAddress(new CAddress(0x100)), 0x100));
manager.setMemoryMap(new com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryMap(Lists.newArrayList(new com.google.security.zynamics.binnavi.debug.models.processmanager.MemorySection(new CAddress(0), new CAddress(0x100)))));
manager.getMemory().store(0, new byte[] { 0, 1, 2, 3 });
process.addListener(listener);
manager.setTargetInformation(new com.google.security.zynamics.binnavi.debug.models.targetinformation.TargetInformation(5, new FilledList<RegisterDescription>(), new DebuggerOptions(false, false, false, false, false, false, false, false, false, false, 12, 0, new ArrayList<DebuggerException>(), false, false, false)));
assertEquals(0, process.getThreads().size());
assertEquals(0, process.getModules().size());
assertEquals(0, process.getMemoryMap().getSections().size());
assertEquals(false, process.getMemory().hasData(0, 4));
manager.setAttached(false);
assertEquals("attached;changedTargetInformation;detached;", listener.events);
assertEquals(0, process.getThreads().size());
assertEquals(0, process.getModules().size());
assertEquals(null, process.getTargetInformation());
assertEquals(0, process.getMemoryMap().getSections().size());
assertEquals(false, process.getMemory().hasData(0, 4));
process.removeListener(listener);
}
Aggregations