[Soot-list] Multiple BytecodeOffsetTag

Arie Zilberstein arie.zilberstein at gmail.com
Sun Nov 29 15:28:22 EST 2009


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/20091129/71003b79/attachment.html 


More information about the Soot-list mailing list