Open Lms24 opened 2 years ago
This is a soot issue, fixed by updating to the latest soot build. I can now create the instrumented JAR. Please pull and re-build both DynamicSlicingCore and this repo.
Thank you for the fix but unfortunately I get another problem when instrumenting the Jar. This is the output of instr-debug.log
:
EDIT: I just saw, I actually do get an instrumented jar, despite the error. I nevertheless want to report the error
[main] INFO JimpleWriter - initialize (17): Initializing Instrumenter
[main] INFO JimpleWriter - initialize (29): Initialization done
[main] INFO JimpleWriter - start (36): Running packs ...
[main] INFO JimpleWriter - start (38): Writing output ...
[main] INFO JimpleWriter - start (40): Output written ...
[main] INFO JavaInstrumenter - initialize (79): Initializing Instrumenter
[main] INFO JavaInstrumenter - initialize (98): Initialization done
[main] INFO JavaInstrumenter - start (252): Running packs ...
[Thread-28] ERROR heros.solver.CountingThreadPoolExecutor - Worker thread execution failed: Failed to apply jb to <net.bytebuddy.implementation.bytecode.constant.FieldConstant: net.bytebuddy.implementation.bytecode.StackManipulation$Size apply(net.bytebuddy.jar.asm.MethodVisitor,net.bytebuddy.implementation.Implementation$Context)>
java.lang.RuntimeException: Failed to apply jb to <net.bytebuddy.implementation.bytecode.constant.FieldConstant: net.bytebuddy.implementation.bytecode.StackManipulation$Size apply(net.bytebuddy.jar.asm.MethodVisitor,net.bytebuddy.implementation.Implementation$Context)>
at soot.asm.AsmMethodSource.getBody(AsmMethodSource.java:2238)
at soot.SootMethod.retrieveActiveBody(SootMethod.java:446)
at soot.PackManager.lambda$retrieveAllBodies$2(PackManager.java:1252)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.ClassCastException: class java.util.LinkedHashMap$Entry cannot be cast to class java.util.HashMap$TreeNode (java.util.LinkedHashMap$Entry and java.util.HashMap$TreeNode are in module java.base of loader 'bootstrap')
at java.base/java.util.HashMap$TreeNode.moveRootToFront(HashMap.java:1882)
at java.base/java.util.HashMap$TreeNode.treeify(HashMap.java:1998)
at java.base/java.util.HashMap.treeifyBin(HashMap.java:767)
at java.base/java.util.HashMap.putVal(HashMap.java:639)
at java.base/java.util.HashMap.put(HashMap.java:607)
at com.google.common.collect.StandardTable.getOrCreate(StandardTable.java:137)
at com.google.common.collect.StandardTable.put(StandardTable.java:148)
at com.google.common.collect.HashBasedTable.put(HashBasedTable.java:51)
at soot.FastHierarchy.resolveMethod(FastHierarchy.java:807)
at soot.FastHierarchy.resolveMethod(FastHierarchy.java:760)
at soot.SootMethodRefImpl.tryResolve(SootMethodRefImpl.java:216)
at soot.SootMethodRefImpl.tryResolve(SootMethodRefImpl.java:202)
at soot.toolkits.exceptions.UnitThrowAnalysis.mightThrow(UnitThrowAnalysis.java:304)
at soot.toolkits.exceptions.UnitThrowAnalysis$ValueSwitch.caseInstanceInvokeExpr(UnitThrowAnalysis.java:1181)
at soot.toolkits.exceptions.UnitThrowAnalysis$ValueSwitch.caseSpecialInvokeExpr(UnitThrowAnalysis.java:1003)
at soot.jimple.internal.AbstractSpecialInvokeExpr.apply(AbstractSpecialInvokeExpr.java:117)
at soot.toolkits.exceptions.UnitThrowAnalysis.mightThrow(UnitThrowAnalysis.java:296)
at soot.toolkits.exceptions.UnitThrowAnalysis$UnitSwitch.caseInvokeStmt(UnitThrowAnalysis.java:802)
at soot.jimple.internal.JInvokeStmt.apply(JInvokeStmt.java:99)
at soot.toolkits.exceptions.UnitThrowAnalysis.mightThrow(UnitThrowAnalysis.java:280)
at soot.toolkits.exceptions.UnitThrowAnalysis.mightThrow(UnitThrowAnalysis.java:275)
at soot.toolkits.graph.ExceptionalUnitGraph.buildExceptionDests(ExceptionalUnitGraph.java:277)
at soot.toolkits.graph.ExceptionalUnitGraph.initialize(ExceptionalUnitGraph.java:220)
at soot.toolkits.graph.ExceptionalUnitGraph.<init>(ExceptionalUnitGraph.java:127)
at soot.jimple.toolkits.scalar.UnreachableCodeEliminator.internalTransform(UnreachableCodeEliminator.java:86)
at soot.BodyTransformer.transform(BodyTransformer.java:47)
at soot.Transform.apply(Transform.java:126)
at soot.JimpleBodyPack.applyPhaseOptions(JimpleBodyPack.java:64)
at soot.JimpleBodyPack.internalApply(JimpleBodyPack.java:112)
at soot.Pack.apply(Pack.java:126)
at soot.asm.AsmMethodSource.getBody(AsmMethodSource.java:2236)
... 5 more
Exception in thread "Thread-28" java.lang.RuntimeException: Failed to apply jb to <net.bytebuddy.implementation.bytecode.constant.FieldConstant: net.bytebuddy.implementation.bytecode.StackManipulation$Size apply(net.bytebuddy.jar.asm.MethodVisitor,net.bytebuddy.implementation.Implementation$Context)>
at soot.asm.AsmMethodSource.getBody(AsmMethodSource.java:2238)
at soot.SootMethod.retrieveActiveBody(SootMethod.java:446)
at soot.PackManager.lambda$retrieveAllBodies$2(PackManager.java:1252)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.ClassCastException: class java.util.LinkedHashMap$Entry cannot be cast to class java.util.HashMap$TreeNode (java.util.LinkedHashMap$Entry and java.util.HashMap$TreeNode are in module java.base of loader 'bootstrap')
at java.base/java.util.HashMap$TreeNode.moveRootToFront(HashMap.java:1882)
at java.base/java.util.HashMap$TreeNode.treeify(HashMap.java:1998)
at java.base/java.util.HashMap.treeifyBin(HashMap.java:767)
at java.base/java.util.HashMap.putVal(HashMap.java:639)
at java.base/java.util.HashMap.put(HashMap.java:607)
at com.google.common.collect.StandardTable.getOrCreate(StandardTable.java:137)
at com.google.common.collect.StandardTable.put(StandardTable.java:148)
at com.google.common.collect.HashBasedTable.put(HashBasedTable.java:51)
at soot.FastHierarchy.resolveMethod(FastHierarchy.java:807)
at soot.FastHierarchy.resolveMethod(FastHierarchy.java:760)
at soot.SootMethodRefImpl.tryResolve(SootMethodRefImpl.java:216)
at soot.SootMethodRefImpl.tryResolve(SootMethodRefImpl.java:202)
at soot.toolkits.exceptions.UnitThrowAnalysis.mightThrow(UnitThrowAnalysis.java:304)
at soot.toolkits.exceptions.UnitThrowAnalysis$ValueSwitch.caseInstanceInvokeExpr(UnitThrowAnalysis.java:1181)
at soot.toolkits.exceptions.UnitThrowAnalysis$ValueSwitch.caseSpecialInvokeExpr(UnitThrowAnalysis.java:1003)
at soot.jimple.internal.AbstractSpecialInvokeExpr.apply(AbstractSpecialInvokeExpr.java:117)
at soot.toolkits.exceptions.UnitThrowAnalysis.mightThrow(UnitThrowAnalysis.java:296)
at soot.toolkits.exceptions.UnitThrowAnalysis$UnitSwitch.caseInvokeStmt(UnitThrowAnalysis.java:802)
at soot.jimple.internal.JInvokeStmt.apply(JInvokeStmt.java:99)
at soot.toolkits.exceptions.UnitThrowAnalysis.mightThrow(UnitThrowAnalysis.java:280)
at soot.toolkits.exceptions.UnitThrowAnalysis.mightThrow(UnitThrowAnalysis.java:275)
at soot.toolkits.graph.ExceptionalUnitGraph.buildExceptionDests(ExceptionalUnitGraph.java:277)
at soot.toolkits.graph.ExceptionalUnitGraph.initialize(ExceptionalUnitGraph.java:220)
at soot.toolkits.graph.ExceptionalUnitGraph.<init>(ExceptionalUnitGraph.java:127)
at soot.jimple.toolkits.scalar.UnreachableCodeEliminator.internalTransform(UnreachableCodeEliminator.java:86)
at soot.BodyTransformer.transform(BodyTransformer.java:47)
at soot.Transform.apply(Transform.java:126)
at soot.JimpleBodyPack.applyPhaseOptions(JimpleBodyPack.java:64)
at soot.JimpleBodyPack.internalApply(JimpleBodyPack.java:112)
at soot.Pack.apply(Pack.java:126)
at soot.asm.AsmMethodSource.getBody(AsmMethodSource.java:2236)
... 5 more
Exception in thread "main" java.lang.RuntimeException: Failed to apply jb to <net.bytebuddy.implementation.bytecode.constant.FieldConstant: net.bytebuddy.implementation.bytecode.StackManipulation$Size apply(net.bytebuddy.jar.asm.MethodVisitor,net.bytebuddy.implementation.Implementation$Context)>
at soot.asm.AsmMethodSource.getBody(AsmMethodSource.java:2238)
at soot.SootMethod.retrieveActiveBody(SootMethod.java:446)
at soot.PackManager.lambda$retrieveAllBodies$2(PackManager.java:1252)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.ClassCastException: class java.util.LinkedHashMap$Entry cannot be cast to class java.util.HashMap$TreeNode (java.util.LinkedHashMap$Entry and java.util.HashMap$TreeNode are in module java.base of loader 'bootstrap')
at java.base/java.util.HashMap$TreeNode.moveRootToFront(HashMap.java:1882)
at java.base/java.util.HashMap$TreeNode.treeify(HashMap.java:1998)
at java.base/java.util.HashMap.treeifyBin(HashMap.java:767)
at java.base/java.util.HashMap.putVal(HashMap.java:639)
at java.base/java.util.HashMap.put(HashMap.java:607)
at com.google.common.collect.StandardTable.getOrCreate(StandardTable.java:137)
at com.google.common.collect.StandardTable.put(StandardTable.java:148)
at com.google.common.collect.HashBasedTable.put(HashBasedTable.java:51)
at soot.FastHierarchy.resolveMethod(FastHierarchy.java:807)
at soot.FastHierarchy.resolveMethod(FastHierarchy.java:760)
at soot.SootMethodRefImpl.tryResolve(SootMethodRefImpl.java:216)
at soot.SootMethodRefImpl.tryResolve(SootMethodRefImpl.java:202)
at soot.toolkits.exceptions.UnitThrowAnalysis.mightThrow(UnitThrowAnalysis.java:304)
at soot.toolkits.exceptions.UnitThrowAnalysis$ValueSwitch.caseInstanceInvokeExpr(UnitThrowAnalysis.java:1181)
at soot.toolkits.exceptions.UnitThrowAnalysis$ValueSwitch.caseSpecialInvokeExpr(UnitThrowAnalysis.java:1003)
at soot.jimple.internal.AbstractSpecialInvokeExpr.apply(AbstractSpecialInvokeExpr.java:117)
at soot.toolkits.exceptions.UnitThrowAnalysis.mightThrow(UnitThrowAnalysis.java:296)
at soot.toolkits.exceptions.UnitThrowAnalysis$UnitSwitch.caseInvokeStmt(UnitThrowAnalysis.java:802)
at soot.jimple.internal.JInvokeStmt.apply(JInvokeStmt.java:99)
at soot.toolkits.exceptions.UnitThrowAnalysis.mightThrow(UnitThrowAnalysis.java:280)
at soot.toolkits.exceptions.UnitThrowAnalysis.mightThrow(UnitThrowAnalysis.java:275)
at soot.toolkits.graph.ExceptionalUnitGraph.buildExceptionDests(ExceptionalUnitGraph.java:277)
at soot.toolkits.graph.ExceptionalUnitGraph.initialize(ExceptionalUnitGraph.java:220)
at soot.toolkits.graph.ExceptionalUnitGraph.<init>(ExceptionalUnitGraph.java:127)
at soot.jimple.toolkits.scalar.UnreachableCodeEliminator.internalTransform(UnreachableCodeEliminator.java:86)
at soot.BodyTransformer.transform(BodyTransformer.java:47)
at soot.Transform.apply(Transform.java:126)
at soot.JimpleBodyPack.applyPhaseOptions(JimpleBodyPack.java:64)
at soot.JimpleBodyPack.internalApply(JimpleBodyPack.java:112)
at soot.Pack.apply(Pack.java:126)
at soot.asm.AsmMethodSource.getBody(AsmMethodSource.java:2236)
... 5 more
I pulled, cleaned and re-built both, Core and Slicer4J
I do not get this error, however, it seems like disabling soot's unreachable code optimization may work. I'll try that and update the code and let you know.
Hi there, I got another problem with Jar instrumentation. I tried to slice test cases from javapoet and I got the following error message in
instr-debug.log
:Here's the fat jar I created from the project:
javapoet-1.14.0-SNAPSHOT-fat-tests.zip
This is not the first time that I am seeing issues related to
SymbolTable
. When I was trying to perform slicing on thecommons-lang
library I got similar errors during instrumentation. This is really a problem because I need to benchmark at least 10 projects for my Master's thesis and so far Slicer4J managed to work with 3 of over 20 open source projects I tried.I would be really happy if you could look into this issue. Thank you.