[Soot-list] Exception in thread "main" java.lang.ClassCastException: soot.coffi.CONSTANT_InterfaceMethodref_info cannot be cast to soot.coffi.CONSTANT_Methodref_info

Jason Xie 472408570 at qq.com
Tue Jun 3 10:47:36 EDT 2014


Dear Steven:
   Thanks for reply. Actually,I had set the  “-src-prec apk”set in the second line and I remove the "--pp" options right now. while it still didn't work.Do it  have any other wrong configuration ?
   The configuration is following:(The AndroidPlatform and AkpPath is a String type which  i set at the beginning of code);

                         G.reset();


                        Options.v().set_src_prec(Options.src_prec_apk);


                        List<String> argsList = new ArrayList<String>();


                        argsList.addAll(Arrays.asList(new String[] { "-w",  "-android-jars", AndroidPlatform,"-process-dir", AkpPath, "-pp","-allow-phantom-refs", "-f", "n" 





                        }));


                        Scene.v().addBasicClass("java.io.PrintStream",SootClass.SIGNATURES);


                        Scene.v().addBasicClass("java.lang.System",SootClass.SIGNATURES);


                        String[] soot_args = argsList.toArray(new String[0]); 


                        Pack pack1=PackManager.v().getPack("wjtp");


                        pack1.add(new Transform("wjtp.myTrans", new CompTransfor()));


                        soot.Main.main(soot_args);


Thanks&Regards,
Jason
------------------ Original ------------------
From:  "Steven Arzt";<Steven.Arzt at cased.de>;
Date:  Tue, Jun 3, 2014 10:26 PM
To:  "Jason Xie"<472408570 at qq.com>; 

Subject:  AW: AW: [Soot-list] Exception in thread "main" java.lang.ClassCastException:	soot.coffi.CONSTANT_InterfaceMethodref_info cannot be cast to	soot.coffi.CONSTANT_Methodref_info



 
Hi Jason,

 

Your option list is a bit weird. Please set “-src-prec apk”. The main activity  thing is commented out, but should not be there anyway. Furthermore, I would not use the “-pp” option with Android since your Java classpath contains the JRE JARs and not the ones from Android.

 

Best regards,

  Steven

 

Von: Jason Xie [mailto:472408570 at qq.com] 
Gesendet: Dienstag, 3. Juni 2014 16:11
An: Steven Arzt
Betreff: Re:AW: [Soot-list] Exception in thread "main" java.lang.ClassCastException: soot.coffi.CONSTANT_InterfaceMethodref_info cannot be cast to soot.coffi.CONSTANT_Methodref_info

 

Dear Steven:


  Thanks for your replay firstly.The following code is my soot configuration:


   main:


                        G.reset();


                        Options.v().set_src_prec(Options.src_prec_apk);


                        List<String> argsList = new ArrayList<String>();


                        argsList.addAll(Arrays.asList(new String[] { "-w",  "-android-jars", AndroidPlatform,"-process-dir", AkpPath, "-pp","-allow-phantom-refs", "-f", "n" 





                        }));


                        Scene.v().addBasicClass("java.io.PrintStream",SootClass.SIGNATURES);


                        Scene.v().addBasicClass("java.lang.System",SootClass.SIGNATURES);


                        String[] soot_args = argsList.toArray(new String[0]);  


                        Pack pack1=PackManager.v().getPack("wjtp");


                        pack1.add(new Transform("wjtp.myTrans", new CompTransfor()));


                        soot.Main.main(soot_args);


 


 


 


