You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I am trying to use Soot Spark for generating static call graphs. My aim is to use the call graphs in the following way -
If a method is changed in the code, I want to backtrack along the call graph to figure out all the methods that it is going to affect.
Now, the case where I'm facing a issue is as follows -
Consider the case where I have a parent class A (methods - process(), handle()) and 2 classes, B and C inherit it.
B and C override the method handle() but not process().
Consider 2 cases:
Case 1: We only call b.process() in the code -
In this case, the methods reachable from D.func1() are precise -
Case 2: We call both b.process() and c.process() but from 2 methods -
However, in this case, C.handle() is also shown as a reachable method from D.func1()
As a result of this issue, I end up marking false positive methods too while backtracking from a method, say that is probably called from B.handle(). For eg: if b.handle() call a method foo(), and foo() is changed, we end up marking both D.func1() and D.func2() as affected, when in truth only D.func1() should be affected.
I understand that this is due to the fact that we find methods iteratively
Is there some way in which I can get reachable methods more precisely
Note:
This is the way I call reachable methods
`String targetClassName = "D";
String targetMethodName = "func1";
SootMethod sm = Scene.v().getSootClass(targetClassName).getMethodByName(targetMethodName);
System.out.println("\nMETHODS REACHABLE FROM: " + sm);
System.out.println("Reachable methods:");
ReachableMethods rm;
rm = new ReachableMethods(cgSpark, Collections.singleton(sm));
rm.update();
Set<String> sigs = new HashSet<String>();
QueueReader<MethodOrMethodContext> qr = rm.listener();
while (qr.hasNext()) {
MethodOrMethodContext momc = qr.next();
if (momc != null) {
SootMethod m = momc.method();
if (m.isConcrete()) {
String sig = m.getBytecodeSignature();
if (sigs.add(sig)) {
System.out.println(m);
}
}
}
}`
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
I am trying to use Soot Spark for generating static call graphs. My aim is to use the call graphs in the following way -
If a method is changed in the code, I want to backtrack along the call graph to figure out all the methods that it is going to affect.
Now, the case where I'm facing a issue is as follows -
Consider the case where I have a parent class A (methods - process(), handle()) and 2 classes, B and C inherit it.
B and C override the method handle() but not process().
Consider 2 cases:
Case 1: We only call b.process() in the code -
In this case, the methods reachable from D.func1() are precise -
Case 2: We call both b.process() and c.process() but from 2 methods -
However, in this case, C.handle() is also shown as a reachable method from D.func1()
As a result of this issue, I end up marking false positive methods too while backtracking from a method, say that is probably called from B.handle(). For eg: if b.handle() call a method foo(), and foo() is changed, we end up marking both D.func1() and D.func2() as affected, when in truth only D.func1() should be affected.
I understand that this is due to the fact that we find methods iteratively
Is there some way in which I can get reachable methods more precisely
Note:
This is the way I call reachable methods
And this is the spark config I've been using
Beta Was this translation helpful? Give feedback.
All reactions