lib: add aliases for Babeltrace structure types
[babeltrace.git] / plugins / lttng-utils / debug-info.h
CommitLineData
4f45f9bb
JD
1#ifndef BABELTRACE_PLUGIN_DEBUG_INFO_H
2#define BABELTRACE_PLUGIN_DEBUG_INFO_H
3
4/*
5 * Babeltrace - Debug information Plug-in
6 *
7 * Copyright (c) 2015 EfficiOS Inc.
8 * Copyright (c) 2015 Antoine Busque <abusque@efficios.com>
9 *
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:
16 *
17 * The above copyright notice and this permission notice shall be included in
18 * all copies or substantial portions of the Software.
19 *
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
26 * SOFTWARE.
27 */
28
29#include <stdbool.h>
30#include <stdint.h>
31#include <stddef.h>
32#include <babeltrace/babeltrace-internal.h>
9d408fca 33#include <babeltrace/babeltrace.h>
4f45f9bb 34
c4838cef
PP
35#define VPID_FIELD_NAME "vpid"
36#define IP_FIELD_NAME "ip"
37#define BADDR_FIELD_NAME "baddr"
38#define CRC32_FIELD_NAME "crc32"
39#define BUILD_ID_FIELD_NAME "build_id"
40#define FILENAME_FIELD_NAME "filename"
41#define IS_PIC_FIELD_NAME "is_pic"
42#define MEMSZ_FIELD_NAME "memsz"
43#define PATH_FIELD_NAME "path"
44
1c78e839
JD
45enum debug_info_stream_state {
46 /*
47 * We know the stream exists but we have never received a
48 * stream_begin notification for it.
49 */
50 DEBUG_INFO_UNKNOWN_STREAM,
51 /* We know this stream is active (between stream_begin and _end). */
52 DEBUG_INFO_ACTIVE_STREAM,
53 /* We have received a stream_end for this stream. */
54 DEBUG_INFO_COMPLETED_STREAM,
55};
56
4f45f9bb
JD
57struct debug_info_component {
58 FILE *err;
59 char *arg_debug_info_field_name;
60 const char *arg_debug_dir;
61 bool arg_full_path;
62 const char *arg_target_prefix;
63};
64
65struct debug_info_iterator {
66 struct debug_info_component *debug_info_component;
b19ff26f 67 /* Map between bt_trace and struct bt_writer. */
4f45f9bb 68 GHashTable *trace_map;
504db471
JD
69 /* Input iterators associated with this output iterator. */
70 GPtrArray *input_iterator_group;
b19ff26f
PP
71 const bt_notification *current_notification;
72 bt_notification_iterator *input_iterator;
504db471
JD
73 FILE *err;
74};
75
76struct debug_info_trace {
b19ff26f
PP
77 const bt_trace *trace;
78 const bt_trace *writer_trace;
504db471 79 struct debug_info_component *debug_info_component;
1c78e839 80 struct debug_info_iterator *debug_it;
504db471
JD
81 int static_listener_id;
82 int trace_static;
4f45f9bb
JD
83 /* Map between reader and writer stream. */
84 GHashTable *stream_map;
85 /* Map between reader and writer stream class. */
86 GHashTable *stream_class_map;
87 /* Map between reader and writer stream class. */
88 GHashTable *packet_map;
89 /* Map between a trace_class and its corresponding debug_info. */
90 GHashTable *trace_debug_map;
1c78e839
JD
91 /* Map between a stream and enum debug_info_stream_state. */
92 GHashTable *stream_states;
4f45f9bb
JD
93};
94
95struct debug_info_source {
96 /* Strings are owned by debug_info_source. */
97 char *func;
98 uint64_t line_no;
99 char *src_path;
100 /* short_src_path points inside src_path, no need to free. */
101 const char *short_src_path;
102 char *bin_path;
103 /* short_bin_path points inside bin_path, no need to free. */
104 const char *short_bin_path;
105 /*
106 * Location within the binary. Either absolute (@0x1234) or
107 * relative (+0x4321).
108 */
109 char *bin_loc;
110};
111
112BT_HIDDEN
9d325e17 113struct debug_info *debug_info_create(struct debug_info_component *comp);
4f45f9bb
JD
114
115BT_HIDDEN
116void debug_info_destroy(struct debug_info *debug_info);
117
118BT_HIDDEN
119struct debug_info_source *debug_info_query(struct debug_info *debug_info,
120 int64_t vpid, uint64_t ip);
121
122BT_HIDDEN
b19ff26f 123void debug_info_handle_event(FILE *err, const bt_event *event,
4f45f9bb
JD
124 struct debug_info *debug_info);
125
1c78e839
JD
126BT_HIDDEN
127void debug_info_close_trace(struct debug_info_iterator *debug_it,
128 struct debug_info_trace *di_trace);
129
4f45f9bb 130#endif /* BABELTRACE_PLUGIN_DEBUG_INFO_H */
This page took 0.03723 seconds and 4 git commands to generate.