misterg | c2e7548 | 2017-09-19 16:54:40 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017 The Abseil Authors. |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | |
| 16 | * Defines ABSL_STACKTRACE_INL_HEADER to the *-inl.h containing |
| 17 | * actual unwinder implementation. |
| 18 | * This header is "private" to stacktrace.cc. |
| 19 | * DO NOT include it into any other files. |
| 20 | */ |
| 21 | #ifndef ABSL_DEBUGGING_INTERNAL_STACKTRACE_CONFIG_H_ |
| 22 | #define ABSL_DEBUGGING_INTERNAL_STACKTRACE_CONFIG_H_ |
| 23 | |
| 24 | // First, test platforms which only support a stub. |
| 25 | #if ABSL_STACKTRACE_INL_HEADER |
| 26 | #error ABSL_STACKTRACE_INL_HEADER cannot be directly set |
| 27 | #elif defined(__native_client__) || defined(__APPLE__) || \ |
Daniel Ylitalo | 5fe41af | 2017-12-13 21:02:50 +0100 | [diff] [blame] | 28 | defined(__FreeBSD__) || defined(__ANDROID__) || defined(__myriad2__) || \ |
Abseil Team | 4e2e6c5 | 2018-03-20 21:10:15 -0700 | [diff] [blame] | 29 | defined(__asmjs__) || defined(__wasm__) || defined(__Fuchsia__) |
misterg | c2e7548 | 2017-09-19 16:54:40 -0400 | [diff] [blame] | 30 | #define ABSL_STACKTRACE_INL_HEADER \ |
| 31 | "absl/debugging/internal/stacktrace_unimplemented-inl.inc" |
| 32 | |
| 33 | // Next, test for Mips and Windows. |
Abseil Team | cf6ab6b | 2017-09-24 08:20:48 -0700 | [diff] [blame] | 34 | // TODO(marmstrong): Mips case, remove the check for ABSL_STACKTRACE_INL_HEADER |
misterg | c2e7548 | 2017-09-19 16:54:40 -0400 | [diff] [blame] | 35 | #elif defined(__mips__) && !defined(ABSL_STACKTRACE_INL_HEADER) |
| 36 | #define ABSL_STACKTRACE_INL_HEADER \ |
| 37 | "absl/debugging/internal/stacktrace_unimplemented-inl.inc" |
| 38 | #elif defined(_WIN32) // windows |
| 39 | #define ABSL_STACKTRACE_INL_HEADER \ |
| 40 | "absl/debugging/internal/stacktrace_win32-inl.inc" |
| 41 | |
| 42 | // Finally, test NO_FRAME_POINTER. |
| 43 | #elif !defined(NO_FRAME_POINTER) |
| 44 | # if defined(__i386__) || defined(__x86_64__) |
| 45 | #define ABSL_STACKTRACE_INL_HEADER \ |
| 46 | "absl/debugging/internal/stacktrace_x86-inl.inc" |
| 47 | # elif defined(__ppc__) || defined(__PPC__) |
| 48 | #define ABSL_STACKTRACE_INL_HEADER \ |
| 49 | "absl/debugging/internal/stacktrace_powerpc-inl.inc" |
| 50 | # elif defined(__aarch64__) |
| 51 | #define ABSL_STACKTRACE_INL_HEADER \ |
| 52 | "absl/debugging/internal/stacktrace_aarch64-inl.inc" |
| 53 | # elif defined(__arm__) |
| 54 | #define ABSL_STACKTRACE_INL_HEADER \ |
| 55 | "absl/debugging/internal/stacktrace_arm-inl.inc" |
| 56 | # endif |
| 57 | #else // defined(NO_FRAME_POINTER) |
| 58 | # if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) |
| 59 | #define ABSL_STACKTRACE_INL_HEADER \ |
| 60 | "absl/debugging/internal/stacktrace_unimplemented-inl.inc" |
| 61 | # elif defined(__ppc__) || defined(__PPC__) |
| 62 | // Use glibc's backtrace. |
| 63 | #define ABSL_STACKTRACE_INL_HEADER \ |
| 64 | "absl/debugging/internal/stacktrace_generic-inl.inc" |
| 65 | # elif defined(__arm__) |
| 66 | # error stacktrace without frame pointer is not supported on ARM |
| 67 | # endif |
| 68 | #endif // NO_FRAME_POINTER |
| 69 | |
| 70 | #if !defined(ABSL_STACKTRACE_INL_HEADER) |
| 71 | #error Not supported yet |
| 72 | #endif |
| 73 | |
| 74 | #endif // ABSL_DEBUGGING_INTERNAL_STACKTRACE_CONFIG_H_ |