]> git.ipfire.org Git - thirdparty/gcc.git/blame - libbacktrace/testlib.h
[Ada] New pragma Aggregate_Individually_Assign
[thirdparty/gcc.git] / libbacktrace / testlib.h
CommitLineData
3be33b09 1/* testlib.h -- Header for test functions for libbacktrace library
fbd26352 2 Copyright (C) 2012-2019 Free Software Foundation, Inc.
3be33b09 3 Written by Ian Lance Taylor, Google.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are
7met:
8
9 (1) Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
11
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.
16
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.
20
21THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
25INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
30IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31POSSIBILITY OF SUCH DAMAGE. */
32
33#ifndef LIBBACKTRACE_TESTLIB_H
34#define LIBBACKTRACE_TESTLIB_H
35
36/* Portable attribute syntax. Actually some of these tests probably
37 won't work if the attributes are not recognized. */
38
39#ifndef GCC_VERSION
40# define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
41#endif
42
43#if (GCC_VERSION < 2007)
44# define __attribute__(x)
45#endif
46
47#ifndef ATTRIBUTE_UNUSED
48# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
49#endif
50
51/* Used to collect backtrace info. */
52
53struct info
54{
55 char *filename;
56 int lineno;
57 char *function;
58};
59
60/* Passed to backtrace callback function. */
61
62struct bdata
63{
64 struct info *all;
65 size_t index;
66 size_t max;
67 int failed;
68};
69
70/* Passed to backtrace_simple callback function. */
71
72struct sdata
73{
74 uintptr_t *addrs;
75 size_t index;
76 size_t max;
77 int failed;
78};
79
80/* Passed to backtrace_syminfo callback function. */
81
82struct symdata
83{
84 const char *name;
85 uintptr_t val, size;
86 int failed;
87};
88
89/* The backtrace state. */
90
91extern void *state;
92
93/* The number of failures. */
94
95extern int failures;
96
97extern const char *base (const char *p);
98extern 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);
101extern int callback_one (void *, uintptr_t, const char *, int, const char *);
102extern void error_callback_one (void *, const char *, int);
103extern int callback_two (void *, uintptr_t);
104extern void error_callback_two (void *, const char *, int);
105extern void callback_three (void *, uintptr_t, const char *, uintptr_t,
106 uintptr_t);
107extern void error_callback_three (void *, const char *, int);
108extern void error_callback_create (void *, const char *, int);
109
110#endif /* !defined(LIBBACKTRACE_TESTLIB_H) */