Index: runtime/vm/profiler.cc |
diff --git a/runtime/vm/profiler.cc b/runtime/vm/profiler.cc |
index ddd5b26817bfdea01f4dd4b7ff9d14ba51db6256..3509c4a54ba224f4a76c3d101c48524232b54362 100644 |
--- a/runtime/vm/profiler.cc |
+++ b/runtime/vm/profiler.cc |
@@ -529,7 +529,8 @@ class ProfilerDartStackWalker : public ProfilerStackWalker { |
return NextExit(); |
} |
uword* new_fp = CallerFP(); |
- if (new_fp <= fp_) { |
+ if (!IsCalleeFrameOf(reinterpret_cast<uword>(new_fp), |
+ reinterpret_cast<uword>(fp_))) { |
// FP didn't move to a higher address. |
Cutch
2016/08/19 13:49:31
fix comment
rmacnak
2016/08/19 23:28:16
Done.
|
return false; |
} |
@@ -837,8 +838,8 @@ static bool GetAndValidateIsolateStackBounds(Thread* thread, |
ASSERT(os_thread != NULL); |
ASSERT(stack_lower != NULL); |
ASSERT(stack_upper != NULL); |
-#if defined(USING_SIMULATOR) |
const bool in_dart_code = thread->IsExecutingDartCode(); |
+#if defined(USING_SIMULATOR) |
if (in_dart_code) { |
Isolate* isolate = thread->isolate(); |
ASSERT(isolate != NULL); |
@@ -859,7 +860,8 @@ static bool GetAndValidateIsolateStackBounds(Thread* thread, |
return false; |
} |
#endif |
- if (sp > *stack_lower) { |
+ |
+ if (!in_dart_code && sp > *stack_lower) { |
Cutch
2016/08/19 13:49:31
can this "!in_dart_code" be made DBC specific some
zra
2016/08/19 15:40:08
please add parens (sp > *stack_lower)
rmacnak
2016/08/19 23:28:16
Done.
|
// The stack pointer gives us a tighter lower bound. |
*stack_lower = sp; |
} |
@@ -1125,11 +1127,6 @@ void Profiler::SampleThreadSingleFrame(Thread* thread, uintptr_t pc) { |
void Profiler::SampleThread(Thread* thread, |
const InterruptedThreadState& state) { |
-#if defined(TARGET_ARCH_DBC) |
- // TODO(vegorov) implement simulator stack sampling. |
- return; |
-#endif |
- |
ASSERT(thread != NULL); |
OSThread* os_thread = thread->os_thread(); |
ASSERT(os_thread != NULL); |
@@ -1155,14 +1152,17 @@ void Profiler::SampleThread(Thread* thread, |
uintptr_t sp = 0; |
uintptr_t fp = state.fp; |
uintptr_t pc = state.pc; |
-#if defined(USING_SIMULATOR) && !defined(TARGET_ARCH_DBC) |
+#if defined(USING_SIMULATOR) |
Simulator* simulator = NULL; |
#endif |
if (in_dart_code) { |
// If we're in Dart code, use the Dart stack pointer. |
#if defined(TARGET_ARCH_DBC) |
Cutch
2016/08/19 13:49:31
why not fold this into:
#if defined(TARGET_ARCH_D
rmacnak
2016/08/19 23:28:16
DBC doesn't define Simulator::get_register.
|
- UNIMPLEMENTED(); |
+ simulator = isolate->simulator(); |
+ sp = simulator->get_sp(); |
+ fp = simulator->get_fp(); |
+ pc = simulator->get_pc(); |
#elif defined(USING_SIMULATOR) |
simulator = isolate->simulator(); |
sp = simulator->get_register(SPREG); |