use of com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule in project binnavi by google.
the class ProcessStartSynchronizer method handleSuccess.
@Override
protected void handleSuccess(final ProcessStartReply reply) {
final TargetProcessThread thread = reply.getProcessStart().getThread();
final MemoryModule module = reply.getProcessStart().getModule();
getDebugger().getProcessManager().addThread(thread);
getDebugger().getProcessManager().setActiveThread(thread);
refreshRegisters();
CRelocationNotifier.relocateModule(getDebugger(), module);
getDebugger().getProcessManager().addModule(module);
CBreakpointModuleSynchronizer.enableRegularBreakpoints(getDebugger(), module);
try {
getDebugger().resume();
} catch (final DebugExceptionWrapper e) {
NaviLogger.severe("Error: Could not resume debugger. Exception: %s", e);
}
}
use of com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule in project binnavi by google.
the class ReplySynchronizer method resetTargetProcess.
/**
* Resets information about the target process.
*/
protected void resetTargetProcess() {
final BreakpointManager manager = debugger.getBreakpointManager();
final ProcessManager processManager = debugger.getProcessManager();
debugger.setTerminated();
manager.clearBreakpointsPassive(BreakpointType.ECHO);
manager.clearBreakpointsPassive(BreakpointType.STEP);
deactivateBreakpoints();
processManager.getMemory().clear();
processManager.setMemoryMap(new MemoryMap(new ArrayList<MemorySection>()));
final Collection<TargetProcessThread> threads = processManager.getThreads();
for (final TargetProcessThread thread : threads) {
processManager.removeThread(thread);
}
for (final MemoryModule module : processManager.getModules()) {
processManager.removeModule(module);
}
processManager.setAttached(false);
processManager.setActiveThread(null);
}
use of com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule in project binnavi by google.
the class ProcessTest method testModules.
@Test
public void testModules() {
final MockProcessListener listener = new MockProcessListener();
final ProcessManager manager = new ProcessManager();
manager.addModule(new MemoryModule("Hannes", "C:\\Hannes.dll", new RelocatedAddress(new CAddress(0x100)), 0x100));
final Process process = new Process(manager);
assertEquals(1, process.getModules().size());
process.addListener(listener);
final MemoryModule dll = new MemoryModule("Foobert.dll", "C:\\Foobert.dll", new RelocatedAddress(new CAddress(0x100)), 0x100);
manager.addModule(dll);
assertEquals("addedModule/Foobert.dll;", listener.events);
assertEquals(2, process.getModules().size());
manager.removeModule(dll);
assertEquals("addedModule/Foobert.dll;removedModule/Foobert.dll;", listener.events);
assertEquals(1, process.getModules().size());
process.removeListener(listener);
}
use of com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule in project binnavi by google.
the class CModulesTableRenderer method getTableCellRendererComponent.
@Override
public Component getTableCellRendererComponent(final JTable table, final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) {
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
final MemoryModule module = ((CModulesTable) table).getTreeTableModel().getModules().get(table.convertRowIndexToModel(row));
final Color color = m_colorGenerator.getColor(module);
setBackground(color == null ? Color.WHITE : color);
return this;
}
use of com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule in project binnavi by google.
the class CMemoryRefreshButtonSynchronizerTest method testSwitchDebugger.
@Test
public void testSwitchDebugger() throws DebugExceptionWrapper {
final TargetProcessThread thread = new TargetProcessThread(0x666, ThreadState.RUNNING);
final MemoryModule module = new MemoryModule("narf.exe", "C:\\zort\\narf.exe", new RelocatedAddress(new CAddress(0x1000)), 123345);
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
debugger.connect();
debugger.connection.m_synchronizer.receivedEvent(new TargetInformationReply(0, 0, new TargetInformation(32, new FilledList<RegisterDescription>(), new DebuggerOptions(false, false, false, false, false, true, false, false, false, false, 1, 0, new ArrayList<DebuggerException>(), false, false, false))));
debugger.connection.m_synchronizer.receivedEvent(new ProcessStartReply(0, 0, new ProcessStart(thread, module)));
final MockDebugger debugger2 = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
debugger2.connect();
debugger2.connection.m_synchronizer.receivedEvent(new TargetInformationReply(0, 0, new TargetInformation(32, new FilledList<RegisterDescription>(), new DebuggerOptions(false, false, false, false, false, false, false, false, false, false, 1, 0, new ArrayList<DebuggerException>(), false, false, false))));
debugger2.connection.m_synchronizer.receivedEvent(new ProcessStartReply(0, 0, new ProcessStart(thread, module)));
m_model.setActiveDebugger(debugger);
debugger.getProcessManager().setActiveThread(thread);
assertTrue(m_refreshButton.isEnabled());
assertEquals(m_defaultAction, m_refreshButton.getAction());
m_model.setActiveDebugger(debugger2);
debugger2.getProcessManager().setActiveThread(thread);
assertTrue(m_refreshButton.isEnabled());
assertEquals(m_askAction, m_refreshButton.getAction());
m_synchronizer.dispose();
debugger.close();
debugger2.close();
}
Aggregations