[Soot-list] Soot Instrumenting Try/Finally

Bodden, Eric eric.bodden at sit.fraunhofer.de
Thu Oct 17 09:47:55 EDT 2013


Hi Wing.

This should be fairly easy. Indeed all you need to do is to add a trap to the Jimple Body. If you call body.getTraps() this returns a list of traps that you can add to. A trap consists of four elements:

- starting statement of the "try"
- end statement of the "try"
- Type of exception to catch
- target statement, i.e., 1st statement of the catch block

Your catch block would then typically start with an IdentityStmt of the form:

ex = @CaughtException;

Here @CaughtException is a CaughtExceptionRef, i.e., an implicit reference that models the caught exception. This means that in the remainder of the catch block you can refer to the local "ex" to refer to the caught exception.

Eric



On 15.10.2013, at 22:21, Guru Devanla <gdevan2 at uic.edu> wrote:

> 
> Hi Wing,
> 
> Can you share the jimple code that this generates. I ran it with a sample program, and it seems to generate a trap towards the end which may be what you need.
> 
> Thanks
> Guru
> 
> 
> 
> On Tue, Oct 15, 2013 at 12:25 PM, Wing Lam <winglam at cs.washington.edu> wrote:
> RefType.v(thrwCls)
> 
> 
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list

--
Prof. Eric Bodden, Ph.D., http://sse.ec-spride.de/ http://bodden.de/
Head of Secure Software Engineering  at Fraunhofer SIT, TU Darmstadt and EC SPRIDE
Tel: +49 6151 16-75422    Fax: +49 6151 16-72051
Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
Url : http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20131017/80f595e9/attachment.bin 


More information about the Soot-list mailing list