xref: /aosp_15_r20/external/abseil-cpp/absl/debugging/internal/stacktrace_config.h (revision 9356374a3709195abf420251b3e825997ff56c0f)
1*9356374aSAndroid Build Coastguard Worker /*
2*9356374aSAndroid Build Coastguard Worker  * Copyright 2017 The Abseil Authors.
3*9356374aSAndroid Build Coastguard Worker  *
4*9356374aSAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
5*9356374aSAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
6*9356374aSAndroid Build Coastguard Worker  * You may obtain a copy of the License at
7*9356374aSAndroid Build Coastguard Worker  *
8*9356374aSAndroid Build Coastguard Worker  *      https://www.apache.org/licenses/LICENSE-2.0
9*9356374aSAndroid Build Coastguard Worker  *
10*9356374aSAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
11*9356374aSAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
12*9356374aSAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*9356374aSAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
14*9356374aSAndroid Build Coastguard Worker  * limitations under the License.
15*9356374aSAndroid Build Coastguard Worker 
16*9356374aSAndroid Build Coastguard Worker  * Defines ABSL_STACKTRACE_INL_HEADER to the *-inl.h containing
17*9356374aSAndroid Build Coastguard Worker  * actual unwinder implementation.
18*9356374aSAndroid Build Coastguard Worker  * This header is "private" to stacktrace.cc.
19*9356374aSAndroid Build Coastguard Worker  * DO NOT include it into any other files.
20*9356374aSAndroid Build Coastguard Worker */
21*9356374aSAndroid Build Coastguard Worker #ifndef ABSL_DEBUGGING_INTERNAL_STACKTRACE_CONFIG_H_
22*9356374aSAndroid Build Coastguard Worker #define ABSL_DEBUGGING_INTERNAL_STACKTRACE_CONFIG_H_
23*9356374aSAndroid Build Coastguard Worker 
24*9356374aSAndroid Build Coastguard Worker #include "absl/base/config.h"
25*9356374aSAndroid Build Coastguard Worker 
26*9356374aSAndroid Build Coastguard Worker #if defined(ABSL_STACKTRACE_INL_HEADER)
27*9356374aSAndroid Build Coastguard Worker #error ABSL_STACKTRACE_INL_HEADER cannot be directly set
28*9356374aSAndroid Build Coastguard Worker 
29*9356374aSAndroid Build Coastguard Worker #elif defined(_WIN32)
30*9356374aSAndroid Build Coastguard Worker #define ABSL_STACKTRACE_INL_HEADER \
31*9356374aSAndroid Build Coastguard Worker     "absl/debugging/internal/stacktrace_win32-inl.inc"
32*9356374aSAndroid Build Coastguard Worker 
33*9356374aSAndroid Build Coastguard Worker #elif defined(__APPLE__)
34*9356374aSAndroid Build Coastguard Worker #ifdef ABSL_HAVE_THREAD_LOCAL
35*9356374aSAndroid Build Coastguard Worker // Thread local support required for UnwindImpl.
36*9356374aSAndroid Build Coastguard Worker #define ABSL_STACKTRACE_INL_HEADER \
37*9356374aSAndroid Build Coastguard Worker   "absl/debugging/internal/stacktrace_generic-inl.inc"
38*9356374aSAndroid Build Coastguard Worker #endif  // defined(ABSL_HAVE_THREAD_LOCAL)
39*9356374aSAndroid Build Coastguard Worker 
40*9356374aSAndroid Build Coastguard Worker // Emscripten stacktraces rely on JS. Do not use them in standalone mode.
41*9356374aSAndroid Build Coastguard Worker #elif defined(__EMSCRIPTEN__) && !defined(STANDALONE_WASM)
42*9356374aSAndroid Build Coastguard Worker #define ABSL_STACKTRACE_INL_HEADER \
43*9356374aSAndroid Build Coastguard Worker   "absl/debugging/internal/stacktrace_emscripten-inl.inc"
44*9356374aSAndroid Build Coastguard Worker 
45*9356374aSAndroid Build Coastguard Worker #elif defined(__linux__) && !defined(__ANDROID__)
46*9356374aSAndroid Build Coastguard Worker 
47*9356374aSAndroid Build Coastguard Worker #if defined(NO_FRAME_POINTER) && \
48*9356374aSAndroid Build Coastguard Worker     (defined(__i386__) || defined(__x86_64__) || defined(__aarch64__))
49*9356374aSAndroid Build Coastguard Worker // Note: The libunwind-based implementation is not available to open-source
50*9356374aSAndroid Build Coastguard Worker // users.
51*9356374aSAndroid Build Coastguard Worker #define ABSL_STACKTRACE_INL_HEADER \
52*9356374aSAndroid Build Coastguard Worker   "absl/debugging/internal/stacktrace_libunwind-inl.inc"
53*9356374aSAndroid Build Coastguard Worker #define STACKTRACE_USES_LIBUNWIND 1
54*9356374aSAndroid Build Coastguard Worker #elif defined(NO_FRAME_POINTER) && defined(__has_include)
55*9356374aSAndroid Build Coastguard Worker #if __has_include(<execinfo.h>)
56*9356374aSAndroid Build Coastguard Worker // Note: When using glibc this may require -funwind-tables to function properly.
57*9356374aSAndroid Build Coastguard Worker #define ABSL_STACKTRACE_INL_HEADER \
58*9356374aSAndroid Build Coastguard Worker   "absl/debugging/internal/stacktrace_generic-inl.inc"
59*9356374aSAndroid Build Coastguard Worker #endif  // __has_include(<execinfo.h>)
60*9356374aSAndroid Build Coastguard Worker #elif defined(__i386__) || defined(__x86_64__)
61*9356374aSAndroid Build Coastguard Worker #define ABSL_STACKTRACE_INL_HEADER \
62*9356374aSAndroid Build Coastguard Worker   "absl/debugging/internal/stacktrace_x86-inl.inc"
63*9356374aSAndroid Build Coastguard Worker #elif defined(__ppc__) || defined(__PPC__)
64*9356374aSAndroid Build Coastguard Worker #define ABSL_STACKTRACE_INL_HEADER \
65*9356374aSAndroid Build Coastguard Worker   "absl/debugging/internal/stacktrace_powerpc-inl.inc"
66*9356374aSAndroid Build Coastguard Worker #elif defined(__aarch64__)
67*9356374aSAndroid Build Coastguard Worker #define ABSL_STACKTRACE_INL_HEADER \
68*9356374aSAndroid Build Coastguard Worker   "absl/debugging/internal/stacktrace_aarch64-inl.inc"
69*9356374aSAndroid Build Coastguard Worker #elif defined(__riscv)
70*9356374aSAndroid Build Coastguard Worker #define ABSL_STACKTRACE_INL_HEADER \
71*9356374aSAndroid Build Coastguard Worker   "absl/debugging/internal/stacktrace_riscv-inl.inc"
72*9356374aSAndroid Build Coastguard Worker #elif defined(__has_include)
73*9356374aSAndroid Build Coastguard Worker #if __has_include(<execinfo.h>)
74*9356374aSAndroid Build Coastguard Worker // Note: When using glibc this may require -funwind-tables to function properly.
75*9356374aSAndroid Build Coastguard Worker #define ABSL_STACKTRACE_INL_HEADER \
76*9356374aSAndroid Build Coastguard Worker   "absl/debugging/internal/stacktrace_generic-inl.inc"
77*9356374aSAndroid Build Coastguard Worker #endif  // __has_include(<execinfo.h>)
78*9356374aSAndroid Build Coastguard Worker #endif  // defined(__has_include)
79*9356374aSAndroid Build Coastguard Worker 
80*9356374aSAndroid Build Coastguard Worker #endif  // defined(__linux__) && !defined(__ANDROID__)
81*9356374aSAndroid Build Coastguard Worker 
82*9356374aSAndroid Build Coastguard Worker // Fallback to the empty implementation.
83*9356374aSAndroid Build Coastguard Worker #if !defined(ABSL_STACKTRACE_INL_HEADER)
84*9356374aSAndroid Build Coastguard Worker #define ABSL_STACKTRACE_INL_HEADER \
85*9356374aSAndroid Build Coastguard Worker   "absl/debugging/internal/stacktrace_unimplemented-inl.inc"
86*9356374aSAndroid Build Coastguard Worker #endif
87*9356374aSAndroid Build Coastguard Worker 
88*9356374aSAndroid Build Coastguard Worker #endif  // ABSL_DEBUGGING_INTERNAL_STACKTRACE_CONFIG_H_
89