Search in sources :

Example 1 with BackEndDebuggerProvider

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

the class CDebugEventNotifier method activateWindow.

/**
   * Activates the window of this debugger.
   *
   * @return The window of this debugger.
   */
private JFrame activateWindow() {
    for (final IGraphContainerWindow window : CWindowManager.instance().getOpenWindows()) {
        for (final IGraphPanel graphPanel : window) {
            final BackEndDebuggerProvider debuggerProvider = graphPanel.getModel().getDebuggerProvider();
            for (final IDebugger d : debuggerProvider) {
                if (d == m_debugger) {
                    window.activate(graphPanel);
                    window.show();
                    return window.getFrame();
                }
            }
        }
    }
    return null;
}
Also used : IGraphContainerWindow(com.google.security.zynamics.binnavi.Gui.GraphWindows.IGraphContainerWindow) IGraphPanel(com.google.security.zynamics.binnavi.Gui.GraphWindows.IGraphPanel) BackEndDebuggerProvider(com.google.security.zynamics.binnavi.debug.debugger.BackEndDebuggerProvider) IDebugger(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger)

Example 2 with BackEndDebuggerProvider

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

the class CVariableHighlighterTest method test1Simple.

@Test
public void test1Simple() throws FileReadException, CouldntLoadDataException, LoadCancelledException, CouldntSaveDataException {
    final ZyGraph graph = ZyGraphFactory.generateTestGraph();
    final List<INaviInstruction> mockInstructions = new ArrayList<INaviInstruction>();
    final CCodeNode node = graph.getRawView().getBasicBlocks().get(0);
    final NaviNode naviNode = graph.getNode(node);
    mockInstructions.add(Iterables.get(node.getInstructions(), 0));
    final BackEndDebuggerProvider provider = new MockDebuggerProvider();
    @SuppressWarnings("unused") final CCodeNodeUpdater updater = new CCodeNodeUpdater(graph, naviNode, node, provider);
    assertFalse(naviNode.getRealizer().getNodeContent().getLineContent(0).hasHighlighting(CHighlightLayers.VARIABLE_LAYER));
    CVariableHighlighter.highlightInstructions(graph, mockInstructions);
    assertTrue(naviNode.getRealizer().getNodeContent().getLineContent(0).hasHighlighting(CHighlightLayers.VARIABLE_LAYER));
}
Also used : ZyGraph(com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph) CCodeNode(com.google.security.zynamics.binnavi.disassembly.CCodeNode) CCodeNodeUpdater(com.google.security.zynamics.binnavi.ZyGraph.Updaters.CodeNodes.CCodeNodeUpdater) ArrayList(java.util.ArrayList) NaviNode(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode) BackEndDebuggerProvider(com.google.security.zynamics.binnavi.debug.debugger.BackEndDebuggerProvider) MockDebuggerProvider(com.google.security.zynamics.binnavi.Debug.Debugger.MockDebuggerProvider) INaviInstruction(com.google.security.zynamics.binnavi.disassembly.INaviInstruction) Test(org.junit.Test)

Example 3 with BackEndDebuggerProvider

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

the class CCommentUtilities method createInstructionLine.

/**
   * TODO (timkornau): either comment function or find a nicer way to generate a pretty printed
   * instruction line which does not depend on the graph model.
   */
public static String createInstructionLine(final INaviInstruction instruction, final CGraphModel graphModel) {
    final ZyGraphViewSettings graphSettings = graphModel.getGraph().getSettings();
    final BackEndDebuggerProvider provider = graphModel.getDebuggerProvider();
    final INodeModifier modifier = new CDefaultModifier(graphSettings, provider);
    return ZyInstructionBuilder.buildInstructionLine(instruction, graphSettings, modifier).first();
}
Also used : INodeModifier(com.google.security.zynamics.binnavi.ZyGraph.Builders.Modifiers.INodeModifier) ZyGraphViewSettings(com.google.security.zynamics.binnavi.ZyGraph.ZyGraphViewSettings) BackEndDebuggerProvider(com.google.security.zynamics.binnavi.debug.debugger.BackEndDebuggerProvider) CDefaultModifier(com.google.security.zynamics.binnavi.ZyGraph.Builders.Modifiers.CDefaultModifier)

