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

Unified Diff: runtime/vm/il_printer.cc

Issue 11876019: When printing constants in the flow graph truncate them at the first new line character. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/il_printer.cc
diff --git a/runtime/vm/il_printer.cc b/runtime/vm/il_printer.cc
index b3410f59672437030e25bc7b112ed3fba2154c82..4a6fe3bd38d397b14803d01fbaf3999ddb7771fe 100644
--- a/runtime/vm/il_printer.cc
+++ b/runtime/vm/il_printer.cc
@@ -203,7 +203,17 @@ void Value::PrintTo(BufferFormatter* f) const {
void ConstantInstr::PrintOperandsTo(BufferFormatter* f) const {
- f->Print("#%s", value().ToCString());
+ const char* cstr = value().ToCString();
+ const char* new_line = strchr(cstr, '\n');
+ if (new_line == NULL) {
+ f->Print("#%s", cstr);
+ } else {
+ const intptr_t pos = new_line - cstr;
+ char* buffer = Isolate::Current()->current_zone()->Alloc<char>(pos + 1);
+ strncpy(buffer, cstr, pos);
+ buffer[pos] = '\0';
+ f->Print("#%s\\n...", buffer);
+ }
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698