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

Unified Diff: src/mksnapshot.cc

Issue 14031036: Also print the exception when mksnapshot failed to compile extra code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mksnapshot.cc
diff --git a/src/mksnapshot.cc b/src/mksnapshot.cc
index abfe69397b0998927fd7d2c0a498de38f64780a2..91058ad00cf8f2e87f020465deb1d81176311b74 100644
--- a/src/mksnapshot.cc
+++ b/src/mksnapshot.cc
@@ -291,6 +291,24 @@ class BZip2Decompressor : public StartupDataDecompressor {
#endif
+void DumpException(Handle<Message> message) {
+ Local<String> message_string = message->Get();
Sven Panne 2013/04/29 11:23:36 Simpler: -----------------------------------------
jochen (gone - plz use gerrit) 2013/04/29 11:38:28 Done.
+ Local<String> message_line = message->GetSourceLine();
+ int len = 2 + message_string->Utf8Length() + message_line->Utf8Length();
+ char* buf = new char(len);
+ message_string->WriteUtf8(buf);
+ fprintf(stderr, "%s at line %d\n", buf, message->GetLineNumber());
+ message_line->WriteUtf8(buf);
+ fprintf(stderr, "%s\n", buf);
+ int from = message->GetStartColumn();
+ int to = message->GetEndColumn();
+ int i;
+ for (i = 0; i < from; i++) fprintf(stderr, " ");
+ for ( ; i <= to; i++) fprintf(stderr, "^");
+ fprintf(stderr, "\n");
+}
+
+
int main(int argc, char** argv) {
// By default, log code create information in the snapshot.
i::FLAG_log_code = true;
@@ -350,27 +368,14 @@ int main(int argc, char** argv) {
TryCatch try_catch;
Local<Script> script = Script::Compile(source);
if (try_catch.HasCaught()) {
- fprintf(stderr, "Failure compiling '%s' (see above)\n", name);
+ fprintf(stderr, "Failure compiling '%s'\n", name);
+ DumpException(try_catch.Message());
exit(1);
}
script->Run();
if (try_catch.HasCaught()) {
fprintf(stderr, "Failure running '%s'\n", name);
- Local<Message> message = try_catch.Message();
- Local<String> message_string = message->Get();
- Local<String> message_line = message->GetSourceLine();
- int len = 2 + message_string->Utf8Length() + message_line->Utf8Length();
- char* buf = new char(len);
- message_string->WriteUtf8(buf);
- fprintf(stderr, "%s at line %d\n", buf, message->GetLineNumber());
- message_line->WriteUtf8(buf);
- fprintf(stderr, "%s\n", buf);
- int from = message->GetStartColumn();
- int to = message->GetEndColumn();
- int i;
- for (i = 0; i < from; i++) fprintf(stderr, " ");
- for ( ; i <= to; i++) fprintf(stderr, "^");
- fprintf(stderr, "\n");
+ DumpException(try_catch.Message());
exit(1);
}
context->Exit();
« 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