[Soot-list] Issue with trap generation in Jimple

Khilan Gudka khilan at doc.ic.ac.uk
Wed Jun 13 04:27:20 EDT 2012


Hi Eric

A couple of questions to see if I understand things correctly...

1) Can the return statement throw an exception? If it can then will u still
need to insert an exceptional edge from the assignment to the handler?

2) What happens if an un-related field store is inserted between the
assignment and the return, like $r1.f = $r2. I.e so you have...

$u0 = 1
$r1.f = $r2
return $u;

... and if the inserted statement could also throw a NPE then will you also
need an exceptional edge from the original assingment $u0 = 1 to the
handler?

Cheers
Khilan

On Wednesday, 13 June 2012, Eric Bodden wrote:

> Hi all.
>
> I just found an interesting problem with the generation of traps that
> requires some discussion on how to fix best.
>
> Please consider the following code:
>
>     label5:
>        $u0 = 1;
>        return $u0;
>
>     label6:
>        $u1 := @caughtexception;
>        exitmonitor $u0;
>        throw $u1;
>
>        catch java.lang.Throwable from label2 to label5 with label6;
>
> The problem here is at follows:
> At the beginning, $u0 holds a reference-typed value. Hence, if "$u0 =
> 1;" throws an exception, it is correct to execute the exception
> handler at label6 and call "exitmonitor $u0;". If the statement "$u0 =
> 1;" does NOT throw an exception, then the assignment succeeds and the
> method returns 1.
>
> Currently the type assignment for $u0 fails because both the handler
> and the return are considered to be successors, and therefore "uses"
> of $u0. But this is actually incorrect, I think. Rather, we should
> generate an exceptional edge from just *before* the assignment to the
> handler, and a normal successor from after the assignment to its
> normal successor. That is a bit fishy also, because it assumes that
> the last Jimple statement of a trap will have no effect (guaranteed!)
> if an exception is thrown. I think this should always be the case, but
> I am not 100% sure. In any case, I think it is the only way to
> correctly type-assign the above code.
>
> Any feedback would be appreciated.
>
> Cheers,
> Eric
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca <javascript:;>
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>


-- 

--
Khilan Gudka
PhD Student
Department of Computing
Imperial College London
http://www.doc.ic.ac.uk/~khilan/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20120613/23a92c39/attachment.html 


More information about the Soot-list mailing list