Austin Schuh | 36244a1 | 2019-09-21 17:52:38 -0700 | [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 | * https://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 | |
Austin Schuh | b4691e9 | 2020-12-31 12:37:18 -0800 | [diff] [blame^] | 24 | #include "absl/base/config.h" |
| 25 | |
Austin Schuh | 36244a1 | 2019-09-21 17:52:38 -0700 | [diff] [blame] | 26 | #if defined(ABSL_STACKTRACE_INL_HEADER) |
| 27 | #error ABSL_STACKTRACE_INL_HEADER cannot be directly set |
| 28 | |
| 29 | #elif defined(_WIN32) |
| 30 | #define ABSL_STACKTRACE_INL_HEADER \ |
| 31 | "absl/debugging/internal/stacktrace_win32-inl.inc" |
| 32 | |
Austin Schuh | b4691e9 | 2020-12-31 12:37:18 -0800 | [diff] [blame^] | 33 | #elif defined(__APPLE__) |
| 34 | #ifdef ABSL_HAVE_THREAD_LOCAL |
| 35 | // Thread local support required for UnwindImpl. |
| 36 | #define ABSL_STACKTRACE_INL_HEADER \ |
| 37 | "absl/debugging/internal/stacktrace_generic-inl.inc" |
| 38 | #endif |
| 39 | |
Austin Schuh | 36244a1 | 2019-09-21 17:52:38 -0700 | [diff] [blame] | 40 | #elif defined(__linux__) && !defined(__ANDROID__) |
| 41 | |
Austin Schuh | b4691e9 | 2020-12-31 12:37:18 -0800 | [diff] [blame^] | 42 | #if defined(NO_FRAME_POINTER) && \ |
| 43 | (defined(__i386__) || defined(__x86_64__) || defined(__aarch64__)) |
| 44 | // Note: The libunwind-based implementation is not available to open-source |
| 45 | // users. |
Austin Schuh | 36244a1 | 2019-09-21 17:52:38 -0700 | [diff] [blame] | 46 | #define ABSL_STACKTRACE_INL_HEADER \ |
Austin Schuh | b4691e9 | 2020-12-31 12:37:18 -0800 | [diff] [blame^] | 47 | "absl/debugging/internal/stacktrace_libunwind-inl.inc" |
| 48 | #define STACKTRACE_USES_LIBUNWIND 1 |
| 49 | #elif defined(NO_FRAME_POINTER) && defined(__has_include) |
| 50 | #if __has_include(<execinfo.h>) |
Austin Schuh | 36244a1 | 2019-09-21 17:52:38 -0700 | [diff] [blame] | 51 | // Note: When using glibc this may require -funwind-tables to function properly. |
| 52 | #define ABSL_STACKTRACE_INL_HEADER \ |
| 53 | "absl/debugging/internal/stacktrace_generic-inl.inc" |
Austin Schuh | b4691e9 | 2020-12-31 12:37:18 -0800 | [diff] [blame^] | 54 | #endif |
| 55 | #elif defined(__i386__) || defined(__x86_64__) |
Austin Schuh | 36244a1 | 2019-09-21 17:52:38 -0700 | [diff] [blame] | 56 | #define ABSL_STACKTRACE_INL_HEADER \ |
Austin Schuh | b4691e9 | 2020-12-31 12:37:18 -0800 | [diff] [blame^] | 57 | "absl/debugging/internal/stacktrace_x86-inl.inc" |
| 58 | #elif defined(__ppc__) || defined(__PPC__) |
Austin Schuh | 36244a1 | 2019-09-21 17:52:38 -0700 | [diff] [blame] | 59 | #define ABSL_STACKTRACE_INL_HEADER \ |
Austin Schuh | b4691e9 | 2020-12-31 12:37:18 -0800 | [diff] [blame^] | 60 | "absl/debugging/internal/stacktrace_powerpc-inl.inc" |
| 61 | #elif defined(__aarch64__) |
Austin Schuh | 36244a1 | 2019-09-21 17:52:38 -0700 | [diff] [blame] | 62 | #define ABSL_STACKTRACE_INL_HEADER \ |
Austin Schuh | b4691e9 | 2020-12-31 12:37:18 -0800 | [diff] [blame^] | 63 | "absl/debugging/internal/stacktrace_aarch64-inl.inc" |
| 64 | #elif defined(__has_include) |
| 65 | #if __has_include(<execinfo.h>) |
| 66 | // Note: When using glibc this may require -funwind-tables to function properly. |
Austin Schuh | 36244a1 | 2019-09-21 17:52:38 -0700 | [diff] [blame] | 67 | #define ABSL_STACKTRACE_INL_HEADER \ |
Austin Schuh | b4691e9 | 2020-12-31 12:37:18 -0800 | [diff] [blame^] | 68 | "absl/debugging/internal/stacktrace_generic-inl.inc" |
| 69 | #endif |
| 70 | #endif |
Austin Schuh | 36244a1 | 2019-09-21 17:52:38 -0700 | [diff] [blame] | 71 | |
Austin Schuh | b4691e9 | 2020-12-31 12:37:18 -0800 | [diff] [blame^] | 72 | #endif |
| 73 | |
| 74 | // Fallback to the empty implementation. |
| 75 | #if !defined(ABSL_STACKTRACE_INL_HEADER) |
Austin Schuh | 36244a1 | 2019-09-21 17:52:38 -0700 | [diff] [blame] | 76 | #define ABSL_STACKTRACE_INL_HEADER \ |
| 77 | "absl/debugging/internal/stacktrace_unimplemented-inl.inc" |
Austin Schuh | 36244a1 | 2019-09-21 17:52:38 -0700 | [diff] [blame] | 78 | #endif |
| 79 | |
| 80 | #endif // ABSL_DEBUGGING_INTERNAL_STACKTRACE_CONFIG_H_ |