use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.
the class ReplySynchronizer method deactivateBreakpoints.
/**
* Deactivates all regular breakpoints which are not disabled.
*/
private void deactivateBreakpoints() {
final BreakpointManager manager = debugger.getBreakpointManager();
final Set<BreakpointAddress> addressesToRemove = new HashSet<>();
final Set<BreakpointAddress> addressesToDisable = new HashSet<>();
for (final Breakpoint breakpoint : manager.getBreakpoints(BreakpointType.REGULAR)) {
final BreakpointAddress address = breakpoint.getAddress();
if (manager.getBreakpointStatus(address, BreakpointType.REGULAR) == BreakpointStatus.BREAKPOINT_DELETING) {
// When the target process is reset, the BreakpointDeleted message will never arrive.
// It is therefore necessary to delete the DELETING breakpoints manually.
// See Case 2109 for an example of what can happen.
addressesToRemove.add(address);
} else if (manager.getBreakpointStatus(address, BreakpointType.REGULAR) != BreakpointStatus.BREAKPOINT_DISABLED) {
addressesToDisable.add(address);
}
}
manager.removeBreakpoints(BreakpointType.REGULAR, addressesToRemove);
manager.setBreakpointStatus(addressesToDisable, BreakpointType.REGULAR, BreakpointStatus.BREAKPOINT_INACTIVE);
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.
the class BreakpointableNodeCounter method next.
@Override
public IterationMode next(final NaviNode node) {
final INaviViewNode viewNode = node.getRawNode();
if (viewNode instanceof INaviCodeNode) {
final INaviCodeNode codeNode = (INaviCodeNode) viewNode;
final INaviInstruction instruction = Iterables.getFirst(codeNode.getInstructions(), null);
final INaviModule module = instruction.getModule();
final BreakpointAddress address = new BreakpointAddress(module, new UnrelocatedAddress(instruction.getAddress()));
if (EchoBreakpointCollector.isBlocked(breakpointManager, address)) {
return IterationMode.CONTINUE;
}
++breakpointAbleNodeCount;
} else if (viewNode instanceof INaviFunctionNode) {
final INaviFunctionNode functionNode = (INaviFunctionNode) viewNode;
final INaviModule module = functionNode.getFunction().getModule();
final BreakpointAddress address = new BreakpointAddress(module, new UnrelocatedAddress(functionNode.getFunction().getAddress()));
if (EchoBreakpointCollector.isBlocked(breakpointManager, address)) {
return IterationMode.CONTINUE;
}
++breakpointAbleNodeCount;
}
return IterationMode.CONTINUE;
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.
the class EchoBreakpointCollector method next.
@Override
public IterationMode next(final NaviNode node) {
final INaviViewNode viewNode = node.getRawNode();
if (viewNode instanceof INaviCodeNode) {
final INaviCodeNode codeNode = (INaviCodeNode) viewNode;
final INaviInstruction instruction = Iterables.getFirst(codeNode.getInstructions(), null);
final INaviModule module = instruction.getModule();
final BreakpointAddress address = new BreakpointAddress(module, new UnrelocatedAddress(instruction.getAddress()));
if (isBlocked(manager, address)) {
return IterationMode.CONTINUE;
}
NaviLogger.info("Adding Echo breakpoint %s to the active list", address.getAddress().getAddress().toHexString());
// Add the echo breakpoint to the list of active echo breakpoints
echoBreakpointAbleAddresses.add(address);
} else if (viewNode instanceof INaviFunctionNode) {
final INaviFunctionNode functionNode = (INaviFunctionNode) viewNode;
final INaviModule module = functionNode.getFunction().getModule();
final BreakpointAddress address = new BreakpointAddress(module, new UnrelocatedAddress(functionNode.getFunction().getAddress()));
if (isBlocked(manager, address)) {
return IterationMode.CONTINUE;
}
NaviLogger.info("Adding Echo breakpoint %s to the active list", address.getAddress().getAddress().toHexString());
// Add the echo breakpoint to the list of active echo breakpoints
echoBreakpointAbleAddresses.add(address);
}
return IterationMode.CONTINUE;
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.
the class BreakpointManagerTest method testPreinitialized.
@Test
public void testPreinitialized() {
final com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager internalManager = new com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager();
internalManager.addBreakpoints(BreakpointType.REGULAR, CommonTestObjects.BP_ADDRESS_0_SET);
internalManager.addBreakpoints(BreakpointType.ECHO, Sets.newHashSet(new BreakpointAddress(CommonTestObjects.MODULE, new UnrelocatedAddress(new CAddress(1)))));
final BreakpointManager apiManager = new BreakpointManager(internalManager);
assertEquals(0, apiManager.getBreakpoints().get(0).getAddress().toLong());
assertEquals(1, apiManager.getEchoBreakpoints().get(0).getAddress().toLong());
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.
the class BreakpointHelpersTest method testGetEchoBreakpointsNode.
@Test
public void testGetEchoBreakpointsNode() {
assertTrue(BreakpointHelpers.getEchoBreakpoints(m_debugger, m_node).isEmpty());
m_debugger.getBreakpointManager().getNative().addBreakpoints(BreakpointType.ECHO, Sets.newHashSet(new BreakpointAddress(m_module, new UnrelocatedAddress(new CAddress(0x1234)))));
final List<Address> breakpoints = BreakpointHelpers.getEchoBreakpoints(m_debugger, m_node);
assertEquals(1, breakpoints.size());
assertEquals(0x1234, breakpoints.get(0).toLong());
try {
BreakpointHelpers.getEchoBreakpoints(null, m_node);
fail();
} catch (final NullPointerException exception) {
}
try {
BreakpointHelpers.getEchoBreakpoints(m_debugger, (CodeNode) null);
fail();
} catch (final NullPointerException exception) {
}
}
Aggregations