[Soot-list] Retaining debug information through Soot?

Bodden, Eric eric.bodden at sit.fraunhofer.de
Sat Nov 23 03:59:06 EST 2013


Hi Nate.

In the package soot.coffi you will find several references to LocalVariableTable. This is where Soot parses the original table from the bytecode and applies the local-variable aggregation and naming.

To generate such attributes again, you should create a class implementing soot.tagkit.Tag. The getValue() method in this interface generates the attribute bytecode value for this tag. Look at other implementers of this interface to see what this can look like.

Then one would best add a transform to the pack "jap" in PackManager, line 278. These are all transforms that apply some kind of tagging. The BodyTransformer you insert there is passed a Body for every method in the Scene. Simply attach the tag to the Body (or its owning SootMethod?) and you should be good to go.

Once this works for you I would appreciate if you could share the code through a pull request against the "develop" branch of Soot.

Best wishes,
Eric




On 23.11.2013, at 01:50, Nate Deisinger <ndeisinger at wisc.edu> wrote:

> That sounds like it would be the best option.  I'm not familiar with how Soot writes out to bytecode, so pointers on how to get started modifying that behavior (as well as how to add an appropriate Tag for variable names) would be appreciated.
> 
> Thanks,
> Nathan
> 
> On 11/22/2013 02:18 AM, Bodden, Eric wrote:
>> Hi Nathan.
>> 
>>> Ah, my mistake for not mentioning I had tried that option. I know that gets me Jimple with the names intact, but Soot doesn't seem to translate that into actual Java debug information when exporting a class. Thanks for the response, though!
>> While this is probably true (I would need to check) this should be not too hard to implement. Essentially, Soot initially parses the attributes to generate the variable names but then the original attribute is probably not actually converted into a Tag (which is Soot's internal representation of attributes). I think all one would need to do is extend Soot to create an appropriate Tag. Then in the end, this tag would automatically be written out into a bytecode attribute again by Soot. (each Tag class implements a method that defines how the tag is converted into an attribute)
>> 
>> One thing to keep in mind is that you might want to create these tags in the end of Soot's computation such that the tags reflect renamings/additions etc. that Soot might have made.
>> 
>> If you would like to work on such an extension let me know and I can give you some more pointers.
>> 
>> Cheers,
>> Eric
> 

--
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/20131123/789fc01b/attachment.bin 


More information about the Soot-list mailing list