-
Notifications
You must be signed in to change notification settings - Fork 18
Soot migration
Alexey Volkov edited this page Dec 12, 2022
·
10 revisions
Terminology:
| Soot | JacoDB | |
|---|---|---|
| bytecode storage | - | JacoDB |
| scope of visible classes | Scene | JcClasspath |
| class | SootClass | JcClassOrInterface |
| class method | SootMethod | JcMethod |
| class field | SootField | JcField |
| type (with generics substitution) | - | JcJvmType |
| 3-address bytecode representation | JimpleBody | JcRawInstList |
| Control flow graph | ClassicCompleteUnitGraph | JcGraph |
| Soot | JacoDB |
// points to specific runtime version
G.v().initJdk(new G.JreInfo(location, version));
Options options = Options.v();
options.set_soot_classpath(files);
Scene.v().loadNecessaryClasses();
PackManager.v().runPacks(); |
val db = jacodb {
// points to specific runtime version
useJavaRuntime(runtimeFolder)
// jars to process
loadByteCode(listOf(jar1, jar2))
// persist all information to improve performance between restarts
persistent(location = "/home/user/jcdb.db", clearOnStart = false)
}
val classpath = db.classpath(listOf(jar1))
|
| Soot | JacoDB |
SootClass clazz = Scene.v().getSootClass("java.lang.String"); |
val clazz = classpath.findClassOrNull("java.lang.String") |
| Soot | JacoDB |
SootClass clazz = Scene.v().getSootClass("java.lang.String");
clazz.getMethod("length", Lists.emptyList()).retrieveActiveBody() |
val clazz = classpath.findClassOrNull("java.lang.String") ?: throw IllegalStateException()
classpath.findMethod("length").instructionList() |
| Soot | JacoDB |
ClassicCompleteUnitGraph graph = new ClassicCompleteUnitGraph(sootMmthod.getActiveBody()); |
val cfg = jcMethod.instructionList().graph() |