[Soot-list] Changing reference of super class through out project

Marc Miltenberger Marc.Miltenberger at cased.de
Thu Aug 13 00:58:14 EDT 2015


Hi,
  well, you can use my code as a template.
  Just like for SpecialInvoke, you can also change the VirtualInvokes in 
your code.
  If you do not know the difference between these, you should make sure 
to gather that knowledge, maybe here
http://stackoverflow.com/questions/13764238/why-invokespecial-is-needed-when-invokevirtual-exists

  You probably also want to change the StaticInvokes, but then your 
replacement class then needs to have all the static methods of the 
former parent class (if any).

  The soot transformation itself runs forever or executing the outputted 
code? The latter case might indicate that the instrumentation inserted 
an endless loop somewhere.

  Also, you might have to change (static) field accesses if your former 
parent contained package visable, protected or public fields which can 
be accessed by the subclasses.
  The following methods might be interesting to you in order to change 
field accesses:
Stmt.containsFieldRef();
Stmt.getFieldRef() can be e.g. instanceof InstanceFieldRef or instanceof 
StaticFieldRef.

In case of InstanceFieldRef:
InstanceFieldRef.getBase() gives you the base local of the field. Since 
you are (hopefully) changing the local variables which are of the 
(Ref)Type "FormerParent" to the (Ref)Type "InstrumentedParent", you do 
not need further steps for instance fields.

In case of StaticFieldRef:
StaticFieldRef.getField() gives you the accessed field. You want to 
change it in case it uses a field of FormerParent, very similar to the 
code of my former post.


  At the end, you just make sure that the instrumented subclasses do not 
access the former parent class, but your new parent class instead.
  You need to think what might be appropriate statements to change when 
the hierarchy changes.
  I think about cast statements for example.
  In case you forget to change any statement you should have changed, 
either the soot validator or the JVM/Dalvik will tell you at runtime.

Good luck,
  Marc

Am 13.08.2015 um 05:42 schrieb Tanzirul Azim:
> HI I were not able to verify the results as my soot transformation is
> running for ever, but looking the Jimple files what I have found that
> the instrumentation was actually done following your example. But
> instead of special invoke it is virtual invoke.
>
>
> --
> Regards,
> Tanzirul Azim
>
>
>
> _______________________________________________
> Soot-list mailing list
> Soot-list at CS.McGill.CA
> https://mailman.CS.McGill.CA/mailman/listinfo/soot-list
>



More information about the Soot-list mailing list