Skip to content

Commit

Permalink
Minor Soot + File Fixes (#243)
Browse files Browse the repository at this point in the history
* Minor soot fixes

* Don't do application class
  • Loading branch information
DavidBakerEffendi authored Mar 13, 2022
1 parent 87e24ea commit bf6aaef
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Fixed

- No longer set `deleteOnExit` for files in temp dir since they get cleaned via try-final call already.
- Set Soot to non-application mode and non-whole program mode for efficiency.

## [1.0.20] - 2022-03-11

### Fixed
Expand Down
11 changes: 5 additions & 6 deletions src/main/scala/com/github/plume/oss/Jimple2Cpg.scala
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,10 @@ class Jimple2Cpg {
sourceFileNames
.map(getQualifiedClassPath)
.foreach { cp =>
Scene.v().addBasicClass(cp, SootClass.BODIES)
Scene.v().loadClassAndSupport(cp).setApplicationClass()
Scene.v().addBasicClass(cp)
Scene.v().loadClassAndSupport(cp)
}
Scene.v().loadDynamicClasses()
Scene.v().loadNecessaryClasses()
Scene.v().addBasicClass("soot.dummy.InvokeDynamic", SootClass.SIGNATURES)
}

private def basePasses(
Expand Down Expand Up @@ -238,9 +236,10 @@ class Jimple2Cpg {
).collect { case pass: CpgPassBase with PlumeCpgPassBase => pass }

private def configureSoot(): Unit = {
logger.info("Configuring Soot")
// set application mode
Options.v().set_app(true)
Options.v().set_whole_program(true)
Options.v().set_app(false)
Options.v().set_whole_program(false)
// make sure classpath is configured correctly
Options.v().set_soot_classpath(ProgramHandlingUtil.TEMP_DIR.toString)
Options.v().set_prepend_classpath(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ object ProgramHandlingUtil {
Using.resource(zip.getInputStream(entry)) { input =>
Files.copy(input, destFile.toPath)
}
destFile.deleteOnExit()
Option(destFile.getAbsolutePath)
} catch {
case e: Exception =>
Expand Down

0 comments on commit bf6aaef

Please sign in to comment.