[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Can CHA more than it's supposed to?
On Fri, Aug 08, 2003 at 09:39:32AM +0100, Eric Bodden wrote:
> Hi!
>
> Tonight I was just playing around with your Eclipse plugin and the Jimple
> Annotation Pack, because I just wanted to step through your paper "Virtual
> Method Call Resolution for Java" and the examples in there. But already at
> the first example, I came across a problem: I had CHA on, SPARK off and
> Jimple Annotation for Callgraphs enabled. Well it did compile and work and
> was annotated. But: The static types were actually fully resolved and did
> _not_ actually contain the whole hierarchy, like it's actually supposed to
> be in CHA (isn't it?). So either I am missing the plot completely here or
> the CHA implementation can just more than it can or something is wrong with
> the annotation algorithm... Do you have any ideas?
You need to run Soot with the Whole Program option. It's -w or
-whole-program on the command line, and in the General Options section
in Eclipse. Otherwise, Soot only builds a call graph containing the
class you are analyzing (ie Main class).
> Also I found a bug: If you, by accident, forget to change the output option
> to "Jimple" but still enable the Jimple Annotation Pack, you get a
> ClassCastException, which is certainly somehow right, but I still think that
> a proper error message would be better in that case.
Again, this is not because it's not outputting Jimple, but because
you're not running in whole program mode. Note that, it least for me,
it prints:
Warning: using incomplete callgraph containing only application classes.
several times before throwing the exception (and in the above case as
well). The reason for this exception is a bit complicated. First, the
call graph is only really created when the -w option is given. However,
Dava needs a call graph no matter what. But a real call graph takes a
long time to compute when you're just decompiling one file. So, when you
ask the Scene for a call graph and it doesn't have one, it just creates
a small, incomplete one that is mostly sufficient for Dava. But since
it's not a real call graph, it throws it away again. The jap.cgtagger
phase asks the Scene for a call graph for each class it processes. So
the Scene builds a new call graph as it's processing each class, since
it doesn't already have one from the whole-program pack. But by then,
some of the other classes have been converted to Baf and the Jimple
thrown away, so it can't create this incomplete call graph and throws
this exception.
I think the Scene should only create this incomplete call graph only
when it's running Dava, to avoid misleading people who fail to read the
warning. I'll make this change so it appears in the next release of
Soot.
Ondrej
>
> Thank you very much,
>
> Eric
>
> P.S. The code I used is attached.