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

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: 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 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 return true; 878 return true;
879 } 879 }
880 880
881 881
882 char* Isolate::DoStacktraceInterrupt(Dart_IsolateInterruptCallback cb) { 882 char* Isolate::DoStacktraceInterrupt(Dart_IsolateInterruptCallback cb) {
883 ASSERT(stacktrace_ == NULL); 883 ASSERT(stacktrace_ == NULL);
884 SetVmStatsCallback(cb); 884 SetVmStatsCallback(cb);
885 if (status_sync == NULL) { 885 if (status_sync == NULL) {
886 status_sync = new Monitor(); 886 status_sync = new Monitor();
887 } 887 }
888 ScheduleInterrupts(Isolate::kVmStatusInterrupt); 888 if (is_runnable()) {
889 { 889 ScheduleInterrupts(Isolate::kVmStatusInterrupt);
890 MonitorLocker ml(status_sync); 890 {
891 if (stacktrace_ == NULL) { // It may already be available. 891 MonitorLocker ml(status_sync);
892 ml.Wait(); 892 if (stacktrace_ == NULL) { // It may already be available.
893 ml.Wait(1000);
894 }
893 } 895 }
896 SetVmStatsCallback(NULL);
894 } 897 }
895 SetVmStatsCallback(NULL);
896 ASSERT(stacktrace_ != NULL);
897 // result is freed by VmStats::WebServer().
898 char* result = stacktrace_; 898 char* result = stacktrace_;
899 stacktrace_ = NULL; 899 stacktrace_ = NULL;
900 if (result == NULL) {
901 // Return empty stack.
902 TextBuffer buffer(256);
903 buffer.Printf("{ \"handle\": \"0x%"Px64"\", \"stacktrace\": []}",
904 reinterpret_cast<int64_t>(this));
905
906 result = strndup(buffer.buf(), buffer.length());
907 }
908 ASSERT(result != NULL);
909 // result is freed by VmStats::WebServer().
900 return result; 910 return result;
901 } 911 }
902 912
903 913
904 char* Isolate::GetStatusStacktrace() { 914 char* Isolate::GetStatusStacktrace() {
905 return DoStacktraceInterrupt(&FetchStacktrace); 915 return DoStacktraceInterrupt(&FetchStacktrace);
906 } 916 }
907 917
908 char* Isolate::GetStatusStackFrame(intptr_t index) { 918 char* Isolate::GetStatusStackFrame(intptr_t index) {
909 ASSERT(index >= 0); 919 ASSERT(index >= 0);
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 return func.raw(); 1077 return func.raw();
1068 } 1078 }
1069 1079
1070 1080
1071 void IsolateSpawnState::Cleanup() { 1081 void IsolateSpawnState::Cleanup() {
1072 SwitchIsolateScope switch_scope(isolate()); 1082 SwitchIsolateScope switch_scope(isolate());
1073 Dart::ShutdownIsolate(); 1083 Dart::ShutdownIsolate();
1074 } 1084 }
1075 1085
1076 } // namespace dart 1086 } // 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