Search in sources :

Example 1 with CBookmarkTableModel

use of com.google.security.zynamics.binnavi.Gui.Debug.Bookmarks.CBookmarkTableModel in project binnavi by google.

the class CBookmarksTableModelTest method test2getValueAt.

@Test
public void test2getValueAt() {
    final DebugTargetSettings target = new ModuleTargetSettings(CommonTestObjects.MODULE);
    final DebuggerProvider debuggerProvider = new DebuggerProvider(target);
    final CBookmarkTableModel model = new CBookmarkTableModel(debuggerProvider);
    final IAddress address = new MockAddress();
    final CBookmark bookmark = new CBookmark(address, "foo");
    final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
    debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, CommonTestObjects.BP_ADDRESS_0_SET);
    debuggerProvider.addDebugger(debugger);
    final BookmarkManager bookmarkManager = debugger.getBookmarkManager();
    bookmarkManager.addBookmark(bookmark);
    assertEquals(1, bookmarkManager.getNumberOfBookmarks());
    assertEquals("foo", model.getValueAt(0, 2));
    assertEquals(address.toHexString(), model.getValueAt(0, 1));
    assertEquals(debugger.getPrintableString(), model.getValueAt(0, 0));
    final int[] rows = { 0 };
    CBookmarkFunctions.deleteBookmarks(debuggerProvider, rows);
    assertEquals(0, bookmarkManager.getNumberOfBookmarks());
    model.dispose();
}
Also used : MockDebugger(com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger) CBookmark(com.google.security.zynamics.binnavi.models.Bookmarks.memory.CBookmark) DebuggerProvider(com.google.security.zynamics.binnavi.debug.debugger.DebuggerProvider) CBookmarkTableModel(com.google.security.zynamics.binnavi.Gui.Debug.Bookmarks.CBookmarkTableModel) DebugTargetSettings(com.google.security.zynamics.binnavi.debug.debugger.DebugTargetSettings) ModuleTargetSettings(com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings) MockAddress(com.google.security.zynamics.zylib.disassembly.MockAddress) IAddress(com.google.security.zynamics.zylib.disassembly.IAddress) BookmarkManager(com.google.security.zynamics.binnavi.models.Bookmarks.memory.BookmarkManager) Test(org.junit.Test)

Example 2 with CBookmarkTableModel

use of com.google.security.zynamics.binnavi.Gui.Debug.Bookmarks.CBookmarkTableModel in project binnavi by google.

the class CBoookmarkFunctionsTest method test2DeleteBookmarks.

@Test
public void test2DeleteBookmarks() {
    final DebugTargetSettings target = new ModuleTargetSettings(CommonTestObjects.MODULE);
    final DebuggerProvider debuggerProvider = new DebuggerProvider(target);
    final CBookmarkTableModel model = new CBookmarkTableModel(debuggerProvider);
    final CBookmark bookmark = new CBookmark(new MockAddress(), "foo");
    final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
    debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, CommonTestObjects.BP_ADDRESS_0_SET);
    debuggerProvider.addDebugger(debugger);
    final BookmarkManager bookmarkManager = debugger.getBookmarkManager();
    bookmarkManager.addBookmark(bookmark);
    assertEquals(1, bookmarkManager.getNumberOfBookmarks());
    final int[] rows = { 0 };
    CBookmarkFunctions.deleteBookmarks(debuggerProvider, rows);
    assertEquals(0, bookmarkManager.getNumberOfBookmarks());
    model.dispose();
}
Also used : MockDebugger(com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger) CBookmark(com.google.security.zynamics.binnavi.models.Bookmarks.memory.CBookmark) DebuggerProvider(com.google.security.zynamics.binnavi.debug.debugger.DebuggerProvider) CBookmarkTableModel(com.google.security.zynamics.binnavi.Gui.Debug.Bookmarks.CBookmarkTableModel) DebugTargetSettings(com.google.security.zynamics.binnavi.debug.debugger.DebugTargetSettings) ModuleTargetSettings(com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings) MockAddress(com.google.security.zynamics.zylib.disassembly.MockAddress) BookmarkManager(com.google.security.zynamics.binnavi.models.Bookmarks.memory.BookmarkManager) Test(org.junit.Test)

Example 3 with CBookmarkTableModel

use of com.google.security.zynamics.binnavi.Gui.Debug.Bookmarks.CBookmarkTableModel in project binnavi by google.

the class CBookmarksTableModelTest method test1DynamicDebugger.

@Test
public void test1DynamicDebugger() {
    final DebugTargetSettings target = new ModuleTargetSettings(CommonTestObjects.MODULE);
    final DebuggerProvider debuggerProvider = new DebuggerProvider(target);
    final CBookmarkTableModel model = new CBookmarkTableModel(debuggerProvider);
    final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
    debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, CommonTestObjects.BP_ADDRESS_0_SET);
    debuggerProvider.addDebugger(debugger);
    model.dispose();
}
Also used : MockDebugger(com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger) DebuggerProvider(com.google.security.zynamics.binnavi.debug.debugger.DebuggerProvider) CBookmarkTableModel(com.google.security.zynamics.binnavi.Gui.Debug.Bookmarks.CBookmarkTableModel) DebugTargetSettings(com.google.security.zynamics.binnavi.debug.debugger.DebugTargetSettings) ModuleTargetSettings(com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings) Test(org.junit.Test)

Aggregations

MockDebugger (com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger)3 CBookmarkTableModel (com.google.security.zynamics.binnavi.Gui.Debug.Bookmarks.CBookmarkTableModel)3 DebugTargetSettings (com.google.security.zynamics.binnavi.debug.debugger.DebugTargetSettings)3 DebuggerProvider (com.google.security.zynamics.binnavi.debug.debugger.DebuggerProvider)3 ModuleTargetSettings (com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings)3 Test (org.junit.Test)3 BookmarkManager (com.google.security.zynamics.binnavi.models.Bookmarks.memory.BookmarkManager)2 CBookmark (com.google.security.zynamics.binnavi.models.Bookmarks.memory.CBookmark)2 MockAddress (com.google.security.zynamics.zylib.disassembly.MockAddress)2 IAddress (com.google.security.zynamics.zylib.disassembly.IAddress)1