[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get SootClass out of existing .class-file?



On Mon, Nov 18, 2002 at 06:24:16PM -0000, Eric Bodden wrote:
> Hi again!
> 
> Meanwhile I understood, how to run CHA and VTA on SootClass objects
> respectively the current scene. But what I still could not figure out is
> how to actually get a SootClass object out of an existing .class-file.
> What I need is to first list all class files belonging to a project
> (let's say folder and its subfolders = packages) and then parse them
> somehow to get a full scene of SootClass objects. So can please anyone
> quickly tell me, which methods I have to use for that?

Have a look at http://www.sable.mcgill.ca/soot/tutorial/. Specifically,
I think the "Developing a goto Instrumenter" and "A Brief Note on
Soot's Whole-Program Analysis Support" examples are closest to what
you're looking for, but have a look at the others as well.

Briefly, to get Soot to look at all the classfiles in a project, you
probably want the --app option. The normal way to use Soot to with
existing class files is to put your transformation code in a
BodyTransformer, and providing a new Main class that adds your
transformer, and then calls the Main of Soot (see Goto Instrumenter
example).

> And another certainly quickly to answer question: I think there should
> be RTA implemented in the package, shouldn't it? I cannot find it. So
> where is it?!

Unfortunately, RTA was implemented in a branch, and never integrated
into the main version of Soot, so it is not there. The difficulty with
RTA for Java is reflection: the Class.newInstance() method can create
objects of arbitrary type. Of course, it shouldn't be very hard to use
the code in VTA to implement RTA, but it has not been done. Also, the
version that I am hoping to release later this week will have a
points-to analyis framework (Spark), with which it should be easy to
implement RTA or VTA. If I get around to it, I might add in an RTA
option before releasing it.

Ondrej

> Thank you very much,
> Eric
> 
> ------------------------------------------------------------
> Eric Bodden
> CS-DIP full time student @ University of Kent at Canterbury
> UKC internal phone: 5095
> ICQ UIN: 12656220, secure mail on demand
> Website: http://www.bodden.de
>