The CompTransfor class:


    public class CompTransfor extends soot.SceneTransformer {


      @Override


            protected void internalTransform(String arg0, Map<String, String> arg1) {



             List<SootClass> applicationClass = new ArrayList<SootClass>();


                        Iterator<SootClass> iterator = Scene.v().getApplicationClasses().iterator();


                        while (iterator.hasNext()) {


                                   SootClass temp = iterator.next();


                                   String classname = temp.getName();


                                   if (!classname.startsWith("android")&&!classname.startsWith("java"))


                                               applicationClass.add(temp);


                        }


           for (int i = 0; i < applicationClass.size(); i++) {


                   SootClass sc = applicationClass.get(i);


                    List<SootMethod> methodList = sc.getMethods();


                           for (SootMethod sm : methodList) {


                                   Body body = sm.retrieveActiveBody();


                                   UnitGraph g = new ExceptionalUnitGraph(body);



                        ..............


                }


         }


    }


The is the kernel part of my code to get the unitGraph of the Apk file. Do it make a sense?


------------------ Original ------------------


From:  "Steven Arzt";<Steven.Arzt at cased.de>;


Date:  Tue, Jun 3, 2014 09:59 PM


To:  "Jason Xie"<472408570 at qq.com>; "'Soot list'"<soot-list at sable.mcgill.ca>; 


Subject:  AW: [Soot-list] Exception in thread "main" java.lang.ClassCastException: soot.coffi.CONSTANT_InterfaceMethodref_info cannot be cast to soot.coffi.CONSTANT_Methodref_info



 


Hi Jason,

 

Please send the code with which you use Soot and the options with which you configure Soot. Since you are analyzing an APK file, Soot should not be using Coffi at all if I’m not mistaken.

 

Best regards,

  Steven

 

Von: soot-list-bounces at CS.McGill.CA [mailto:soot-list-bounces at CS.McGill.CA] Im Auftrag von Jason Xie
Gesendet: Dienstag, 3. Juni 2014 15:46
An: Steven Arzt; Soot list
Betreff: [Soot-list] Exception in thread "main" java.lang.ClassCastException: soot.coffi.CONSTANT_InterfaceMethodref_info cannot be cast to soot.coffi.CONSTANT_Methodref_info

 

Dear Steven and All:


     when I want to get the CFG of apk, I encounter the the following Exception:(Do some guys have the same problems?)


    Exception in thread "main" java.lang.ClassCastException: soot.coffi.CONSTANT_InterfaceMethodref_info cannot be cast to soot.coffi.CONSTANT_Methodref_info


            at soot.coffi.CFG.jimpleReturnTypeOfMethodRef(CFG.java:2488)


            at soot.coffi.CFG.processFlow(CFG.java:2315)


            at soot.coffi.CFG.jimplify(CFG.java:1119)


            at soot.coffi.CFG.jimplify(CFG.java:925)


            at soot.coffi.CoffiMethodSource.getBody(CoffiMethodSource.java:100)


            at soot.SootMethod.getBodyFromMethodSource(SootMethod.java:89)


            at soot.SootMethod.retrieveActiveBody(SootMethod.java:322)


            at soot.jimple.toolkits.callgraph.OnFlyCallGraphBuilder.processNewMethod(OnFlyCallGraphBuilder.java:526)


            at soot.jimple.toolkits.callgraph.OnFlyCallGraphBuilder.processReachables(OnFlyCallGraphBuilder.java:419)


            at soot.jimple.toolkits.callgraph.CallGraphBuilder.build(CallGraphBuilder.java:84)


            at soot.jimple.toolkits.callgraph.CHATransformer.internalTransform(CHATransformer.java:43)


            at soot.SceneTransformer.transform(SceneTransformer.java:39)


            at soot.Transform.apply(Transform.java:90)


            at soot.RadioScenePack.internalApply(RadioScenePack.java:57)


            at soot.jimple.toolkits.callgraph.CallGraphPack.internalApply(CallGraphPack.java:49)


            at soot.Pack.apply(Pack.java:116)


            at soot.PackManager.runWholeProgramPacks(PackManager.java:539)


            at soot.PackManager.runPacksNormally(PackManager.java:443)


            at soot.PackManager.runPacks(PackManager.java:388)


            at soot.Main.run(Main.java:203)


            at soot.Main.main(Main.java:146)


        Looking forward to your reply.


Thanks&Regards,


Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20140603/db149b66/attachment-0001.html 


More information about the Soot-list mailing list