[Soot-list] a question about exception analysis

mbatch at cs.mcgill.ca mbatch at cs.mcgill.ca
Tue Aug 29 19:51:14 EDT 2006


> I am tring to use soot to perform an exception analysis.
> I noticed that the catch statements are traslated in jimple as
> IdentityStatement nodes, whose right value is something like
> "@caughtexception", that is a JCaughtExceptionRef instance.
> Now i am interested in finding out how to identify the type of this right
> value. I tried the method getType() of JCaughtExceptionRef, but it returns
> for any exception the type throwable. This is correct, but inaccurate.
> Can anyone tell me how to get a more accurate typing?

What you want to do is get the list of traps for the method body. You can
get the chain by using the Body.getTraps() method.

Each trap has a SootClass associated with it that represents the throwable
that it catches (getException()).

Each trap also has the beginning and ending unit that the try block covers
(getBeginUnit(), getEndUnit()) and the first unit of the catch block is
referred to as the "handler" (getHandlerUnit()).

Remember, the ending unit of a trap is _not_ included in the try block -
it's an exclusive boundary whereas the begin unit is an inclusive
boundary.

Michael



More information about the Soot-list mailing list