[Soot-list] Using soot within a javaagent

Eric Bodden eric.bodden at ec-spride.de
Wed Jan 4 10:47:16 EST 2012


Thanks Prashant.

I actually wonder whether providing at least the java.lang classes to
Soot would actually not be reasonable for such a use case. After all,
those classes are always available. Would this cause any trouble in
your use case?

Eric

On 3 January 2012 23:11, Prashant Deva <prashant.deva at gmail.com> wrote:
> Oops it seems like in my haste to keep the mail short and concise I didnt
> check the stack trace well enough to notice it was the other portion of code
> that was causing the issue.
>
> Here is the full main class:
>
> public static void main(String[] args)
> {
> Options.v().allow_phantom_refs();
> SootClass sootClass = Scene.v().loadClass("com.chtest.Snippet",
> SootClass.BODIES);
> Body body = null;
> for (SootMethod method : sootClass.getMethods())
> {
> if (method.getName().equals("foo"))
> {
> if (method.isConcrete())
> {
> body = method.retrieveActiveBody();
> break;
> }
> }
> }
>
> System.out.println("**** Body ****");
> System.out.println(body);
> System.out.println();
>
> System.out.println("**** Blocks ****");
> BlockGraph blockGraph = new ExceptionalBlockGraph(body);
> for (Block block : blockGraph.getBlocks())
> {
> System.out.println(block);
> }
> }
>
>
> The crash happens at the line:
> method.retrieveActiveBody();
>
> if I dont call Scene.v().loadNecessaryClasses();
>
>
> Prashant
>
>
>
> On Mon, Jan 2, 2012 at 2:25 AM, Eric Bodden <eric.bodden at ec-spride.de>
> wrote:
>>
>> Hello.
>>
>> > Why is it that even after allowing phantom refs soot throws an exception
>> > for
>> > a type not loaded?
>>
>> I think this has to do with the fact that phantom-refs support was
>> patched into Soot at a very late stage. Some parts of Soot may still
>> require (or think they require) information about certain types. I
>> would have to look into this further to be sure.
>>
>> But essentially, are you saying that with using
>> "Scene.v().loadNecessaryClasses();" you are now getting what you want?
>>
>> Cheers,
>> Eric
>
>



-- 
Eric Bodden, Ph.D., http://bodden.de/
Head of Secure Software Engineering Group at EC SPRIDE
Principal Investigator in Secure Services at CASED
Tel: +49 6151 16-75422    Fax: +49 6151 16-72051
Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt


More information about the Soot-list mailing list