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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/address_sanitizer.h" 5 #include "platform/address_sanitizer.h"
6 #include "platform/memory_sanitizer.h" 6 #include "platform/memory_sanitizer.h"
7 #include "platform/utils.h" 7 #include "platform/utils.h"
8 8
9 #include "vm/allocation.h" 9 #include "vm/allocation.h"
10 #include "vm/atomic.h" 10 #include "vm/atomic.h"
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 } 941 }
942 #else 942 #else
943 static uintptr_t __attribute__((noinline)) GetProgramCounter() { 943 static uintptr_t __attribute__((noinline)) GetProgramCounter() {
944 return reinterpret_cast<uintptr_t>( 944 return reinterpret_cast<uintptr_t>(
945 __builtin_extract_return_addr(__builtin_return_address(0))); 945 __builtin_extract_return_addr(__builtin_return_address(0)));
946 } 946 }
947 #endif 947 #endif
948 948
949 949
950 void Profiler::DumpStackTrace(bool native_stack_trace) { 950 void Profiler::DumpStackTrace(bool native_stack_trace) {
951 // Allow only one stack trace to prevent recursively printing stack traces if
952 // we hit an assert while printing the stack.
953 static uintptr_t started_dump = 0;
954 if (AtomicOperations::FetchAndIncrement(&started_dump) != 0) {
955 OS::PrintErr("Aborting re-entrant request for stack trace.\n");
956 return;
957 }
958
951 Thread* thread = Thread::Current(); 959 Thread* thread = Thread::Current();
952 if (thread == NULL) { 960 if (thread == NULL) {
953 return; 961 return;
954 } 962 }
955 OSThread* os_thread = thread->os_thread(); 963 OSThread* os_thread = thread->os_thread();
956 ASSERT(os_thread != NULL); 964 ASSERT(os_thread != NULL);
957 Isolate* isolate = thread->isolate(); 965 Isolate* isolate = thread->isolate();
958 if (!CheckIsolate(isolate)) { 966 if (!CheckIsolate(isolate)) {
959 return; 967 return;
960 } 968 }
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
1581 1589
1582 1590
1583 ProcessedSampleBuffer::ProcessedSampleBuffer() 1591 ProcessedSampleBuffer::ProcessedSampleBuffer()
1584 : code_lookup_table_(new CodeLookupTable(Thread::Current())) { 1592 : code_lookup_table_(new CodeLookupTable(Thread::Current())) {
1585 ASSERT(code_lookup_table_ != NULL); 1593 ASSERT(code_lookup_table_ != NULL);
1586 } 1594 }
1587 1595
1588 #endif // !PRODUCT 1596 #endif // !PRODUCT
1589 1597
1590 } // namespace dart 1598 } // namespace dart
OLDNEW
« 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