I found LocalVariableTable and MethodParameters attributes in .class are lost after instrumentation? I am not sure whether it's bug because I use soot my own way, so commit a feature request. Here's the detailed descriptions below:
I am using Soot to develop a Javaagent, thus requiring a workflow from byte[] to Jimple to byte[], rather than class files. So it would be better If soot can run continuely (that's what I do now) instead of executing only once (reads all class files and then outputs all class files), and supports byte[] workflow.
To do this, I added a byte stream ClassProvider so that I can use Scene.v().loadClassAndSupport(String) directly to read project classes. The output implemented a subclass of soot.baf.BafASMBackend to obtain byte array data of classes. Core implementation:
public class SubClass extends BafASMBackend {
/* ... */
public byte[] generateClassBytes() {
ClassWriter cw = new SootASMClassWriter(ClassWriter.COMPUTE_FRAMES);
cv = cw;
generateByteCode();
return cw.toByteArray();
}
}
However, the classes obtained this way lost useful attributes for the program, such as LocalVariableTable and MethodParameters. Is there any wrong in my usage? How to handle this process more properly? Thank you for your reply!
I found LocalVariableTable and MethodParameters attributes in .class are lost after instrumentation? I am not sure whether it's bug because I use soot my own way, so commit a feature request. Here's the detailed descriptions below:
I am using Soot to develop a Javaagent, thus requiring a workflow from byte[] to Jimple to byte[], rather than class files. So it would be better If soot can run continuely (that's what I do now) instead of executing only once (reads all class files and then outputs all class files), and supports byte[] workflow.
To do this, I added a byte stream
ClassProvider
so that I can useScene.v().loadClassAndSupport(String)
directly to read project classes. The output implemented a subclass ofsoot.baf.BafASMBackend
to obtain byte array data of classes. Core implementation:However, the classes obtained this way lost useful attributes for the program, such as LocalVariableTable and MethodParameters. Is there any wrong in my usage? How to handle this process more properly? Thank you for your reply!