use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.
the class CGraphDebuggerTest method testHasBreakpoint.
@Test
public void testHasBreakpoint() {
m_debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(m_module, new UnrelocatedAddress(new CAddress(0x123)))));
assertTrue(CGraphDebugger.hasBreakpoint(m_debugger.getBreakpointManager(), m_module, new UnrelocatedAddress(new CAddress(0x123))));
assertFalse(CGraphDebugger.hasBreakpoint(m_debugger.getBreakpointManager(), m_module, new UnrelocatedAddress(new CAddress(0x124))));
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress 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.debug.models.breakpoints.BreakpointAddress 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.debug.models.breakpoints.BreakpointAddress 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();
}
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.
the class CGraphDebugger method setBreakpoint.
/**
* Sets a breakpoint at a given address.
*
* @param manager The breakpoint manager that sets the breakpoint.
* @param module The module where the breakpoint is set.
* @param unrelocatedAddress The unrelocated address of the breakpoint.
*/
public static void setBreakpoint(final BreakpointManager manager, final INaviModule module, final UnrelocatedAddress unrelocatedAddress) {
Preconditions.checkNotNull(manager, "IE01713: Manager argument can not be null");
Preconditions.checkNotNull(module, "IE01714: Module argument can not be null");
Preconditions.checkNotNull(unrelocatedAddress, "IE01715: Address argument can not be null");
final BreakpointAddress address = new BreakpointAddress(module, unrelocatedAddress);
if (!manager.hasBreakpoint(BreakpointType.REGULAR, address)) {
manager.addBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(address));
}
}
Aggregations