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