[Soot-list] invokespecial side effects

Daniel Luchaup dluchaup at gmail.com
Thu Oct 31 12:38:39 EDT 2013


Hello,

I was wondering what is the best practice to deal with the side-effects of
invokespecial; they are not listed as results.

Ideally each jimple statement that modifies a local should specify that
local as a result.
However, that is not the case for invokespecial. For instance (see complete
example at the end of the email):
..............
 (s1:)  $r2 = new java.lang.StringBuilder;
 (s2:)  $r3 = ...
 (s3:)  specialinvoke $r2.<java.lang.StringBuilder: void
<init>(java.lang.String)>($r3);
 (s4:)  use($r2);
.............
If I use SmartLocalDefs.getDefsOfAt($r2, (s2)), I get s1, but in fact $r2
was last modified at s3.
It seems that, at least in this case, specialinvoke should have a result:
  (s3:) $rX = specialinvoke $r2.<java.lang.StringBuilder: void
<init>(java.lang.String)>($r3);

So, to get the real definition of $r2 that reaches (s4:) one would have to
explicitly reason about the above code pattern.

Can this be done better?

Thank you
Daniel

P.S. FYI: A more complete example:
The jimple code for 'String copy1(String s1) { return s1+"!!!";}' contains:
>>>>>
        r0 := @this: dummy;
        r1 := @parameter0: java.lang.String;
        $r2 = new java.lang.StringBuilder;
        $r3 = staticinvoke <java.lang.String: java.lang.String
valueOf(java.lang.Object)>(r1);
        specialinvoke $r2.<java.lang.StringBuilder: void
<init>(java.lang.String)>($r3);
        $r4 = virtualinvoke $r2.<java.lang.StringBuilder:
java.lang.StringBuilder append(java.lang.String)>("!!!");
        $r5 = virtualinvoke $r4.<java.lang.StringBuilder: java.lang.String
toString()>();
        return $r5;
<<<<<
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20131031/bebd7cc6/attachment.html 


More information about the Soot-list mailing list