Search in sources :

Example 1 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 2 with MemoryModule

use of com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule in project binnavi by google.

the class ModuleUnloadedSynchronizer method handleSuccess.

@Override
protected void handleSuccess(final ModuleUnloadedReply reply) {
    final ProcessManager processManager = getDebugger().getProcessManager();
    final MemoryModule replyModule = reply.getModule();
    final MemoryModule existingModule = processManager.getModule(replyModule.getBaseAddress());
    if (existingModule == null) {
        processManager.removeNonExistingModule(replyModule);
    } else {
        processManager.removeModule(existingModule);
        CBreakpointModuleSynchronizer.disableEchoBreakpoints(getDebugger(), existingModule);
        CBreakpointModuleSynchronizer.disableRegularBreakpoints(getDebugger(), existingModule);
    }
    if (needsResume()) {
        try {
            getDebugger().resume();
        } catch (final DebugExceptionWrapper e) {
            NaviLogger.severe("Error: Could not resume the debugger. Exception: %s", e);
        }
    }
}
Also used : DebugExceptionWrapper(com.google.security.zynamics.binnavi.debug.debugger.DebugExceptionWrapper) ProcessManager(com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessManager) MemoryModule(com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule)

Example 3 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 4 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 5 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)

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