[Soot-list] Re: about the code coverage

=?GB2312?B?0Oy9oQ==?= fightmyway at gmail.com
Wed Oct 8 13:30:30 EDT 2008


Hi:
Question1:
I have tried adding -validate switch to Soot, then it give follow
information:

>>>>>>
r0 := @this: tester.TestClass
specialinvoke r0.<java.lang.Object: void <init>()>()
specialinvoke counterRef.<profile.Counter: void increase(int)>(0)
specialinvoke counterRef.<profile.Counter: void report()>()
return
Exception in thread "main" java.lang.RuntimeException: no defs for value:
counterRef! in <tester.TestClass: void <init>()>
    at soot.Body.validateUses(Body.java:336)
    at soot.Body.validate(Body.java:233)
    at soot.jimple.JimpleBody.validate(JimpleBody.java:66)
    at soot.PackManager.runBodyPacks(PackManager.java:774)
    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 profile.Convert.main(Convert.java:38)
>>>>>>

So i know it means i haven't define the object. Addtionally, I diff the file
generated by my program with another right class file generated by javac. I
find that i should use the virtualinvoke stmt instead of specialinvoke stmt,
and i try many ways to insert a define object statement. but i faile. I
can't find the right API to implement this.  Can you give me some idea?

Additionally, can you tell me the difference between the specailinvoke and
virtualinvoke? En, i also wonder how the static object can insert into the
TestClass? There seem to be no insert statement.

Question2: I have collected some information about profiling. I do this
storing the inforamtion to a object defined by myself. It is a local
variables of subclass of BodyTransfor. I find it seem to be no way to assign
the object to an object I add as a field of the TestClass. Is it right?

Question3:
At last i use the static way as that in the tutorial to profiling then i
find: Assume that TestClass is  the class to be tested, Class AnotherClass
is a variable in the TestClass.

Class TestClass{
public staic void main(Sting[] args){
AnotherClass a;
a.method;
}
}

Then the Jimple code will be:
r1 := new AnotherClass
virtualInvoke.......

It seems that the BodyTransfor class don't modify AnotherClass ' s method,
so i can't get profiling information. En, is it right? And how can i reach
my aim?


Thank you very much for your sincely replay. Your help has help me overcome
some difficulties.!!

sincely!!

On Wed, Oct 8, 2008 at 7:25 AM, Eric Bodden <eric.bodden at mail.mcgill.ca>wrote:

>
> > question2:
> > i have write the code and use soot to deal with the class which to be
> > tested. but when i run the class which had been add some instrution, it
> > report the error like this:
> >>>>>>xj at xj-laptop:~/workspace/test/sootOutput$ java tester.TestClass
> > Exception in thread "main" java.lang.VerifyError: (class:
> tester/TestClass,
> > method: main signature: ([Ljava/lang/String;)V) Illegal use of nonvirtual
> > function call
> > Could not find the main class: tester.TestClass.  Program will exit.
> > <<<<<
> > can you give some suggestion?
>
> That's a little hard to say. Apparently you generate invalid code. You
> can try adding the -validate switch to Soot. This will validate your
> generated Jimple code and may give you a clue about what's wrong.
>
> Eric
>
> --
> Eric Bodden
> Sable Research Group
> McGill University, Montréal, Canada
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20081009/d66089e7/attachment.htm


More information about the Soot-list mailing list