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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 1652873004: Print stack trace when Dart_SetReturnValue is passed UnwindError. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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 | « runtime/lib/stacktrace.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl.cc
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 6a1a904940faf3ff264420717a9d81f221e722ca..ed1ebaad361e7c0d92e29daf4b217656c62dcfe8 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -7,6 +7,7 @@
#include "include/dart_native_api.h"
#include "platform/assert.h"
+#include "lib/stacktrace.h"
#include "vm/class_finalizer.h"
#include "vm/compiler.h"
#include "vm/dart.h"
@@ -4792,6 +4793,11 @@ DART_EXPORT void Dart_SetReturnValue(Dart_NativeArguments args,
NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
ASSERT(arguments->thread()->isolate() == Isolate::Current());
if ((retval != Api::Null()) && (!Api::IsInstance(retval))) {
+ // Print the current stack trace to make the problematic caller
+ // easier to find.
+ const Stacktrace& stacktrace = GetCurrentStacktrace(0);
+ OS::PrintErr("=== Current Trace:\n%s===\n", stacktrace.ToCString());
+
const Object& ret_obj = Object::Handle(Api::UnwrapHandle(retval));
FATAL1("Return value check failed: saw '%s' expected a dart Instance.",
ret_obj.ToCString());
« no previous file with comments | « runtime/lib/stacktrace.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698