Index: runtime/vm/thread_interrupter_android.cc |
diff --git a/runtime/vm/thread_interrupter_android.cc b/runtime/vm/thread_interrupter_android.cc |
index 1c780bab680722ed8b34cd50896d17de8296a8c8..5c4092dbe8c54ad6e69c34a53efdd6edcf70f917 100644 |
--- a/runtime/vm/thread_interrupter_android.cc |
+++ b/runtime/vm/thread_interrupter_android.cc |
@@ -6,11 +6,9 @@ |
#if defined(TARGET_OS_ANDROID) |
#include <sys/syscall.h> // NOLINT |
-#include <errno.h> // NOLINT |
#include "vm/flags.h" |
#include "vm/os.h" |
-#include "vm/profiler.h" |
#include "vm/signal_handler.h" |
#include "vm/thread_interrupter.h" |
@@ -30,16 +28,22 @@ class ThreadInterrupterAndroid : public AllStatic { |
if (thread == NULL) { |
return; |
} |
+ ThreadInterruptCallback callback = NULL; |
+ void* callback_data = NULL; |
+ if (!thread->IsThreadInterrupterEnabled(&callback, &callback_data)) { |
+ return; |
+ } |
// Extract thread state. |
ucontext_t* context = reinterpret_cast<ucontext_t*>(context_); |
mcontext_t mcontext = context->uc_mcontext; |
InterruptedThreadState its; |
+ its.tid = thread->id(); |
its.pc = SignalHandler::GetProgramCounter(mcontext); |
its.fp = SignalHandler::GetFramePointer(mcontext); |
its.csp = SignalHandler::GetCStackPointer(mcontext); |
its.dsp = SignalHandler::GetDartStackPointer(mcontext); |
its.lr = SignalHandler::GetLinkRegister(mcontext); |
- Profiler::SampleThread(thread, its); |
+ callback(its, callback_data); |
} |
}; |
@@ -50,7 +54,7 @@ void ThreadInterrupter::InterruptThread(Thread* thread) { |
reinterpret_cast<void*>(thread->id())); |
} |
int result = syscall(__NR_tgkill, getpid(), thread->id(), SIGPROF); |
- ASSERT((result == 0) || (result == ESRCH)); |
+ ASSERT(result == 0); |
} |