[Soot-list] Question about the CHA-based call graph in Soot.

Bodden, Eric eric.bodden at sit.fraunhofer.de
Mon Feb 10 02:57:58 EST 2014


Hello Yu.

On 10.02.2014, at 00:30, Yu Feng <fengyu8299 at gmail.com> wrote:

> Hi all,
> 
> I ran the following simple codes with command-line options:
> soot.Main.v().run(new String[] {
> 
> "-W",
> 
> "-main-class", className,
> 
> "-process-dir", "/Documents/workspace/CFLexamples/bin",
> 
> "-src-prec", "java",
> 
> "-allow-phantom-refs",
> 
> "-no-bodies-for-excluded",
> 
> "-exclude", "java",
> 
> "-exclude", "javax",
> 
> "-output-format", "none",
> 
> "-p", "jb", "use-original-names:true",
> 
> "-p", "cg.cha", "on",
> 
> "-app", className } );
> 
> A {
> foo();
> }
> 
> B extends A{
> foo();
> }
> 
> C extends A{
> foo();
> }
> 
> A a = new C();
> a.foo();
> 
> Based on CHA(http://www.cs.ucla.edu/~palsberg/paper/oopsla00.pdf), all the 'foo()' in A, B and C should be added to the call edges for 'a.foo()' .
> 
> With the default cg.cha in soot, I got the precise result:  foo()@C, but this is inconsistent with the concept of CHA. 

You have to please look at the Jimple code that is generated. I am sure it looks like this:

> C a = new C();
> a.foo();



> Did Soot perform any optimization automatically? How can I get an 'imprecise' and original version of CHA-based call graph?

Are you analyzing bytecode? That might explain things. In bytecode "a" is just a stack location and in fact does not have any type information at all. Soot re-assigns those types by looking at how the location is used. In this case it is only ever assigned an object of type "C" which is why it will be typed "C" as well. For bytecode there is no way to go around this except for maybe tweaking the type assigner. If you go from source code then I suspect that Soot would behave differently.

Eric
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
Url : http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20140210/8698436b/attachment.bin 


More information about the Soot-list mailing list