Search in sources :

Example 36 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 37 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 38 with IDebugger

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

the class CBookmarkTableHelpers method findBookmark.

/**
 * Returns the corresponding bookmark manager and index for a row in the bookmarks table.
 *
 * @param debuggerProvider Provides the debuggers where breakpoints can be set.
 * @param row The row of the bookmark table.
 *
 * @return The bookmark manager/bookmark index pair for the bookmark in the given row.
 */
public static Triple<IDebugger, BookmarkManager, Integer> findBookmark(final BackEndDebuggerProvider debuggerProvider, final int row) {
    Preconditions.checkNotNull(debuggerProvider, "IE01322: Debugger provider argument can't be null");
    Preconditions.checkArgument(row >= 0, "IE01323: Row arguments can not be negative");
    int bookmarks = 0;
    for (final IDebugger debugger : debuggerProvider.getDebuggers()) {
        if ((row >= bookmarks) && (row < bookmarks + debugger.getBookmarkManager().getNumberOfBookmarks())) {
            return Triple.make(debugger, debugger.getBookmarkManager(), row - bookmarks);
        } else {
            bookmarks += debugger.getBookmarkManager().getNumberOfBookmarks();
        }
    }
    throw new IllegalArgumentException("IE01324: Invalid row number");
}
Also used : IDebugger(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger)

Example 39 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) Pair(com.google.security.zynamics.zylib.general.Pair) BookmarkManager(com.google.security.zynamics.binnavi.models.Bookmarks.memory.BookmarkManager)

Example 40 with IDebugger

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

the class CRegisterMenuProvider method getRegisterMenu.

@Override
public JPopupMenu getRegisterMenu(final int registerNumber) {
    final IDebugger debugger = m_debugPerspectiveModel.getCurrentSelectedDebugger();
    if (debugger == null) {
        return null;
    }
    final JPopupMenu menu = new JPopupMenu();
    final BigInteger value = m_dataProvider.getRegisterInformation(registerNumber).getValue();
    menu.add(CActionProxy.proxy(new CCopyRegisterValueAction(value.toString(16).toUpperCase())));
    final MemorySection section = ProcessHelpers.getSectionWith(debugger.getProcessManager().getMemoryMap(), new CAddress(value));
    final JMenuItem gotoAddress = menu.add(CActionProxy.proxy(new CGotoOffsetAction(m_debugPerspectiveModel, new CAddress(value))));
    gotoAddress.setEnabled(section != null);
    if (containsAddress(m_debugPerspectiveModel.getGraphModel().getGraph().getRawView(), value.longValue())) {
        menu.add(CActionProxy.proxy(new CZoomToAddressAction(m_debugPerspectiveModel.getGraphModel().getGraph(), new CAddress(value), debugger.getModule(new RelocatedAddress(new CAddress(value))))));
    } else {
        final IViewContainer container = m_debugPerspectiveModel.getGraphModel().getViewContainer();
        menu.add(CActionProxy.proxy(new CSearchAction(m_debugPerspectiveModel.getGraphModel().getParent(), container, new CAddress(value))));
    }
    return menu;
}
Also used : CZoomToAddressAction(com.google.security.zynamics.binnavi.Gui.Debug.RegisterPanel.Actions.CZoomToAddressAction) CCopyRegisterValueAction(com.google.security.zynamics.binnavi.Gui.Debug.RegisterPanel.Actions.CCopyRegisterValueAction) IViewContainer(com.google.security.zynamics.binnavi.disassembly.views.IViewContainer) MemorySection(com.google.security.zynamics.binnavi.debug.models.processmanager.MemorySection) CGotoOffsetAction(com.google.security.zynamics.binnavi.Gui.Debug.RegisterPanel.Actions.CGotoOffsetAction) RelocatedAddress(com.google.security.zynamics.binnavi.disassembly.RelocatedAddress) BigInteger(java.math.BigInteger) CSearchAction(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Actions.CSearchAction) JMenuItem(javax.swing.JMenuItem) IDebugger(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger) JPopupMenu(javax.swing.JPopupMenu) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress)

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