1 /* testlib.h -- Header for test functions for libbacktrace library
2 Copyright (C) 2012-2022 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
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
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. */
40 # define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
43 #if (GCC_VERSION < 2007)
44 # define __attribute__(x)
47 #ifndef ATTRIBUTE_UNUSED
48 # define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
51 /* Used to collect backtrace info. */
60 /* Passed to backtrace callback function. */
70 /* Passed to backtrace_simple callback function. */
80 /* Passed to backtrace_syminfo callback function. */
89 /* The backtrace state. */
93 /* The number of 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,
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) */