[Soot-list] A BUG about JimpleConstructorFolder and Line number or any options I did not turn on?

Chris Pickett chris.pickett at mail.mcgill.ca
Mon Apr 9 20:01:07 EDT 2007


Hi Peng,

Please do:

$ diff -u JimpleConstructorFolder.java.org JimpleConstructorFolder.java 
 > JimpleConstructorFolder.patch

and attach JimpleConstructorFolder.patch to a message sent to the 
mailing list; Eric and Pat can then review your changes and decide what 
to incorporate.

Thanks!
Chris

Peng Li wrote:
> HI Patrick and Eric,
> 
> Thank you very much for your quick replies. I have done the
> modification, which is very simple. we just need to add two new lines
> "  LineNumberTag tag = (LineNumberTag)s.getTag("LineNumberTag");
> constructStmt.addTag(tag);" after the making new stmt "   AssignStmt
> constructStmt =
> Jimple.v().newAssignStmt(((DefinitionStmt)s).getLeftOp(),
> ((DefinitionStmt)s).getRightOp());"
> 
> I have done some other changes for this transformer. I added a table
> which can map the old hashcode of each newexpr to the corresponding
> new hashcode for my purpose. I dont know if the soot list people
> would like to see that, so I did not send it to the list. Please let
> me know if you would like to see my code.
> 
> Thank you very much for your help.
> 
> Cheers
> Peng
> 
> 2007/4/9, Eric Bodden <eric.bodden at mail.mcgill.ca>:
>> We don't create a new-statement, we just move it, from what I can see.
>> (line 248)
>>
>> Eric
>>
>> On 09/04/07, Patrick Lam <plam at sable.mcgill.ca> wrote:
>> > Peng Li wrote:
>> > > private static int getLineNumber(Stmt s) {
>> > >         Iterator ti = s.getTags().iterator();
>> > >         while (ti.hasNext()) {
>> > >             Object o = ti.next();
>> > >             if (o instanceof LineNumberTag)
>> > >             {
>> > >             LineNumberTag linetag = (LineNumberTag) o;
>> > >             return linetag.getLineNumber();
>> > >             }
>> > >         }
>> > >         return -1;
>> > >     }
>> >
>> > The JimpleConstructorFolder creates a new statement from a number of 
>> old
>> > statements in the original source code. However, it does not copy the
>> > tags of the old statement to the new statement. It's not a bug, it's
>> > just that no one has implemented that functionality.
>> >
>> > If you need that functionality, you'll have to modify the
>> > JimpleConstructorFolder yourself so that when it creates a NewExpr, it
>> > will also copy the relevant LineNumberTag (sort of like what you have
>> > right now in your method, just that you add the tags to the new
>> > statement).
>> >
>> > Please send your patch back to the list so that it can be added to the
>> > Soot trunk for the next release!
>> >
>> > pat
>> > _______________________________________________
>> > Soot-list mailing list
>> > Soot-list at sable.mcgill.ca
>> > http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>> >
>>
>>
>> -- 
>> Eric Bodden
>> Sable Research Group
>> McGill University, Montréal, Canada
>>
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list


More information about the Soot-list mailing list