use of com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress in project binnavi by google.
the class CGraphDebuggerTest method testRemoveBreakpoint3.
@Test
public void testRemoveBreakpoint3() {
final Set<BreakpointAddress> breakpointAddresses = Sets.newHashSet(new BreakpointAddress(m_module, new UnrelocatedAddress(new CAddress(0x1123))), new BreakpointAddress(m_module, new UnrelocatedAddress(new CAddress(0x1124))));
m_debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, breakpointAddresses);
m_debugger.getBreakpointManager().setBreakpointStatus(BreakpointType.REGULAR, BreakpointStatus.BREAKPOINT_ACTIVE, 1);
CGraphDebugger.removeBreakpoint(m_debugger.getBreakpointManager(), m_module, new UnrelocatedAddress(new CAddress(0x1123)));
CGraphDebugger.removeBreakpoint(m_debugger.getBreakpointManager(), m_module, new UnrelocatedAddress(new CAddress(0x1124)));
assertEquals(0, m_debugger.getBreakpointManager().getNumberOfBreakpoints(BreakpointType.REGULAR));
}
use of com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress in project binnavi by google.
the class CGraphDebuggerTest method testGetBreakpointStatus.
@Test
public void testGetBreakpointStatus() {
m_debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(m_module, new UnrelocatedAddress(new CAddress(0x123)))));
assertEquals(BreakpointStatus.BREAKPOINT_INACTIVE, CGraphDebugger.getBreakpointStatus(m_debugger.getBreakpointManager(), m_module, new UnrelocatedAddress(new CAddress(0x123))));
}
use of com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress in project binnavi by google.
the class CGraphDebuggerTest method testToggleBreakpoint.
@Test
public void testToggleBreakpoint() {
CGraphDebugger.toggleBreakpoint(m_debugger.getBreakpointManager(), m_module, new UnrelocatedAddress(new CAddress(0x123)));
assertEquals(1, m_debugger.getBreakpointManager().getNumberOfBreakpoints(BreakpointType.REGULAR));
assertEquals(0x123, m_debugger.getBreakpointManager().getBreakpoint(BreakpointType.REGULAR, 0).getAddress().getAddress().getAddress().toLong());
assertEquals(BreakpointStatus.BREAKPOINT_INACTIVE, m_debugger.getBreakpointManager().getBreakpointStatus(BreakpointType.REGULAR, 0));
CGraphDebugger.toggleBreakpoint(m_debugger.getBreakpointManager(), m_module, new UnrelocatedAddress(new CAddress(0x123)));
assertEquals(0, m_debugger.getBreakpointManager().getNumberOfBreakpoints(BreakpointType.REGULAR));
}
use of com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress in project binnavi by google.
the class CGraphDebuggerTest method testToggleBreakpointStatus.
@Test
public void testToggleBreakpointStatus() {
CGraphDebugger.toggleBreakpoint(m_debugger.getBreakpointManager(), m_module, new UnrelocatedAddress(new CAddress(0x123)));
assertEquals(1, m_debugger.getBreakpointManager().getNumberOfBreakpoints(BreakpointType.REGULAR));
assertEquals(0x123, m_debugger.getBreakpointManager().getBreakpoint(BreakpointType.REGULAR, 0).getAddress().getAddress().getAddress().toLong());
assertEquals(BreakpointStatus.BREAKPOINT_INACTIVE, m_debugger.getBreakpointManager().getBreakpointStatus(BreakpointType.REGULAR, 0));
CGraphDebugger.toggleBreakpointStatus(m_debugger.getBreakpointManager(), m_module, new UnrelocatedAddress(new CAddress(0x123)));
assertEquals(1, m_debugger.getBreakpointManager().getNumberOfBreakpoints(BreakpointType.REGULAR));
assertEquals(0x123, m_debugger.getBreakpointManager().getBreakpoint(BreakpointType.REGULAR, 0).getAddress().getAddress().getAddress().toLong());
assertEquals(BreakpointStatus.BREAKPOINT_DISABLED, m_debugger.getBreakpointManager().getBreakpointStatus(BreakpointType.REGULAR, 0));
CGraphDebugger.toggleBreakpointStatus(m_debugger.getBreakpointManager(), m_module, new UnrelocatedAddress(new CAddress(0x123)));
assertEquals(1, m_debugger.getBreakpointManager().getNumberOfBreakpoints(BreakpointType.REGULAR));
assertEquals(0x123, m_debugger.getBreakpointManager().getBreakpoint(BreakpointType.REGULAR, 0).getAddress().getAddress().getAddress().toLong());
assertEquals(BreakpointStatus.BREAKPOINT_INACTIVE, m_debugger.getBreakpointManager().getBreakpointStatus(BreakpointType.REGULAR, 0));
}
use of com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress in project binnavi by google.
the class PostgreSQLTracesLoader method loadTraceEvents.
/**
* Loads the trace events of a trace list from the database.
*
* @param connection The connection to the database.
* @param traceList The trace list whose events are loaded.
* @param modules List of all modules stored in the database.
*
* @throws SQLException Thrown if the trace events could not be loaded.
*/
private static void loadTraceEvents(final CConnection connection, final TraceList traceList, final List<? extends INaviModule> modules) throws SQLException {
final List<List<TraceRegister>> values = loadTraceEventValues(connection, traceList);
final String query = "select tid, module_id, address, type from " + CTableNames.TRACE_EVENT_TABLE + " where trace_id = " + traceList.getId() + " order by position asc";
final ResultSet resultSet = connection.executeQuery(query, true);
int counter = 0;
try {
while (resultSet.next()) {
final long tid = resultSet.getLong("tid");
final int moduleId = resultSet.getInt("module_id");
final INaviModule module = resultSet.wasNull() ? null : findModule(modules, moduleId);
final BreakpointAddress address = new BreakpointAddress(module, new UnrelocatedAddress(PostgreSQLHelpers.loadAddress(resultSet, "address")));
final int event = resultSet.getInt("type");
traceList.addEvent(new TraceEvent(tid, address, TraceEventType.parseInt(event), values.isEmpty() ? new ArrayList<TraceRegister>() : values.get(counter)));
counter++;
}
} finally {
resultSet.close();
}
}
Aggregations