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

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: updates 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..4e34d1875302718be3ca59bb996dc7da50545ac2 100644
--- a/src/mksnapshot.cc
+++ b/src/mksnapshot.cc
@@ -291,6 +291,18 @@ class BZip2Decompressor : public StartupDataDecompressor {
#endif
+void DumpException(Handle<Message> message) {
+ String::Utf8Value message_string(message->Get());
+ String::Utf8Value message_line(message->GetSourceLine());
+ fprintf(stderr, "%s at line %d\n", *message_string, message->GetLineNumber());
+ fprintf(stderr, "%s\n", *message_line);
+ for (int i = 0; i <= message->GetEndColumn(); ++i) {
+ fprintf(stderr, "%c", i < message->GetStartColumn() ? ' ' : '^');
+ }
+ 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 +362,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