use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager in project binnavi by google.
the class CBreakpointFunctions method allDisabled.
/**
* Tests whether all breakpoints set in the specified rows are disabled.
*
* @param debuggerProvider Provides the debuggers where breakpoints can be set.
* @param rows Rows that identify the breakpoints.
*
* @return True, if all selected breakpoints are disabled. False, otherwise.
*/
public static boolean allDisabled(final BackEndDebuggerProvider debuggerProvider, final int[] rows) {
checkArguments(debuggerProvider, rows);
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();
if (manager.getBreakpointStatus(BreakpointType.REGULAR, breakpointIndex) != BreakpointStatus.BREAKPOINT_DISABLED) {
return false;
}
}
return true;
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager in project binnavi by google.
the class CGraphDebuggerTest method testRemoveBreakpoint.
@Test
public void testRemoveBreakpoint() {
final BreakpointManager manager = new BreakpointManager();
manager.addBreakpoints(BreakpointType.REGULAR, CommonTestObjects.BP_ADDRESS_123_SET);
manager.addBreakpoints(BreakpointType.REGULAR, CommonTestObjects.BP_ADDRESS_456_SET);
manager.setBreakpointStatus(BreakpointType.REGULAR, BreakpointStatus.BREAKPOINT_ACTIVE, 1);
CGraphDebugger.removeBreakpoints(CommonTestObjects.BP_ADDRESS_123_SET, manager);
CGraphDebugger.removeBreakpoints(CommonTestObjects.BP_ADDRESS_456_SET, manager);
assertEquals(1, manager.getNumberOfBreakpoints(BreakpointType.REGULAR));
assertEquals(0x123, manager.getBreakpoint(BreakpointType.REGULAR, 0).getAddress().getAddress().getAddress().toLong());
assertEquals(BreakpointStatus.BREAKPOINT_DELETING, manager.getBreakpointStatus(BreakpointType.REGULAR, 1));
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager in project binnavi by google.
the class CBreakpointManagerTest method setUp.
@Before
public void setUp() {
m_manager = new BreakpointManager();
m_manager.addBreakpoints(BreakpointType.REGULAR, CommonTestObjects.BP_ADDRESS_123_SET);
m_manager.addBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(m_module, new UnrelocatedAddress(new CAddress(0x456)))));
m_manager.addBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(m_module, new UnrelocatedAddress(new CAddress(0x789)))));
m_manager.addBreakpoints(BreakpointType.ECHO, Sets.newHashSet(new BreakpointAddress(m_module, new UnrelocatedAddress(new CAddress(0x111)))));
m_manager.addBreakpoints(BreakpointType.ECHO, Sets.newHashSet(new BreakpointAddress(m_module, new UnrelocatedAddress(new CAddress(0x222)))));
m_manager.addBreakpoints(BreakpointType.STEP, Sets.newHashSet(new BreakpointAddress(m_module, new UnrelocatedAddress(new CAddress(0x1000)))));
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager in project binnavi by google.
the class BreakpointSetSynchronizer method handleSuccess.
@Override
protected void handleSuccess(final BreakpointSetReply reply) {
final BreakpointManager manager = getDebugger().getBreakpointManager();
final Set<BreakpointAddress> addressesToActivate = new HashSet<>();
final Set<BreakpointAddress> addressesToInvalidate = new HashSet<>();
for (final Pair<RelocatedAddress, Integer> resultPair : reply.getAddresses()) {
if (resultPair.second() == 0) {
// If a breakpoint was successfully set in the target process, its status is
// set to ACTIVE in the breakpoint manager.
final BreakpointAddress breakpointAddress = DebuggerHelpers.getBreakpointAddress(getDebugger(), resultPair.first());
if (manager.getBreakpointStatus(breakpointAddress, BreakpointType.REGULAR) != BreakpointStatus.BREAKPOINT_DISABLED) {
addressesToActivate.add(breakpointAddress);
}
} else {
// If a breakpoint could not be set in the target process, its status in the
// breakpoint manager is set to INVALID. The real status of the breakpoint
// is unknown though.
addressesToInvalidate.add(DebuggerHelpers.getBreakpointAddress(getDebugger(), resultPair.first()));
}
}
manager.setBreakpointStatus(addressesToInvalidate, BreakpointType.REGULAR, BreakpointStatus.BREAKPOINT_INVALID);
manager.setBreakpointStatus(addressesToActivate, BreakpointType.REGULAR, BreakpointStatus.BREAKPOINT_ACTIVE);
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager in project binnavi by google.
the class BreakpointRemovedSynchronizer method handleSuccess.
@Override
protected void handleSuccess(final BreakpointsRemovedReply reply) {
// If a breakpoint was removed from the target process, it can be removed
// from the breakpoint manager too unless the breakpoint is set to disabled
// there.
final BreakpointManager manager = getDebugger().getBreakpointManager();
final Set<BreakpointAddress> addressesToRemove = new HashSet<>();
final Set<BreakpointAddress> addressesToInvalidate = new HashSet<>();
for (final Pair<RelocatedAddress, Integer> resultPair : reply.getAddresses()) {
if (resultPair.second() == 0) {
final BreakpointAddress address = DebuggerHelpers.getBreakpointAddress(getDebugger(), resultPair.first());
if (manager.getBreakpointStatus(address, BreakpointType.REGULAR) == BreakpointStatus.BREAKPOINT_DELETING) {
addressesToRemove.add(address);
}
} else {
addressesToInvalidate.add(DebuggerHelpers.getBreakpointAddress(getDebugger(), resultPair.first()));
}
}
manager.removeBreakpointsPassive(BreakpointType.REGULAR, addressesToRemove);
manager.setBreakpointStatus(addressesToInvalidate, BreakpointType.REGULAR, BreakpointStatus.BREAKPOINT_INVALID);
}
Aggregations