[Soot-list] Problem of mapping runnable object to its caller method
Xinxin Jin
xinxin at cs.ucsd.edu
Wed Feb 11 23:40:10 EST 2015
Hi all,
I have a problem in tracing a runnable object's caller method. To make it
clear, I simplified my code as follows:
public class A {
public void Foo () {
Thread t = new Thread(new MyFirstHandler());
}
private class MyFirstHandler implements Runnable {
@Override
public void run() {
CreateFile();
}
}
}
public class B {
public void Bar () {
Thread t = new Thread(new MySecondHandler());
}
....
}
My problem is : Given method CreateFile(), I want to trace back to get its
caller method. Ideally I should get "A.Foo()".
My algorithm is to use InterproceduralCFG.getCallersOf() provided by heros,
starting from createFile() and tracing backwards level by level:
(1) Get <java.lang.Thread: void run()> as the only caller of CreateFile()
(2) Continue to get the callers of <java.lang.Thread: void run()>.
Now you may guess what happens: Because both A.Foo() and B.Bar() call
<java.lang.Thread:
void run()>, I get A.Foo() and B.Bar() as createFile()'s caller methods.
So my question is how to remove B.Bar() from my results ?
Thanks a lot !
--
Xinxin Jin
Ph.D. student, Computer Science
University of California, San Diego
http://cseweb.ucsd.edu/~x7jin/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20150211/eee2bbf4/attachment.html
More information about the Soot-list
mailing list