[Soot-list] Questions about profiler2 example

Eric Bodden eric.bodden at mail.mcgill.ca
Thu Jul 16 14:11:43 EDT 2009


Sorry, I think I made a mistake. As the exception says, you have to
use addBasicClass("MyCounter",SIGNATURES). The SIGNATURES constant is
important. Otherwise, the class will not be resolved to the right
level.

Eric

2009/7/16 Kelvin Tian <kevinn.tian at gmail.com>:
> Dear Eric,
>
>    I modified the code as you said,  adding  " SootClass counterClass =
> Scene.v().getSootClass("MyCounter");"  and
> "Scene.v().addBasicClass("MyCounter");".
> But the same error still happens as below,
> Exception in thread "main" java.lang.RuntimeException: This operation
> requires resolving level SIGNATURES but MyCounter is at resolving level
> HIERARCHY
> If you are extending Soot, try to add the following call before calling
> soot.Main.main(..):
> Scene.v().addBasicClass(MyCounter,SIGNATURES);
>
> Is it supposed to be working now?  Or do I need to add a signaure level in
> addBasicClass method? Thanks for any suggestions and have a good day!
>
>
>
> --
> Best regards,
> Kelvin
>
>
> On Thu, Jul 16, 2009 at 11:59 AM, Eric Bodden <eric.bodden at mail.mcgill.ca>
> wrote:
>>
>> Hi Kelvin.
>>
>> In general it should be possible to create multiple counters that way.
>> The error that you see has nothing to do with whether you use one
>> counter or many. It rather has to do with using loadClassAndSupport.
>>
>> Instead of using loadClassAndSupport("X") I would suggest to...
>>
>> 1.) add the following call just before the call to soot.Main.main(args):
>>
>> Scene.v().addBasicClass("X");
>>
>> 2.) Then within the internalTransform method, simply access the class via:
>>
>> Scene.v().getClass("X");
>>
>> Eric
>>
>> 2009/7/16 Kelvin Tian <kevinn.tian at gmail.com>:
>> >     I'm using Soot to do some instrumentation, and I've some questions
>> > related to the profiler2 example, under link
>> > http://www.sable.mcgill.ca/soot/tutorial/profiler2/index.html ?
>> >  In this example, I see it use a counter class to add a counter to count
>> > the
>> > number of InvokeStatic statements, and there's only one counter.  If I
>> > want
>> > to create several counters to get different profiling information, can I
>> > create several instances of counter class and use each instance to count
>> > different things?
>> > I tried to do that, coding similarly like below,
>> > (ie:
>> >    SootClass counter1 =  Scene.v().loadClassAndSupport("MyCounter");
>> >    increaseCounter1 = counter1.getMethod("void increase(int)");
>> >    .....
>> >    SootClass counter2 =  Scene.v().loadClassAndSupport("MyCounter");
>> >    increaseCounter2 = counter2.getMethod("void increase(int)");
>> >    ...
>> > )
>> > but I got a lot of runtime errors like this: " Exception in thread
>> > "main"
>> > java.lang.RuntimeException: This operation requires resolving level
>> > SIGNATURES but MyCounter is at resolving level HIERARCHY  If you are
>> > extending Soot, try to add the following call before calling
>> > soot.Main.main
>> > "
>> >
>> > So I just wonder if this is applicable to create different instances of
>> > counter class, and if not, are there any better ways to create more than
>> > one
>> > counter? Or do I have to instrument jimple code to manually add counter
>> > code
>> > for each counter I want?  Thanks so much for answers!
>> >
>> >
>> >
>> > --
>> > Best regards,
>> > Kelvin
>> >
>> > _______________________________________________
>> > Soot-list mailing list
>> > Soot-list at sable.mcgill.ca
>> > http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>> >
>> >
>>
>>
>>
>> --
>> Eric Bodden
>> Sable Research Group, McGill University
>> Montréal, Québec, Canada
>
>



-- 
Eric Bodden
Sable Research Group, McGill University
Montréal, Québec, Canada


More information about the Soot-list mailing list