[Soot-list] Multiple runs of Soot

Campbell Morrison cammorr at gmail.com
Mon Jul 20 07:59:39 EDT 2009


Thank you for the very speedy reply.
> How do you translate the
> eclipse AST to Jimple anyway? Do you do this yourself or do you have
> Soot read in the Java source file? If you work directly on the AST
> then surely attaching the AST node seems to make more sense.

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)

On Fri, Jul 10, 2009 at 5:04 PM, Eric Bodden <eric.bodden at mail.mcgill.ca>wrote:

> Hi Campbell.
>
> ...
> > In this, I need to be able to link if b0 != 2 goto label0; and if b1 != 2
> > goto label0; together to indicate that they come from the same if
> > statement.  My question is, is there a way to link the Jimple statements
> to
> > the Java source code statements?  It is very important to note that I
> cannot
> > use line numbers.  The reason I cannot use line numbers is because it is
> > syntactically correct, albeit not good coding practice, to have more than
> > one statement on a single line:
> ...
> > This is why I can't use line numbers.  Is there a way to link the Jimple
> > statements to Java source code statements without using line numbers?
>
> Yes, one way would be to use both line numbers and column positions.
> That should disambiguate things in every case. Actually people have
> been working hard on attaching column positions as often as possible
> when converting Java source to Jimple exactly for that purpose.
> *Generally* what you want is attach some piece of information
> (whatever that may be) to the Jimple statements in the form of a Tag,
> i.e. an Object of a class that implements soot.tagkit.Tag
> (http://www.sable.mcgill.ca/soot/doc/soot/tagkit/Tag.html). This
> *could* be a tag that holds line numbers and column information (such
> tags already exist:
> http://www.sable.mcgill.ca/soot/doc/soot/tagkit/SourceLnPosTag.html)
> or it could even be a tag that holds your eclipse/JDT AST node. Maybe
> the latter is more suitable in your case. How do you translate the
> eclipse AST to Jimple anyway? Do you do this yourself or do you have
> Soot read in the Java source file? If you work directly on the AST
> then surely attaching the AST node seems to make more sense.
>
> > The second problem I have is with the Soot execution environment.
> Because
> > I'm writing a plugin, its operation will generally be used numerous times
> > during an execution of Eclipse.  The problem is that as soon as I run
> Soot
> > once, all its classes are instantiated and options set.  If I try to run
> > Soot again, it complains about variables already being set , timers
> already
> > initialized, etc.  At the moment I have to close Eclipse and run it again
> in
> > order to run Soot again.  My question therefore is is there a way "reset"
> > the Soot environment to allow me to run Soot more than once?  I tried
> > clearing all the variables in the soot.options.Options class, but it
> didn't
> > work.  My knowledge of the inner workings of Soot is somewhat limited, so
> I
> > don't know if it can't be done, or if I'm just missing something.
>
> Yes: G.v().reset() should reset every static variable in Soot.
>
> Eric
> --
> Eric Bodden
> Sable Research Group, McGill University
> Montréal, Québec, Canada
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20090720/7b700a4d/attachment.html 


More information about the Soot-list mailing list