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

Unified Diff: runtime/vm/exceptions.cc

Issue 1691443002: Make --abort_on_assertion_errors more selective. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comments Created 4 years, 10 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 | « no previous file | tests/compiler/dart2js/dart2js.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/exceptions.cc
diff --git a/runtime/vm/exceptions.cc b/runtime/vm/exceptions.cc
index 369d099793d7deaf620a70ecc5109600d0625843..7cabfefcf4c4ae4c3f530f9f6fe4cb637cf88988 100644
--- a/runtime/vm/exceptions.cc
+++ b/runtime/vm/exceptions.cc
@@ -19,6 +19,8 @@
namespace dart {
+// TODO(vegorov): Remove --abort_on_assertion_errors flag and associated
+// infrastructure (dartbug.com/25753)
DEFINE_FLAG(bool, abort_on_assertion_errors, false,
"Abort on assertion and typecheck failures");
DEFINE_FLAG(bool, print_stacktrace_at_throw, false,
@@ -687,8 +689,25 @@ void Exceptions::ThrowJavascriptCompatibilityError(const char* msg) {
}
+static bool IsLikelyInternalDart2JSCrash(const Stacktrace& stacktrace) {
+ Function& function = Function::Handle();
+ String& name = String::Handle();
+ for (intptr_t i = 0, len = stacktrace.Length(); i < len; i++) {
+ function = stacktrace.FunctionAtFrame(i);
+ name = function.QualifiedPrettyName();
+ if (name.Equals("_CompilerDiagnosticReporter.withCurrentElement")) {
+ return true;
+ }
+ }
+ return false;
+}
+
+
void Exceptions::PrintStackTraceAndAbort(const char* reason) {
- const Instance& stacktrace = Instance::Handle(CurrentStacktrace());
+ const Stacktrace& stacktrace = Stacktrace::Handle(CurrentStacktrace());
+ if (!IsLikelyInternalDart2JSCrash(stacktrace)) {
+ return;
+ }
OS::PrintErr("\n\n\nAborting due to %s. Stacktrace:\n%s\n",
reason,
« no previous file with comments | « no previous file | tests/compiler/dart2js/dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698