Search in sources :

Example 6 with CBookmark

use of com.google.security.zynamics.binnavi.models.Bookmarks.memory.CBookmark in project binnavi by google.

the class BookmarkManager method removeBookmark.

// ! Removes a bookmark.
/**
   * Removes the memory bookmark at the given address.
   *
   * @param address Address of the bookmark.
   */
public void removeBookmark(final Address address) {
    Preconditions.checkNotNull(address, "Error: Address argument can not be null");
    final CBookmark bookmark = m_bookmarkManager.getBookmark(new CAddress(address.toLong()));
    Preconditions.checkNotNull(bookmark, "Error: No bookmark exists at the specified address");
    m_bookmarkManager.removeBookmark(bookmark);
}
Also used : CBookmark(com.google.security.zynamics.binnavi.models.Bookmarks.memory.CBookmark) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress)

Example 7 with CBookmark

use of com.google.security.zynamics.binnavi.models.Bookmarks.memory.CBookmark 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 8 with CBookmark

use of com.google.security.zynamics.binnavi.models.Bookmarks.memory.CBookmark in project binnavi by google.

the class BookmarkManagerTest method testPreinitialized.

@Test
public void testPreinitialized() {
    final BookmarkManager nativeManager = new BookmarkManager();
    nativeManager.addBookmark(new CBookmark(new CAddress(0), "foo"));
    final com.google.security.zynamics.binnavi.API.debug.BookmarkManager apiManager = new com.google.security.zynamics.binnavi.API.debug.BookmarkManager(nativeManager);
    final Bookmark bm = apiManager.getBookmark(0);
    assertEquals(0, bm.getAddress().toLong());
    assertEquals("foo", bm.getDescription());
}
Also used : CBookmark(com.google.security.zynamics.binnavi.models.Bookmarks.memory.CBookmark) CBookmark(com.google.security.zynamics.binnavi.models.Bookmarks.memory.CBookmark) BookmarkManager(com.google.security.zynamics.binnavi.models.Bookmarks.memory.BookmarkManager) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

Aggregations

CBookmark (com.google.security.zynamics.binnavi.models.Bookmarks.memory.CBookmark)8 BookmarkManager (com.google.security.zynamics.binnavi.models.Bookmarks.memory.BookmarkManager)5 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)5 Test (org.junit.Test)3 MockDebugger (com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger)2 CBookmarkTableModel (com.google.security.zynamics.binnavi.Gui.Debug.Bookmarks.CBookmarkTableModel)2 DebugTargetSettings (com.google.security.zynamics.binnavi.debug.debugger.DebugTargetSettings)2 DebuggerProvider (com.google.security.zynamics.binnavi.debug.debugger.DebuggerProvider)2 ModuleTargetSettings (com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings)2 IDebugger (com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger)2 IAddress (com.google.security.zynamics.zylib.disassembly.IAddress)2 MockAddress (com.google.security.zynamics.zylib.disassembly.MockAddress)2 CCreateBookmarkAction (com.google.security.zynamics.binnavi.Gui.Debug.MemoryPanel.Actions.CCreateBookmarkAction)1 CDeleteBookmarkAction (com.google.security.zynamics.binnavi.Gui.Debug.MemoryPanel.Actions.CDeleteBookmarkAction)1 CDumpMemoryRangeAction (com.google.security.zynamics.binnavi.Gui.Debug.MemoryPanel.Actions.CDumpMemoryRangeAction)1 CFollowDumpAction (com.google.security.zynamics.binnavi.Gui.Debug.MemoryPanel.Actions.CFollowDumpAction)1 CGotoAction (com.google.security.zynamics.binnavi.Gui.Debug.MemoryPanel.Actions.CGotoAction)1 CGotoBookmarkAction (com.google.security.zynamics.binnavi.Gui.Debug.MemoryPanel.Actions.CGotoBookmarkAction)1 CLoadAllAction (com.google.security.zynamics.binnavi.Gui.Debug.MemoryPanel.Actions.CLoadAllAction)1 CSearchAction (com.google.security.zynamics.binnavi.Gui.Debug.MemoryPanel.Actions.CSearchAction)1