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

Side by Side Diff: runtime/vm/isolate.cc

Issue 13939003: Fixed stack trace for isolates without any Dart frames. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: fixed divide-by-zero error in bargraph.dart 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/vmstats/vmstats.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/isolate.h" 5 #include "vm/isolate.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "platform/json.h" 9 #include "platform/json.h"
10 #include "lib/mirrors.h" 10 #include "lib/mirrors.h"
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 return true; 877 return true;
878 } 878 }
879 879
880 880
881 char* Isolate::DoStacktraceInterrupt(Dart_IsolateInterruptCallback cb) { 881 char* Isolate::DoStacktraceInterrupt(Dart_IsolateInterruptCallback cb) {
882 ASSERT(stacktrace_ == NULL); 882 ASSERT(stacktrace_ == NULL);
883 SetVmStatsCallback(cb); 883 SetVmStatsCallback(cb);
884 if (status_sync == NULL) { 884 if (status_sync == NULL) {
885 status_sync = new Monitor(); 885 status_sync = new Monitor();
886 } 886 }
887 bool is_main_isolate = (strstr(name(), "$main-") != NULL);
887 ScheduleInterrupts(Isolate::kVmStatusInterrupt); 888 ScheduleInterrupts(Isolate::kVmStatusInterrupt);
888 { 889 {
889 MonitorLocker ml(status_sync); 890 MonitorLocker ml(status_sync);
890 if (stacktrace_ == NULL) { // It may already be available. 891 if (stacktrace_ == NULL) { // It may already be available.
891 ml.Wait(); 892 if (is_main_isolate) {
893 // Main isolate may have finished, but waiting for other isolates
894 // to finish. If so, it won't respond to interrupts.
895 ml.Wait(500);
Ivan Posva 2013/04/12 14:37:36 This is quite unfortunate. There must be a way to
896 } else {
897 ml.Wait();
898 }
892 } 899 }
893 } 900 }
894 SetVmStatsCallback(NULL); 901 SetVmStatsCallback(NULL);
895 ASSERT(stacktrace_ != NULL);
896 // result is freed by VmStats::WebServer().
897 char* result = stacktrace_; 902 char* result = stacktrace_;
898 stacktrace_ = NULL; 903 stacktrace_ = NULL;
904 if (is_main_isolate && result == NULL) {
Ivan Posva 2013/04/12 14:37:36 Why do we only care about the main isolate here? A
Tom Ball 2013/04/16 18:11:02 Replaced main-only test, with test for whether iso
905 // Return empty stack.
906 TextBuffer buffer(256);
907 buffer.Printf("{ \"handle\": \"0x%"Px64"\", \"stacktrace\": []}",
908 reinterpret_cast<int64_t>(this));
909
910 result = strndup(buffer.buf(), buffer.length());
911 }
912 ASSERT(result != NULL);
913 // result is freed by VmStats::WebServer().
899 return result; 914 return result;
900 } 915 }
901 916
902 917
903 char* Isolate::GetStatusStacktrace() { 918 char* Isolate::GetStatusStacktrace() {
904 return DoStacktraceInterrupt(&FetchStacktrace); 919 return DoStacktraceInterrupt(&FetchStacktrace);
905 } 920 }
906 921
907 char* Isolate::GetStatusStackFrame(intptr_t index) { 922 char* Isolate::GetStatusStackFrame(intptr_t index) {
908 ASSERT(index >= 0); 923 ASSERT(index >= 0);
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 return func.raw(); 1081 return func.raw();
1067 } 1082 }
1068 1083
1069 1084
1070 void IsolateSpawnState::Cleanup() { 1085 void IsolateSpawnState::Cleanup() {
1071 SwitchIsolateScope switch_scope(isolate()); 1086 SwitchIsolateScope switch_scope(isolate());
1072 Dart::ShutdownIsolate(); 1087 Dart::ShutdownIsolate();
1073 } 1088 }
1074 1089
1075 } // namespace dart 1090 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/vmstats/vmstats.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698