[Soot-list] how to process single class file to a jimple file

毅力公司 472408570 at qq.com
Mon Mar 10 12:29:07 EDT 2014


Dear all,
I am just beginning to learn to use the Soot.
I am in trouble with how to process the single class file to a jimple file by command-line and in eclipse. Do someone can give me a help? 
screenshot are attached below~
the command-line:
jasonxie at jasonxie-HP-ENVY-15-Notebook-PC:~/Downloads/SootTest/SootTest/test$ ls
InvokeStaticInstrumenter.class  MainDriver.class  MyCounter.class  soot-2.5.0.jar  TestInvoke.class
jasonxie at jasonxie-HP-ENVY-15-Notebook-PC:~/Downloads/SootTest/SootTest/test$ java -jar soot-2.5.0.jar -cp .:"%JAVA_HOME%"\jre\lib\rt.jar TestInvoke.java
Soot started on Tue Mar 11 00:10:27 HKT 2014
Exception in thread "main" java.lang.RuntimeException: couldn't find class: TestInvoke.java (is your soot-class-path set properly?)
	at soot.SootResolver.bringToHierarchy(SootResolver.java:205)
	at soot.SootResolver.bringToSignatures(SootResolver.java:239)
	at soot.SootResolver.processResolveWorklist(SootResolver.java:154)
	at soot.SootResolver.resolveClass(SootResolver.java:124)
	at soot.Scene.loadClass(Scene.java:448)
	at soot.Scene.loadClassAndSupport(Scene.java:433)
	at soot.Scene.loadNecessaryClass(Scene.java:1053)
	at soot.Scene.loadNecessaryClasses(Scene.java:1067)
	at soot.Main.run(Main.java:167)
	at soot.Main.main(Main.java:141)



how to transfer the TestInvoke.class to a jimple file?
or In eclipse:
I got a TestInvoke.class in the "sootOutput"filefolder , it was show like this:

But when transferred it  a jimple file by right-click to create a jimple file for TestInvoke.class
It was different with the the original TestInvoke.class file:
class TestInvoke extends java.lang.Object
{
    private static int calls;


    static void <clinit>()
    {
        <TestInvoke: int calls> = 0;
        return;
    }


    void <init>()
    {
        TestInvoke r0;


        r0 := @this: TestInvoke;
        specialinvoke r0.<java.lang.Object: void <init>()>();
        return;
    }


    public static void main(java.lang.String[])
    {
        java.lang.String[] r0;
        int i0, $i1;
        java.io.PrintStream $r1;
        java.lang.StringBuilder $r2, $r3, $r4;
        java.lang.String $r5;


        r0 := @parameter0: java.lang.String[];
        i0 = 0;
        goto label1;


     label0:
        staticinvoke <TestInvoke: void foo()>();
        i0 = i0 + 1;


     label1:
        if i0 < 10 goto label0;


        $r1 = <java.lang.System: java.io.PrintStream out>;
        $r2 = new java.lang.StringBuilder;
        specialinvoke $r2.<java.lang.StringBuilder: void <init>(java.lang.String)>("I made ");
        $i1 = <TestInvoke: int calls>;
        $r3 = virtualinvoke $r2.<java.lang.StringBuilder: java.lang.StringBuilder append(int)>($i1);
        $r4 = virtualinvoke $r3.<java.lang.StringBuilder: java.lang.StringBuilder append(java.lang.String)>(" static calls");
        $r5 = virtualinvoke $r4.<java.lang.StringBuilder: java.lang.String toString()>();
        virtualinvoke $r1.<java.io.PrintStream: void println(java.lang.String)>($r5);
        return;
    }


    private static void foo()
    {
        int $i0, $i1;


        $i0 = <TestInvoke: int calls>;
        $i1 = $i0 + 1;
        <TestInvoke: int calls> = $i1;
        staticinvoke <TestInvoke: void bar()>();
        return;
    }


    private static void bar()
    {
        int $i0, $i1;


        $i0 = <TestInvoke: int calls>;
        $i1 = $i0 + 1;
        <TestInvoke: int calls> = $i1;
        return;
    }
}

Looking forward your help.
Thanks a lot.
Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20140311/217ec0a8/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/octet-stream
Size: 51367 bytes
Desc: not available
Url : http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20140311/217ec0a8/attachment-0001.obj 


More information about the Soot-list mailing list