use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress 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.BreakpointAddress in project binnavi by google.
the class BreakpointManagerTest method testSetBreakpoint.
@Test
public void testSetBreakpoint() {
apiManager.addListener(mockListener);
try {
apiManager.setBreakpoint(null, null);
} catch (final NullPointerException exception) {
}
apiManager.setBreakpoint(module, new Address(0x123));
assertEquals("addedBreakpoint/123;", mockListener.events);
try {
apiManager.setBreakpoint(null, new Address(0x123));
} catch (final NullPointerException exception) {
}
internalManager.addBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(CommonTestObjects.MODULE, new UnrelocatedAddress(new CAddress(0x124)))));
assertEquals("addedBreakpoint/123;addedBreakpoint/124;", mockListener.events);
assertTrue(apiManager.hasBreakpoint(module, new Address(0x124)));
apiManager.removeListener(mockListener);
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.
the class BreakpointManagerTest method testSetEchoBreakpoint.
@Test
public void testSetEchoBreakpoint() {
apiManager.addListener(mockListener);
try {
apiManager.setEchoBreakpoint(null, null);
} catch (final NullPointerException exception) {
}
apiManager.setEchoBreakpoint(module, new Address(0x123));
assertEquals("addedEchoBreakpoint/123;", mockListener.events);
try {
apiManager.setEchoBreakpoint(null, new Address(0x123));
} catch (final NullPointerException exception) {
}
internalManager.addBreakpoints(BreakpointType.ECHO, Sets.newHashSet(new BreakpointAddress(CommonTestObjects.MODULE, new UnrelocatedAddress(new CAddress(0x124)))));
assertEquals("addedEchoBreakpoint/123;addedEchoBreakpoint/124;", mockListener.events);
assertTrue(apiManager.hasEchoBreakpoint(module, new Address(0x124)));
apiManager.removeListener(mockListener);
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.
the class BreakpointManagerTest method testRemoveEchoBreakpoint.
@Test
public void testRemoveEchoBreakpoint() {
try {
apiManager.removeEchoBreakpoint(null, null);
fail();
} catch (final NullPointerException exception) {
}
apiManager.setEchoBreakpoint(module, new Address(0x123));
apiManager.setEchoBreakpoint(module, new Address(0x124));
apiManager.addListener(mockListener);
apiManager.removeEchoBreakpoint(module, new Address(0x123));
internalManager.removeBreakpoints(BreakpointType.ECHO, Sets.newHashSet(new BreakpointAddress(CommonTestObjects.MODULE, new UnrelocatedAddress(new CAddress(0x124)))));
assertEquals("removedEchoBreakpoint/123;removedEchoBreakpoint/124;", mockListener.events);
assertEquals(0, apiManager.getBreakpoints().size());
apiManager.removeListener(mockListener);
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.
the class CEventValueTableModelTest method foo.
@Test
public void foo() {
final CEventValueTableModel model = new CEventValueTableModel();
final INaviModule mockModule = new MockModule();
final TraceEvent event = new TraceEvent(77, new BreakpointAddress(mockModule, new UnrelocatedAddress(new CAddress(0x123))), TraceEventType.REGULAR_BREAKPOINT, Lists.newArrayList(new TraceRegister("eax", new CAddress(0x123), new byte[] { 05, 06, 07 })));
assertEquals(0, model.getRowCount());
model.setEvent(event);
assertEquals(1, model.getRowCount());
assertEquals("eax", model.getValueAt(0, 0));
assertEquals("00000123", model.getValueAt(0, 1));
assertEquals("05 06 07", model.getValueAt(0, 2));
}
Aggregations