Search in sources :

Example 6 with IDebugger

use of com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger in project binnavi by google.

the class CMemorySectionPanelSynchronizer method updateMemoryBox.

/**
 * Updates the memory selection box.
 */
private void updateMemoryBox() {
    final IDebugger activeDebugger = debugPerspectiveModel.getCurrentSelectedDebugger();
    final ArrayList<CMemorySectionWrapper> sections = new ArrayList<>();
    if ((activeDebugger != null) && activeDebugger.isConnected()) {
        for (final MemorySection section : activeDebugger.getProcessManager().getMemoryMap()) {
            sections.add(new CMemorySectionWrapper(section));
        }
    }
    new SwingInvoker() {

        @Override
        protected void operation() {
            memorySectionBox.removeAllItems();
            if ((activeDebugger != null) && activeDebugger.isConnected()) {
                for (final CMemorySectionWrapper sectionWrapper : sections) {
                    memorySectionBox.addItem(sectionWrapper);
                }
            }
        }
    }.invokeAndWait();
}
Also used : MemorySection(com.google.security.zynamics.binnavi.debug.models.processmanager.MemorySection) ArrayList(java.util.ArrayList) SwingInvoker(com.google.security.zynamics.zylib.gui.SwingInvoker) IDebugger(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger)

Example 7 with IDebugger

use of com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger in project binnavi by google.

the class CRegisterViewSynchronizer method dispose.

/**
 * Cleans up allocated resources.
 */
public void dispose() {
    m_debugPerspectiveModel.removeListener(m_debugListener);
    final IDebugger activeDebugger = m_debugPerspectiveModel.getCurrentSelectedDebugger();
    final TargetProcessThread activeThread = activeDebugger == null ? null : activeDebugger.getProcessManager().getActiveThread();
    if (activeThread != null) {
        activeThread.removeListener(m_threadListener);
    }
}
Also used : TargetProcessThread(com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread) IDebugger(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger)

Example 8 with IDebugger

use of com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger in project binnavi by google.

the class CStackViewSynchronizer method updateGui.

/**
 * Updates the GUI depending on the current state of the target process.
 */
private void updateGui() {
    final IDebugger activeDebugger = m_debugPerspectiveModel.getCurrentSelectedDebugger();
    final TargetProcessThread activeThread = activeDebugger == null ? null : activeDebugger.getProcessManager().getActiveThread();
    if (activeThread == null) {
        m_stackView.setDefinitionStatus(DefinitionStatus.UNDEFINED);
        m_stackView.setEnabled(false);
    } else {
        m_stackView.setDefinitionStatus(DefinitionStatus.DEFINED);
        m_stackView.setEnabled(true);
        m_stackView.gotoOffset(getStackPointer(activeThread));
    }
}
Also used : TargetProcessThread(com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread) IDebugger(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger)

Example 9 with IDebugger

use of com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger in project binnavi by google.

the class CBreakpointFunctionsTest method test7setBreakpoints.

@Test
public void test7setBreakpoints() throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
    final MockFunction mockFunction = new MockFunction();
    final INaviModule mockModule = mockFunction.getModule();
    CFunctionContainerHelper.addFunction(mockModule.getContent().getFunctionContainer(), mockFunction);
    final DebugTargetSettings target = new ModuleTargetSettings(mockModule);
    final DebuggerProvider debuggerProvider = new DebuggerProvider(target);
    final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(mockModule));
    debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(mockModule, new UnrelocatedAddress(new CAddress(0x1234)))));
    @SuppressWarnings("unused") final Breakpoint breakPoint = debugger.getBreakpointManager().getBreakpoint(BreakpointType.REGULAR, new BreakpointAddress(mockModule, new UnrelocatedAddress(new CAddress(0x1234))));
    // CBreakpointAddress address = new CBreakpointAddress(mockModule, new CUnrelocatedAddress(new
    // CAddress(0x2c9)));
    debuggerProvider.addDebugger(debugger);
    final CBreakpointTableModel tableModel = new CBreakpointTableModel(debuggerProvider);
    assertEquals(1, tableModel.getRowCount());
    final IFilledList<Pair<IDebugger, INaviFunction>> targets = new FilledList<Pair<IDebugger, INaviFunction>>();
    final Pair<IDebugger, INaviFunction> targetPair = new Pair<IDebugger, INaviFunction>(debugger, mockFunction);
    targets.add(targetPair);
    CBreakpointRemoveFunctions.removeBreakpoints(targets);
    assertEquals(0, tableModel.getRowCount());
    CBreakpointSetFunctions.setBreakpoints(targets);
    assertEquals(1, tableModel.getRowCount());
}
Also used : MockFunction(com.google.security.zynamics.binnavi.disassembly.MockFunction) Breakpoint(com.google.security.zynamics.binnavi.debug.models.breakpoints.Breakpoint) FilledList(com.google.security.zynamics.zylib.types.lists.FilledList) IFilledList(com.google.security.zynamics.zylib.types.lists.IFilledList) CBreakpointTableModel(com.google.security.zynamics.binnavi.Gui.Debug.BreakpointTable.CBreakpointTableModel) DebugTargetSettings(com.google.security.zynamics.binnavi.debug.debugger.DebugTargetSettings) ModuleTargetSettings(com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings) IDebugger(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) MockDebugger(com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) DebuggerProvider(com.google.security.zynamics.binnavi.debug.debugger.DebuggerProvider) UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) INaviFunction(com.google.security.zynamics.binnavi.disassembly.INaviFunction) Pair(com.google.security.zynamics.zylib.general.Pair) Test(org.junit.Test)

