use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.
the class BreakpointHelpers method getBreakpoints.
/**
* Returns the addresses of a code node where breakpoints of a given type are set.
*
* @param debugger The debugger that set the breakpoints.
* @param node The code node to check.
* @param type The type of the breakpoints to search for.
*
* @return The addresses of the code node where breakpoints are set.
*/
private static List<Address> getBreakpoints(final Debugger debugger, final CodeNode node, final BreakpointType type) {
Preconditions.checkNotNull(debugger, "Error: Debugger argument can not be null");
Preconditions.checkNotNull(node, "Error: Node argument can not be null");
final BreakpointManager manager = debugger.getBreakpointManager();
final List<Address> breakpoints = new ArrayList<Address>();
for (final Instruction instruction : node.getInstructions()) {
final BreakpointAddress address = new BreakpointAddress(instruction.getNative().getModule(), new UnrelocatedAddress(new CAddress(instruction.getAddress().toLong())));
if (manager.getNative().hasBreakpoint(type, address)) {
breakpoints.add(new Address(address.getAddress().getAddress().toBigInteger()));
}
}
return breakpoints;
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.
the class BreakpointManager method getEchoBreakpoint.
// ! Returns an echo breakpoint from a given address.
/**
* Returns the echo breakpoint at the given address.
*
* @param module The module the echo breakpoint belongs to.
* @param address The address of the breakpoint to return.
*
* @return The breakpoint at the given address.
*/
public Breakpoint getEchoBreakpoint(final Module module, final Address address) {
Preconditions.checkNotNull(address, "Error: Address argument can not be null");
final com.google.security.zynamics.binnavi.debug.models.breakpoints.Breakpoint internalBreakpoint = breakpointManager.getBreakpoint(BreakpointType.ECHO, new BreakpointAddress(module == null ? null : module.getNative(), new UnrelocatedAddress(new CAddress(address.toLong()))));
return echoBreakpointMap.get(internalBreakpoint);
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.
the class BreakpointManager method setBreakpoint.
// ! Sets a regular breakpoint.
/**
* Sets a regular breakpoint at the given address.
*
* @param module The module the breakpoint is tied to. This argument can be null.
* @param address The address of the breakpoint.
*
* @return The set breakpoint. Null is returned if no breakpoint was set.
*/
public Breakpoint setBreakpoint(final Module module, final Address address) {
Preconditions.checkNotNull(address, "Error: Address argument can not be null");
final INaviModule realModule = module == null ? null : module.getNative();
final BreakpointAddress breakpointAddress = new BreakpointAddress(realModule, new UnrelocatedAddress(new CAddress(address.toLong())));
final Set<BreakpointAddress> breakpoints = Sets.newHashSet(breakpointAddress);
breakpointManager.addBreakpoints(BreakpointType.REGULAR, breakpoints);
return echoBreakpointMap.get(breakpointManager.getBreakpoint(BreakpointType.REGULAR, breakpointAddress));
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.
the class BreakpointManager method removeEchoBreakpoint.
// ! Removes an echo breakpoint.
/**
* Removes an echo breakpoint from a given address.
*
* @param module The module the breakpoint is tied to. This argument can be null.
* @param address The address of the breakpoint.
*/
public void removeEchoBreakpoint(final Module module, final Address address) {
Preconditions.checkNotNull(address, "Error: Address argument can not be null");
breakpointManager.removeBreakpoints(BreakpointType.ECHO, Sets.newHashSet(new BreakpointAddress(module == null ? null : module.getNative(), new UnrelocatedAddress(new CAddress(address.toLong())))));
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.
the class BreakpointManager method setEchoBreakpoint.
// ! Sets an echo breakpoint.
/**
* Sets an echo breakpoint at the given address.
*
* @param module The module the breakpoint is tied to. This argument can be null.
* @param address The address of the breakpoint.
*
* @return The set breakpoint. Null is returned if no breakpoint was set.
*/
public Breakpoint setEchoBreakpoint(final Module module, final Address address) {
Preconditions.checkNotNull(address, "Error: Address argument can not be null");
final INaviModule realModule = module == null ? null : module.getNative();
final BreakpointAddress breakpointAddress = new BreakpointAddress(realModule, new UnrelocatedAddress(new CAddress(address.toLong())));
final Set<BreakpointAddress> breakpoints = Sets.newHashSet(breakpointAddress);
breakpointManager.addBreakpoints(BreakpointType.ECHO, breakpoints);
return echoBreakpointMap.get(breakpointManager.getBreakpoint(BreakpointType.ECHO, breakpointAddress));
}
Aggregations