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 "vm/globals.h" | 5 #include "vm/globals.h" |
6 #include "vm/simulator.h" | 6 #include "vm/simulator.h" |
7 #include "vm/signal_handler.h" | 7 #include "vm/signal_handler.h" |
8 #if defined(TARGET_OS_LINUX) | 8 #if defined(TARGET_OS_LINUX) |
9 | 9 |
10 namespace dart { | 10 namespace dart { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 lr = static_cast<uintptr_t>(mcontext.regs[30]); | 92 lr = static_cast<uintptr_t>(mcontext.regs[30]); |
93 #elif defined(HOST_ARCH_MIPS) | 93 #elif defined(HOST_ARCH_MIPS) |
94 lr = static_cast<uintptr_t>(mcontext.gregs[31]); | 94 lr = static_cast<uintptr_t>(mcontext.gregs[31]); |
95 #else | 95 #else |
96 #error Unsupported architecture. | 96 #error Unsupported architecture. |
97 #endif // HOST_ARCH_... | 97 #endif // HOST_ARCH_... |
98 return lr; | 98 return lr; |
99 } | 99 } |
100 | 100 |
101 | 101 |
102 void SignalHandler::Install(SignalAction action) { | 102 void SignalHandler::InstallImpl(SignalAction action) { |
103 struct sigaction act; | 103 struct sigaction act; |
104 act.sa_handler = NULL; | 104 act.sa_handler = NULL; |
105 act.sa_sigaction = action; | 105 act.sa_sigaction = action; |
106 sigemptyset(&act.sa_mask); | 106 sigemptyset(&act.sa_mask); |
107 act.sa_flags = SA_RESTART | SA_SIGINFO; | 107 act.sa_flags = SA_RESTART | SA_SIGINFO; |
108 int r = sigaction(SIGPROF, &act, NULL); | 108 int r = sigaction(SIGPROF, &act, NULL); |
109 ASSERT(r == 0); | 109 ASSERT(r == 0); |
110 } | 110 } |
111 | 111 |
112 | 112 |
113 void SignalHandler::Remove() { | 113 void SignalHandler::Remove() { |
114 // Ignore future SIGPROF signals because by default SIGPROF will terminate | 114 // Ignore future SIGPROF signals because by default SIGPROF will terminate |
115 // the process and we may have some signals in flight. | 115 // the process and we may have some signals in flight. |
116 struct sigaction act; | 116 struct sigaction act; |
117 act.sa_handler = SIG_IGN; | 117 act.sa_handler = SIG_IGN; |
118 sigemptyset(&act.sa_mask); | 118 sigemptyset(&act.sa_mask); |
119 act.sa_flags = 0; | 119 act.sa_flags = 0; |
120 int r = sigaction(SIGPROF, &act, NULL); | 120 int r = sigaction(SIGPROF, &act, NULL); |
121 ASSERT(r == 0); | 121 ASSERT(r == 0); |
122 } | 122 } |
123 | 123 |
124 | 124 |
125 } // namespace dart | 125 } // namespace dart |
126 | 126 |
127 #endif // defined(TARGET_OS_LINUX) | 127 #endif // defined(TARGET_OS_LINUX) |
OLD | NEW |