[Soot-list] Class Hierarchy Analysis causes NullPointerException

Eric Bodden bodden at st.informatik.tu-darmstadt.de
Fri Dec 18 09:23:36 EST 2009


Hello.

> When start() is invoked on a thread, a new thread is created and run()
> is called implicitly on the newly-created thread. Thus the THREAD edge
> is necessary to model the implicit call to run(). In this case, the
> problem seems to be that start() is being called using a special invoke,
> whereas the implicit call to run() is then (presumably) being done as
> a virtual call. However, because the call to start() is a special
> invoke, Soot tries to also resolve the call to run() as a special
> invoke, which fails. The fix is to always handle the THREAD edge
> as a virtual call, even if the original start() call is special.

Ah, this makes sense. The interesting question, of course, is how
there can be a special-invoke to start() in the first place, as
start() is certainly a virtual method. To me it seems that the
bytecode is dodgy.

> So, the following if statement in addType:
>    if( site.iie() instanceof SpecialInvokeExpr ) {
> should be changed to:
>    if( site.iie() instanceof SpecialInvokeExpr && site.kind != Kind.THREAD ) {
> Can you try this to see if it fixes the problem?

Yep, that did the trick. Commited as revision 3353.

Thanks a lot Ondrej!

Eric


More information about the Soot-list mailing list