use of com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceEvent in project binnavi by google.
the class CEventTableMenu method addOpenFunction.
/**
* Adds a menu item to open the selected trace.
*
* @param parent Parent window of the menu.
* @param traces The selected traces.
*/
private void addOpenFunction(final Window parent, final List<ITraceEvent> traces) {
if (traces.size() == 1) {
final ITraceEvent trace = traces.get(0);
final INaviModule module = trace.getOffset().getModule();
if (module.isLoaded()) {
final INaviFunction function = module.getContent().getFunctionContainer().getFunction(trace.getOffset().getAddress().getAddress());
if (function != null) {
final IViewContainer container = graphModel.getViewContainer();
final INaviView view = container.getView(function);
if (view != null) {
add(new JMenuItem(CActionProxy.proxy(new COpenInLastWindowAction(parent, container, new INaviView[] { view }))));
addSeparator();
}
}
}
}
}
use of com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceEvent in project binnavi by google.
the class PostgreSQLProviderTest method testTraceFunctionsSave1.
@Test
public void testTraceFunctionsSave1() throws CouldntLoadDataException, LoadCancelledException, CouldntSaveDataException {
final INaviProject project = getProvider().createProject("SOME_PROJECT");
getProvider().createTrace(project, "SOME_TRACE", "SOME_TRACE_DESCRIPTION");
project.load();
final TraceList trace = project.getContent().getTraces().get(0);
final INaviModule module = getProvider().loadModules().get(0);
module.load();
final long tid = 0x1L;
final UnrelocatedAddress address2 = new UnrelocatedAddress(new CAddress(0x1234));
final BreakpointAddress address = new BreakpointAddress(module, address2);
final TraceEventType type = TraceEventType.ECHO_BREAKPOINT;
final List<TraceRegister> values = new ArrayList<>();
final ITraceEvent event = new TraceEvent(tid, address, type, values);
trace.addEvent(event);
trace.setDescription("burzelbarf");
PostgreSQLTraceFunctions.save((AbstractSQLProvider) getProvider(), trace);
project.close();
INaviProject project2 = null;
for (final INaviProject cProject : getProvider().loadProjects()) {
if (cProject.getConfiguration().getId() == project.getConfiguration().getId()) {
project2 = cProject;
}
}
getProvider().createTrace(project2, "SOME_TRACE_2", "SOME_TRACE_DESCRIPTION_2");
project2.load();
final TraceList trace2 = project2.getContent().getTraces().get(0);
assertEquals("burzelbarf", trace2.getDescription());
}
use of com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceEvent in project binnavi by google.
the class CRegisterFilterExpression method evaluate.
@Override
public boolean evaluate(final CTraceEventWrapper element) {
final ITraceEvent trace = element.unwrap();
boolean returnValue = false;
for (final TraceRegister register : trace.getRegisterValues()) {
if ("any".equalsIgnoreCase(m_register) || register.getName().equalsIgnoreCase(m_register)) {
returnValue |= evaluateExpression(m_predicate, register, m_value);
}
}
return returnValue;
}
use of com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceEvent in project binnavi by google.
the class CTraceCombinationFunctions method createCombinedTrace.
/**
* Fills a combined trace from the events of multiple input traces.
*
* @param newTrace The trace to fill.
* @param traces The input events.
* @param addresses The addresses of the events to put into the combined trace.
*/
private static void createCombinedTrace(final TraceList newTrace, final List<TraceList> traces, final Set<BreakpointAddress> addresses) {
final Set<BreakpointAddress> visitedAddresses = new LinkedHashSet<BreakpointAddress>();
for (final TraceList trace : traces) {
for (final ITraceEvent event : trace) {
final BreakpointAddress address = event.getOffset();
if (!addresses.contains(address)) {
continue;
}
if (visitedAddresses.contains(address)) {
continue;
}
visitedAddresses.add(address);
newTrace.addEvent(event);
}
}
}
use of com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceEvent in project binnavi by google.
the class CTraceFunctions method setBreakpoints.
/**
* Sets breakpoints on trace events.
*
* @param model Provides the active debugger.
* @param events Events on which breakpoints are set.
*/
public static void setBreakpoints(final CDebugPerspectiveModel model, final List<ITraceEvent> events) {
final IDebugger debugger = model.getCurrentSelectedDebugger();
if (debugger == null) {
return;
}
final List<INaviModule> modules = debugger.getModules();
final Set<BreakpointAddress> addresses = new HashSet<BreakpointAddress>();
for (final ITraceEvent event : events) {
final BreakpointAddress address = event.getOffset();
if ((address.getModule() == null) || (modules.contains(address.getModule()) && !debugger.getBreakpointManager().hasBreakpoint(BreakpointType.REGULAR, address))) {
addresses.add(address);
}
}
debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, addresses);
}
Aggregations