use of com.google.security.zynamics.binnavi.debug.debugger.DebugTargetSettings 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();
}
use of com.google.security.zynamics.binnavi.debug.debugger.DebugTargetSettings 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();
}
use of com.google.security.zynamics.binnavi.debug.debugger.DebugTargetSettings in project binnavi by google.
the class CBreakpointTableModelTest method test6Utility.
@Test
public void test6Utility() {
final DebugTargetSettings target = new ModuleTargetSettings(CommonTestObjects.MODULE);
final DebuggerProvider debuggerProvider = new DebuggerProvider(target);
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, BREAKPOINT_ADDRESS_SET);
final Breakpoint breakPoint = debugger.getBreakpointManager().getBreakpoint(BreakpointType.REGULAR, BREAKPOINT_ADDRESS);
@SuppressWarnings("unused") final CAddress address = new CAddress(0);
final BaseNode root = new BaseNode();
final BreakpointCondition bpCondition = new BreakpointCondition("foo", root);
breakPoint.setCondition(bpCondition);
breakPoint.setDescription("purzel");
debuggerProvider.addDebugger(debugger);
final CBreakpointTableModel tableModel = new CBreakpointTableModel(debuggerProvider);
assertEquals(7, tableModel.getColumnCount());
assertEquals("Status", tableModel.getColumnName(0));
assertEquals("Debugger", tableModel.getColumnName(1));
assertEquals("Unrelocated Address", tableModel.getColumnName(2));
assertEquals("Relocated Address", tableModel.getColumnName(3));
assertEquals("Module", tableModel.getColumnName(4));
assertEquals("Condition", tableModel.getColumnName(5));
assertEquals("Description", tableModel.getColumnName(6));
assertEquals(1, tableModel.getRowCount());
}
use of com.google.security.zynamics.binnavi.debug.debugger.DebugTargetSettings in project binnavi by google.
the class CBreakpointFunctionsTest method test6removeFunctions.
@Test
public void test6removeFunctions() throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
final MockFunction mockFunction = new MockFunction();
final INaviModule mockModule = mockFunction.getModule();
CFunctionContainerHelper.addFunction(mockModule.getContent().getFunctionContainer(), mockFunction);
final DebugTargetSettings target = new ModuleTargetSettings(mockModule);
final DebuggerProvider debuggerProvider = new DebuggerProvider(target);
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(mockModule));
debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(mockModule, new UnrelocatedAddress(new CAddress(0x1234)))));
@SuppressWarnings("unused") final Breakpoint breakPoint = debugger.getBreakpointManager().getBreakpoint(BreakpointType.REGULAR, new BreakpointAddress(mockModule, new UnrelocatedAddress(new CAddress(0x1234))));
debuggerProvider.addDebugger(debugger);
final CBreakpointTableModel tableModel = new CBreakpointTableModel(debuggerProvider);
assertEquals(1, tableModel.getRowCount());
final IFilledList<Pair<IDebugger, INaviFunction>> targets = new FilledList<Pair<IDebugger, INaviFunction>>();
final Pair<IDebugger, INaviFunction> targetPair = new Pair<IDebugger, INaviFunction>(debugger, mockFunction);
targets.add(targetPair);
assertEquals(1, targets.size());
CBreakpointRemoveFunctions.removeBreakpoints(targets);
@SuppressWarnings("unused") final BreakpointManager manager = debugger.getBreakpointManager();
assertEquals(0, tableModel.getRowCount());
}
use of com.google.security.zynamics.binnavi.debug.debugger.DebugTargetSettings in project binnavi by google.
the class CBreakpointFunctionsTest method test7setBreakpoints.
@Test
public void test7setBreakpoints() throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
final MockFunction mockFunction = new MockFunction();
final INaviModule mockModule = mockFunction.getModule();
CFunctionContainerHelper.addFunction(mockModule.getContent().getFunctionContainer(), mockFunction);
final DebugTargetSettings target = new ModuleTargetSettings(mockModule);
final DebuggerProvider debuggerProvider = new DebuggerProvider(target);
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(mockModule));
debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(mockModule, new UnrelocatedAddress(new CAddress(0x1234)))));
@SuppressWarnings("unused") final Breakpoint breakPoint = debugger.getBreakpointManager().getBreakpoint(BreakpointType.REGULAR, new BreakpointAddress(mockModule, new UnrelocatedAddress(new CAddress(0x1234))));
// CBreakpointAddress address = new CBreakpointAddress(mockModule, new CUnrelocatedAddress(new
// CAddress(0x2c9)));
debuggerProvider.addDebugger(debugger);
final CBreakpointTableModel tableModel = new CBreakpointTableModel(debuggerProvider);
assertEquals(1, tableModel.getRowCount());
final IFilledList<Pair<IDebugger, INaviFunction>> targets = new FilledList<Pair<IDebugger, INaviFunction>>();
final Pair<IDebugger, INaviFunction> targetPair = new Pair<IDebugger, INaviFunction>(debugger, mockFunction);
targets.add(targetPair);
CBreakpointRemoveFunctions.removeBreakpoints(targets);
assertEquals(0, tableModel.getRowCount());
CBreakpointSetFunctions.setBreakpoints(targets);
assertEquals(1, tableModel.getRowCount());
}
Aggregations