| 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 #ifndef VM_SIGNAL_HANDLER_H_ | 5 #ifndef VM_SIGNAL_HANDLER_H_ |
| 6 #define VM_SIGNAL_HANDLER_H_ | 6 #define VM_SIGNAL_HANDLER_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
| 10 | 10 |
| 11 #if defined(TARGET_OS_LINUX) | 11 #if defined(TARGET_OS_LINUX) |
| 12 #include <signal.h> // NOLINT | 12 #include <signal.h> // NOLINT |
| 13 #include <ucontext.h> // NOLINT | 13 #include <ucontext.h> // NOLINT |
| 14 #elif defined(TARGET_OS_ANDROID) | 14 #elif defined(TARGET_OS_ANDROID) |
| 15 #include <android/api-level.h> // NOLINT | |
| 16 /* Android <= 19 doesn't have ucontext.h */ | |
| 17 #if __ANDROID_API__ <= 19 | |
| 18 #include <signal.h> // NOLINT | 15 #include <signal.h> // NOLINT |
| 16 #if !defined(__BIONIC_HAVE_UCONTEXT_T) |
| 19 #include <asm/sigcontext.h> // NOLINT | 17 #include <asm/sigcontext.h> // NOLINT |
| 20 // These are not defined on Android, so we have to define them here. | 18 // If ucontext_t is not defined on Android, define it here. |
| 21 typedef struct sigcontext mcontext_t; | 19 typedef struct sigcontext mcontext_t; |
| 22 typedef struct ucontext { | 20 typedef struct ucontext { |
| 23 uint32_t uc_flags; | 21 uint32_t uc_flags; |
| 24 struct ucontext *uc_link; | 22 struct ucontext *uc_link; |
| 25 stack_t uc_stack; | 23 stack_t uc_stack; |
| 26 struct sigcontext uc_mcontext; | 24 struct sigcontext uc_mcontext; |
| 27 uint32_t uc_sigmask; | 25 uint32_t uc_sigmask; |
| 28 } ucontext_t; | 26 } ucontext_t; |
| 29 #else | 27 #endif // !defined(__BIONIC_HAVE_UCONTEXT_T) |
| 30 // Android > 19 has ucontext.h | |
| 31 #include <signal.h> // NOLINT | |
| 32 #include <ucontext.h> // NOLINT | |
| 33 #endif // __ANDROID_API__ <= 19 | |
| 34 #elif defined(TARGET_OS_MACOS) | 28 #elif defined(TARGET_OS_MACOS) |
| 35 #include <signal.h> // NOLINT | 29 #include <signal.h> // NOLINT |
| 36 #include <sys/ucontext.h> // NOLINT | 30 #include <sys/ucontext.h> // NOLINT |
| 37 #elif defined(TARGET_OS_WINDOWS) | 31 #elif defined(TARGET_OS_WINDOWS) |
| 38 // Stub out for windows. | 32 // Stub out for windows. |
| 39 struct siginfo_t; | 33 struct siginfo_t; |
| 40 struct mcontext_t; | 34 struct mcontext_t; |
| 41 struct sigset_t { | 35 struct sigset_t { |
| 42 }; | 36 }; |
| 43 #endif | 37 #endif |
| (...skipping 10 matching lines...) Expand all Loading... |
| 54 static uintptr_t GetFramePointer(const mcontext_t& mcontext); | 48 static uintptr_t GetFramePointer(const mcontext_t& mcontext); |
| 55 static uintptr_t GetCStackPointer(const mcontext_t& mcontext); | 49 static uintptr_t GetCStackPointer(const mcontext_t& mcontext); |
| 56 static uintptr_t GetDartStackPointer(const mcontext_t& mcontext); | 50 static uintptr_t GetDartStackPointer(const mcontext_t& mcontext); |
| 57 private: | 51 private: |
| 58 }; | 52 }; |
| 59 | 53 |
| 60 | 54 |
| 61 } // namespace dart | 55 } // namespace dart |
| 62 | 56 |
| 63 #endif // VM_SIGNAL_HANDLER_H_ | 57 #endif // VM_SIGNAL_HANDLER_H_ |
| OLD | NEW |