adbad09d6c6533082aaafb0374f750706c464cee
1 #ifndef _BABELTRACE_TRACE_DEBUGINFO_H
2 #define _BABELTRACE_TRACE_DEBUGINFO_H
5 * Babeltrace - Debug information state tracker wrapper
7 * Copyright (c) 2015 EfficiOS Inc.
8 * Copyright (c) 2015 Antoine Busque <abusque@efficios.com>
10 * Permission is hereby granted, free of charge, to any person obtaining a copy
11 * of this software and associated documentation files (the "Software"), to deal
12 * in the Software without restriction, including without limitation the rights
13 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 * copies of the Software, and to permit persons to whom the Software is
15 * furnished to do so, subject to the following conditions:
17 * The above copyright notice and this permission notice shall be included in
18 * all copies or substantial portions of the Software.
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29 #include <babeltrace/ctf-ir/metadata.h>
31 #ifdef ENABLE_DEBUGINFO
33 #include <babeltrace/debuginfo.h>
34 #include <babeltrace/ctf-text/types.h>
38 void ctf_text_integer_write_debug_info(struct bt_stream_pos
*ppos
,
39 struct bt_definition
*definition
)
41 struct definition_integer
*integer_definition
=
42 container_of(definition
, struct definition_integer
, p
);
43 struct ctf_text_stream_pos
*pos
= ctf_text_pos(ppos
);
44 struct debug_info_source
*debug_info_src
=
45 integer_definition
->debug_info_src
;
47 /* Print debug info if available */
49 if (debug_info_src
->func
|| debug_info_src
->filename
) {
50 bool add_comma
= false;
52 fprintf(pos
->fp
, ", debug_info = { ");
54 if (debug_info_src
->func
) {
55 fprintf(pos
->fp
, "func = \"%s\"",
56 debug_info_src
->func
);
60 if (debug_info_src
->filename
) {
62 fprintf(pos
->fp
, ", ");
65 fprintf(pos
->fp
, "source_loc = \"%s:%" PRIu64
67 debug_info_src
->filename
,
68 debug_info_src
->line_no
);
71 fprintf(pos
->fp
, " }");
77 int trace_debug_info_create(struct ctf_trace
*trace
)
81 if (strcmp(trace
->env
.domain
, "ust") != 0) {
85 if (strcmp(trace
->env
.tracer_name
, "lttng-ust") != 0) {
89 trace
->debug_info
= debug_info_create();
90 if (!trace
->debug_info
) {
100 void trace_debug_info_destroy(struct ctf_trace
*trace
)
102 debug_info_destroy(trace
->debug_info
);
106 void handle_debug_info_event(struct ctf_stream_declaration
*stream_class
,
107 struct ctf_event_definition
*event
)
109 debug_info_handle_event(stream_class
->trace
->debug_info
, event
);
112 #else /* #ifdef ENABLE_DEBUGINFO */
115 void ctf_text_integer_write_debug_info(struct bt_stream_pos
*ppos
,
116 struct bt_definition
*definition
)
122 int trace_debug_info_create(struct ctf_trace
*trace
)
128 void trace_debug_info_destroy(struct ctf_trace
*trace
)
134 void handle_debug_info_event(struct ctf_stream_declaration
*stream_class
,
135 struct ctf_event_definition
*event
)
140 #endif /* #else #ifdef ENABLE_DEBUGINFO */
142 #endif /* _BABELTRACE_TRACE_DEBUGINFO_H */
This page took 0.035392 seconds and 4 git commands to generate.