[ARM] Fix ICE in Armv8-M Security Extensions code
[official-gcc.git] / libbacktrace / testlib.h
blob2bfe62f3daac4b25b3df42cfcd86e40826ddcf66
1 /* testlib.h -- Header for test functions for libbacktrace library
2 Copyright (C) 2012-2017 Free Software Foundation, Inc.
3 Written by Ian Lance Taylor, Google.
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are
7 met:
9 (1) Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
12 (2) Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in
14 the documentation and/or other materials provided with the
15 distribution.
17 (3) The name of the author may not be used to
18 endorse or promote products derived from this software without
19 specific prior written permission.
21 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
25 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
30 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 POSSIBILITY OF SUCH DAMAGE. */
33 #ifndef LIBBACKTRACE_TESTLIB_H
34 #define LIBBACKTRACE_TESTLIB_H
36 /* Portable attribute syntax. Actually some of these tests probably
37 won't work if the attributes are not recognized. */
39 #ifndef GCC_VERSION
40 # define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
41 #endif
43 #if (GCC_VERSION < 2007)
44 # define __attribute__(x)
45 #endif
47 #ifndef ATTRIBUTE_UNUSED
48 # define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
49 #endif
51 /* Used to collect backtrace info. */
53 struct info
55 char *filename;
56 int lineno;
57 char *function;
60 /* Passed to backtrace callback function. */
62 struct bdata
64 struct info *all;
65 size_t index;
66 size_t max;
67 int failed;
70 /* Passed to backtrace_simple callback function. */
72 struct sdata
74 uintptr_t *addrs;
75 size_t index;
76 size_t max;
77 int failed;
80 /* Passed to backtrace_syminfo callback function. */
82 struct symdata
84 const char *name;
85 uintptr_t val, size;
86 int failed;
89 /* The backtrace state. */
91 extern void *state;
93 /* The number of failures. */
95 extern int failures;
97 extern const char *base (const char *p);
98 extern void check (const char *name, int index, const struct info *all,
99 int want_lineno, const char *want_function,
100 const char *want_file, int *failed);
101 extern int callback_one (void *, uintptr_t, const char *, int, const char *);
102 extern void error_callback_one (void *, const char *, int);
103 extern int callback_two (void *, uintptr_t);
104 extern void error_callback_two (void *, const char *, int);
105 extern void callback_three (void *, uintptr_t, const char *, uintptr_t,
106 uintptr_t);
107 extern void error_callback_three (void *, const char *, int);
108 extern void error_callback_create (void *, const char *, int);
110 #endif /* !defined(LIBBACKTRACE_TESTLIB_H) */