eloop: Remove global user data pointer
[libeap.git] / src / utils / trace.h
1 /*
2  * Backtrace debugging
3  * Copyright (c) 2009, Jouni Malinen <j@w1.fi>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation.
8  *
9  * Alternatively, this software may be distributed under the terms of BSD
10  * license.
11  *
12  * See README and COPYING for more details.
13  */
14
15 #ifndef TRACE_H
16 #define TRACE_H
17
18 #define WPA_TRACE_LEN 16
19
20 #ifdef WPA_TRACE
21 #include <execinfo.h>
22
23 #define WPA_TRACE_INFO void *btrace[WPA_TRACE_LEN]; int btrace_num;
24 #define wpa_trace_dump(title, ptr) \
25         wpa_trace_dump_func((title), (ptr)->btrace, (ptr)->btrace_num)
26 void wpa_trace_dump_func(const char *title, void **btrace, int btrace_num);
27 #define wpa_trace_record(ptr) \
28         (ptr)->btrace_num = backtrace((ptr)->btrace, WPA_TRACE_LEN)
29 void wpa_trace_show(const char *title);
30
31 #else /* WPA_TRACE */
32
33 #define WPA_TRACE_INFO
34 #define wpa_trace_dump(title, ptr) do { } while (0)
35 #define wpa_trace_record(ptr) do { } while (0)
36 #define wpa_trace_show(title) do { } while (0)
37
38 #endif /* WPA_TRACE */
39
40 #endif /* TRACE_H */