v / thirdparty / libbacktrace
Raw file | 111 loc (100 sloc) | 3.3 KB | Latest commit hash 76a735450
1/* Copyright (C) 2012-2021 Free Software Foundation, Inc.
2 Written by Ian Lance Taylor, Google.
3
4Redistribution and use in source and binary forms, with or without
5modification, are permitted provided that the following conditions are
6met:
7
8 (1) Redistributions of source code must retain the above copyright
9 notice, this list of conditions and the following disclaimer.
10
11 (2) Redistributions in binary form must reproduce the above copyright
12 notice, this list of conditions and the following disclaimer in
13 the documentation and/or other materials provided with the
14 distribution.
15
16 (3) The name of the author may not be used to
17 endorse or promote products derived from this software without
18 specific prior written permission.
19
20THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
24INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
29IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30POSSIBILITY OF SUCH DAMAGE. */
31
32#define HAVE_ATOMIC_FUNCTIONS 1
33#define HAVE_CLOCK_GETTIME 1
34#define HAVE_DECL_GETPAGESIZE 0
35#define HAVE_DECL_STRNLEN 1
36#define HAVE_DL_ITERATE_PHDR 1
37#define HAVE_GETIPINFO 1
38#define HAVE_LSTAT 1
39#define HAVE_READLINK 1
40#define HAVE_SYNC_FUNCTIONS 1
41
42#define HAVE_DLFCN_H 1
43#define HAVE_INTTYPES_H 1
44#define HAVE_LINK_H 1
45#define HAVE_MEMORY_H 1
46#define HAVE_STDINT_H 1
47#define HAVE_STDLIB_H 1
48#define HAVE_STRINGS_H 1
49#define HAVE_STRING_H 1
50#define HAVE_UNISTD_H 1
51#define STDC_HEADERS 1
52#include <stdint.h>
53#if UINTPTR_MAX == 0xFFFFFFFF
54 #define BACKTRACE_ELF_SIZE 32
55 #define BACKTRACE_XCOFF_SIZE 32
56#elif UINTPTR_MAX == 0xFFFFFFFFFFFFFFFFu
57 #define BACKTRACE_ELF_SIZE 64
58 #define BACKTRACE_XCOFF_SIZE 64
59#endif
60#ifdef __TINYC__
61 #undef HAVE_ATOMIC_FUNCTIONS
62 #undef HAVE_SYNC_FUNCTIONS
63#endif
64#ifndef _WIN32
65#define HAVE_FCNTL 1
66#endif
67#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
68 #define HAVE_KERN_PROC 1
69 #define HAVE_KERN_PROC_ARGS 1
70#endif
71#ifdef __APPLE__
72 #define HAVE_MACH_O_DYLD_H 1
73#endif
74#ifndef _ALL_SOURCE
75 #define _ALL_SOURCE 1
76#endif
77#ifndef _GNU_SOURCE
78 #define _GNU_SOURCE 1
79 #undef HAVE_DL_ITERATE_PHDR
80#endif
81#ifndef _POSIX_PTHREAD_SEMANTICS
82 #define _POSIX_PTHREAD_SEMANTICS 1
83#endif
84#ifndef _TANDEM_SOURCE
85 #define _TANDEM_SOURCE 1
86#endif
87#ifndef __EXTENSIONS__
88 #define __EXTENSIONS__ 1
89#endif
90#ifndef _DARWIN_USE_64_BIT_INODE
91 #define _DARWIN_USE_64_BIT_INODE 1
92#endif
93
94#define BACKTRACE_SUPPORTED 1
95#define BACKTRACE_USES_MALLOC 1
96#define BACKTRACE_SUPPORTS_THREADS 1
97#define BACKTRACE_SUPPORTS_DATA 0
98
99#if __TINYC__
100 #undef BACKTRACE_SUPPORTED
101#endif
102
103#include "base.c"
104
105#if defined(__linux__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
106 #include "linux.c"
107#elif defined(__APPLE__)
108 #include "darwin.c"
109#elif defined(_WIN32)
110 #include "windows.c"
111#endif