[Soot-list] Question about CallGraph

Eric Bodden eric.bodden at mail.mcgill.ca
Mon Feb 5 07:41:16 EST 2007


I am passing this on to the list because I don't know much about how the
PAG works...

Has anybody any idea why the PAG is empty? 

> I transfered a right option for SparkOption to build a PAG 
> successfully:
>  
> Transform sparkTranform = new Transform( "cg.spark", null );
>  
> sparkTranform.setDefaultOptions("enabled:true verbose:true 
> ignore-types:false force-gc:false pre-jimplify:false 
> vta:false rta:false field-based:false types-for-sites:false 
> merge-stringbuffer:true string-constants:false 
> simulate-natives:true simple-edges-bidirectional:false 
> on-fly-cg:true simplify-offline:false simplify-sccs:false 
> ignore-types-for-sc cs:false propagator:worklist 
> set-impl:double double-set-old:hybrid double-set-new:hybrid 
> dump-html:false dump-pag:false dump-solution:false 
> topo-sort:false dump -types:true class-method-var:true 
> dump-answer:false add-tags:false set-mass:false");
>  
> Map options1 = PhaseOptions.v().getPhaseOptions( sparkTranform );
> SparkOptions opts = new SparkOptions( options1 );
> ContextInsensitiveBuilder b = new ContextInsensitiveBuilder(); 
> final PAG pag = (PAG) b.setup( opts );
> b.build();
>  
> When executing, no error occur. But when I use the following 
> commands in order to collect information about the number of node:
>  
> System.out.println("VarNodes: " + pag.getVarNodeNumberer().size());
> System.out.println("FieldRefNodes: 
> "+pag.getFieldRefNodeNumberer().size()); 
> System.out.println("AllocNodes: 
> "+pag.getAllocNodeNumberer().size());  
>       
> I received the following result:
>  
> VarNodes: 0
> FieldRefNodes: 0
> AllocNodes: 0
>  
> According to the Soot document, the method build() fills in 
> the pointer assignment graph (PAG) returned by setup. This 
> thing isn't match the above result.
>  
> Would you like to explain this problem for me?
>  
> Thanks & BRs,
>  
> ----- Original Message ----- 
> From: "Eric Bodden" <eric.bodden at mail.mcgill.ca 
> <mailto:eric.bodden at mail.mcgill.ca> >
> To: "Thanh Son IT" <thanhson at saigonpostel.com.vn 
> <mailto:thanhson at saigonpostel.com.vn> >
> Cc: "Nguyen Hua Phung_BK" <phung at dit.hcmut.edu.vn 
> <mailto:phung at dit.hcmut.edu.vn> >; <phung at cse.hcmut.edu.vn 
> <mailto:phung at cse.hcmut.edu.vn> >
> Sent: Monday, January 29, 2007 8:27 PM
> Subject: RE: [Soot-list] Question about CallGraph
> 
> 
> Well, I assume that you have not initialized the pack correctly. It is
> looking for a value for the phase option "set-impl" but presumably
> cannot find one.
> 
> 
> 
> Eric  
> 
> > -----Original Message-----
> > From: Thanh Son IT [mailto:thanhson at saigonpostel.com.vn] 
> > Sent: Sunday, January 28, 2007 9:49 PM
> > To: Eric Bodden
> > Cc: Nguyen Hua Phung_BK; phung at cse.hcmut.edu.vn 
> <mailto:phung at cse.hcmut.edu.vn> 
> > Subject: Re: [Soot-list] Question about CallGraph
> > 
> > Thanks,
> > 
> > In the subphase "wjtp.abc" of the user-defined Pack "wjtp", I 
> > got the callgraph (CHA) of the analysed program.
> > Besides, I also want to get the PAG of the analysed program; 
> > but I have a problem in the option to create PAG.
> > 
> > protected void internalTransform(String phaseName, Map options)  {
> >   SparkOptions opts = new SparkOptions( options );
> >   ContextInsensitiveBuilder b = new ContextInsensitiveBuilder();
> >   PAG pag = (PAG) b.setup( opts );
> >   b.build();
> >  }
> > 
> > When executing, the following error occur:
> > 
> > Exception in thread "main" java.lang.RuntimeException: 
> > Invalid value  of phase option set-impl
> >         at soot.options.SparkOptions.set_impl(SparkOptions.java:437)
> >         at getCG.internalTransform(getCG.java:57)
> >         at soot.SceneTransformer.transform(SceneTransformer.java:39)
> > 
> > BRs,
> > Mr.Son
> > 
> > ----- Original Message -----
> > From: "Eric Bodden" <eric.bodden at mail.mcgill.ca 
> <mailto:eric.bodden at mail.mcgill.ca> >
> > To: "Thanh Son IT" <thanhson at saigonpostel.com.vn 
> <mailto:thanhson at saigonpostel.com.vn> >
> > Cc: "Nguyen Hua Phung_BK" <phung at dit.hcmut.edu.vn 
> <mailto:phung at dit.hcmut.edu.vn> >; 
> > <phung at cse.hcmut.edu.vn <mailto:phung at cse.hcmut.edu.vn> >
> > Sent: Tuesday, January 23, 2007 8:13 PM
> > Subject: RE: [Soot-list] Question about CallGraph
> > 
> > 
> > I don't quite understand. You want to add an analysis called 
> > "wjtp.abc"
> > to the "wjtp" pack? Then you just have to get the right pack 
> > within abc
> > and add the Transformer to it. Not that you cannot easily 
> add a whole
> > pack to Soot, i.e. the order of *packs* is predefined. 
> However, within
> > each pack you can shuffle around analyses however you like.
> > 
> > 
> > Eric
> > 
> > 
> > > -----Original Message-----
> > > From: Thanh Son IT [mailto:thanhson at saigonpostel.com.vn]
> > > Sent: Monday, January 22, 2007 10:19 PM
> > > To: Eric Bodden
> > > Cc: Nguyen Hua Phung_BK; phung at cse.hcmut.edu.vn 
> <mailto:phung at cse.hcmut.edu.vn> 
> > > Subject: Re: [Soot-list] Question about CallGraph
> > >
> > > Thank Mr.Eric for your information,
> > >
> > > I have a question for you.
> > > According to the Soot phase flow: jb -> cg -> wjtp -> wjop 
> > -> wjap ->
> > > jtp ->
> > > jop -> jap -> bb -> tag, if I use option -w, are all phases
> > implemented
> > > on
> > > my program ?
> > >
> > > Assuming I have a subphase "wjtp.abc" in the user-define 
> > Pack "wjtp",
> > > how to
> > > write code in order to can type command:
> > > java MyDriver -p wjtp.abc HelloWorld    ??? (Only 3 phase jb, cg &
> > wjtp
> > > are
> > > implemented).
> > >
> > > BRs,
> > >
> > > ----- Original Message -----
> > > From: "Eric Bodden" <eric.bodden at mail.mcgill.ca 
> <mailto:eric.bodden at mail.mcgill.ca> >
> > > To: "Thanh Son IT" <thanhson at saigonpostel.com.vn 
> <mailto:thanhson at saigonpostel.com.vn> >
> > > Sent: Tuesday, January 23, 2007 8:46 AM
> > > Subject: RE: [Soot-list] Question about CallGraph
> > >
> > >
> > > Hmm, I am not sure. Actually, soot 2.2.3 should be able 
> to cope with
> > > Java 5 bytecode. I have used this combination before. Having said
> > that,
> > > maybe something changed in a javac minor version which produces
> > > bytecode
> > > that Soot does not expect. Anyway, I have tried your 
> > example with Java
> > > 5
> > > and my personal (SVN) build of Soot and Jasmin and that 
> > works without
> > > problems. So if it was a bug, it must have been fixed in 
> > the meantime.
> > > You can get nightly builds of Soot from:
> > >
> > > http://www.sable.mcgill.ca/soot/nightly.html 
> <http://www.sable.mcgill.ca/soot/nightly.html> 
> > >
> > >
> > > Eric
> > >
> > >
> > > > -----Original Message-----
> > > > From: Thanh Son IT [mailto:thanhson at saigonpostel.com.vn]
> > > > Sent: Monday, January 22, 2007 8:42 PM
> > > > To: Eric Bodden
> > > > Cc: soot-list at sable.mcgill.ca 
> <mailto:soot-list at sable.mcgill.ca> 
> > > > Subject: Re: [Soot-list] Question about CallGraph
> > > >
> > > > Thanks,
> > > >
> > > > I solved this problem. Yesterday, I used JDK 1.5.
> > > > Today, I return JDK 1.4 and don't see this error.
> > > > Would you like to explain this error for me?
> > > >
> > > > BRs,
> > > > ----- Original Message -----
> > > > From: "Eric Bodden" <eric.bodden at mail.mcgill.ca 
> <mailto:eric.bodden at mail.mcgill.ca> >
> > > > To: "Thanh Son IT" <thanhson at saigonpostel.com.vn 
> <mailto:thanhson at saigonpostel.com.vn> >
> > > > Cc: <soot-list at sable.mcgill.ca 
> <mailto:soot-list at sable.mcgill.ca> >
> > > > Sent: Tuesday, January 23, 2007 1:02 AM
> > > > Subject: RE: [Soot-list] Question about CallGraph
> > > >
> > > >
> > > > Hmm, this definitely does not seem to be related to your
> > > > transformation.
> > > > I assume that rather something is wrong (or at least unexpected)
> > with
> > > > the bytecode that you feed in. How did you compile the 
> class file
> > for
> > > > "aaa" ?
> > > >
> > > > Are you sure, you only have a single soot jar file on 
> > your classpath
> > > > and
> > > > not accidentally any other version of coffi or so?
> > > >
> > > >
> > > > Eric
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: soot-list-bounces at sable.mcgill.ca 
> <mailto:soot-list-bounces at sable.mcgill.ca>  [mailto:soot-list-
> > > > > bounces at sable.mcgill.ca 
> <mailto:bounces at sable.mcgill.ca> ] On Behalf Of Thanh Son IT
> > > > > Sent: Sunday, January 21, 2007 9:16 PM
> > > > > To: soot-list at sable.mcgill.ca 
> <mailto:soot-list at sable.mcgill.ca> 
> > > > > Subject: [Soot-list] Question about CallGraph
> > > > >
> > > > > Hi,
> > > > >
> > > > > I'm using Soot verison 2.2.3.
> > > > > I want add a Transformer into user-define Pack "wjtp".
> > > > >
> > > > > --------------------------------------------
> > > > > /* Usage: java Main [soot-options] appClass  */
> > > > > /* import necessary soot packages */
> > > > > import soot.*;
> > > > > import java.io.*;
> > > > >
> > > > >  public class Main {
> > > > >  public static void main(String[] args) {
> > > > >
> > > > >  /* check the arguments */
> > > > >  if (args.length == 0) {
> > > > >  System.err.println("Usage: java Main [options] classname");
> > > > > System.exit(0);  }
> > > > >
> > > > >  /* add a phase to transformer pack by call Pack.add */
> > > > >
> > > > >  PackManager.v().getPack("wjtp").add(new
> > > > > Transform("wjtp.name",stm123.v()));
> > > > >
> > > > >  /* Give control to Soot to process all options,
> > > > >  * InvokeStaticInstrumenter.internalTransform will get called.
> > > > >  */
> > > > >  soot.Main.main(args);
> > > > >  }
> > > > >  }
> > > > > --------------------------------------------------------------
> > > > >
> > > > > import soot.*;
> > > > > import soot.jimple.*;
> > > > > import soot.util.*;
> > > > > import java.util.*;
> > > > > import java.io.*;
> > > > >
> > > > > class stm123 extends SceneTransformer{
> > > > >  private static stm123 instance = new stm123();  
> > private stm123()
> > > {}
> > > > > public static stm123 v() { return instance; }
> > > > >
> > > > >  protected void internalTransform(String phaseName, 
> Map options)
> > {
> > > > >    //options.v().set_whole_program(true);
> > > > >    //CHATransformer.v().transform();
> > > > >    //CallGraph cg = Scene.v().getCallGraph();
> > > > >    //System.out.println(cg.size());
> > > > >
> > > > >    System.out.println("test");
> > > > >   }
> > > > > }
> > > > >
> > > > >
> > > >
> > >
> > --------------------------------------------------------------
> > ---------
> > > > >
> > > > > import java.io.*;
> > > > >
> > > > > class aaa {
> > > > > public static void main(String[] arg) {
> > > > > UI ui = new TextUI();
> > > > > ui.display("Hello World");
> > > > > }
> > > > > }
> > > > >
> > > > >
> > > >
> > >
> > --------------------------------------------------------------
> > ---------
> > > > > ------
> > > > >
> > > > > When I use command:
> > > > > > java Main -w aaa
> > > > >
> > > > > the following error occured:
> > > > >
> > > > > Soot started on Mon Jan 22 08:58:59 ICT 2007 
> Exception in thread
> > > > "main"
> > > > > java.lang.ClassCastException: soot.coffi.CONSTANT_Class_info
> > > > >         at soot.coffi.Util.addAnnotations(Util.java:980)
> > > > >         at
> > > > > 
> soot.coffi.Util.addAnnotationVisibilityAttribute(Util.java:942)
> > > > >         at soot.coffi.Util.resolveFromClassFile(Util.java:409)
> > > > >         at 
> > soot.CoffiClassSource.resolve(CoffiClassSource.java:37)
> > > > >         at
> > > soot.SootResolver.bringToHierarchy(SootResolver.java:148)
> > > > >         at
> > > soot.SootResolver.bringToSignatures(SootResolver.java:172)
> > > > >         at 
> > soot.SootResolver.bringToBodies(SootResolver.java:214)
> > > > >         at
> > > > > 
> soot.SootResolver.processResolveWorklist(SootResolver.java:100)
> > > > >         at 
> soot.SootResolver.resolveClass(SootResolver.java:89)
> > > > >         at soot.Scene.tryLoadClass(Scene.java:298)
> > > > >         at soot.Scene.loadBasicClasses(Scene.java:848)
> > > > >         at soot.Scene.loadNecessaryClasses(Scene.java:874)
> > > > >         at soot.Main.run(Main.java:170)
> > > > >         at soot.Main.main(Main.java:146)
> > > > >         at Main.main(Main.java:40)
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > >
> > 
> > 
> > 
> 
> 



More information about the Soot-list mailing list