Skip to content

Commit 189635c

Browse files
committed
Added "unmarshal" command to Dafny server to aid in debugging. The command deserializes (that is, unmarshals) and prints the serialized Dafny program.
1 parent f7cfb19 commit 189635c

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

Source/DafnyServer/Server.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ void Respond(string[] command) {
8787
ServerUtils.checkArgs(command, 0);
8888
ReadPayload();
8989
VersionCheck.CurrentVersion();
90+
} else if (verb == "unmarshal") {
91+
ServerUtils.checkArgs(command, 0);
92+
var payload = ReadPayload();
93+
VerificationTask.ReadTask(payload).Unmarshal();
9094
} else if (verb == "quit") {
9195
ServerUtils.checkArgs(command, 0);
9296
Exit();

Source/DafnyServer/VerificationTask.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,9 @@ public void CounterExample() {
6363
public void DotGraph() {
6464
new DafnyHelper(args, filename, ProgramSource).DotGraph();
6565
}
66+
67+
public void Unmarshal() {
68+
Console.WriteLine(ProgramSource);
69+
}
6670
}
6771
}

Test/server/unmarshal.transcript

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# RUN: %server "%s" > "%t"
2+
# RUN: %diff "%s.expect" "%t"
3+
unmarshal
4+
eyJhcmdzIjpbIi9jb21waWxlOjAiLCIvbm9sb2dvIiwiL3ByaW50VG9vbHRpcHMiLCIvdGltZUxp
5+
bWl0OjIwIl0sImZpbGVuYW1lIjoidHJhbnNjcmlwdCIsInNvdXJjZSI6Im1ldGhvZCBBKGE6aW50
6+
KSByZXR1cm5zIChiOiBpbnQpIHtcbiAgYiA6PSBhO1xuICBhc3NlcnQgZmFsc2U7XG59XG4iLCJz
7+
b3VyY2VJc0ZpbGUiOmZhbHNlfQ==
8+
[[DAFNY-CLIENT: EOM]]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Reading from unmarshal.transcript
2+
method A(a:int) returns (b: int) {
3+
b := a;
4+
assert false;
5+
}
6+
7+
Verification completed successfully!
8+
[SUCCESS] [[DAFNY-SERVER: EOM]]
9+
Verification completed successfully!
10+
[SUCCESS] [[DAFNY-SERVER: EOM]]

0 commit comments

Comments
 (0)