use of com.google.security.zynamics.binnavi.API.disassembly.Address 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) {
}
}
use of com.google.security.zynamics.binnavi.API.disassembly.Address in project binnavi by google.
the class TraceLoggerTest method testHitsProject.
@Test
public void testHitsProject() throws CouldntSaveDataException, DebugExceptionWrapper {
m_mockDebugger.connect();
final Trace trace = m_projectLogger.start("Name", "Description", Lists.newArrayList(new TracePoint(m_mockModule, new Address(0x100))));
m_mockDebugger.connection.m_synchronizer.receivedEvent(new EchoBreakpointHitReply(0, 0, 0, new RegisterValues(Lists.<ThreadRegisters>newArrayList(new ThreadRegisters(0, Lists.newArrayList(new RegisterValue("esp", BigInteger.valueOf(0x1100), new byte[0], true, false)))))));
m_projectLogger.stop();
assertEquals("Name", trace.getName());
assertEquals("Description", trace.getDescription());
assertEquals(1, trace.getEvents().size());
assertEquals(0x100, trace.getEvents().get(0).getAddress().toLong());
assertEquals("TraceLogger [Debugger 'Mock' : Mock Project]", m_projectLogger.toString());
}
use of com.google.security.zynamics.binnavi.API.disassembly.Address in project binnavi by google.
the class TraceLoggerTest method testHits.
@Test
public void testHits() throws CouldntSaveDataException, DebugExceptionWrapper {
m_mockDebugger.connect();
final Trace trace = m_logger.start("Name", "Description", Lists.newArrayList(new TracePoint(m_mockModule, new Address(0x100)), new TracePoint(m_mockModule, new Address(0x100))));
m_mockDebugger.connection.m_synchronizer.receivedEvent(new EchoBreakpointHitReply(0, 0, 0, new RegisterValues(Lists.<ThreadRegisters>newArrayList(new ThreadRegisters(0, Lists.newArrayList(new RegisterValue("esp", BigInteger.valueOf(0x1100), new byte[0], true, false)))))));
m_logger.stop();
assertEquals("Name", trace.getName());
assertEquals("Description", trace.getDescription());
assertEquals(1, trace.getEvents().size());
assertEquals(0x100, trace.getEvents().get(0).getAddress().toLong());
assertEquals("TraceLogger [Debugger 'Mock' : Mock Module]", m_logger.toString());
}
use of com.google.security.zynamics.binnavi.API.disassembly.Address in project binnavi by google.
the class BreakpointManagerTest method testGetBreakpoints.
@Test
public void testGetBreakpoints() {
apiManager.setBreakpoint(module, new Address(0x123));
final List<Breakpoint> breakpoints = apiManager.getBreakpoints();
assertEquals(0x123, breakpoints.get(0).getAddress().toLong());
}
use of com.google.security.zynamics.binnavi.API.disassembly.Address in project binnavi by google.
the class BreakpointManagerTest method testHasEchoBreakpoint.
@Test
public void testHasEchoBreakpoint() {
try {
apiManager.hasEchoBreakpoint(null, null);
fail();
} catch (final NullPointerException exception) {
}
assertFalse(apiManager.hasEchoBreakpoint(module, new Address(0x123)));
apiManager.setEchoBreakpoint(module, new Address(0x123));
assertTrue(apiManager.hasEchoBreakpoint(module, new Address(0x123)));
}
Aggregations