[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Java line code of NewExpression
Hi,
The following is what Ondrej sent to me. It may help.
"First, you need the Value that is the new expression at the allocation
site. Call pag.makeAllocNode( newExpr, newExpr.getType(), method ), where
method is the SootMethod in which the new expression is. This gives
you an AllocNode for the allocation site. Then, to determine whether a
local may point to an object allocated at that allocation site, call
pag.reachingObjects(local), cast the result to a PointsToSetInternal,
and call contains(allocNode) on it."
First of all, you need Spark. Please read the soot document, "soot
command options". And you may need larger heep size. The command line I am
using (for Soot 2.0.1) is:
java -Xmx500m YOUR-PROGRAM --app -w -p cg.spark enabled:true BENCHMARK
You can get points-to-analysis by using:
PointsToAnalysis pta = Scene.v().getPointsToAnalysis();
cast PointsToAnalysis to PAG. Then you can follow what Ondrej wrote as
above.
I don't know if it's the best way, but it works for me. This will tell you
which statement(s) of Jimple file allocate(s) the object you want.
Hope this will help. Ondrej is the Spark guru. He may tell you more.
cheers
lin
On Tue, 10 Feb 2004, wassim masri wrote:
> When printing the return Set of a reachingObjects() call
>
> I get output that looks as follows:
>
> "
> AllocNode 17 new Object1 in method <Test1: Object1 getObject(boolean)>,
> AllocNode 16 new Object2 in method <Test1: Object1 getObject(boolean)>,
> ....
> "
>
> This output gives the information about the NewExpression and in which
> method it occured.
>
> Is there a way to get more info like: which line of Java code (or bytecode)
> it occurred?
>
> Thanks,
> Wes
>
> _________________________________________________________________
> Find great local high-speed Internet access value at the MSN High-Speed
> Marketplace. http://click.atdmt.com/AVE/go/onm00200360ave/direct/01/
>
>
>