Retrieving Method Body from Soot Class with SOOTUP #1142
Replies: 2 comments 9 replies
-
Hi @DHANUSHIYADEVI |
Beta Was this translation helpful? Give feedback.
-
@DHANUSHIYADEVI { |
Beta Was this translation helpful? Give feedback.
-
I am new to SootUp and trying to GET method body from a Soot class, but I'm encountering a ClassCastException for certain classes, as shown below:
Caused by: java.lang.ClassCastException: class sootup.core.jimple.common.constant.StringConstant cannot be cast to class sootup.core.jimple.basic.Local (sootup.core.jimple.common.constant.StringConstant and sootup.core.jimple.basic.Local are in unnamed module of loader 'app')
at sootup.java.core.interceptors.typeresolving.TypePromotionVisitor.visit(TypePromotionVisitor.java:76)
at sootup.java.core.interceptors.typeresolving.TypeChecker.handleInvokeExpr(TypeChecker.java:300)
at sootup.java.core.interceptors.typeresolving.TypeChecker.caseAssignStmt(TypeChecker.java:220)
at sootup.core.jimple.common.stmt.JAssignStmt.accept(JAssignStmt.java:201)
at sootup.core.jimple.common.stmt.JAssignStmt.accept(JAssignStmt.java:59)
at sootup.java.core.interceptors.typeresolving.TypePromotionVisitor.getPromotedTyping(TypePromotionVisitor.java:47)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
at sootup.java.core.interceptors.typeresolving.TypeResolver.resolve(TypeResolver.java:81)
at sootup.java.core.interceptors.TypeAssigner.interceptBody(TypeAssigner.java:42)
at sootup.java.bytecode.frontend.AsmMethodSource.resolveBody(AsmMethodSource.java:234)
... 8 more
Would greatly appreciate any confirmation or corrections, as I’m unsure why I’m getting a ClassCastException for only certain classes. Am I using the correct approach to retrieve the method body? I’m following the example provided in this link.
Thank you in advance for your time and assistance.
Beta Was this translation helpful? Give feedback.
All reactions