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