[Soot-list] want to maintain bytecode offsets for classfiles

Manjiri Namjoshi manjiri.namjoshi at googlemail.com
Mon Oct 6 15:47:13 EDT 2008


Hello,

I was taking a look at the array bounds check annotation example.
The attributes that are added are something like this:

void footest()
Code(max_stack = 3, max_locals = 2, code_length = 9)
0:    iconst_2
1:    newarray                <int>
3:    astore_1
4:    aload_1
5:    iconst_0
6:    iconst_1
7:    iastore
8:    return

Attribute(s) = LineNumber(0, 5), LineNumber(4, 7), LineNumber(8, 3)

The line numbers seem to be the bytecode offsets ... am i right?
If yes then the offsets should get maintained after the annotation of
classfiles.

Please correct me if i am going wrong.

Thanks !

Sincerely,
Manjiri

2008/10/6 Manjiri Namjoshi <manjiri.namjoshi at googlemail.com>

> Hi,
>
> Thank You !
> Sorry to bother again but does SOOT provide any flag to turn off the
> optimizations on the classfiles and only allow annotations?
>
> Sincerely,
> Manjiri
>
> 2008/10/6 Eric Bodden <eric.bodden at mail.mcgill.ca>
>
> Looking at the source code it seems that it returns the offset from
>> the original classfile.
>>
>> Eric
>>
>> 2008/10/5 Manjiri Namjoshi <manjiri.namjoshi at googlemail.com>:
>> > Hi,
>> >
>> > Thanks for your reply !
>> > Actually i would like to know which bytecode offset does the
>> > getBytecodeOffset() return ?
>> > The offset from the original classfile or the transformed classfile?
>> >
>> > I am caring about the offset because i want to add method annotations
>> with a
>> > value as offsets corresponding to only if_cmp instructions !
>> >
>> > Thank You.
>> >
>> >
>> > Sincerely,
>> > Manjiri
>> >
>> > 2008/10/4 Eric Bodden <eric.bodden at mail.mcgill.ca>
>> >>
>> >> Hi Manjiri.
>> >>
>> >> I don't think that what you are looking for is possible. Soot converts
>> >> bytecode to an intermediate representation called Jimple and then back
>> >> to bytecode. This is not a 1:1 transformation. You can try to disable
>> >> some of the phases in the "jb" pack (see here
>> >> http://www.sable.mcgill.ca/soot/tutorial/phase/index.html) but I don't
>> >> think that this is going to preserve all the offsets either.
>> >>
>> >> Just out of curiosity: Why would you care about the offsets?
>> >>
>> >> Eric
>> >>
>> >> 2008/10/4 Manjiri Namjoshi <manjiri.namjoshi at googlemail.com>:
>> >> > Hello,
>> >> >
>> >> > I am trying to run a soot transformation and annotate the classfiles.
>> >> > I observed that the classfiles which the soot produces have different
>> >> > bytecode offsets than the original bytecode offsets.
>> >> >
>> >> > I think soot optimizations is causing this to happen.
>> >> >
>> >> > This is the transformation:
>> >> >        /* adds the transformer. */
>> >> >         PackManager.v().getPack("jtp").add(new
>> >> >                         Transform("jtp.annotexample",
>> >> >                   CreateAnnotationFile.v()));
>> >> >
>> >> >         /* invokes Soot */
>> >> >         soot.Main.main(args);
>> >> >
>> >> > I want to somehow suppress these optimizations and maintain the
>> bytecode
>> >> > offsets.
>> >> >
>> >> > Thanks in advance!
>> >> >
>> >> > Sincerely,
>> >> > Manjiri
>> >> >
>> >> > _______________________________________________
>> >> > 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
>> >
>> >
>>
>>
>>
>> --
>> Eric Bodden
>> Sable Research Group
>> McGill University, Montréal, Canada
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20081006/45ef4788/attachment.htm


More information about the Soot-list mailing list