[Soot-list] Multiple runs of Soot

Eric Bodden eric.bodden at mail.mcgill.ca
Wed Jul 22 10:37:16 EDT 2009


Hmmm, can you try this nightly build of Soot?

http://plg.uwaterloo.ca/~olhotak/build/sootclasses.jar

2.3.0 is over a year old now. That may be the problem.

Eric

2009/7/22 Campbell Morrison <cammorr at gmail.com>:
> I am totally stumped.  Downloaded
> http://www.sable.mcgill.ca/software/sootall-2.3.0.tar.gz again, cleaned and
> built jasmin, polyglot and soot from scratch and then manually added all the
> required libraries in the soot classpath.  I ran soot with the command:
> java soot.Main -cp
> .:/usr/lib/jvm/java-6-sun-1.6.0.03/jre/lib/rt.jar:/polyglot/polyglot.jar:/jasmin/jasminclasses-2.3.0.jar
> -f J -keep-line-number -print-tags -src-prec java Foo
> and my output was still only with LineNumberTag.  I tried it with Java 5 and
> Java 6.  Same result.
>
> From this file ...
> public class Foo {
>
>        public static void main(String[] args) {
>                System.err.println("soso");
>        }
>
> }
>
> ... I get this file ...
>
> public class Foo extends java.lang.Object
> {
> /*Foo.java*/
>
> /*[args]*/
>     public static void main(java.lang.String[])
>     {
>         java.lang.String[] args;
>         java.io.PrintStream temp$0;
>
>         args := @parameter0: java.lang.String[];
> /*3*/
>         temp$0 = <java.lang.System: java.io.PrintStream err>;
> /*3*/
>         virtualinvoke temp$0.<java.io.PrintStream: void
> println(java.lang.String)>("soso");
> /*4*/
>         return;
> /*4*/
>     }
>
> /*[]*/
>     public void <init>()
>     {
>         Foo this;
>
>         this := @this: Foo;
> /*1*/
>         specialinvoke this.<java.lang.Object: void <init>()>();
> /*1*/
>         return;
> /*1*/
>     }
> }
>
> On Wed, Jul 22, 2009 at 12:42 PM, Campbell Morrison <cammorr at gmail.com>
> wrote:
>>
>> Yes something's definitely funky on my side.  Thank you for your help
>>
>> On Wed, Jul 22, 2009 at 12:18 PM, Eric Bodden <eric.bodden at mail.mcgill.ca>
>> wrote:
>>>
>>> Hi Campbell.
>>>
>>> I don't know what, but you must be doing something wrong.
>>>
>>> For me, Soot produces from this class...
>>>
>>>
>>> public class Foo {
>>>
>>>        public static void main(String[] args) {
>>>                System.err.println("soso");
>>>        }
>>>
>>> }
>>>
>>>
>>> ... this file...
>>>
>>> public class Foo extends java.lang.Object
>>> {
>>> /*Foo.java*/
>>>
>>> /*[args]*/
>>>    public static void main(java.lang.String[])
>>>    {
>>>        java.lang.String[] args;
>>>        java.io.PrintStream temp$0;
>>>
>>>        args := @parameter0: java.lang.String[];
>>> /*Source Line Pos Tag: sline: 4 eline: 4 spos: 26 epos: 38 file:
>>> Foo.java*/
>>>        temp$0 = <java.lang.System: java.io.PrintStream err>;
>>> /*Source Line Pos Tag: sline: 5 eline: 5 spos: 3 epos: 29 file:
>>> Foo.java*/
>>>        virtualinvoke temp$0.<java.io.PrintStream: void
>>> println(java.lang.String)>("soso");
>>> /*Source Line Pos Tag: sline: 5 eline: 5 spos: 3 epos: 29 file:
>>> Foo.java*/
>>>        return;
>>> /*Source Line Pos Tag: sline: 5 eline: 5 spos: 3 epos: 29 file:
>>> Foo.java*/
>>>    }
>>>
>>> /*[]*/
>>>    public void <init>()
>>>    {
>>>        Foo this;
>>>
>>>        this := @this: Foo;
>>> /*2*/
>>>        specialinvoke this.<java.lang.Object: void <init>()>();
>>> /*2*/
>>>        return;
>>> /*2*/
>>>    }
>>> }
>>>
>>>
>>> .... using this command line:
>>>
>>> -f J -cp
>>> .:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/classes.jar
>>> -keep-line-number -print-tags -src-prec java Foo
>>>
>>> I guess something must be wrong with your soot-class-path or
>>> something. Note that Soot must be able to find your *source* files on
>>> the soot-class-path.
>>>
>>> Eric
>>>
>>> 2009/7/21 Campbell Morrison <cammorr at gmail.com>:
>>> > I'm currently bypassing my program and running Soot as a standalone
>>> > program.  I run Soot with the command:
>>> > java soot.Main -f J -d /foo/bar --soot-classpath /class/path
>>> > -keep-line-number -print-tags -src-prec java testClass and then look in
>>> > the
>>> > output file testClass.jimple.  From what I see it's still just
>>> > LineNumberTag, and not SourceLnPosTag.
>>> >
>>> > On Mon, Jul 20, 2009 at 6:37 PM, Eric Bodden
>>> > <eric.bodden at mail.mcgill.ca>
>>> > wrote:
>>> >>
>>> >> I think a LineNumberTag in cases where a class is loaded from
>>> >> bytecode. In that case, there is no column information available, and
>>> >> hence Soot uses another Tag. Are you sure that Soot loads classes from
>>> >> source code in your case?
>>> >>
>>> >> This may help:
>>> >> http://www.sable.mcgill.ca/pipermail/soot-list/2005-July/000313.html
>>> >>
>>> >> Eric
>>> >>
>>> >> 2009/7/20 Campbell Morrison <cammorr at gmail.com>:
>>> >> > I already have -keep-line-number and -keep-offset as arguments to
>>> >> > soot.Main.main(..) for some of the operations I do, but
>>> >> > SourceLnPosTag
>>> >> > is
>>> >> > never added to the Jimple units.  The only tags added are
>>> >> > http://www.sable.mcgill.ca/soot/doc/soot/tagkit/LineNumberTag.html
>>> >> > and
>>> >> >
>>> >> > http://www.sable.mcgill.ca/soot/doc/soot/tagkit/BytecodeOffsetTag.html
>>> >> >
>>> >> > I followed Soot's code around a bit and found that in
>>> >> > http://www.sable.mcgill.ca/soot/doc/soot/PackManager.html a
>>> >> >
>>> >> >
>>> >> > http://www.sable.mcgill.ca/soot/doc/soot/jimple/toolkits/annotation/LineNumberAdder.html
>>> >> > is instantiated and run.  This adder only adds the LineNumberTag to
>>> >> > units.
>>> >> > I can't find where or how
>>> >> > http://www.sable.mcgill.ca/soot/doc/soot/tagkit/SourceLnPosTag.html
>>> >> > is
>>> >> > added
>>> >> > to Jimple units.
>>> >> >
>>> >> > Perhaps it has to do with where my transformer is added?  Before
>>> >> > running
>>> >> > Soot, I add my own transformer with this line:
>>> >> > PackManager.v().getPack( "jtp" ).add( new Transform( "jtp.trueexec",
>>> >> > SymbolicTransformer.v()));
>>> >> >
>>> >> >
>>> >> > On Mon, Jul 20, 2009 at 2:15 PM, Eric Bodden
>>> >> > <eric.bodden at mail.mcgill.ca>
>>> >> > wrote:
>>> >> >>
>>> >> >> Hi again.
>>> >> >>
>>> >> >> > I use Soot to read in the Java class files and generate Jimple,
>>> >> >> > so I
>>> >> >> > never
>>> >> >> > directly look at the Java source code or the AST.  I only work
>>> >> >> > with
>>> >> >> > the
>>> >> >> > resulting Jimple code.  Can I add the SourceLnPosTag to the
>>> >> >> > Jimple
>>> >> >> > statements without creating another transformer?  (For example
>>> >> >> > using
>>> >> >> > -keep-line-number input command for line number tag)
>>> >> >>
>>> >> >> Yes, simply pass -keep-line-number as an argument to
>>> >> >> soot.Main.main(..) when you call it.
>>> >> >>
>>> >> >> Eric
>>> >> >> --
>>> >> >> Eric Bodden
>>> >> >> Sable Research Group, McGill University
>>> >> >> Montréal, Québec, Canada
>>> >> >
>>> >> >
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >> Eric Bodden
>>> >> Sable Research Group, McGill University
>>> >> Montréal, Québec, Canada
>>> >
>>> >
>>>
>>>
>>>
>>> --
>>> Eric Bodden
>>> Sable Research Group, McGill University
>>> Montréal, Québec, Canada
>>
>
>



-- 
Eric Bodden
Sable Research Group, McGill University
Montréal, Québec, Canada


More information about the Soot-list mailing list