Skip to content

Commit b5c1365

Browse files
authored
Merge pull request #562 from viperproject/symb-ex-logger
Scope-based SymbExLogger Take 2
2 parents 3cab9ba + 3fe86f2 commit b5c1365

95 files changed

Lines changed: 3087 additions & 3205 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.idea
22
.idea_modules
3+
common/target
34
project/project
45
project/target
56
target
@@ -18,5 +19,7 @@ utils/scripts/tidy_smtlib.jar
1819
silicon_classpath.txt
1920
lib/
2021
silver
22+
src/test/resources/symbExLogTests/*.alog
23+
.DS_Store
2124
viper_tutorial_examples
2225
.bsp/

build.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ lazy val silicon = (project in file("."))
2929
// External dependencies
3030
libraryDependencies += "com.typesafe.scala-logging" %% "scala-logging" % "3.9.2",
3131
libraryDependencies += "org.apache.commons" % "commons-pool2" % "2.9.0",
32+
libraryDependencies += "io.spray" %% "spray-json" % "1.3.6",
3233

3334
// Only get a few compilation errors at once
3435
maxErrors := 5,

src/main/scala/Config.scala

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,6 @@ class Config(args: Seq[String]) extends SilFrontendConfig(args, "Silicon") {
196196
valueName = "level"
197197
)
198198

199-
val writeSymbexLogFile: ScallopOption[Boolean] = opt[Boolean]("writeSymbexLogFile",
200-
descr = "Report the symbolic execution log as ExecutionTraceReport",
201-
default = Some(false),
202-
noshort = true,
203-
hidden = true
204-
)
205-
206199
val timeout: ScallopOption[Int] = opt[Int]("timeout",
207200
descr = ( "Time out after approx. n seconds. The timeout is for the whole verification, "
208201
+ "not per method or proof obligation (default: 0, i.e. no timeout)."),
@@ -486,6 +479,13 @@ class Config(args: Seq[String]) extends SilFrontendConfig(args, "Silicon") {
486479
noshort = true
487480
)
488481

482+
val logConfig: ScallopOption[String] = opt[String]("logConfig",
483+
descr = "Path to config file specifying SymbExLogger options",
484+
default = None,
485+
noshort = true,
486+
hidden = false
487+
)
488+
489489
val disableCatchingExceptions: ScallopOption[Boolean] = opt[Boolean]("disableCatchingExceptions",
490490
descr =s"Don't catch exceptions (can be useful for debugging problems with ${Silicon.name})",
491491
default = Some(false),
@@ -553,6 +553,7 @@ class Config(args: Seq[String]) extends SilFrontendConfig(args, "Silicon") {
553553
sys.error(s"Unexpected combination: $other")
554554
}
555555

556+
validateFileOpt(logConfig)
556557
validateFileOpt(setAxiomatizationFile)
557558
validateFileOpt(multisetAxiomatizationFile)
558559
validateFileOpt(sequenceAxiomatizationFile)

src/main/scala/Silicon.scala

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import viper.silver.reporter._
2020
import viper.silver.verifier.{DefaultDependency => SilDefaultDependency, Failure => SilFailure, Success => SilSuccess, TimeoutOccurred => SilTimeoutOccurred, VerificationResult => SilVerificationResult, Verifier => SilVerifier}
2121
import viper.silicon.common.config.Version
2222
import viper.silicon.interfaces.Failure
23+
import viper.silicon.logger.SymbExLogger
2324
import viper.silicon.reporting.condenseToViperResult
2425
import viper.silicon.verifier.DefaultMasterVerifier
2526
import viper.silver.cfg.silver.SilverCfg
@@ -206,8 +207,14 @@ class Silicon(val reporter: Reporter, private var debugInfo: Seq[(String, Any)]
206207

207208
result = Some(condenseToViperResult(failures))
208209
} catch { /* Catch exceptions thrown during verification (errors are not caught) */
209-
case _: TimeoutException =>
210+
case _: TimeoutException => {
211+
// verification was interrupted, therefore close the current member's scope:
212+
SymbExLogger.currentLog().closeMemberScope()
213+
if (config.ideModeAdvanced()) {
214+
reporter report ExecutionTraceReport(SymbExLogger.memberList, List(), List())
215+
}
210216
result = Some(SilFailure(SilTimeoutOccurred(config.timeout(), "second(s)") :: Nil))
217+
}
211218
case exception: Exception if !config.disableCatchingExceptions() =>
212219
config.assertVerified() // Raises an exception itself, if it fails
213220

0 commit comments

Comments
 (0)