[Soot-list] Using soot within a javaagent
Prashant Deva
prashant.deva at gmail.com
Tue Jan 3 17:11:22 EST 2012
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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20120103/a36c8028/attachment.html
More information about the Soot-list
mailing list