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

Unified Diff: runtime/vm/profiler.cc

Issue 2230713005: Guard against re-entrant requests for stack traces. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: atomic Created 4 years, 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/profiler.cc
diff --git a/runtime/vm/profiler.cc b/runtime/vm/profiler.cc
index b8827c58e7f1109068c6035ea041db8114e01ae2..271c09c89d8f7b16c15a7dae925cf0ee7ee91e26 100644
--- a/runtime/vm/profiler.cc
+++ b/runtime/vm/profiler.cc
@@ -948,6 +948,14 @@ static uintptr_t __attribute__((noinline)) GetProgramCounter() {
void Profiler::DumpStackTrace(bool native_stack_trace) {
+ // Allow only one stack trace to prevent recursively printing stack traces if
+ // we hit an assert while printing the stack.
+ static uintptr_t started_dump = 0;
+ if (AtomicOperations::FetchAndIncrement(&started_dump) != 0) {
+ OS::PrintErr("Aborting re-entrant request for stack trace.\n");
+ return;
+ }
+
Thread* thread = Thread::Current();
if (thread == NULL) {
return;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698