debug-info refactoring
[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>
33#include <babeltrace/ctf-ir/event.h>
34#include <babeltrace/ctf-ir/trace.h>
35#include <babeltrace/ctf-ir/fields.h>
36#include <babeltrace/ctf-ir/event-class.h>
37
38struct debug_info_component {
39 FILE *err;
40 char *arg_debug_info_field_name;
41 const char *arg_debug_dir;
42 bool arg_full_path;
43 const char *arg_target_prefix;
44};
45
46struct debug_info_iterator {
47 struct debug_info_component *debug_info_component;
48 /* Map between struct bt_ctf_trace and struct bt_ctf_writer. */
49 GHashTable *trace_map;
504db471
JD
50 /* Input iterators associated with this output iterator. */
51 GPtrArray *input_iterator_group;
52 struct bt_notification *current_notification;
53 struct bt_notification_iterator *input_iterator;
54 FILE *err;
55};
56
57struct debug_info_trace {
58 struct bt_ctf_trace *trace;
59 struct bt_ctf_trace *writer_trace;
60 struct debug_info_component *debug_info_component;
61 int static_listener_id;
62 int trace_static;
4f45f9bb
JD
63 /* Map between reader and writer stream. */
64 GHashTable *stream_map;
65 /* Map between reader and writer stream class. */
66 GHashTable *stream_class_map;
67 /* Map between reader and writer stream class. */
68 GHashTable *packet_map;
69 /* Map between a trace_class and its corresponding debug_info. */
70 GHashTable *trace_debug_map;
4f45f9bb
JD
71};
72
73struct debug_info_source {
74 /* Strings are owned by debug_info_source. */
75 char *func;
76 uint64_t line_no;
77 char *src_path;
78 /* short_src_path points inside src_path, no need to free. */
79 const char *short_src_path;
80 char *bin_path;
81 /* short_bin_path points inside bin_path, no need to free. */
82 const char *short_bin_path;
83 /*
84 * Location within the binary. Either absolute (@0x1234) or
85 * relative (+0x4321).
86 */
87 char *bin_loc;
88};
89
90BT_HIDDEN
9d325e17 91struct debug_info *debug_info_create(struct debug_info_component *comp);
4f45f9bb
JD
92
93BT_HIDDEN
94void debug_info_destroy(struct debug_info *debug_info);
95
96BT_HIDDEN
97struct debug_info_source *debug_info_query(struct debug_info *debug_info,
98 int64_t vpid, uint64_t ip);
99
100BT_HIDDEN
101void debug_info_handle_event(FILE *err, struct bt_ctf_event *event,
102 struct debug_info *debug_info);
103
4f45f9bb 104#endif /* BABELTRACE_PLUGIN_DEBUG_INFO_H */
This page took 0.029268 seconds and 4 git commands to generate.