5e9d79cacc8e744d10659301750ca069f4d72a09
[babeltrace.git] / include / babeltrace / debuginfo.h
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 *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;
51 };
52
53 BT_HIDDEN
54 struct debug_info *debug_info_create(void);
55
56 BT_HIDDEN
57 void debug_info_destroy(struct debug_info *debug_info);
58
59 BT_HIDDEN
60 void debug_info_handle_event(struct debug_info *debug_info,
61 struct ctf_event_definition *event);
62
63 #else /* ifdef ENABLE_DEBUGINFO */
64
65 static inline
66 struct debug_info *debug_info_create(void) { return malloc(1); }
67
68 static inline
69 void debug_info_destroy(struct debug_info *debug_info) { free(debug_info); }
70
71 static inline
72 void debug_info_handle_event(struct debug_info *debug_info,
73 struct ctf_event_definition *event) { }
74
75 #endif /* ENABLE_DEBUGINFO */
76
77 #endif /* _BABELTRACE_DEBUGINFO_H */
This page took 0.029687 seconds and 3 git commands to generate.