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

Unified Diff: runtime/vm/profiler.cc

Issue 958183002: Fix Win64 flakey crash related to reading from stack guard page. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 | 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 f049ad49a98d2af508cecd01aafda6064400ca5c..3a5dcd7583150364d961082853603762d398d828 100644
--- a/runtime/vm/profiler.cc
+++ b/runtime/vm/profiler.cc
@@ -872,6 +872,11 @@ class ProfilerNativeStackWalker : public ValueObject {
static void CopyPCMarkerIfSafe(Sample* sample) {
ASSERT(sample != NULL);
+ if (sample->vm_tag() != VMTag::kDartTagId) {
+ // We can only trust the stack pointer if we are executing Dart code.
+ // See http://dartbug.com/20421 for details.
+ return;
+ }
uword* fp = reinterpret_cast<uword*>(sample->fp());
uword* sp = reinterpret_cast<uword*>(sample->sp());
@@ -899,6 +904,11 @@ static void CopyPCMarkerIfSafe(Sample* sample) {
static void CopyStackBuffer(Sample* sample) {
ASSERT(sample != NULL);
+ if (sample->vm_tag() != VMTag::kDartTagId) {
+ // We can only trust the stack pointer if we are executing Dart code.
+ // See http://dartbug.com/20421 for details.
+ return;
+ }
uword* sp = reinterpret_cast<uword*>(sample->sp());
uword* buffer = sample->GetStackBuffer();
if (sp != NULL) {
@@ -1018,13 +1028,7 @@ void Profiler::RecordSampleInterruptCallback(
sample->set_fp(state.fp);
sample->set_lr(state.lr);
CopyStackBuffer(sample);
koda 2015/02/26 21:05:31 I would prefer to have the "if" here instead, and
-#if !(defined(TARGET_OS_WINDOWS) && defined(TARGET_ARCH_X64))
- // It is never safe to read other thread's stack unless on Win64
- // other thread is inside Dart code.
- if (vm_tag != VMTag::kDartTagId) {
- CopyPCMarkerIfSafe(sample);
- }
-#endif
+ CopyPCMarkerIfSafe(sample);
// Walk the call stack.
if (FLAG_profile_vm) {
« 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