Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Test.jar
Binary file not shown.
7 changes: 6 additions & 1 deletion boomerangPDS/src/main/java/boomerang/QueryGraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,12 @@ public void onOutTransitionAdded(
WeightedPAutomaton<Edge, INode<Val>, W> weightedPAutomaton) {
if (t.getStart() instanceof GeneratedState && callee != null) {
Edge callSiteLabel = t.getLabel();
getSolver(child).allowUnbalanced(callee, callSiteLabel);
getSolver(child)
.allowUnbalanced(
callee,
(parent instanceof BackwardQuery
? callSiteLabel.getTarget()
: callSiteLabel.getStart()));
}
if (t.getTarget() instanceof GeneratedState) {
getSolver(parent)
Expand Down
83 changes: 83 additions & 0 deletions boomerangPDS/src/main/java/boomerang/WeightedBoomerang.java
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,10 @@ public DefaultValueMap<BackwardQuery, BackwardBoomerangSolver<W>> getBackwardSol
return queryToBackwardSolvers;
}

public QueryGraph<W> getQueryGraph() {
return queryGraph;
}

private final class EmptyFieldListener
extends WPAStateListener<Field, INode<Node<ControlFlowGraph.Edge, Val>>, W> {

Expand Down Expand Up @@ -967,6 +971,85 @@ public BackwardBoomerangResults<W> solve(BackwardQuery query, boolean timing) {
query, timedout, this.queryToSolvers, backwardSolverIns, getStats(), analysisWatch);
}

public BackwardBoomerangResults<W> solveUnderScope(
BackwardQuery query, Node<Edge, Val> triggeringNode, Query parentQuery) {
if (!options.allowMultipleQueries() && solving) {
throw new RuntimeException(
"One cannot re-use the same Boomerang solver for more than one query, unless option allowMultipleQueries is enabled. If allowMultipleQueries is enabled, ensure to call unregisterAllListeners() on this instance upon termination of all queries.");
}
solving = true;
if (!analysisWatch.isRunning()) {
analysisWatch.start();
}
boolean timedout = false;
try {

LOGGER.trace("Starting backward analysis of: {}", query);
backwardSolve(query);
queryGraph.addEdge(parentQuery, triggeringNode, query);
this.debugOutput();
} catch (BoomerangTimeoutException e) {
timedout = true;
LOGGER.info("Timeout ({}) of query: {} ", analysisWatch, query);
}
if (analysisWatch.isRunning()) {
analysisWatch.stop();
}
return new BackwardBoomerangResults<W>(
query, timedout, this.queryToSolvers, backwardSolverIns, getStats(), analysisWatch);
}

public ForwardBoomerangResults<W> solveUnderScope(
ForwardQuery query, Node<Edge, Val> triggeringNode, Query parentQuery) {
if (!options.allowMultipleQueries() && solving) {
throw new RuntimeException(
"One cannot re-use the same Boomerang solver for more than one query, unless option allowMultipleQueries is enabled. If allowMultipleQueries is enabled, ensure to call unregisterAllListeners() on this instance upon termination of all queries.");
}
solving = true;
if (!analysisWatch.isRunning()) {
analysisWatch.start();
}
boolean timedout = false;
try {
LOGGER.trace("Starting forward analysis of: {}", query);
forwardSolve(query);
LOGGER.trace(
"Query terminated in {} ({}), visited methods {}",
analysisWatch,
query,
visitedMethods.size());
queryGraph.addEdge(parentQuery, triggeringNode, query);
} catch (BoomerangTimeoutException e) {
timedout = true;
LOGGER.trace(
"Timeout ({}) of query: {}, visited methods {}",
analysisWatch,
query,
visitedMethods.size());
} catch (Throwable e) {
LOGGER.error("Solving query crashed in {}", e);
}
if (!options.allowMultipleQueries()) {
unregisterAllListeners();
}

if (analysisWatch.isRunning()) {
analysisWatch.stop();
}
return new ForwardBoomerangResults<W>(
query,
icfg(),
cfg(),
timedout,
this.queryToSolvers,
getStats(),
analysisWatch,
visitedMethods,
options.trackDataFlowPath(),
options.prunePathConditions(),
options.trackImplicitFlows());
}

public void debugOutput() {
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Query Graph \n{}", queryGraph.toDotString());
Expand Down
Loading