use of com.google.security.zynamics.binnavi.debug.models.breakpoints.conditions.BaseNode 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.models.breakpoints.conditions.BaseNode in project binnavi by google.
the class CBreakpointFunctionsTest method test3disableAll.
@Test
public void test3disableAll() {
final INaviModule mockModule = new MockModule();
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(0)))));
final Breakpoint breakPoint = debugger.getBreakpointManager().getBreakpoint(BreakpointType.REGULAR, new BreakpointAddress(mockModule, new UnrelocatedAddress(new CAddress(0))));
@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);
@SuppressWarnings("unused") final CBreakpointTableModel tableModel = new CBreakpointTableModel(debuggerProvider);
final int[] rows = { 0 };
assertFalse(CBreakpointFunctions.allDisabled(debuggerProvider, rows));
CBreakpointRemoveFunctions.disableAll(debuggerProvider);
assertTrue(CBreakpointFunctions.allDisabled(debuggerProvider, rows));
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.conditions.BaseNode in project binnavi by google.
the class CBreakpointFunctionsTest method test5enableFunctions.
@Test
public void test5enableFunctions() {
final INaviModule mockModule = new MockModule();
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(0)))));
final Breakpoint breakPoint = debugger.getBreakpointManager().getBreakpoint(BreakpointType.REGULAR, new BreakpointAddress(mockModule, new UnrelocatedAddress(new CAddress(0))));
@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);
@SuppressWarnings("unused") final CBreakpointTableModel tableModel = new CBreakpointTableModel(debuggerProvider);
final int[] rows = { 0 };
assertFalse(CBreakpointFunctions.allDisabled(debuggerProvider, rows));
CBreakpointRemoveFunctions.disableAll(debuggerProvider);
assertTrue(CBreakpointFunctions.allDisabled(debuggerProvider, rows));
CBreakpointSetFunctions.enableAll(debuggerProvider);
assertFalse(CBreakpointFunctions.allDisabled(debuggerProvider, rows));
CBreakpointRemoveFunctions.disableAll(debuggerProvider);
assertTrue(CBreakpointFunctions.allDisabled(debuggerProvider, rows));
CBreakpointSetFunctions.enableBreakpoints(debuggerProvider, rows);
assertFalse(CBreakpointFunctions.allDisabled(debuggerProvider, rows));
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.conditions.BaseNode in project binnavi by google.
the class CBreakpointFunctionsTest method test4DisableBreakpoints.
@Test
public void test4DisableBreakpoints() {
final INaviModule mockModule = new MockModule();
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(0)))));
final Breakpoint breakPoint = debugger.getBreakpointManager().getBreakpoint(BreakpointType.REGULAR, new BreakpointAddress(mockModule, new UnrelocatedAddress(new CAddress(0))));
@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);
@SuppressWarnings("unused") final CBreakpointTableModel tableModel = new CBreakpointTableModel(debuggerProvider);
final int[] rows = { 0 };
final int[] rows2 = { 1 };
assertFalse(CBreakpointFunctions.allDisabled(debuggerProvider, rows));
try {
CBreakpointRemoveFunctions.disableBreakpoints(debuggerProvider, rows2);
} catch (final IllegalArgumentException e) {
}
CBreakpointRemoveFunctions.disableBreakpoints(debuggerProvider, rows);
assertTrue(CBreakpointFunctions.allDisabled(debuggerProvider, rows));
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.conditions.BaseNode in project binnavi by google.
the class CBreakpointTableModelTest method test4getValueAt.
@Test
public void test4getValueAt() {
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);
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(com.google.security.zynamics.binnavi.debug.models.breakpoints.enums.BreakpointStatus.BREAKPOINT_INACTIVE, tableModel.getValueAt(0, 0));
assertEquals(debugger.getPrintableString(), tableModel.getValueAt(0, 1));
assertEquals(address, tableModel.getValueAt(0, 2));
assertEquals("foo", tableModel.getValueAt(0, 5));
assertEquals("purzel", tableModel.getValueAt(0, 6));
try {
tableModel.getValueAt(0, 7);
fail();
} catch (final IllegalArgumentException e) {
}
}
Aggregations