[Soot-list] Adding a class to scene/hierarchy

Eric Bodden bodden at st.informatik.tu-darmstadt.de
Thu Mar 31 03:25:41 EDT 2011


Hi Derek.

addBasicClass is not going to help you there. This method merely adds
the class to a list of classes to be loaded when Soot starts up. When
you call the method, you are probably calling it at a point in time
where it is already too late.

You could try the following:
http://www.sable.mcgill.ca/pipermail/soot-list/2010-September/003305.html

Eric

On 31 March 2011 05:45, Derek White <whitedw at gmail.com> wrote:
> Hello all,
>
> I have a program that needs to find subclasses of a class that has
> been encountered while walking the body of a method, even if the
> subclasses are not loaded into the Soot scene when Soot is loaded
> initially.  My approach is to use the class loader and class/jar files
> to find any classes that belong to the same package as the class (in
> my case it is guaranteed that any subclasses will be in that same
> package).  Once I have discovered that set of classes, I want to add
> them to the scene and hierarchy in order to call something like
> Hierarchy's getSubclassesOf method to find which of those classes in
> the package are the subclasses I am looking for.
>
> If I just try Scene.v().addBasicClass(className) or
> Scene.v().addBasicClass(className, SootClass.HIERARCHY), className is
> not listed as a subclass by the active hierarchy's
> getSubclassesOf(base) even though it should be
>
> If I try something like:
>
>            Scene.v().tryLoadClass(className, SootClass.HIERARCHY) or
> Scene.v().tryLoadClass(className, SootClass.BODIES)
>
> I get:
>
> java.lang.RuntimeException: This operation requires resolving level
> SIGNATURES but tests.B is at resolving level HIERARCHY
> If you are extending Soot, try to add the following call before
> calling soot.Main.main(..):
> Scene.v().addBasicClass(tests.B,SIGNATURES);
>
>
> Any help would be appreciated.  Thanks in advance.
>
> -Derek
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>



-- 
Dr. Eric Bodden, http://bodden.de/
Principal Investigator in Secure Services at CASED
Coordinator of the CASED Advisory Board of Study Affairs
PostDoc at Software Technology Group, Technische Universität Darmstadt
Tel: +49 6151 16-5478    Fax: +49 6151 16-5410
Mailing Address: S2|02 A209, Hochschulstraße 10, 64289 Darmstadt


More information about the Soot-list mailing list