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

Unified Diff: runtime/vm/debugger_api_impl.cc

Issue 1168933002: Fixes crashes in VM isolate shutdown. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Add asserts Created 5 years, 6 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
Index: runtime/vm/debugger_api_impl.cc
diff --git a/runtime/vm/debugger_api_impl.cc b/runtime/vm/debugger_api_impl.cc
index fc6a5ea759e833bcf5933011fe28e3c9d91cb2c4..4c381dd908724993748661a679b7d5ee8028a5bb 100644
--- a/runtime/vm/debugger_api_impl.cc
+++ b/runtime/vm/debugger_api_impl.cc
@@ -53,6 +53,7 @@ namespace dart {
DART_EXPORT intptr_t Dart_CacheObject(Dart_Handle object_in) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
+ ASSERT(isolate->debugger() != NULL);
const Object& obj = Object::Handle(Api::UnwrapHandle(object_in));
if (obj.IsApiError()) {
return -1;
@@ -64,6 +65,7 @@ DART_EXPORT intptr_t Dart_CacheObject(Dart_Handle object_in) {
DART_EXPORT Dart_Handle Dart_GetCachedObject(intptr_t obj_id) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
+ ASSERT(isolate->debugger() != NULL);
if (!isolate->debugger()->IsValidObjectId(obj_id)) {
return Api::NewError("%s: object id %" Pd " is invalid",
CURRENT_FUNC, obj_id);
@@ -199,6 +201,7 @@ DART_EXPORT Dart_Handle Dart_SetExceptionPauseInfo(
Dart_ExceptionPauseInfo pause_info) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
+ ASSERT(isolate->debugger() != NULL);
isolate->debugger()->SetExceptionPauseInfo(pause_info);
return Api::Success();
}
@@ -207,6 +210,7 @@ DART_EXPORT Dart_Handle Dart_SetExceptionPauseInfo(
DART_EXPORT Dart_ExceptionPauseInfo Dart_GetExceptionPauseInfo() {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
+ ASSERT(isolate->debugger() != NULL);
return isolate->debugger()->GetExceptionPauseInfo();
}
@@ -215,6 +219,7 @@ DART_EXPORT Dart_Handle Dart_GetStackTrace(Dart_StackTrace* trace) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
CHECK_NOT_NULL(trace);
+ ASSERT(isolate->debugger() != NULL);
*trace = reinterpret_cast<Dart_StackTrace>(
isolate->debugger()->CurrentStackTrace());
return Api::Success();
@@ -226,6 +231,7 @@ DART_EXPORT Dart_Handle Dart_GetStackTraceFromError(Dart_Handle handle,
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
CHECK_NOT_NULL(trace);
+ ASSERT(isolate->debugger() != NULL);
const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(handle));
if (obj.IsUnhandledException()) {
const UnhandledException& error = UnhandledException::Cast(obj);
@@ -337,6 +343,7 @@ DART_EXPORT Dart_Handle Dart_SetBreakpoint(
intptr_t line_number) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
+ ASSERT(isolate->debugger() != NULL);
UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in);
Debugger* debugger = isolate->debugger();
@@ -354,6 +361,7 @@ DART_EXPORT Dart_Handle Dart_SetBreakpoint(
DART_EXPORT Dart_Handle Dart_GetBreakpointURL(intptr_t bp_id) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
+ ASSERT(isolate->debugger() != NULL);
Debugger* debugger = isolate->debugger();
ASSERT(debugger != NULL);
Ivan Posva 2015/06/16 16:31:15 Where is the difference to this line? ditto at ot
@@ -369,6 +377,7 @@ DART_EXPORT Dart_Handle Dart_GetBreakpointURL(intptr_t bp_id) {
DART_EXPORT Dart_Handle Dart_GetBreakpointLine(intptr_t bp_id) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
+ ASSERT(isolate->debugger() != NULL);
Debugger* debugger = isolate->debugger();
ASSERT(debugger != NULL);
@@ -387,6 +396,7 @@ DART_EXPORT Dart_Handle Dart_SetBreakpointAtEntry(
Dart_Handle function_name_in) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
+ ASSERT(isolate->debugger() != NULL);
UNWRAP_AND_CHECK_PARAM(Library, library, library_in);
UNWRAP_AND_CHECK_PARAM(String, class_name, class_name_in);
UNWRAP_AND_CHECK_PARAM(String, function_name, function_name_in);
@@ -427,6 +437,7 @@ DART_EXPORT Dart_Handle Dart_OneTimeBreakAtEntry(
Dart_Handle function_name_in) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
+ ASSERT(isolate->debugger() != NULL);
UNWRAP_AND_CHECK_PARAM(Library, library, library_in);
UNWRAP_AND_CHECK_PARAM(String, class_name, class_name_in);
UNWRAP_AND_CHECK_PARAM(String, function_name, function_name_in);
@@ -463,9 +474,7 @@ DART_EXPORT Dart_Handle Dart_OneTimeBreakAtEntry(
DART_EXPORT Dart_Handle Dart_RemoveBreakpoint(intptr_t bp_id) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
- Debugger* debugger = isolate->debugger();
- ASSERT(debugger != NULL);
-
+ ASSERT(isolate->debugger() != NULL);
isolate->debugger()->RemoveBreakpoint(bp_id);
return Api::Success();
}
@@ -474,6 +483,7 @@ DART_EXPORT Dart_Handle Dart_RemoveBreakpoint(intptr_t bp_id) {
DART_EXPORT Dart_Handle Dart_SetStepOver() {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
+ ASSERT(isolate->debugger() != NULL);
isolate->debugger()->SetStepOver();
return Api::Success();
}
@@ -482,6 +492,7 @@ DART_EXPORT Dart_Handle Dart_SetStepOver() {
DART_EXPORT Dart_Handle Dart_SetStepInto() {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
+ ASSERT(isolate->debugger() != NULL);
isolate->debugger()->SetSingleStep();
return Api::Success();
}
@@ -490,6 +501,7 @@ DART_EXPORT Dart_Handle Dart_SetStepInto() {
DART_EXPORT Dart_Handle Dart_SetStepOut() {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
+ ASSERT(isolate->debugger() != NULL);
isolate->debugger()->SetStepOut();
return Api::Success();
}
@@ -498,6 +510,7 @@ DART_EXPORT Dart_Handle Dart_SetStepOut() {
DART_EXPORT Dart_Handle Dart_GetInstanceFields(Dart_Handle object_in) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
+ ASSERT(isolate->debugger() != NULL);
UNWRAP_AND_CHECK_PARAM(Instance, obj, object_in);
return Api::NewHandle(isolate, isolate->debugger()->GetInstanceFields(obj));
}
@@ -506,6 +519,7 @@ DART_EXPORT Dart_Handle Dart_GetInstanceFields(Dart_Handle object_in) {
DART_EXPORT Dart_Handle Dart_GetStaticFields(Dart_Handle target) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
+ ASSERT(isolate->debugger() != NULL);
const Type& type_obj = Api::UnwrapTypeHandle(isolate, target);
if (type_obj.IsNull()) {
return Api::NewError("%s expects argument 'target' to be a type",
@@ -519,6 +533,7 @@ DART_EXPORT Dart_Handle Dart_GetStaticFields(Dart_Handle target) {
DART_EXPORT Dart_Handle Dart_GetLibraryFields(intptr_t library_id) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
+ ASSERT(isolate->debugger() != NULL);
const Library& lib =
Library::Handle(isolate, Library::GetLibrary(library_id));
if (lib.IsNull()) {
@@ -533,6 +548,7 @@ DART_EXPORT Dart_Handle Dart_GetGlobalVariables(intptr_t library_id) {
Isolate* isolate = Isolate::Current();
ASSERT(isolate != NULL);
DARTSCOPE(isolate);
+ ASSERT(isolate->debugger() != NULL);
const Library& lib = Library::Handle(Library::GetLibrary(library_id));
if (lib.IsNull()) {
return Api::NewError("%s: %" Pd " is not a valid library id",
@@ -720,6 +736,7 @@ DART_EXPORT Dart_Handle Dart_GetClassInfo(
Dart_Handle* static_fields) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
+ ASSERT(isolate->debugger() != NULL);
if (!isolate->class_table()->IsValidIndex(cls_id)) {
return Api::NewError("%s: %" Pd " is not a valid class id",
CURRENT_FUNC, cls_id);
@@ -983,6 +1000,7 @@ DART_EXPORT Dart_Isolate Dart_GetIsolate(Dart_IsolateId isolate_id) {
DART_EXPORT Dart_IsolateId Dart_GetIsolateId(Dart_Isolate dart_isolate) {
Isolate* isolate = reinterpret_cast<Isolate*>(dart_isolate);
+ ASSERT(isolate->debugger() != NULL);
return isolate->debugger()->GetIsolateId();
}
« no previous file with comments | « runtime/vm/debugger.cc ('k') | runtime/vm/exceptions.cc » ('j') | runtime/vm/isolate.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698