[Soot-list] How transform local variables into class' s fields.

Eric Bodden bodden at st.informatik.tu-darmstadt.de
Thu Dec 30 09:40:15 EST 2010


Adriano,

the best idea would be to not do these transformations manually on the
.jimple files but instead to implement an actual transformation that
does this automatically for you, e.g. using a BodyTransformer in Soot.
The Soot website has many tutorials that show how to do this kind of
thing. Using a BodyTransformer, you can easily modify the Jimple
representation in memory.

Eric
--
Dr. Eric Bodden
Software Technology Group, Technische Universität Darmstadt, Germany
Tel: +49 6151 16-5478    Fax: +49 6151 16-5410
Mailing Address: S2|02 A209, Hochschulstraße 10, 64289 Darmstadt



On 30 December 2010 13:57, adriano cosimati <agenteborghese at gmail.com> wrote:
> In the code .jimple code I changed some variable was missing,
> but the .jimple code format is actually very difficult to modify and
> maintain,
> especially because the same variables are repeated several times, and there
> is a risk of confusion.
> So I chose the output format .grimp that is lexically much closer to the
> Java source than to Java bytecode.
> I also tried the format .dava ; it would be the ideal solution, but because
> the input code  tested had  control flow obfuscated, soot program gave me a
> NullPointerException at time of the rearrangement of  labels in the code.
>
> Any more elegant and practical solution to my problem to know the status of
> a local variables of an obfuscated method , is welcome.
>
> Thanks for your quick response, and many compliments to the creator of
> 'soot' program .
>
>
> 2010/12/30 Eric Bodden <bodden at st.informatik.tu-darmstadt.de>
>>
>> Hi Adriano.
>>
>> > I thought to turn the .class file into a .jimple file and then change
>> > the
>> > code, and turn local variables into instance fields, so I can debug
>> > them.
>>
>> Note that this will only work if your program does not use any form of
>> recursion. In case of recursion you have multiple copies of the same
>> locals on the call stack and a single field is not enough to simulate
>> all those copies.
>>
>> But about your problem...
>>
>> > When i compile into the .class file, the corresponding .java source is
>> > the
>> > same  i started from
>> > (with a little optimization), but no trace of the two added instance's
>> > fileds.
>> > Where am I wrong ?
>>
>> I think I do not understand your question. The transformation
>> apparently shows up in the jimple code, and hence it should also show
>> up in the .class files that Soot outputs.
>>
>> Eric
>
>


More information about the Soot-list mailing list