Commit | Line | Data |
---|---|---|
c40a57e5 AB |
1 | #ifndef _BABELTRACE_DEBUGINFO_H |
2 | #define _BABELTRACE_DEBUGINFO_H | |
3 | ||
4 | /* | |
5 | * Babeltrace - Debug information state tracker | |
6 | * | |
7 | * Copyright (c) 2015 EfficiOS Inc. | |
8 | * Copyright (c) 2015 Philippe Proulx <pproulx@efficios.com> | |
9 | * Copyright (c) 2015 Antoine Busque <abusque@efficios.com> | |
10 | * Copyright (c) 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com> | |
11 | * | |
12 | * Permission is hereby granted, free of charge, to any person obtaining a copy | |
13 | * of this software and associated documentation files (the "Software"), to deal | |
14 | * in the Software without restriction, including without limitation the rights | |
15 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
16 | * copies of the Software, and to permit persons to whom the Software is | |
17 | * furnished to do so, subject to the following conditions: | |
18 | * | |
19 | * The above copyright notice and this permission notice shall be included in | |
20 | * all copies or substantial portions of the Software. | |
21 | * | |
22 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
23 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
24 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
25 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
26 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
27 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
28 | * SOFTWARE. | |
29 | */ | |
30 | ||
31 | struct debug_info; | |
32 | struct ctf_event_definition; | |
33 | ||
34 | #ifdef ENABLE_DEBUGINFO | |
35 | ||
36 | #include <stdint.h> | |
37 | #include <stdbool.h> | |
38 | #include <stddef.h> | |
39 | #include <babeltrace/babeltrace-internal.h> | |
40 | ||
41 | struct debug_info_source { | |
42 | /* Strings are owned by debug_info_source. */ | |
43 | char *func; | |
44 | uint64_t line_no; | |
45 | char *filename; | |
ff9ce920 JG |
46 | /* short_filename points inside filename, no need to free. */ |
47 | const char *short_filename; | |
c40a57e5 AB |
48 | }; |
49 | ||
50 | BT_HIDDEN | |
51 | struct debug_info *debug_info_create(void); | |
52 | ||
53 | BT_HIDDEN | |
54 | void debug_info_destroy(struct debug_info *debug_info); | |
55 | ||
56 | BT_HIDDEN | |
57 | void debug_info_handle_event(struct debug_info *debug_info, | |
58 | struct ctf_event_definition *event); | |
59 | ||
60 | #else /* ifdef ENABLE_DEBUGINFO */ | |
61 | ||
62 | static inline | |
63 | struct debug_info *debug_info_create(void) { return malloc(1); } | |
64 | ||
65 | static inline | |
66 | void debug_info_destroy(struct debug_info *debug_info) { free(debug_info); } | |
67 | ||
68 | static inline | |
69 | void debug_info_handle_event(struct debug_info *debug_info, | |
70 | struct ctf_event_definition *event) { } | |
71 | ||
72 | #endif /* ENABLE_DEBUGINFO */ | |
73 | ||
74 | #endif /* _BABELTRACE_DEBUGINFO_H */ |