use of com.google.security.zynamics.binnavi.debug.models.breakpoints.Breakpoint in project binnavi by google.
the class CBreakpointRemoveFunctions method deleteBreakpoints.
/**
* Deletes the breakpoints specified by the rows argument.
*
* @param debuggerProvider Provides the debuggers where breakpoints can be set.
* @param rows Rows that identify the breakpoints.
*/
public static void deleteBreakpoints(final BackEndDebuggerProvider debuggerProvider, final int[] rows) {
Preconditions.checkNotNull(debuggerProvider, "IE01886: Debugger provider argument can not be null");
Preconditions.checkNotNull(rows, "IE02253: Rows argument can't be null");
final ArrayList<Pair<IDebugger, BreakpointAddress>> addresses = new ArrayList<Pair<IDebugger, BreakpointAddress>>();
for (final int row : rows) {
final Pair<IDebugger, Integer> breakpoint = CBreakpointTableHelpers.findBreakpoint(debuggerProvider, row);
final BreakpointManager manager = breakpoint.first().getBreakpointManager();
final int breakpointIndex = breakpoint.second();
addresses.add(new Pair<IDebugger, BreakpointAddress>(breakpoint.first(), manager.getBreakpoint(BreakpointType.REGULAR, breakpointIndex).getAddress()));
}
for (final Pair<IDebugger, BreakpointAddress> p : addresses) {
final BreakpointManager manager = p.first().getBreakpointManager();
final BreakpointAddress address = p.second();
manager.setBreakpointStatus(Sets.newHashSet(address), BreakpointType.REGULAR, BreakpointStatus.BREAKPOINT_DELETING);
}
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.Breakpoint in project binnavi by google.
the class CBreakpointRemoveFunctions method disableBreakpoints.
/**
* Disables the breakpoints identified by the rows argument.
*
* @param debuggerProvider Provides the debuggers where breakpoints can be set.
* @param rows Rows that identify the breakpoints.
*/
public static void disableBreakpoints(final BackEndDebuggerProvider debuggerProvider, final int[] rows) {
Preconditions.checkNotNull(debuggerProvider, "IE01919: Debugger provider argument can not be null");
Preconditions.checkNotNull(rows, "IE02254: Rows argument can't be null");
for (final int row : rows) {
final Pair<IDebugger, Integer> breakpoint = CBreakpointTableHelpers.findBreakpoint(debuggerProvider, row);
final BreakpointManager manager = breakpoint.first().getBreakpointManager();
final int breakpointIndex = breakpoint.second();
manager.setBreakpointStatus(BreakpointType.REGULAR, BreakpointStatus.BREAKPOINT_DISABLED, breakpointIndex);
}
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.Breakpoint 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.Breakpoint 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.models.breakpoints.Breakpoint 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