Chromium Code Reviews| Index: src/isolate.cc |
| diff --git a/src/isolate.cc b/src/isolate.cc |
| index 8702ee758c4a5ef513007b1fb9838f7e5ba09240..e8e3424280901fdbe0c4ad6dcced0f3a1acb8137 100644 |
| --- a/src/isolate.cc |
| +++ b/src/isolate.cc |
| @@ -1072,6 +1072,28 @@ Object* Isolate::Throw(Object* exception, MessageLocation* location) { |
| if (FLAG_print_all_exceptions) { |
| printf("=========================================================\n"); |
| printf("Exception thrown:\n"); |
| + if (location) { |
| + Handle<Script> script = location->script(); |
| + Handle<Object> name = Script::GetNameOrSourceURL(script); |
| + printf("at "); |
| + if (name->IsString() && String::cast(*name)->length() > 0) |
| + String::cast(*name)->PrintOn(stdout); |
| + else |
| + printf("<anonymous>"); |
| +#ifdef DEBUG |
| + if (AllowHeapAllocation::IsAllowed()) { |
|
titzer
2016/10/26 15:52:47
Maybe add a comment that GetColumnNumber() allocat
Clemens Hammacher
2016/10/26 16:15:41
Done.
|
| +#else |
| + if (false) { |
| +#endif |
| + printf("%d:%d - %d:%d\n", |
| + Script::GetLineNumber(script, location->start_pos()) + 1, |
| + Script::GetColumnNumber(script, location->start_pos()), |
| + Script::GetLineNumber(script, location->end_pos()) + 1, |
| + Script::GetColumnNumber(script, location->end_pos())); |
| + } else { |
| + printf("line %d\n", script->GetLineNumber(location->start_pos()) + 1); |
| + } |
| + } |
| exception->Print(); |
| printf("Stack Trace:\n"); |
| PrintStack(stdout); |