Example 4 with BackEndDebuggerProvider

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

the class CGraphSynchonizerTest method test1Simple.

// TODO this test is very artificial as it does not test a real work flow.
@Test
public void test1Simple() throws FileReadException, CouldntLoadDataException, LoadCancelledException, CouldntSaveDataException {
    final ZyGraph graph = ZyGraphFactory.generateTestGraph();
    final CSpecialInstructionsModel model = new CSpecialInstructionsModel();
    final List<CSpecialInstruction> instructions = new ArrayList<CSpecialInstruction>();
    final ITypeDescription callsDescription = model.getDescriptions().get(0);
    callsDescription.setEnabled(true);
    final CSpecialInstruction instruction = new CSpecialInstruction(callsDescription, Iterables.getFirst(graph.getRawView().getBasicBlocks().get(2).getInstructions(), null));
    final CCodeNode node = graph.getRawView().getBasicBlocks().get(2);
    final NaviNode naviNode = graph.getNode(node);
    final BackEndDebuggerProvider provider = new MockDebuggerProvider();
    new CCodeNodeUpdater(graph, naviNode, node, provider);
    instructions.add(instruction);
    model.setInstructions(instructions);
    assertFalse(naviNode.getRealizer().getNodeContent().getLineContent(0).hasHighlighting(CHighlightLayers.SPECIAL_INSTRUCTION_LAYER));
    final CGraphSynchronizer synchronizer = new CGraphSynchronizer(graph, model);
    CTypeResultsHighlighter.updateHighlighting(graph, Lists.newArrayList(instruction));
    assertTrue(naviNode.getRealizer().getNodeContent().getLineContent(0).hasHighlighting(CHighlightLayers.SPECIAL_INSTRUCTION_LAYER));
    synchronizer.dispose();
}
Also used : ZyGraph(com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph) CCodeNode(com.google.security.zynamics.binnavi.disassembly.CCodeNode) CCodeNodeUpdater(com.google.security.zynamics.binnavi.ZyGraph.Updaters.CodeNodes.CCodeNodeUpdater) ArrayList(java.util.ArrayList) NaviNode(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode) BackEndDebuggerProvider(com.google.security.zynamics.binnavi.debug.debugger.BackEndDebuggerProvider) MockDebuggerProvider(com.google.security.zynamics.binnavi.Debug.Debugger.MockDebuggerProvider) Test(org.junit.Test)

Aggregations

BackEndDebuggerProvider (com.google.security.zynamics.binnavi.debug.debugger.BackEndDebuggerProvider)4 MockDebuggerProvider (com.google.security.zynamics.binnavi.Debug.Debugger.MockDebuggerProvider)2 CCodeNodeUpdater (com.google.security.zynamics.binnavi.ZyGraph.Updaters.CodeNodes.CCodeNodeUpdater)2 CCodeNode (com.google.security.zynamics.binnavi.disassembly.CCodeNode)2 NaviNode (com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode)2 ZyGraph (com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph)2 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 IGraphContainerWindow (com.google.security.zynamics.binnavi.Gui.GraphWindows.IGraphContainerWindow)1 IGraphPanel (com.google.security.zynamics.binnavi.Gui.GraphWindows.IGraphPanel)1 CDefaultModifier (com.google.security.zynamics.binnavi.ZyGraph.Builders.Modifiers.CDefaultModifier)1 INodeModifier (com.google.security.zynamics.binnavi.ZyGraph.Builders.Modifiers.INodeModifier)1 ZyGraphViewSettings (com.google.security.zynamics.binnavi.ZyGraph.ZyGraphViewSettings)1 IDebugger (com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger)1 INaviInstruction (com.google.security.zynamics.binnavi.disassembly.INaviInstruction)1