[Soot-list] Multiple BytecodeOffsetTag

Attila Bartha at.bartha at gmail.com
Sun Nov 29 18:03:22 EST 2009


Hi Arie

 

I agree. If the method Tag getTag(String aName)  would be renamed to
getFirstTag(..), there would not be any confusion.

Just my opinion, I am not a committer.

 

I guess, in a large number of cases, you can safely assume, that tag names
are unique for a unit.

 

However, I am not (anymore) a fan of hardwiring all kind of additional
information with the code representation.

There are pros (persistence?) and cons. Often, it is cleaner to create a
separate Map<Unit, YourStuff>

 

Regards

 

Attila

 

 

From: soot-list-bounces at sable.mcgill.ca
[mailto:soot-list-bounces at sable.mcgill.ca] On Behalf Of Arie Zilberstein
Sent: Sonntag, 29. November 2009 21:28
To: soot-list at sable.mcgill.ca
Subject: [Soot-list] Multiple BytecodeOffsetTag

 

Hi,

 

What's the best way to find the original bytecode offset of a Jimple stmt?

For some time, I thought this:

 

BytecodeOffsetTag bytecodeOffsetTag = (BytecodeOffsetTag) stmt

                     .getTag("BytecodeOffsetTag");

int bytecodeOffset = bytecodeOffsetTag.getBytecodeOffset();

 

However, I was wrong. A Jimple stmt can be associated with more than 1
bytecode offset. So the best way is actually to loop through the tags and
pick the correct ones, like this:

 

for (Tag tag : stmt.getTags()) {

     if (tag instanceof BytecodeOffsetTag) {

           int bytecodeOffset = ((BytecodeOffsetTag) tag)

                     .getBytecodeOffset();

     ...

}

 

 

My question is, don't you think that the stmt.getTag() method is confusing?
Since a string name is not a unique identifier for a tag, what's the point
in that method? Maybe it should change to return a collection of tags?

 

Best,

Arie

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20091130/95aaa739/attachment.html 


More information about the Soot-list mailing list