Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(833)

Unified Diff: tools/ddbg.dart

Issue 13741025: Add more error detection to debugger test (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/standalone/debugger/debug_lib.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/ddbg.dart
===================================================================
--- tools/ddbg.dart (revision 21113)
+++ tools/ddbg.dart (working copy)
@@ -19,7 +19,8 @@
int seqNum = 0;
int isolate_id = -1;
-bool verbose = false;
+final verbose = false;
+final printMessages = false;
// The current stack trace, while the VM is paused. It's a list
// of activation frames.
@@ -463,14 +464,32 @@
}
}
+bool haveGarbageVmData() {
+ if (vmData == null || vmData.length == 0) return false;
+ var i = 0, char = " ";
+ while (i < vmData.length) {
+ char = vmData[i];
+ if (char != " " && char != "\n" && char != "\r" && char != "\t") break;
+ i++;
+ }
+ if (i >= vmData.length) {
+ return false;
+ } else {
+ return char != "{";
+ }
+}
+
void processVmData(String data) {
- final printMessages = false;
if (vmData == null || vmData.length == 0) {
vmData = data;
} else {
vmData = vmData + data;
}
+ if (haveGarbageVmData()) {
+ print("Error: have garbage data from VM: '$vmData'");
+ return;
+ }
int msg_len = jsonObjectLength(vmData);
if (printMessages && msg_len == 0) {
print("have partial or illegal json message"
@@ -487,8 +506,13 @@
if (printMessages) { print("at least one message: '$vmData'"); }
var msg = vmData.substring(0, msg_len);
if (printMessages) { print("first message: $msg"); }
+ vmData = vmData.substring(msg_len);
+ if (haveGarbageVmData()) {
+ print("Error: garbage data after previous message: '$vmData'");
+ print("Previous message was: '$msg'");
+ return;
+ }
processVmMessage(msg);
- vmData = vmData.substring(msg_len);
msg_len = jsonObjectLength(vmData);
}
if (printMessages) { print("leftover vm data '$vmData'"); }
« no previous file with comments | « tests/standalone/debugger/debug_lib.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698