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()); |