[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: help



On Wed, 5 Sep 2001, xiaorong xiang wrote:

> I want to know how can I get the AST tree for jimple file, I saw there
> is a JimpleAST.class, but I don't know how to use it. Can you give me a
> example? THanks.

Hi,

We have a Jimple parser, which produces a Jimple AST.  If you start from
class files, Jimple ASTs are not produced.

It's not clear to me why you would want to work with the Jimple AST.  Soot
provides far better ways of manipulating the Jimple than via its AST.  We
can't directly write out Jimple from the AST, either.  There is no real
way to get the Jimple AST out.

However, a relevant JimpleAST is available in the mJimpleAST field of the
JimpleMethodSource.  This is created by Soot when the SootClass is first
resolved, and Soot decides that it will load the file from Jimple.  If you
have a SootMethod, you can get the source with getSource.  Cast it to
JimpleMethodSource and read the mJimpleAST field.

pat