[Soot-list] Problems While Trying to Generate CFG on Windows 7

Linghui Luo linghui.luo at uni-paderborn.de
Sun Jul 16 05:07:25 EDT 2017


Hi Ekin,

If you wanna use the wjap.purity phase, I think you should add:

-w
–no-bodies-for-excluded
-p wjap.purity on
-p wjap.purity dump-intra:true

in front of -cp . -pp -process-dir ..\..\
The option –p is to pack phases, it should followed by the phase and an option for it.

However, I never used this phase. I am not sure if you will get your expected CFG.dot. It seems to me that the .dot files generated by wjap.purity are annotated analysis.

Anyone else know that if soot supports outputting a .dot CFG?

Best regards,
Linghui


Von: Ekincan Ufuktepe [mailto:ekincanufuktepe at gmail.com]
Gesendet: Freitag, 14. Juli 2017 23:52
An: Linghui Luo <linghui.luo at uni-paderborn.de>
Betreff: Re: [Soot-list] Problems While Trying to Generate CFG on Windows 7

Hello Linghui,

Thanks for the quick response and advice!

It seems that using "-allow-phantom-refs" worked well. What I did is;

java -cp soot-2.5.0.jar soot.Main -allow-phantom-refs -cp . -process-dir ..\..\myJavaProject

Also, I might have forgotten to mention it, but "myJavaProject" contains both source and bytecode. Therefore, it worked anyways.

So my next step is to generate a CFG. Since that I wanted a CFG output of "myJavaProject", having a .DOT output would be nice. On the phase option list, it looks like to get a .DOT control-flow graph "wjap.purity" is the only option. When I give the following command below, unfortunately I don't get any .DOT file. Or maybe I am using the wrong phaseName to generate a CFG of "myJavaProject"?

java -cp soot-2.5.0.jar soot.Main -allow-phantom-refs -cp . -pp -process-dir ..\..\myJavaProject -dump-cfg wjap.purity

Best Regards,

Ekin




2017-07-14 17:24 GMT+03:00 Linghui Luo <linghui.luo at uni-paderborn.de<mailto:linghui.luo at uni-paderborn.de>>:
Hi Ekin,


1.      Are you sure in your target directory there are .class files which contains the java bytecode of your source codes? Since you mentioned that you proceed a .java file. Soot processes java byte code and transforms it into Jimple.

2.      I think one reason for this kind of error
 Error: Exception in thread "main" java.lang.RuntimeException: couldn't load classfile: java.io.ObjectInputStream
is that this class is seen as a phantom class to soot, since it’s a native class of java. Therefore, I will suggest you to add
the option “–allow-phantom-refs”.

3.      You can use soot as a library by just downloading the nightlybuild
https://soot-build.cs.uni-paderborn.de/nightly/soot/

Best regards,
Linghui
Von: Soot-list [mailto:soot-list-bounces at CS.McGill.CA<mailto:soot-list-bounces at CS.McGill.CA>] Im Auftrag von Ekincan Ufuktepe
Gesendet: Freitag, 14. Juli 2017 15:09
An: soot-list at cs.mcgill.ca<mailto:soot-list at cs.mcgill.ca>
Betreff: [Soot-list] Problems While Trying to Generate CFG on Windows 7

Hi,

I have been trying to generate a CFG (control-flow graph) by using Soot. First I tried to run Soot on command-line and I have been following the instruction on the link.

Here are a couple of trials I have made and the errors I have received.

1)
Command: java -cp soot-2.5.0.jar soot.Main -cp . -process-dir ..\....\myJavaProject

Error: Exception in thread "main" java.lang.RuntimeException: couldn't find class: xxx.yyy.zzz.MyClass (is your soot-class-path set properly?)

"xxx.yyy.zzz.MyClass" is one of the package and class information that is in "myJavaProject"

2)
Command: Command: java -cp soot-2.5.0.jar soot.Main -cp . -pp -process-dir ..\....\myJavaProject

Error: Exception in thread "main" java.lang.RuntimeException: couldn't load classfile: java.io.ObjectInputStream

=============================================

However, when I try to process a single .java file within the same directory with soot-2.5.0.jar I get a different error.

3)
Command: java -cp soot-2.5.0.jar soot.Main -cp . MyClass

Error: Exception in thread "main" java.lang.Error: Error loading java.util.regex.Pattern

So tried to use by giving rt.jar's path.

4) Command: java -cp soot-2.5.0.jar soot.Main -cp . ..\...\Java\jre1.8.0_111\lib\rt.jar MyClass

Error: Exception in thread "main" java.lang.RuntimeException: couldn't find class: ..\...\Java\jre1.8.0_111\lib\rt.jar (is your soot-class-path set properly?)

Or another option

5) Command: java -cp soot-2.5.0.jar soot.Main -cp . -pp MyClass

Error: Exception in thread "main" java.lang.RuntimeException: couldn't load classfile: java.io.ObjectInputStream

I wanted to generate a CFG by using the "dump-cfg", but it seems that I got stuck with the basics. I would really appreciate any with to generate a CFG of a Java project.

Or rather than running Soot on command-line, is it possible to generate a CFG by using soot-2.5.0.jar as a library. If yes, could you please show me how to do it?

Thanks in advance.

Ekin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20170716/bb9d8bdc/attachment-0001.html>


More information about the Soot-list mailing list