use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.
the class CGraphDebugger method toggleBreakpointStatus.
/**
* Disables or enables a breakpoint at a given address.
*
* @param manager The breakpoint manager that is used to toggle the breakpoint status.
* @param module The module where the breakpoint is set.
* @param unrelocatedAddress The unrelocated address where the breakpoint is set.
*/
public static void toggleBreakpointStatus(final BreakpointManager manager, final INaviModule module, final UnrelocatedAddress unrelocatedAddress) {
Preconditions.checkNotNull(manager, "IE01723: Manager argument can not be null");
Preconditions.checkNotNull(module, "IE01724: Module argument can not be null");
Preconditions.checkNotNull(unrelocatedAddress, "IE01725: Address argument can not be null");
final BreakpointAddress address = new BreakpointAddress(module, unrelocatedAddress);
toggleBreakpoint(manager, address);
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress 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);
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress 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.BreakpointAddress in project binnavi by google.
the class DebuggerHelpers method getBreakpointAddress.
/**
* Converts a memory address into a breakpoint address.
*
* @param debugger The debugger which handles the breakpoint.
* @param memoryAddress The memory address to convert.
*
* @return The breakpoint address.
*/
public static BreakpointAddress getBreakpointAddress(final IDebugger debugger, final RelocatedAddress memoryAddress) {
Preconditions.checkNotNull(debugger, "IE00161: Debugger argument can not be null");
Preconditions.checkNotNull(memoryAddress, "IE00163: Memory address argument can not be null");
final INaviModule module = debugger.getModule(memoryAddress);
return new BreakpointAddress(module, module == null ? new UnrelocatedAddress(memoryAddress.getAddress()) : debugger.memoryToFile(module, memoryAddress));
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress 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);
}
Aggregations