use of com.google.security.zynamics.binnavi.debug.models.trace.TraceList in project binnavi by google.
the class Module method convertData.
/**
* Converts internal module data to API module data.
*/
private void convertData() {
m_traces = new ArrayList<Trace>();
for (final TraceList trace : m_module.getContent().getTraceContainer().getTraces()) {
m_traces.add(new Trace(trace));
}
m_module.getContent().getTraceContainer().addListener(m_traceListener);
m_functions = new ArrayList<Function>();
for (final INaviFunction function : m_module.getContent().getFunctionContainer().getFunctions()) {
m_functions.add(new Function(this, function));
}
for (final Function function : m_functions) {
m_functionMap.put(function.getNative(), function);
}
m_views = new ArrayList<View>();
for (final INaviView view : m_module.getContent().getViewContainer().getViews()) {
m_views.add(new View(this, view, m_nodeTagManager, m_viewTagManager));
}
createCallgraph();
}
use of com.google.security.zynamics.binnavi.debug.models.trace.TraceList 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.debug.models.trace.TraceList in project binnavi by google.
the class CEventListTableMenu method addCombineMenu.
/**
* Adds the sub menu that is makes it possible to combine multiple traces into one trace.
*
* @param parent Parent window used for dialogs.
* @param traceProvider Trace provider that provides the trace information shown in the table.
* @param selectedRows Table row indices of the selected traces.
*/
private void addCombineMenu(final JFrame parent, final ITraceListProvider traceProvider, final int[] selectedRows) {
addSeparator();
final JMenu combineMenu = new JMenu("Combine Traces");
final List<TraceList> traces = getTraces(traceProvider, selectedRows);
combineMenu.add(CActionProxy.proxy(new CActionCombineTraces(parent, traceProvider, traces)));
combineMenu.add(CActionProxy.proxy(new CActionIntersectTraces(parent, traceProvider, traces)));
if (traces.size() == 2) {
combineMenu.addSeparator();
combineMenu.add(CActionProxy.proxy(new CActionDifferenceTraces(parent, traceProvider, traces.get(0), traces.get(1))));
combineMenu.add(CActionProxy.proxy(new CActionDifferenceTraces(parent, traceProvider, traces.get(1), traces.get(0))));
}
add(combineMenu);
}
use of com.google.security.zynamics.binnavi.debug.models.trace.TraceList in project binnavi by google.
the class CTraceCombinationFunctions method unionizeTraces.
/**
* Creates a new trace that contains those events that appear in any of the input traces.
*
* @param parent Parent window used for dialogs.
* @param provider Creates the new trace.
* @param traces The input traces.
*/
public static void unionizeTraces(final JFrame parent, final ITraceListProvider provider, final List<TraceList> traces) {
new Thread() {
@Override
public void run() {
try {
final CDefaultProgressOperation operation = new CDefaultProgressOperation("", false, false);
operation.getProgressPanel().setMaximum(3);
operation.getProgressPanel().setText("Combining traces");
final TraceList newTrace = provider.createTrace("Combined Trace", "");
operation.next();
createCombinedTrace(newTrace, traces, getUnionizedAddresses(traces));
operation.next();
newTrace.save();
operation.next();
operation.stop();
} catch (final CouldntSaveDataException e) {
CUtilityFunctions.logException(e);
final String innerMessage = "E00197: " + "Could not combine debug traces";
final String innerDescription = CUtilityFunctions.createDescription("The selected traces could not be combined into a larger trace.", new String[] { "There was a problem with the database connection." }, new String[] { "The trace list was not created. You could try to combine the lists again once the connection problem was resolved." });
NaviErrorDialog.show(parent, innerMessage, innerDescription, e);
}
}
}.start();
}
use of com.google.security.zynamics.binnavi.debug.models.trace.TraceList 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);
}
}
}
Aggregations