Search in sources :

Example 6 with MemoryModule

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);
    }
}
Also used : TargetProcessThread(com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread) DebugExceptionWrapper(com.google.security.zynamics.binnavi.debug.debugger.DebugExceptionWrapper) MemoryModule(com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule)

Example 7 with MemoryModule

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);
}
Also used : MemoryMap(com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryMap) TargetProcessThread(com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread) ArrayList(java.util.ArrayList) BreakpointManager(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager) ProcessManager(com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessManager) MemoryModule(com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule)

Example 8 with MemoryModule

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);
}
Also used : RelocatedAddress(com.google.security.zynamics.binnavi.disassembly.RelocatedAddress) ProcessManager(com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessManager) MemoryModule(com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

Example 9 with MemoryModule

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;
}
Also used : Color(java.awt.Color) MemoryModule(com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule)

Example 10 with MemoryModule

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();
}
Also used : ProcessStart(com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessStart) TargetProcessThread(com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread) RelocatedAddress(com.google.security.zynamics.binnavi.disassembly.RelocatedAddress) ArrayList(java.util.ArrayList) DebuggerOptions(com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerOptions) ProcessStartReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.ProcessStartReply) ModuleTargetSettings(com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings) MemoryModule(com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) MockDebugger(com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger) RegisterDescription(com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterDescription) TargetInformation(com.google.security.zynamics.binnavi.debug.models.targetinformation.TargetInformation) TargetInformationReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.TargetInformationReply) Test(org.junit.Test)

Aggregations

MemoryModule (com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule)21 RelocatedAddress (com.google.security.zynamics.binnavi.disassembly.RelocatedAddress)15 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)13 TargetProcessThread (com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread)12 Test (org.junit.Test)12 DebuggerOptions (com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerOptions)10 RegisterDescription (com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterDescription)9 TargetInformation (com.google.security.zynamics.binnavi.debug.models.targetinformation.TargetInformation)9 ArrayList (java.util.ArrayList)8 MockDebugger (com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger)7 ModuleTargetSettings (com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings)7 MemoryMap (com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryMap)7 MemoryMapReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.MemoryMapReply)6 TargetInformationReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.TargetInformationReply)6 MemorySection (com.google.security.zynamics.binnavi.debug.models.processmanager.MemorySection)6 ProcessStart (com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessStart)5 DebuggerException (com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerException)5 ModuleLoadedReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.ModuleLoadedReply)4 ModuleUnloadedReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.ModuleUnloadedReply)4 ProcessStartReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.ProcessStartReply)3