[Soot-list] Multiple BytecodeOffsetTag

Eric Bodden bodden at st.informatik.tu-darmstadt.de
Mon Nov 30 02:56:06 EST 2009


Hi all.

>From my limited knowledge about that API I conclude that the original
intent was certainly that there could be only one single tag of any
kind for every single unit. However, Soot does not enforce this and
therefore there may be some places where in the meantime Soot was
changed in a way that it now breaks that rule.

I am reluctant to changing an API that is so heavily used. I am ok
with adding methods, but I am not going to delete or rename any method
any time soon, although I would be ok with tagging getTag(..) with
"deprecated" and renaming/removing it later.

Eric

--
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



2009/11/30 Attila Bartha <at.bartha at gmail.com>:
> 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
>
> _______________________________________________
> 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