[Soot-list] How to profile every statement using soot?

Sai Zhang racezhang at gmail.com
Thu Jul 3 01:40:28 EDT 2008


I try to run the Main.java example in this

http://www.sable.mcgill.ca/soot/tutorial/profiler/index.html

tutorial, with the argument of *-f jimple TestCase*

An unexpected exception was thrown like:

Exception in thread "main" java.lang.RuntimeException: tried to get
nonexistent field <java.lang.System: java.io.PrintStream out>
    at soot.Scene.getField(Scene.java:328)
    at
ashes.examples.countgotos.GotoInstrumenter.addStmtsToBefore(Main.java:96)
    at
ashes.examples.countgotos.GotoInstrumenter.internalTransform(Main.java:196)
    at soot.BodyTransformer.transform(BodyTransformer.java:51)
    at soot.Transform.apply(Transform.java:104)
    at soot.BodyPack.internalApply(BodyPack.java:49)
    at soot.Pack.apply(Pack.java:124)
    at soot.PackManager.runBodyPacks(PackManager.java:772)
    at soot.PackManager.runBodyPacks(PackManager.java:452)
    at soot.PackManager.runBodyPacks(PackManager.java:371)
    at soot.PackManager.runPacks(PackManager.java:348)
    at soot.Main.run(Main.java:202)
    at soot.Main.main(Main.java:145)
    at ashes.examples.countgotos.Main.main(Main.java:53)


Is that configuration I missed? My JDK is 1.5, with the latest soot version.


My TestClass is also pretty simple:


public class TestClass {

    public void loops() {
        int i = 0;
        while(i < 100) {
            i = java.lang.Math.abs(i);
            i = i * i;
        }
    }
    public static void main(String args[]) {
        new TestClass().loops();
        return;
    }
}

Can anyone give me some hints on it?


On Thu, Jul 3, 2008 at 8:43 AM, Sai Zhang <racezhang at gmail.com> wrote:

> Thanks a lot. Eric.
>
> On Thu, Jul 3, 2008 at 12:23 AM, Eric Bodden <eric.bodden at mail.mcgill.ca>
> wrote:
>
>> Hi.
>>
>> > My simple question is that, how can i use soot to profile EVERY
>> statement in
>> > my program?  That is, record or just simply println the executed
>> statements.
>>
>> This tutorial should tell you all you need to know:
>> http://www.sable.mcgill.ca/soot/tutorial/profiler/index.html
>>
>>
> I will read this tutorial again.:)
>
>
>>
>> > Another question is that, can I map the Jimple analysis result back to
>> the
>> > Java source code?  Is there any convenient API for this purpose?
>>
>>
>
>>
>> There's not directly an API for that but there is an option
>> -keep-line-number that adds tags with Java source code positions to
>> each Jimple statement. Browse the archive of this mailing list for
>> details.
>
>
> Thanks, that's really useful.
>
>
>>
>>
>> Hope that helps,
>> Eric
>>
>> --
>> Eric Bodden
>> Sable Research Group
>> McGill University, Montréal, Canada
>>
>
>
>
> --
>
> Sai Zhang (saizhang at sjtu.edu.cn)
> http://cse.sjtu.edu.cn/~zhang <http://cse.sjtu.edu.cn/%7Ezhang>
>



-- 

Sai Zhang (saizhang at sjtu.edu.cn)
http://cse.sjtu.edu.cn/~zhang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20080703/3f2855eb/attachment.htm


More information about the Soot-list mailing list