use of com.google.security.zynamics.binnavi.API.disassembly.TracePoint 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.TracePoint 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.TracePoint in project binnavi by google.
the class TraceLogger method start.
// / Starts trace logging.
/**
* Starts trace logging with this logger.
*
* @param name The name of the new trace.
* @param description The description of the new trace.
* @param addresses List of addresses where echo breakpoints should be set.
*
* @return The created event trace.
*
* @throws CouldntSaveDataException Thrown if the event trace could not be written to the
* database.
*/
public Trace start(final String name, final String description, final List<TracePoint> addresses) throws CouldntSaveDataException {
Preconditions.checkArgument(debugger.isConnected(), "Error: Debugger must be connected");
Preconditions.checkArgument(logger == null, "Error: Addresses argument can not be null");
Preconditions.checkNotNull(addresses, "Error: Addresses argument can not be null");
for (final TracePoint address : addresses) {
Preconditions.checkNotNull(address, "Error: Addresses list contains null-elements");
}
try {
final TraceList trace = createTrace(name, description);
logger = createLogger();
logger.start(trace, convertAddresses(addresses), 3);
return ObjectFinders.getObject(trace, getTraces());
} catch (final com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException e) {
throw new CouldntSaveDataException(e);
}
}
use of com.google.security.zynamics.binnavi.API.disassembly.TracePoint in project binnavi by google.
the class TraceLoggerTest method testEmptyHits.
@Test
public void testEmptyHits() throws CouldntSaveDataException, DebugExceptionWrapper {
m_mockDebugger.connect();
final Trace trace = m_logger.start("Name", "Description", Lists.newArrayList(new TracePoint(m_mockModule, new Address(0x100))));
m_logger.stop();
assertEquals("Name", trace.getName());
assertEquals("Description", trace.getDescription());
assertTrue(trace.getEvents().isEmpty());
}
use of com.google.security.zynamics.binnavi.API.disassembly.TracePoint in project binnavi by google.
the class TraceLoggerTest method testStartErrors.
@Test
public void testStartErrors() throws CouldntSaveDataException, DebugExceptionWrapper {
try {
@SuppressWarnings("unused") final Trace trace = m_logger.start("Name", "Description", Lists.newArrayList(new TracePoint(m_mockModule, new Address(0x100))));
fail();
} catch (final IllegalArgumentException exception) {
}
m_mockDebugger.connect();
try {
@SuppressWarnings("unused") final Trace trace = m_logger.start(null, "Description", Lists.newArrayList(new TracePoint(m_mockModule, new Address(0x100))));
fail();
} catch (final NullPointerException exception) {
}
try {
@SuppressWarnings("unused") final Trace trace = m_logger.start("Name", null, Lists.newArrayList(new TracePoint(m_mockModule, new Address(0x100))));
fail();
} catch (final NullPointerException exception) {
}
try {
@SuppressWarnings("unused") final Trace trace = m_logger.start("Name", "Description", null);
fail();
} catch (final NullPointerException exception) {
}
try {
@SuppressWarnings("unused") final Trace trace = m_logger.start("Name", "Description", Lists.newArrayList(new TracePoint(m_mockModule, null)));
fail();
} catch (final NullPointerException exception) {
}
@SuppressWarnings("unused") final Trace trace = m_logger.start("Name", "Description", Lists.newArrayList(new TracePoint(m_mockModule, new Address(0x100))));
try {
m_logger.start("Name", "Description", Lists.newArrayList(new TracePoint(m_mockModule, new Address(0x100))));
fail();
} catch (final IllegalArgumentException exception) {
}
m_logger.stop();
try {
m_logger.stop();
fail();
} catch (final NullPointerException exception) {
}
}
Aggregations