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

Unified Diff: runtime/vm/snapshot.cc

Issue 793763004: Fix error string to include information about class and library when the snapshot writer throws an … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years 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 | « runtime/vm/snapshot.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/snapshot.cc
===================================================================
--- runtime/vm/snapshot.cc (revision 42528)
+++ runtime/vm/snapshot.cc (working copy)
@@ -1055,7 +1055,8 @@
class_table_(isolate_->class_table()),
forward_list_(kMaxPredefinedObjectIds),
exception_type_(Exceptions::kNone),
- exception_msg_(NULL) {
+ exception_msg_(NULL),
+ unmarked_objects_(false) {
}
@@ -1610,15 +1611,33 @@
void SnapshotWriter::CheckIfSerializable(RawClass* cls) {
if (Class::IsSignatureClass(cls)) {
// We do not allow closure objects in an isolate message.
- SetWriteException(Exceptions::kArgument,
- "Illegal argument in isolate message"
- " : (object is a closure)");
+ Isolate* isolate = Isolate::Current();
+ HANDLESCOPE(isolate);
+ const char* format = "Illegal argument in isolate message"
+ " : (object is a closure - %s %s)";
+ UnmarkAll(); // Unmark objects now as we are about to print stuff.
+ const Class& clazz = Class::Handle(isolate, cls);
+ const Function& func = Function::Handle(isolate,
+ clazz.signature_function());
+ ASSERT(!func.IsNull());
+ intptr_t len = OS::SNPrint(NULL, 0, format,
+ clazz.ToCString(), func.ToCString()) + 1;
+ char* chars = isolate->current_zone()->Alloc<char>(len);
+ OS::SNPrint(chars, len, format, clazz.ToCString(), func.ToCString());
+ SetWriteException(Exceptions::kArgument, chars);
}
if (cls->ptr()->num_native_fields_ != 0) {
// We do not allow objects with native fields in an isolate message.
- SetWriteException(Exceptions::kArgument,
- "Illegal argument in isolate message"
- " : (object extends NativeWrapper)");
+ Isolate* isolate = Isolate::Current();
+ HANDLESCOPE(Isolate::Current());
+ const char* format = "Illegal argument in isolate message"
+ " : (object extends NativeWrapper - %s)";
+ UnmarkAll(); // Unmark objects now as we are about to print stuff.
+ const Class& clazz = Class::Handle(isolate, cls);
+ intptr_t len = OS::SNPrint(NULL, 0, format, clazz.ToCString()) + 1;
+ char* chars = isolate->current_zone()->Alloc<char>(len);
+ OS::SNPrint(chars, len, format, clazz.ToCString());
+ SetWriteException(Exceptions::kArgument, chars);
}
}
« no previous file with comments | « runtime/vm/snapshot.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698