[Soot-list] Can I use soot to do this

Venkatesh Prasad Ranganath vranganath at sbcglobal.net
Fri Aug 4 11:33:29 EDT 2006


On Fri, 2006-08-04 at 08:35 +1000, Nicholas Irving wrote: 

> Hi
> I have been expirementing (without success) to generate a Call Graph
> of a simple HelloWorld application, so as to be able to see if it
> makes a call to a particular System Function. For example I wanted to
> see when using FileWriter it made a called to FileOutputStream
> 
> public static void main(String[] args) throws IOException, NamingException {
>          FileWriter out = new FileWriter("test.txt");
> }
> 
> produces
> 
> HelloWorld<init>()V
> 	java.lang.Object<init>()V
> HelloWorldmain([Ljava/lang/String;)V
> 	java.io.FileWriter<init>(Ljava/lang/String;)V
> 		java.io.FileOutputStream<init>(Ljava/lang/String;)V
> 		java.io.OutputStreamWriter<init>(Ljava/io/OutputStream;)V
> 
> Is this type of analysis possible with Soot?


In the above example, the presence of the call chain from
"java.io.FileWriter<init>(Ljava/lang/String;)V" to
"java.io.FileOutputStream<init>(Ljava/lang/String;)V" in the call graph
implies an "yes" answer to the question "Will the execution of a
FileWriter method result in the execution of a FileOutputStream method?"

Generally, if you can recast your questions as graph-reachability
questions, then a simple search (DFS/BFS) on the call graph will suffice
to answer (e.g. questions of the form "Is there a call path from method
X to method Y?").  In analysis toolkits like Indus
(http://indus.projects.cis.ksu.edu), the call graph already has features
to answer such questions.

NOTE: The above approach will not suffice to answer the question "Will
the invocation of a FileWriter method result in the execution of a
FileOutputStream method?" in the presence of dynamic dispatching.  For
this, you will need to use a different approach that relies on points-to
analysis results.

Hope that helps,

-- 

Venkatesh Prasad Ranganath 
e-id: venkateshprasad.ranganath at gmail.com 
e-id: rvprasad at ksu.edu
web:  http://www.cis.ksu.edu/~rvprasad
blog: http://venkateshthinks.blogspot.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20060804/35b6e43d/attachment.htm


More information about the Soot-list mailing list