blob: c0df5bb067f10b1cde20f5afdc98d3e3e65e3354 [file] [log] [blame]
mistergc2e75482017-09-19 16:54:40 -04001/*
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__) || \
28 defined(__ANDROID__) || defined(__myriad2__) || defined(__asmjs__) || \
29 defined(__Fuchsia__) || defined(__GENCLAVE__) || \
30 defined(GOOGLE_UNSUPPORTED_OS_HERCULES)
31#define ABSL_STACKTRACE_INL_HEADER \
32 "absl/debugging/internal/stacktrace_unimplemented-inl.inc"
33
34// Next, test for Mips and Windows.
35// TODO(marmstrong): http://b/21334018: Mips case, remove the check for
36// ABSL_STACKTRACE_INL_HEADER.
37#elif defined(__mips__) && !defined(ABSL_STACKTRACE_INL_HEADER)
38#define ABSL_STACKTRACE_INL_HEADER \
39 "absl/debugging/internal/stacktrace_unimplemented-inl.inc"
40#elif defined(_WIN32) // windows
41#define ABSL_STACKTRACE_INL_HEADER \
42 "absl/debugging/internal/stacktrace_win32-inl.inc"
43
44// Finally, test NO_FRAME_POINTER.
45#elif !defined(NO_FRAME_POINTER)
46# if defined(__i386__) || defined(__x86_64__)
47#define ABSL_STACKTRACE_INL_HEADER \
48 "absl/debugging/internal/stacktrace_x86-inl.inc"
49# elif defined(__ppc__) || defined(__PPC__)
50#define ABSL_STACKTRACE_INL_HEADER \
51 "absl/debugging/internal/stacktrace_powerpc-inl.inc"
52# elif defined(__aarch64__)
53#define ABSL_STACKTRACE_INL_HEADER \
54 "absl/debugging/internal/stacktrace_aarch64-inl.inc"
55# elif defined(__arm__)
56#define ABSL_STACKTRACE_INL_HEADER \
57 "absl/debugging/internal/stacktrace_arm-inl.inc"
58# endif
59#else // defined(NO_FRAME_POINTER)
60# if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__)
61#define ABSL_STACKTRACE_INL_HEADER \
62 "absl/debugging/internal/stacktrace_unimplemented-inl.inc"
63# elif defined(__ppc__) || defined(__PPC__)
64// Use glibc's backtrace.
65#define ABSL_STACKTRACE_INL_HEADER \
66 "absl/debugging/internal/stacktrace_generic-inl.inc"
67# elif defined(__arm__)
68# error stacktrace without frame pointer is not supported on ARM
69# endif
70#endif // NO_FRAME_POINTER
71
72#if !defined(ABSL_STACKTRACE_INL_HEADER)
73#error Not supported yet
74#endif
75
76#endif // ABSL_DEBUGGING_INTERNAL_STACKTRACE_CONFIG_H_