Example 10 with IDebugger

use of com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger in project binnavi by google.

the class CBreakpointFunctionsTest method test6removeFunctions.

@Test
public void test6removeFunctions() throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
    final MockFunction mockFunction = new MockFunction();
    final INaviModule mockModule = mockFunction.getModule();
    CFunctionContainerHelper.addFunction(mockModule.getContent().getFunctionContainer(), mockFunction);
    final DebugTargetSettings target = new ModuleTargetSettings(mockModule);
    final DebuggerProvider debuggerProvider = new DebuggerProvider(target);
    final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(mockModule));
    debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(mockModule, new UnrelocatedAddress(new CAddress(0x1234)))));
    @SuppressWarnings("unused") final Breakpoint breakPoint = debugger.getBreakpointManager().getBreakpoint(BreakpointType.REGULAR, new BreakpointAddress(mockModule, new UnrelocatedAddress(new CAddress(0x1234))));
    debuggerProvider.addDebugger(debugger);
    final CBreakpointTableModel tableModel = new CBreakpointTableModel(debuggerProvider);
    assertEquals(1, tableModel.getRowCount());
    final IFilledList<Pair<IDebugger, INaviFunction>> targets = new FilledList<Pair<IDebugger, INaviFunction>>();
    final Pair<IDebugger, INaviFunction> targetPair = new Pair<IDebugger, INaviFunction>(debugger, mockFunction);
    targets.add(targetPair);
    assertEquals(1, targets.size());
    CBreakpointRemoveFunctions.removeBreakpoints(targets);
    @SuppressWarnings("unused") final BreakpointManager manager = debugger.getBreakpointManager();
    assertEquals(0, tableModel.getRowCount());
}
Also used : MockFunction(com.google.security.zynamics.binnavi.disassembly.MockFunction) Breakpoint(com.google.security.zynamics.binnavi.debug.models.breakpoints.Breakpoint) FilledList(com.google.security.zynamics.zylib.types.lists.FilledList) IFilledList(com.google.security.zynamics.zylib.types.lists.IFilledList) CBreakpointTableModel(com.google.security.zynamics.binnavi.Gui.Debug.BreakpointTable.CBreakpointTableModel) DebugTargetSettings(com.google.security.zynamics.binnavi.debug.debugger.DebugTargetSettings) ModuleTargetSettings(com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings) BreakpointManager(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager) IDebugger(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) MockDebugger(com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) DebuggerProvider(com.google.security.zynamics.binnavi.debug.debugger.DebuggerProvider) UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) INaviFunction(com.google.security.zynamics.binnavi.disassembly.INaviFunction) Pair(com.google.security.zynamics.zylib.general.Pair) Test(org.junit.Test)

Aggregations

IDebugger (com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger)62 BreakpointManager (com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager)16 TargetProcessThread (com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread)16 MockDebugger (com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger)6 ModuleTargetSettings (com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings)6 Breakpoint (com.google.security.zynamics.binnavi.debug.models.breakpoints.Breakpoint)6 BreakpointAddress (com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress)6 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)6 Test (org.junit.Test)6 MemorySection (com.google.security.zynamics.binnavi.debug.models.processmanager.MemorySection)5 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)5 UnrelocatedAddress (com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress)5 CDebugPerspectiveModel (com.google.security.zynamics.binnavi.Gui.GraphWindows.Panels.CDebugPerspectiveModel)4 INaviFunction (com.google.security.zynamics.binnavi.disassembly.INaviFunction)4 INaviInstruction (com.google.security.zynamics.binnavi.disassembly.INaviInstruction)4 BookmarkManager (com.google.security.zynamics.binnavi.models.Bookmarks.memory.BookmarkManager)4 IAddress (com.google.security.zynamics.zylib.disassembly.IAddress)4 Pair (com.google.security.zynamics.zylib.general.Pair)4 ArrayList (java.util.ArrayList)4 IGraphModel (com.google.security.zynamics.binnavi.Gui.GraphWindows.IGraphModel)3