Search in sources :

Example 46 with IDebugger

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

the class CBookmarkTableModel method getBookmarkAddress.

/**
   * Finds the bookmark address of the bookmark that is displayed in a given row of the table.
   *
   * @param row The table row where the bookmark is displayed.
   *
   * @return The bookmark address of the bookmark in the given row.
   */
private String getBookmarkAddress(final int row) {
    final Triple<IDebugger, BookmarkManager, Integer> bookmarkTriple = CBookmarkTableHelpers.findBookmark(m_debuggerProvider, row);
    final BookmarkManager manager = bookmarkTriple.second();
    final int index = bookmarkTriple.third();
    return manager.getBookmark(index).getAddress().toHexString();
}
Also used : IDebugger(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger) BookmarkManager(com.google.security.zynamics.binnavi.models.Bookmarks.memory.BookmarkManager)

Example 47 with IDebugger

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

the class CBookmarkTableModel method setBookmarkDescription.

/**
   * Modifies the bookmark description of the bookmark displayed in the given row.
   *
   * @param row The row of the bookmark.
   * @param description The new description of the bookmark.
   */
private void setBookmarkDescription(final int row, final String description) {
    final Triple<IDebugger, BookmarkManager, Integer> bookmarkTriple = CBookmarkTableHelpers.findBookmark(m_debuggerProvider, row);
    final BookmarkManager manager = bookmarkTriple.second();
    final int index = bookmarkTriple.third();
    manager.getBookmark(index).setDescription(description);
}
Also used : IDebugger(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger) BookmarkManager(com.google.security.zynamics.binnavi.models.Bookmarks.memory.BookmarkManager)

Example 48 with IDebugger

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

the class CBookmarkTableModel method getBookmarkDescription.

/**
   * Finds the bookmark description of the bookmark that is displayed in a given row of the table.
   *
   * @param row The table row where the bookmark is displayed.
   *
   * @return The bookmark description of the bookmark in the given row.
   */
private String getBookmarkDescription(final int row) {
    final Triple<IDebugger, BookmarkManager, Integer> bookmarkTriple = CBookmarkTableHelpers.findBookmark(m_debuggerProvider, row);
    final BookmarkManager manager = bookmarkTriple.second();
    final int index = bookmarkTriple.third();
    return manager.getBookmark(index).getDescription();
}
Also used : IDebugger(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger) BookmarkManager(com.google.security.zynamics.binnavi.models.Bookmarks.memory.BookmarkManager)

Example 49 with IDebugger

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

the class CBookmarkFunctions method deleteBookmarks.

/**
   * Deletes a list of bookmarks.
   *
   * @param provider Contains the debuggers where bookmarks can be set.
   * @param rows The rows of the bookmarks to delete.
   */
public static void deleteBookmarks(final BackEndDebuggerProvider provider, final int[] rows) {
    Preconditions.checkNotNull(provider, "IE01329: Provider argument can not be null");
    Preconditions.checkNotNull(rows, "IE01330: Rows argument can not be null");
    final ArrayList<Pair<BookmarkManager, CBookmark>> bookmarks = new ArrayList<Pair<BookmarkManager, CBookmark>>();
    for (final int row : rows) {
        final Triple<IDebugger, BookmarkManager, Integer> bookmarkTriple = CBookmarkTableHelpers.findBookmark(provider, row);
        final BookmarkManager manager = bookmarkTriple.second();
        final int index = bookmarkTriple.third();
        bookmarks.add(Pair.make(manager, manager.getBookmark(index)));
    }
    for (final Pair<BookmarkManager, CBookmark> p : bookmarks) {
        p.first().removeBookmark(p.second());
    }
}
Also used : CBookmark(com.google.security.zynamics.binnavi.models.Bookmarks.memory.CBookmark) ArrayList(java.util.ArrayList) IDebugger(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger) BookmarkManager(com.google.security.zynamics.binnavi.models.Bookmarks.memory.BookmarkManager) Pair(com.google.security.zynamics.zylib.general.Pair)

Example 50 with IDebugger

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

the class CCodeNodeUpdater method generateContent.

@Override
public void generateContent(final IZyNodeRealizer realizer, final ZyLabelContent content) {
    ZyCodeNodeBuilder.buildContent(content, codeNode, graph.getSettings(), nodeModifier);
    for (final INaviInstruction instruction : codeNode.getInstructions()) {
        final INaviModule module = instruction.getModule();
        if ((provider != null) && (provider.getDebugger(module) != null) && graph.getSettings().getDisplaySettings().getShowMemoryAddresses(provider.getDebugger(module))) {
            final int line = CCodeNodeHelpers.instructionToLine(codeNode, instruction);
            if (line != -1) {
                final ZyLineContent lineContent = this.realizer.getNodeContent().getLineContent(line);
                // TODO(timkornau) x64
                lineContent.setTextColor(0, 8, Color.RED);
            }
        }
    }
    // Set highlighting for breakpoints and the instruction pointer.
    final INaviInstruction instruction = codeNode.getInstructions().iterator().next();
    if (instruction != null) {
        final INaviModule module = instruction.getModule();
        final IDebugger debugger = provider.getDebugger(module);
        if (debugger == null) {
            return;
        }
        final BreakpointManager manager = debugger.getBreakpointManager();
        CBreakpointPainter.paintBreakpoints(manager, node, codeNode);
        if (debugger.getProcessManager().getActiveThread() != null) {
            final RelocatedAddress instructionPointer = debugger.getProcessManager().getActiveThread().getCurrentAddress();
            final MemoryModule memoryModule = debugger.getProcessManager().getModule(instructionPointer);
            final UnrelocatedAddress unrelocatedIP = new DefaultAddressConverter(memoryModule.getBaseAddress().getAddress(), module.getConfiguration().getFileBase()).memoryToFile(instructionPointer);
            CDebuggerPainter.updateSingleNodeDebuggerHighlighting(graph, unrelocatedIP, node);
        }
    }
}
Also used : INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) RelocatedAddress(com.google.security.zynamics.binnavi.disassembly.RelocatedAddress) DefaultAddressConverter(com.google.security.zynamics.binnavi.debug.debugger.DefaultAddressConverter) ZyLineContent(com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLineContent) BreakpointManager(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager) IDebugger(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger) MemoryModule(com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule) INaviInstruction(com.google.security.zynamics.binnavi.disassembly.INaviInstruction)

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