Commit | Line | Data |
---|---|---|
eb75a494 AB |
1 | #ifndef _BABELTRACE_DEBUG_INFO_H |
2 | #define _BABELTRACE_DEBUG_INFO_H | |
b5a8598f AB |
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 | ||
eb75a494 | 34 | #ifdef ENABLE_DEBUG_INFO |
b5a8598f AB |
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; | |
ad2b5b38 JG |
45 | char *src_path; |
46 | /* short_src_path points inside src_path, no need to free. */ | |
47 | const char *short_src_path; | |
48 | char *bin_path; | |
49 | /* short_bin_path points inside bin_path, no need to free. */ | |
50 | const char *short_bin_path; | |
dc419b6c AB |
51 | /* |
52 | * Location within the binary. Either absolute (@0x1234) or | |
53 | * relative (+0x4321). | |
54 | */ | |
55 | char *bin_loc; | |
b5a8598f AB |
56 | }; |
57 | ||
58 | BT_HIDDEN | |
59 | struct debug_info *debug_info_create(void); | |
60 | ||
61 | BT_HIDDEN | |
62 | void debug_info_destroy(struct debug_info *debug_info); | |
63 | ||
64 | BT_HIDDEN | |
65 | void debug_info_handle_event(struct debug_info *debug_info, | |
66 | struct ctf_event_definition *event); | |
67 | ||
eb75a494 | 68 | #else /* ifdef ENABLE_DEBUG_INFO */ |
b5a8598f AB |
69 | |
70 | static inline | |
71 | struct debug_info *debug_info_create(void) { return malloc(1); } | |
72 | ||
73 | static inline | |
74 | void debug_info_destroy(struct debug_info *debug_info) { free(debug_info); } | |
75 | ||
76 | static inline | |
77 | void debug_info_handle_event(struct debug_info *debug_info, | |
78 | struct ctf_event_definition *event) { } | |
79 | ||
eb75a494 | 80 | #endif /* ENABLE_DEBUG_INFO */ |
b5a8598f | 81 | |
eb75a494 | 82 | #endif /* _BABELTRACE_DEBUG_INFO_H */ |