use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager in project binnavi by google.
the class EchoBreakpointSetSynchronizer method handleSuccess.
@Override
protected void handleSuccess(final EchoBreakpointSetReply reply) {
final BreakpointManager manager = getDebugger().getBreakpointManager();
final Set<BreakpointAddress> addressesToActivate = new HashSet<>();
final Set<BreakpointAddress> addressesToRemove = new HashSet<>();
for (final Pair<RelocatedAddress, Integer> resultPair : reply.getAddresses()) {
final RelocatedAddress address = resultPair.first();
if (resultPair.second() == 0) {
addressesToActivate.add(DebuggerHelpers.getBreakpointAddress(getDebugger(), address));
} else {
addressesToRemove.add(DebuggerHelpers.getBreakpointAddress(getDebugger(), address));
}
}
manager.setBreakpointStatus(addressesToActivate, BreakpointType.ECHO, BreakpointStatus.BREAKPOINT_ACTIVE);
manager.removeBreakpointsPassive(BreakpointType.ECHO, addressesToRemove);
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager in project binnavi by google.
the class StepBreakpointSetSynchronizer method handleSuccess.
/**
* When a stepping breakpoint was set in the target process, its state is set to ACTIVE in the
* breakpoint manager.
*/
@Override
protected void handleSuccess(final StepBreakpointSetReply reply) {
final BreakpointManager manager = getDebugger().getBreakpointManager();
final Set<BreakpointAddress> addressesToActivate = new HashSet<BreakpointAddress>();
final Set<BreakpointAddress> addressesToRemove = new HashSet<BreakpointAddress>();
for (final Pair<RelocatedAddress, Integer> resultPair : reply.getAddresses()) {
final RelocatedAddress address = resultPair.first();
if (resultPair.second() == DebuggerErrorCodes.SUCCESS) {
addressesToActivate.add(DebuggerHelpers.getBreakpointAddress(getDebugger(), address));
} else {
addressesToRemove.add(DebuggerHelpers.getBreakpointAddress(getDebugger(), address));
}
}
manager.setBreakpointStatus(addressesToActivate, BreakpointType.STEP, BreakpointStatus.BREAKPOINT_ACTIVE);
manager.removeBreakpoints(BreakpointType.STEP, addressesToRemove);
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager in project binnavi by google.
the class ReplySynchronizer method updateHitBreakpoints.
/**
* Updates the hit state of breakpoints.
*
* @param address The current value of the program counter which is used to determine the state of
* breakpoints.
*/
protected void updateHitBreakpoints(final BreakpointAddress address) {
Preconditions.checkNotNull(address, "IE01048: Address argument can not be null");
final BreakpointManager manager = debugger.getBreakpointManager();
for (final Breakpoint breakpoint : manager.getBreakpoints(BreakpointType.REGULAR)) {
final boolean isAddressSame = address.equals(breakpoint.getAddress());
if ((manager.getBreakpointStatus(breakpoint.getAddress(), BreakpointType.REGULAR) == BreakpointStatus.BREAKPOINT_HIT) && !isAddressSame) {
// Activate the previously hit breakpoint
manager.setBreakpointStatus(Sets.newHashSet(breakpoint.getAddress()), BreakpointType.REGULAR, BreakpointStatus.BREAKPOINT_ACTIVE);
break;
} else if (isAddressSame) {
// Hit the currently hit breakpoint
try {
manager.setBreakpointStatus(Sets.newHashSet(breakpoint.getAddress()), BreakpointType.REGULAR, BreakpointStatus.BREAKPOINT_HIT);
} catch (final IllegalArgumentException exception) {
// Not one of our breakpoints.
return;
}
}
}
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager in project binnavi by google.
the class CBreakpointFunctions method allNotDisabled.
/**
* Tests whether not 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 not all selected breakpoints are disabled. False, otherwise.
*/
public static boolean allNotDisabled(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 CBreakpointSetFunctions method enableBreakpoints.
/**
* Enables all breakpoints that are 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 enableBreakpoints(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();
manager.setBreakpointStatus(BreakpointType.REGULAR, BreakpointStatus.BREAKPOINT_ENABLED, breakpointIndex);
}
}
Aggregations