| OLD | NEW |
| 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/globals.h" | 5 #include "platform/globals.h" |
| 6 #if defined(HOST_OS_ANDROID) | 6 #if defined(HOST_OS_ANDROID) |
| 7 | 7 |
| 8 #include <errno.h> // NOLINT |
| 8 #include <sys/syscall.h> // NOLINT | 9 #include <sys/syscall.h> // NOLINT |
| 9 #include <errno.h> // NOLINT | |
| 10 | 10 |
| 11 #include "vm/flags.h" | 11 #include "vm/flags.h" |
| 12 #include "vm/os.h" | 12 #include "vm/os.h" |
| 13 #include "vm/profiler.h" | 13 #include "vm/profiler.h" |
| 14 #include "vm/signal_handler.h" | 14 #include "vm/signal_handler.h" |
| 15 #include "vm/thread_interrupter.h" | 15 #include "vm/thread_interrupter.h" |
| 16 | 16 |
| 17 namespace dart { | 17 namespace dart { |
| 18 | 18 |
| 19 #ifndef PRODUCT | 19 #ifndef PRODUCT |
| (...skipping 19 matching lines...) Expand all Loading... |
| 39 InterruptedThreadState its; | 39 InterruptedThreadState its; |
| 40 its.pc = SignalHandler::GetProgramCounter(mcontext); | 40 its.pc = SignalHandler::GetProgramCounter(mcontext); |
| 41 its.fp = SignalHandler::GetFramePointer(mcontext); | 41 its.fp = SignalHandler::GetFramePointer(mcontext); |
| 42 its.csp = SignalHandler::GetCStackPointer(mcontext); | 42 its.csp = SignalHandler::GetCStackPointer(mcontext); |
| 43 its.dsp = SignalHandler::GetDartStackPointer(mcontext); | 43 its.dsp = SignalHandler::GetDartStackPointer(mcontext); |
| 44 its.lr = SignalHandler::GetLinkRegister(mcontext); | 44 its.lr = SignalHandler::GetLinkRegister(mcontext); |
| 45 Profiler::SampleThread(thread, its); | 45 Profiler::SampleThread(thread, its); |
| 46 } | 46 } |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 | |
| 50 bool ThreadInterrupter::IsDebuggerAttached() { | 49 bool ThreadInterrupter::IsDebuggerAttached() { |
| 51 return false; | 50 return false; |
| 52 } | 51 } |
| 53 | 52 |
| 54 | |
| 55 void ThreadInterrupter::InterruptThread(OSThread* thread) { | 53 void ThreadInterrupter::InterruptThread(OSThread* thread) { |
| 56 if (FLAG_trace_thread_interrupter) { | 54 if (FLAG_trace_thread_interrupter) { |
| 57 OS::PrintErr("ThreadInterrupter interrupting %p\n", | 55 OS::PrintErr("ThreadInterrupter interrupting %p\n", |
| 58 reinterpret_cast<void*>(thread->id())); | 56 reinterpret_cast<void*>(thread->id())); |
| 59 } | 57 } |
| 60 int result = syscall(__NR_tgkill, getpid(), thread->id(), SIGPROF); | 58 int result = syscall(__NR_tgkill, getpid(), thread->id(), SIGPROF); |
| 61 ASSERT((result == 0) || (result == ESRCH)); | 59 ASSERT((result == 0) || (result == ESRCH)); |
| 62 } | 60 } |
| 63 | 61 |
| 64 | |
| 65 void ThreadInterrupter::InstallSignalHandler() { | 62 void ThreadInterrupter::InstallSignalHandler() { |
| 66 SignalHandler::Install< | 63 SignalHandler::Install< |
| 67 ThreadInterrupterAndroid::ThreadInterruptSignalHandler>(); | 64 ThreadInterrupterAndroid::ThreadInterruptSignalHandler>(); |
| 68 } | 65 } |
| 69 | 66 |
| 70 | |
| 71 void ThreadInterrupter::RemoveSignalHandler() { | 67 void ThreadInterrupter::RemoveSignalHandler() { |
| 72 SignalHandler::Remove(); | 68 SignalHandler::Remove(); |
| 73 } | 69 } |
| 74 | 70 |
| 75 #endif // !PRODUCT | 71 #endif // !PRODUCT |
| 76 | 72 |
| 77 } // namespace dart | 73 } // namespace dart |
| 78 | 74 |
| 79 #endif // defined(HOST_OS_ANDROID) | 75 #endif // defined(HOST_OS_ANDROID) |
| OLD | NEW |