@@ -6,7 +6,7 @@ import viper.silicon.interfaces.state.Chunk
6
6
import viper .silicon .interfaces .{Failure , SiliconDebuggingFailureContext , Success , VerificationResult }
7
7
import viper .silicon .resources .{FieldID , PredicateID }
8
8
import viper .silicon .rules .evaluator
9
- import viper .silicon .state .terms .Term
9
+ import viper .silicon .state .terms .{ Term , True }
10
10
import viper .silicon .state .{BasicChunk , IdentifierFactory , MagicWandChunk , QuantifiedFieldChunk , QuantifiedMagicWandChunk , QuantifiedPredicateChunk , State }
11
11
import viper .silicon .utils .ast .simplifyVariableName
12
12
import viper .silicon .verifier .{MainVerifier , Verifier , WorkerVerifier }
@@ -26,7 +26,8 @@ case class ProofObligation(s: State,
26
26
v : Verifier ,
27
27
proverEmits : Seq [String ],
28
28
preambleAssumptions : Seq [DebugAxiom ],
29
- branchConditions : Seq [(ast.Exp , ast.Exp )],
29
+ branchConditions : Seq [Term ],
30
+ branchConditionExps : Seq [(ast.Exp , ast.Exp )],
30
31
assumptionsExp : InsertionOrderedSet [DebugExp ],
31
32
assertion : Term ,
32
33
eAssertion : DebugExp ,
@@ -52,13 +53,23 @@ case class ProofObligation(s: State,
52
53
}) +
53
54
s " \n\t\t ${originalErrorReason.readableMessage}\n\n "
54
55
55
- private lazy val stateString : String =
56
- s " Store: \n\t\t ${s.g.values.map(v => s " ${v._1} -> ${v._2._2.get}" ).mkString(" \n\t\t " )}\n\n Heap: \n\t\t ${s.h.values.map(chunkString).mkString(" \n\t\t " )}\n\n "
56
+ private lazy val stateString : String = {
57
+ if (printConfig.printInternalTermRepresentation)
58
+ s " Store: \n\t\t ${s.g.values.map(v => s " ${v._1} -> ${v._2._1}" ).mkString(" \n\t\t " )}\n\n Heap: \n\t\t ${s.h.values.map(chunkString).mkString(" \n\t\t " )}\n\n "
59
+ else
60
+ s " Store: \n\t\t ${s.g.values.map(v => s " ${v._1} -> ${v._2._2.get}" ).mkString(" \n\t\t " )}\n\n Heap: \n\t\t ${s.h.values.map(chunkString).mkString(" \n\t\t " )}\n\n "
61
+ }
57
62
58
- private lazy val branchConditionString : String =
59
- s " Branch Conditions: \n\t\t ${branchConditions.map(bc => Simplifier .simplify(bc._2, true )).filter(bc => bc != ast.TrueLit ()()).mkString(" \n\t\t " )}\n\n "
63
+ private lazy val branchConditionString : String = {
64
+ if (printConfig.printInternalTermRepresentation)
65
+ s " Branch Conditions: \n\t\t ${branchConditions.filter(bc => bc != True ).mkString(" \n\t\t " )}\n\n "
66
+ else
67
+ s " Branch Conditions: \n\t\t ${branchConditionExps.map(bc => Simplifier .simplify(bc._2, true )).filter(bc => bc != ast.TrueLit ()()).mkString(" \n\t\t " )}\n\n "
68
+ }
60
69
61
70
private def chunkString (c : Chunk ): String = {
71
+ if (printConfig.printInternalTermRepresentation)
72
+ return c.toString
62
73
val res = c match {
63
74
case bc : BasicChunk =>
64
75
val snapExpString = bc.snapExp match {
@@ -219,7 +230,7 @@ class SiliconDebugger(verificationResults: List[VerificationResult],
219
230
}
220
231
221
232
val obl = Some (ProofObligation (failureContext.state.get, failureContext.verifier.get, failureContext.proverDecls, failureContext.preambleAssumptions,
222
- failureContext.branchConditions, failureContext.assumptions,
233
+ failureContext.branchConditions, failureContext.branchConditionExps, failureContext. assumptions,
223
234
failureContext.failedAssertion, failureContext.failedAssertionExp, None ,
224
235
new DebugExpPrintConfiguration , currResult.message.reason,
225
236
new DebugResolver (this .pprogram, this .resolver.names), new DebugTranslator (this .pprogram, translator.getMembers())))
@@ -537,6 +548,13 @@ class SiliconDebugger(verificationResults: List[VerificationResult],
537
548
case _ =>
538
549
}
539
550
551
+ println(s " Enter the new value for printInternalTermRepresentation: " )
552
+ readLine().toLowerCase match {
553
+ case " true" | " 1" | " t" => obl.printConfig.printInternalTermRepresentation = true
554
+ case " false" | " 0" | " f" => obl.printConfig.printInternalTermRepresentation = false
555
+ case _ =>
556
+ }
557
+
540
558
// println(s"Enter the new value for nodeToHierarchyLevelMap:")
541
559
// obl.printConfig.addHierarchyLevelForId(readLine())
542
560
}
0 commit comments