1d5886b74bc1f17e315174aa81710639005a4c43
[babeltrace.git] / src / plugins / lttng-utils / debug-info / debug-info.c
1 /*
2 * Babeltrace - Debug Information State Tracker
3 *
4 * Copyright (c) 2015 EfficiOS Inc. and Linux Foundation
5 * Copyright (c) 2015 Philippe Proulx <pproulx@efficios.com>
6 * Copyright (c) 2015 Antoine Busque <abusque@efficios.com>
7 * Copyright (c) 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 * Copyright (c) 2019 Francis Deslauriers <francis.deslauriers@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 #define BT_LOG_TAG "PLUGIN-CTF-LTTNG-UTILS-DEBUG-INFO-FLT"
30 #include "logging.h"
31
32 #include <glib.h>
33
34 #include "common/assert.h"
35 #include "common/common.h"
36 #include "fd-cache/fd-cache.h"
37
38 #include "bin-info.h"
39 #include "debug-info.h"
40 #include "trace-ir-data-copy.h"
41 #include "trace-ir-mapping.h"
42 #include "trace-ir-metadata-copy.h"
43 #include "utils.h"
44
45 #define DEFAULT_DEBUG_INFO_FIELD_NAME "debug_info"
46 #define LTTNG_UST_STATEDUMP_PREFIX "lttng_ust"
47 #define VPID_FIELD_NAME "vpid"
48 #define IP_FIELD_NAME "ip"
49 #define BADDR_FIELD_NAME "baddr"
50 #define CRC32_FIELD_NAME "crc"
51 #define BUILD_ID_FIELD_NAME "build_id"
52 #define FILENAME_FIELD_NAME "filename"
53 #define IS_PIC_FIELD_NAME "is_pic"
54 #define MEMSZ_FIELD_NAME "memsz"
55 #define PATH_FIELD_NAME "path"
56
57 struct debug_info_component {
58 gchar *arg_debug_dir;
59 gchar *arg_debug_info_field_name;
60 gchar *arg_target_prefix;
61 bt_bool arg_full_path;
62 };
63
64 struct debug_info_msg_iter {
65 struct debug_info_component *debug_info_component;
66 bt_self_message_iterator *input_iterator;
67 bt_self_component *self_comp;
68 bt_self_component_port_input_message_iterator *msg_iter;
69
70 struct trace_ir_maps *ir_maps;
71 /* in_trace -> debug_info_mapping. */
72 GHashTable *debug_info_map;
73
74 struct bt_fd_cache fd_cache;
75 };
76
77 struct debug_info_source {
78 /* Strings are owned by debug_info_source. */
79 gchar *func;
80 /*
81 * Store the line number as a string so that the allocation and
82 * conversion to string is only done once.
83 */
84 gchar *line_no;
85 gchar *src_path;
86 /* short_src_path points inside src_path, no need to free. */
87 const gchar *short_src_path;
88 gchar *bin_path;
89 /* short_bin_path points inside bin_path, no need to free. */
90 const gchar *short_bin_path;
91 /*
92 * Location within the binary. Either absolute (@0x1234) or
93 * relative (+0x4321).
94 */
95 gchar *bin_loc;
96 };
97
98 struct proc_debug_info_sources {
99 /*
100 * Hash table: base address (pointer to uint64_t) to bin info; owned by
101 * proc_debug_info_sources.
102 */
103 GHashTable *baddr_to_bin_info;
104
105 /*
106 * Hash table: IP (pointer to uint64_t) to (struct debug_info_source *);
107 * owned by proc_debug_info_sources.
108 */
109 GHashTable *ip_to_debug_info_src;
110 };
111
112 struct debug_info {
113 struct debug_info_component *comp;
114 const bt_trace *input_trace;
115 uint64_t destruction_listener_id;
116
117 /*
118 * Hash table of VPIDs (pointer to int64_t) to
119 * (struct proc_debug_info_sources*); owned by debug_info.
120 */
121 GHashTable *vpid_to_proc_dbg_info_src;
122 GQuark q_statedump_bin_info;
123 GQuark q_statedump_debug_link;
124 GQuark q_statedump_build_id;
125 GQuark q_statedump_start;
126 GQuark q_dl_open;
127 GQuark q_lib_load;
128 GQuark q_lib_unload;
129 struct bt_fd_cache *fd_cache; /* Weak ref. Owned by the iterator. */
130 };
131
132 static
133 int debug_info_init(struct debug_info *info)
134 {
135 info->q_statedump_bin_info = g_quark_from_string(
136 "lttng_ust_statedump:bin_info");
137 info->q_statedump_debug_link = g_quark_from_string(
138 "lttng_ust_statedump:debug_link");
139 info->q_statedump_build_id = g_quark_from_string(
140 "lttng_ust_statedump:build_id");
141 info->q_statedump_start = g_quark_from_string(
142 "lttng_ust_statedump:start");
143 info->q_dl_open = g_quark_from_string("lttng_ust_dl:dlopen");
144 info->q_lib_load = g_quark_from_string("lttng_ust_lib:load");
145 info->q_lib_unload = g_quark_from_string("lttng_ust_lib:unload");
146
147 return bin_info_init();
148 }
149
150 static
151 void debug_info_source_destroy(struct debug_info_source *debug_info_src)
152 {
153 if (!debug_info_src) {
154 return;
155 }
156
157 g_free(debug_info_src->func);
158 g_free(debug_info_src->line_no);
159 g_free(debug_info_src->src_path);
160 g_free(debug_info_src->bin_path);
161 g_free(debug_info_src->bin_loc);
162 g_free(debug_info_src);
163 }
164
165 static
166 struct debug_info_source *debug_info_source_create_from_bin(
167 struct bin_info *bin, uint64_t ip)
168 {
169 int ret;
170 struct debug_info_source *debug_info_src = NULL;
171 struct source_location *src_loc = NULL;
172
173 debug_info_src = g_new0(struct debug_info_source, 1);
174
175 if (!debug_info_src) {
176 goto end;
177 }
178
179 /* Lookup function name */
180 ret = bin_info_lookup_function_name(bin, ip, &debug_info_src->func);
181 if (ret) {
182 goto error;
183 }
184
185 /* Can't retrieve src_loc from ELF, or could not find binary, skip. */
186 if (!bin->is_elf_only || !debug_info_src->func) {
187 /* Lookup source location */
188 ret = bin_info_lookup_source_location(bin, ip, &src_loc);
189 if (ret) {
190 BT_LOGI("Failed to lookup source location: ret=%d", ret);
191 }
192 }
193
194 if (src_loc) {
195 debug_info_src->line_no =
196 g_strdup_printf("%"PRId64, src_loc->line_no);
197 if (!debug_info_src->line_no) {
198 BT_LOGE("Error occured when setting line_no field.");
199 goto error;
200 }
201
202 if (src_loc->filename) {
203 debug_info_src->src_path = g_strdup(src_loc->filename);
204 if (!debug_info_src->src_path) {
205 goto error;
206 }
207
208 debug_info_src->short_src_path = get_filename_from_path(
209 debug_info_src->src_path);
210 }
211 source_location_destroy(src_loc);
212 }
213
214 if (bin->elf_path) {
215 debug_info_src->bin_path = g_strdup(bin->elf_path);
216 if (!debug_info_src->bin_path) {
217 goto error;
218 }
219
220 debug_info_src->short_bin_path = get_filename_from_path(
221 debug_info_src->bin_path);
222
223 ret = bin_info_get_bin_loc(bin, ip, &(debug_info_src->bin_loc));
224 if (ret) {
225 goto error;
226 }
227 }
228
229 end:
230 return debug_info_src;
231
232 error:
233 debug_info_source_destroy(debug_info_src);
234 return NULL;
235 }
236
237 static
238 void proc_debug_info_sources_destroy(
239 struct proc_debug_info_sources *proc_dbg_info_src)
240 {
241 if (!proc_dbg_info_src) {
242 return;
243 }
244
245 if (proc_dbg_info_src->baddr_to_bin_info) {
246 g_hash_table_destroy(proc_dbg_info_src->baddr_to_bin_info);
247 }
248
249 if (proc_dbg_info_src->ip_to_debug_info_src) {
250 g_hash_table_destroy(proc_dbg_info_src->ip_to_debug_info_src);
251 }
252
253 g_free(proc_dbg_info_src);
254 }
255
256 static
257 struct proc_debug_info_sources *proc_debug_info_sources_create(void)
258 {
259 struct proc_debug_info_sources *proc_dbg_info_src = NULL;
260
261 proc_dbg_info_src = g_new0(struct proc_debug_info_sources, 1);
262 if (!proc_dbg_info_src) {
263 goto end;
264 }
265
266 proc_dbg_info_src->baddr_to_bin_info = g_hash_table_new_full(
267 g_int64_hash, g_int64_equal, (GDestroyNotify) g_free,
268 (GDestroyNotify) bin_info_destroy);
269 if (!proc_dbg_info_src->baddr_to_bin_info) {
270 goto error;
271 }
272
273 proc_dbg_info_src->ip_to_debug_info_src = g_hash_table_new_full(
274 g_int64_hash, g_int64_equal, (GDestroyNotify) g_free,
275 (GDestroyNotify) debug_info_source_destroy);
276 if (!proc_dbg_info_src->ip_to_debug_info_src) {
277 goto error;
278 }
279
280 end:
281 return proc_dbg_info_src;
282
283 error:
284 proc_debug_info_sources_destroy(proc_dbg_info_src);
285 return NULL;
286 }
287
288 static
289 struct proc_debug_info_sources *proc_debug_info_sources_ht_get_entry(
290 GHashTable *ht, int64_t vpid)
291 {
292 gpointer key = g_new0(int64_t, 1);
293 struct proc_debug_info_sources *proc_dbg_info_src = NULL;
294
295 if (!key) {
296 goto end;
297 }
298
299 *((int64_t *) key) = vpid;
300
301 /* Exists? Return it */
302 proc_dbg_info_src = g_hash_table_lookup(ht, key);
303 if (proc_dbg_info_src) {
304 goto end;
305 }
306
307 /* Otherwise, create and return it */
308 proc_dbg_info_src = proc_debug_info_sources_create();
309 if (!proc_dbg_info_src) {
310 goto end;
311 }
312
313 g_hash_table_insert(ht, key, proc_dbg_info_src);
314 /* Ownership passed to ht */
315 key = NULL;
316 end:
317 g_free(key);
318 return proc_dbg_info_src;
319 }
320
321 static inline
322 const bt_field *event_borrow_payload_field(const bt_event *event,
323 const char *field_name)
324 {
325 const bt_field *event_payload, *field;
326
327 event_payload = bt_event_borrow_payload_field_const(event);
328 BT_ASSERT(event_payload);
329
330 field = bt_field_structure_borrow_member_field_by_name_const(
331 event_payload, field_name);
332 return field;
333 }
334
335 static inline
336 const bt_field *event_borrow_common_context_field(const bt_event *event,
337 const char *field_name)
338 {
339 const bt_field *event_common_ctx, *field = NULL;
340
341 event_common_ctx = bt_event_borrow_common_context_field_const(event);
342 if (!event_common_ctx) {
343 goto end;
344 }
345
346 field = bt_field_structure_borrow_member_field_by_name_const(
347 event_common_ctx, field_name);
348
349 end:
350 return field;
351 }
352
353 static inline
354 void event_get_common_context_signed_integer_field_value(
355 const bt_event *event, const char *field_name, int64_t *value)
356 {
357 *value = bt_field_signed_integer_get_value(
358 event_borrow_common_context_field(event, field_name));
359 }
360
361 static inline
362 int event_get_payload_build_id_length(const bt_event *event,
363 const char *field_name, uint64_t *build_id_len)
364 {
365 const bt_field *build_id_field;
366 const bt_field_class *build_id_field_class;
367
368 build_id_field = event_borrow_payload_field(event, field_name);
369 build_id_field_class = bt_field_borrow_class_const(build_id_field);
370
371 BT_ASSERT(bt_field_class_get_type(build_id_field_class) ==
372 BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY);
373 BT_ASSERT(bt_field_class_get_type(
374 bt_field_class_array_borrow_element_field_class_const(
375 build_id_field_class)) ==
376 BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER);
377
378 *build_id_len = bt_field_array_get_length(build_id_field);
379
380 return 0;
381 }
382
383 static inline
384 int event_get_payload_build_id_value(const bt_event *event,
385 const char *field_name, uint8_t *build_id)
386 {
387 const bt_field *curr_field, *build_id_field;
388 const bt_field_class *build_id_field_class;
389 uint64_t i, build_id_len;
390 int ret;
391
392 ret = 0;
393
394 build_id_field = event_borrow_payload_field(event, field_name);
395 build_id_field_class = bt_field_borrow_class_const(build_id_field);
396
397 BT_ASSERT(bt_field_class_get_type(build_id_field_class) ==
398 BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY);
399 BT_ASSERT(bt_field_class_get_type(
400 bt_field_class_array_borrow_element_field_class_const(
401 build_id_field_class)) ==
402 BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER);
403
404 build_id_len = bt_field_array_get_length(build_id_field);
405
406 for (i = 0; i < build_id_len; i++) {
407 curr_field =
408 bt_field_array_borrow_element_field_by_index_const(
409 build_id_field, i);
410
411 build_id[i] = bt_field_unsigned_integer_get_value(curr_field);
412 }
413
414 return ret;
415 }
416
417 static
418 void event_get_payload_unsigned_integer_field_value(const bt_event *event,
419 const char *field_name, uint64_t *value)
420 {
421 *value = bt_field_unsigned_integer_get_value(
422 event_borrow_payload_field(event, field_name));
423 }
424
425 static
426 void event_get_payload_string_field_value(const bt_event *event,
427 const char *field_name, const char **value)
428 {
429 *value = bt_field_string_get_value(
430 event_borrow_payload_field(event, field_name));
431 }
432
433 static inline
434 bool event_has_payload_field(const bt_event *event,
435 const char *field_name)
436 {
437 return event_borrow_payload_field(event, field_name) != NULL;
438 }
439
440 static
441 struct debug_info_source *proc_debug_info_sources_get_entry(
442 struct proc_debug_info_sources *proc_dbg_info_src, uint64_t ip)
443 {
444 struct debug_info_source *debug_info_src = NULL;
445 gpointer key = g_new0(uint64_t, 1);
446 GHashTableIter iter;
447 gpointer baddr, value;
448
449 if (!key) {
450 goto end;
451 }
452
453 *((uint64_t *) key) = ip;
454
455 /* Look in IP to debug infos hash table first. */
456 debug_info_src = g_hash_table_lookup(
457 proc_dbg_info_src->ip_to_debug_info_src,
458 key);
459 if (debug_info_src) {
460 goto end;
461 }
462
463 /* Check in all bin_infos. */
464 g_hash_table_iter_init(&iter, proc_dbg_info_src->baddr_to_bin_info);
465
466 while (g_hash_table_iter_next(&iter, &baddr, &value))
467 {
468 struct bin_info *bin = value;
469
470 if (!bin_info_has_address(value, ip)) {
471 continue;
472 }
473
474 /*
475 * Found; add it to cache.
476 *
477 * FIXME: this should be bounded in size (and implement
478 * a caching policy), and entries should be prunned when
479 * libraries are unmapped.
480 */
481 debug_info_src = debug_info_source_create_from_bin(bin, ip);
482 if (debug_info_src) {
483 g_hash_table_insert(
484 proc_dbg_info_src->ip_to_debug_info_src,
485 key, debug_info_src);
486 /* Ownership passed to ht. */
487 key = NULL;
488 }
489 break;
490 }
491
492 end:
493 free(key);
494 return debug_info_src;
495 }
496
497 static
498 struct debug_info_source *debug_info_query(struct debug_info *debug_info,
499 int64_t vpid, uint64_t ip)
500 {
501 struct debug_info_source *dbg_info_src = NULL;
502 struct proc_debug_info_sources *proc_dbg_info_src;
503
504 proc_dbg_info_src = proc_debug_info_sources_ht_get_entry(
505 debug_info->vpid_to_proc_dbg_info_src, vpid);
506 if (!proc_dbg_info_src) {
507 goto end;
508 }
509
510 dbg_info_src = proc_debug_info_sources_get_entry(proc_dbg_info_src, ip);
511
512 end:
513 return dbg_info_src;
514 }
515
516 static
517 struct debug_info *debug_info_create(struct debug_info_component *comp,
518 const bt_trace *trace, struct bt_fd_cache *fdc)
519 {
520 int ret;
521 struct debug_info *debug_info;
522
523 BT_ASSERT(comp);
524 BT_ASSERT(trace);
525 BT_ASSERT(fdc);
526
527 debug_info = g_new0(struct debug_info, 1);
528 if (!debug_info) {
529 goto end;
530 }
531
532 debug_info->vpid_to_proc_dbg_info_src = g_hash_table_new_full(
533 g_int64_hash, g_int64_equal, (GDestroyNotify) g_free,
534 (GDestroyNotify) proc_debug_info_sources_destroy);
535 if (!debug_info->vpid_to_proc_dbg_info_src) {
536 goto error;
537 }
538
539 debug_info->comp = comp;
540 ret = debug_info_init(debug_info);
541 if (ret) {
542 goto error;
543 }
544
545 debug_info->input_trace = trace;
546 debug_info->fd_cache = fdc;
547
548 end:
549 return debug_info;
550 error:
551 g_free(debug_info);
552 return NULL;
553 }
554
555 static
556 void debug_info_destroy(struct debug_info *debug_info)
557 {
558 bt_trace_status status;
559 if (!debug_info) {
560 goto end;
561 }
562
563 if (debug_info->vpid_to_proc_dbg_info_src) {
564 g_hash_table_destroy(debug_info->vpid_to_proc_dbg_info_src);
565 }
566
567 status = bt_trace_remove_destruction_listener(debug_info->input_trace,
568 debug_info->destruction_listener_id);
569 if (status != BT_TRACE_STATUS_OK) {
570 BT_LOGE("Trace destruction listener removal failed.");
571 }
572
573 g_free(debug_info);
574 end:
575 return;
576 }
577
578 static
579 void handle_event_statedump_build_id(struct debug_info *debug_info,
580 const bt_event *event)
581 {
582 struct proc_debug_info_sources *proc_dbg_info_src;
583 uint64_t build_id_len, baddr;
584 uint8_t *build_id = NULL;
585 struct bin_info *bin;
586 int64_t vpid;
587 int ret = 0;
588
589 event_get_common_context_signed_integer_field_value(event,
590 VPID_FIELD_NAME, &vpid);
591 event_get_payload_unsigned_integer_field_value(event,
592 BADDR_FIELD_NAME, &baddr);
593
594 proc_dbg_info_src = proc_debug_info_sources_ht_get_entry(
595 debug_info->vpid_to_proc_dbg_info_src, vpid);
596 if (!proc_dbg_info_src) {
597 goto end;
598 }
599
600 bin = g_hash_table_lookup(proc_dbg_info_src->baddr_to_bin_info,
601 (gpointer) &baddr);
602 if (!bin) {
603 /*
604 * The build_id event comes after the bin has been
605 * created. If it isn't found, just ignore this event.
606 */
607 goto end;
608 }
609 ret = event_get_payload_build_id_length(event, BUILD_ID_FIELD_NAME,
610 &build_id_len);
611
612 build_id = g_new0(uint8_t, build_id_len);
613 if (!build_id) {
614 goto end;
615 }
616
617 ret = event_get_payload_build_id_value(event, BUILD_ID_FIELD_NAME,
618 build_id);
619 if (ret) {
620 goto end;
621 }
622
623 ret = bin_info_set_build_id(bin, build_id, build_id_len);
624 if (ret) {
625 goto end;
626 }
627
628 /*
629 * Reset the is_elf_only flag in case it had been set
630 * previously, because we might find separate debug info using
631 * the new build id information.
632 */
633 bin->is_elf_only = false;
634
635 end:
636 g_free(build_id);
637 return;
638 }
639
640 static
641 void handle_event_statedump_debug_link(struct debug_info *debug_info,
642 const bt_event *event)
643 {
644 struct proc_debug_info_sources *proc_dbg_info_src;
645 struct bin_info *bin = NULL;
646 int64_t vpid;
647 uint64_t baddr;
648 const char *filename = NULL;
649 uint32_t crc32;
650 uint64_t crc_field_value;
651
652 event_get_common_context_signed_integer_field_value(event,
653 VPID_FIELD_NAME, &vpid);
654
655 event_get_payload_unsigned_integer_field_value(event,
656 BADDR_FIELD_NAME, &baddr);
657
658 event_get_payload_unsigned_integer_field_value(event,
659 CRC32_FIELD_NAME, &crc_field_value);
660
661 crc32 = (uint32_t) crc_field_value;
662
663 event_get_payload_string_field_value(event,
664 FILENAME_FIELD_NAME, &filename);
665
666 proc_dbg_info_src = proc_debug_info_sources_ht_get_entry(
667 debug_info->vpid_to_proc_dbg_info_src, vpid);
668 if (!proc_dbg_info_src) {
669 goto end;
670 }
671
672 bin = g_hash_table_lookup(proc_dbg_info_src->baddr_to_bin_info,
673 (gpointer) &baddr);
674 if (!bin) {
675 /*
676 * The debug_link event comes after the bin has been
677 * created. If it isn't found, just ignore this event.
678 */
679 goto end;
680 }
681
682 bin_info_set_debug_link(bin, filename, crc32);
683
684 end:
685 return;
686 }
687
688 static
689 void handle_bin_info_event(struct debug_info *debug_info,
690 const bt_event *event, bool has_pic_field)
691 {
692 struct proc_debug_info_sources *proc_dbg_info_src;
693 struct bin_info *bin;
694 uint64_t baddr, memsz;
695 int64_t vpid;
696 const char *path;
697 gpointer key = NULL;
698 bool is_pic;
699
700 event_get_payload_unsigned_integer_field_value(event,
701 MEMSZ_FIELD_NAME, &memsz);
702 if (memsz == 0) {
703 /* Ignore VDSO. */
704 goto end;
705 }
706
707 event_get_payload_unsigned_integer_field_value(event,
708 BADDR_FIELD_NAME, &baddr);
709
710 /*
711 * This field is not produced by the dlopen event emitted before
712 * lttng-ust 2.9.
713 */
714 if (!event_has_payload_field(event, PATH_FIELD_NAME)) {
715 goto end;
716 }
717 event_get_payload_string_field_value(event, PATH_FIELD_NAME, &path);
718
719 if (has_pic_field) {
720 uint64_t is_pic_field_value;
721
722 event_get_payload_unsigned_integer_field_value(event,
723 IS_PIC_FIELD_NAME, &is_pic_field_value);
724 is_pic = is_pic_field_value == 1;
725 } else {
726 /*
727 * dlopen has no is_pic field, because the shared
728 * object is always PIC.
729 */
730 is_pic = true;
731 }
732
733 event_get_common_context_signed_integer_field_value(event,
734 VPID_FIELD_NAME, &vpid);
735
736 proc_dbg_info_src = proc_debug_info_sources_ht_get_entry(
737 debug_info->vpid_to_proc_dbg_info_src, vpid);
738 if (!proc_dbg_info_src) {
739 goto end;
740 }
741
742 key = g_new0(uint64_t, 1);
743 if (!key) {
744 goto end;
745 }
746
747 *((uint64_t *) key) = baddr;
748
749 bin = g_hash_table_lookup(proc_dbg_info_src->baddr_to_bin_info, key);
750 if (bin) {
751 goto end;
752 }
753
754 bin = bin_info_create(debug_info->fd_cache, path, baddr, memsz, is_pic,
755 debug_info->comp->arg_debug_dir,
756 debug_info->comp->arg_target_prefix);
757 if (!bin) {
758 goto end;
759 }
760
761 g_hash_table_insert(proc_dbg_info_src->baddr_to_bin_info, key, bin);
762 /* Ownership passed to ht. */
763 key = NULL;
764
765 end:
766 g_free(key);
767 return;
768 }
769
770 static inline
771 void handle_event_statedump_bin_info(struct debug_info *debug_info,
772 const bt_event *event)
773 {
774 handle_bin_info_event(debug_info, event, true);
775 }
776
777 static inline
778 void handle_event_lib_load(struct debug_info *debug_info,
779 const bt_event *event)
780 {
781 handle_bin_info_event(debug_info, event, false);
782 }
783
784 static
785 void handle_event_lib_unload(struct debug_info *debug_info,
786 const bt_event *event)
787 {
788 gboolean ret;
789 struct proc_debug_info_sources *proc_dbg_info_src;
790 uint64_t baddr;
791 int64_t vpid;
792
793 event_get_payload_unsigned_integer_field_value(event, BADDR_FIELD_NAME,
794 &baddr);
795
796 event_get_common_context_signed_integer_field_value(event,
797 VPID_FIELD_NAME, &vpid);
798
799 proc_dbg_info_src = proc_debug_info_sources_ht_get_entry(
800 debug_info->vpid_to_proc_dbg_info_src, vpid);
801 if (!proc_dbg_info_src) {
802 /*
803 * It's an unload event for a library for which no load event
804 * was previously received.
805 */
806 goto end;
807 }
808
809 ret = g_hash_table_remove(proc_dbg_info_src->baddr_to_bin_info,
810 (gpointer) &baddr);
811 BT_ASSERT(ret);
812 end:
813 return;
814 }
815
816 static
817 void handle_event_statedump_start(struct debug_info *debug_info,
818 const bt_event *event)
819 {
820 struct proc_debug_info_sources *proc_dbg_info_src;
821 int64_t vpid;
822
823 event_get_common_context_signed_integer_field_value(
824 event, VPID_FIELD_NAME, &vpid);
825
826 proc_dbg_info_src = proc_debug_info_sources_ht_get_entry(
827 debug_info->vpid_to_proc_dbg_info_src, vpid);
828 if (!proc_dbg_info_src) {
829 goto end;
830 }
831
832 g_hash_table_remove_all(proc_dbg_info_src->baddr_to_bin_info);
833 g_hash_table_remove_all(proc_dbg_info_src->ip_to_debug_info_src);
834
835 end:
836 return;
837 }
838
839 void trace_debug_info_remove_func(const bt_trace *in_trace, void *data)
840 {
841 struct debug_info_msg_iter *debug_it = data;
842 if (debug_it->debug_info_map) {
843 gboolean ret;
844 ret = g_hash_table_remove(debug_it->debug_info_map,
845 (gpointer) in_trace);
846 BT_ASSERT(ret);
847 }
848 }
849
850 static
851 void handle_event_statedump(struct debug_info_msg_iter *debug_it,
852 const bt_event *event)
853 {
854 const bt_event_class *event_class;
855 const char *event_name;
856 GQuark q_event_name;
857 const bt_trace *trace;
858 struct debug_info *debug_info;
859
860 BT_ASSERT(debug_it);
861 BT_ASSERT(event);
862
863 event_class = bt_event_borrow_class_const(event);
864
865 event_name = bt_event_class_get_name(event_class);
866
867 trace = bt_stream_borrow_trace_const(
868 bt_event_borrow_stream_const(event));
869
870 debug_info = g_hash_table_lookup(debug_it->debug_info_map, trace);
871 if (!debug_info) {
872 debug_info = debug_info_create(debug_it->debug_info_component,
873 trace, &debug_it->fd_cache);
874 g_hash_table_insert(debug_it->debug_info_map, (gpointer) trace,
875 debug_info);
876 bt_trace_add_destruction_listener(trace,
877 trace_debug_info_remove_func, debug_it,
878 &debug_info->destruction_listener_id);
879 }
880
881 q_event_name = g_quark_try_string(event_name);
882
883 if (q_event_name == debug_info->q_statedump_bin_info) {
884 /* State dump */
885 handle_event_statedump_bin_info(debug_info, event);
886 } else if (q_event_name == debug_info->q_dl_open ||
887 q_event_name == debug_info->q_lib_load) {
888 /*
889 * dl_open and lib_load events are both checked for since
890 * only dl_open was produced as of lttng-ust 2.8.
891 *
892 * lib_load, which is produced from lttng-ust 2.9+, is a lot
893 * more reliable since it will be emitted when other functions
894 * of the dlopen family are called (e.g. dlmopen) and when
895 * library are transitively loaded.
896 */
897 handle_event_lib_load(debug_info, event);
898 } else if (q_event_name == debug_info->q_statedump_start) {
899 /* Start state dump */
900 handle_event_statedump_start(debug_info, event);
901 } else if (q_event_name == debug_info->q_statedump_debug_link) {
902 /* Debug link info */
903 handle_event_statedump_debug_link(debug_info, event);
904 } else if (q_event_name == debug_info->q_statedump_build_id) {
905 /* Build ID info */
906 handle_event_statedump_build_id(debug_info, event);
907 } else if (q_event_name == debug_info-> q_lib_unload) {
908 handle_event_lib_unload(debug_info, event);
909 }
910
911 return;
912 }
913
914 static
915 void destroy_debug_info_comp(struct debug_info_component *debug_info)
916 {
917 if (!debug_info) {
918 return;
919 }
920
921 g_free(debug_info->arg_debug_dir);
922 g_free(debug_info->arg_debug_info_field_name);
923 g_free(debug_info->arg_target_prefix);
924 g_free(debug_info);
925 }
926
927 static
928 void fill_debug_info_bin_field(struct debug_info_source *dbg_info_src,
929 bool full_path, bt_field *curr_field)
930 {
931 bt_field_status status;
932
933 BT_ASSERT(bt_field_get_class_type(curr_field) ==
934 BT_FIELD_CLASS_TYPE_STRING);
935
936 if (dbg_info_src) {
937 if (full_path) {
938 status = bt_field_string_set_value(curr_field,
939 dbg_info_src->bin_path);
940 } else {
941 status = bt_field_string_set_value(curr_field,
942 dbg_info_src->short_bin_path);
943 }
944 if (status != BT_FIELD_STATUS_OK) {
945 BT_LOGE("Cannot set path component of \"bin\" "
946 "curr_field field's value: str-fc-addr=%p",
947 curr_field);
948 }
949
950 status = bt_field_string_append(curr_field, dbg_info_src->bin_loc);
951 if (status != BT_FIELD_STATUS_OK) {
952 BT_LOGE("Cannot set bin location component of \"bin\" "
953 "curr_field field's value: str-fc-addr=%p",
954 curr_field);
955 }
956 } else {
957 status = bt_field_string_set_value(curr_field, "");
958 if (status != BT_FIELD_STATUS_OK) {
959 BT_LOGE("Cannot set \"bin\" curr_field field's value: "
960 "str-fc-addr=%p", curr_field);
961 }
962 }
963 }
964
965 static
966 void fill_debug_info_func_field(struct debug_info_source *dbg_info_src,
967 bt_field *curr_field)
968 {
969 bt_field_status status;
970
971 BT_ASSERT(bt_field_get_class_type(curr_field) ==
972 BT_FIELD_CLASS_TYPE_STRING);
973 if (dbg_info_src && dbg_info_src->func) {
974 status = bt_field_string_set_value(curr_field,
975 dbg_info_src->func);
976 } else {
977 status = bt_field_string_set_value(curr_field, "");
978 }
979 if (status != BT_FIELD_STATUS_OK) {
980 BT_LOGE("Cannot set \"func\" curr_field field's value: "
981 "str-fc-addr=%p", curr_field);
982 }
983 }
984
985 static
986 void fill_debug_info_src_field(struct debug_info_source *dbg_info_src,
987 bool full_path, bt_field *curr_field)
988 {
989 bt_field_status status;
990
991 BT_ASSERT(bt_field_get_class_type(curr_field) ==
992 BT_FIELD_CLASS_TYPE_STRING);
993
994 if (dbg_info_src && dbg_info_src->src_path) {
995 if (full_path) {
996 status = bt_field_string_set_value(curr_field,
997 dbg_info_src->src_path);
998 } else {
999 status = bt_field_string_set_value(curr_field,
1000 dbg_info_src->short_src_path);
1001 }
1002 if (status != BT_FIELD_STATUS_OK) {
1003 BT_LOGE("Cannot set path component of \"src\" "
1004 "curr_field field's value: str-fc-addr=%p",
1005 curr_field);
1006 }
1007
1008 status = bt_field_string_append(curr_field, ":");
1009 if (status != BT_FIELD_STATUS_OK) {
1010 BT_LOGE("Cannot set colon component of \"src\" "
1011 "curr_field field's value: str-fc-addr=%p",
1012 curr_field);
1013 }
1014
1015 status = bt_field_string_append(curr_field, dbg_info_src->line_no);
1016 if (status != BT_FIELD_STATUS_OK) {
1017 BT_LOGE("Cannot set line number component of \"src\" "
1018 "curr_field field's value: str-fc-addr=%p",
1019 curr_field);
1020 }
1021 } else {
1022 status = bt_field_string_set_value(curr_field, "");
1023 if (status != BT_FIELD_STATUS_OK) {
1024 BT_LOGE("Cannot set \"src\" curr_field field's value: "
1025 "str-fc-addr=%p", curr_field);
1026 }
1027 }
1028 }
1029
1030 void fill_debug_info_field_empty(bt_field *debug_info_field)
1031 {
1032 bt_field_status status;
1033 bt_field *bin_field, *func_field, *src_field;
1034
1035 BT_ASSERT(bt_field_get_class_type(debug_info_field) ==
1036 BT_FIELD_CLASS_TYPE_STRUCTURE);
1037
1038 bin_field = bt_field_structure_borrow_member_field_by_name(
1039 debug_info_field, "bin");
1040 func_field = bt_field_structure_borrow_member_field_by_name(
1041 debug_info_field, "func");
1042 src_field = bt_field_structure_borrow_member_field_by_name(
1043 debug_info_field, "src");
1044
1045 BT_ASSERT(bt_field_get_class_type(bin_field) ==
1046 BT_FIELD_CLASS_TYPE_STRING);
1047 BT_ASSERT(bt_field_get_class_type(func_field) ==
1048 BT_FIELD_CLASS_TYPE_STRING);
1049 BT_ASSERT(bt_field_get_class_type(src_field) ==
1050 BT_FIELD_CLASS_TYPE_STRING);
1051
1052 status = bt_field_string_set_value(bin_field, "");
1053 if (status != BT_FIELD_STATUS_OK) {
1054 BT_LOGE("Cannot set \"bin\" bin_field field's value: "
1055 "str-fc-addr=%p", bin_field);
1056 }
1057
1058 status = bt_field_string_set_value(func_field, "");
1059 if (status != BT_FIELD_STATUS_OK) {
1060 BT_LOGE("Cannot set \"func\" func_field field's value: "
1061 "str-fc-addr=%p", func_field);
1062 }
1063
1064 status = bt_field_string_set_value(src_field, "");
1065 if (status != BT_FIELD_STATUS_OK) {
1066 BT_LOGE("Cannot set \"src\" src_field field's value: "
1067 "str-fc-addr=%p", src_field);
1068 }
1069 }
1070 static
1071 void fill_debug_info_field(struct debug_info *debug_info, int64_t vpid,
1072 uint64_t ip, bt_field *debug_info_field)
1073 {
1074 struct debug_info_source *dbg_info_src;
1075 const bt_field_class *debug_info_fc;
1076
1077 BT_ASSERT(bt_field_get_class_type(debug_info_field) ==
1078 BT_FIELD_CLASS_TYPE_STRUCTURE);
1079
1080 debug_info_fc = bt_field_borrow_class_const(debug_info_field);
1081
1082 BT_ASSERT(bt_field_class_structure_get_member_count(debug_info_fc) == 3);
1083
1084 dbg_info_src = debug_info_query(debug_info, vpid, ip);
1085
1086 fill_debug_info_bin_field(dbg_info_src, debug_info->comp->arg_full_path,
1087 bt_field_structure_borrow_member_field_by_name(
1088 debug_info_field, "bin"));
1089 fill_debug_info_func_field(dbg_info_src,
1090 bt_field_structure_borrow_member_field_by_name(
1091 debug_info_field, "func"));
1092 fill_debug_info_src_field(dbg_info_src, debug_info->comp->arg_full_path,
1093 bt_field_structure_borrow_member_field_by_name(
1094 debug_info_field, "src"));
1095 }
1096
1097 static
1098 void fill_debug_info_event_if_needed(struct debug_info_msg_iter *debug_it,
1099 const bt_event *in_event, bt_event *out_event)
1100 {
1101 bt_field *out_common_ctx_field, *out_debug_info_field;
1102 const bt_field *vpid_field, *ip_field, *in_common_ctx_field;
1103 const bt_field_class *in_common_ctx_fc;
1104 struct debug_info *debug_info;
1105 uint64_t vpid;
1106 int64_t ip;
1107 gchar *debug_info_field_name =
1108 debug_it->debug_info_component->arg_debug_info_field_name;
1109
1110 in_common_ctx_field = bt_event_borrow_common_context_field_const(
1111 in_event);
1112 if (!in_common_ctx_field) {
1113 /*
1114 * There is no event common context so no need to add debug
1115 * info field.
1116 */
1117 goto end;
1118 }
1119
1120 in_common_ctx_fc = bt_field_borrow_class_const(in_common_ctx_field);
1121 if (!is_event_common_ctx_dbg_info_compatible(in_common_ctx_fc,
1122 debug_it->ir_maps->debug_info_field_class_name)) {
1123 /*
1124 * The input event common context does not have the necessary
1125 * fields to resolve debug information.
1126 */
1127 goto end;
1128 }
1129
1130 /* Borrow the debug-info field. */
1131 out_common_ctx_field = bt_event_borrow_common_context_field(out_event);
1132 if (!out_common_ctx_field) {
1133 goto end;
1134 }
1135
1136 out_debug_info_field = bt_field_structure_borrow_member_field_by_name(
1137 out_common_ctx_field, debug_info_field_name);
1138
1139 vpid_field = bt_field_structure_borrow_member_field_by_name_const(
1140 out_common_ctx_field, VPID_FIELD_NAME);
1141 ip_field = bt_field_structure_borrow_member_field_by_name_const(
1142 out_common_ctx_field, IP_FIELD_NAME);
1143
1144 vpid = bt_field_signed_integer_get_value(vpid_field);
1145 ip = bt_field_unsigned_integer_get_value(ip_field);
1146
1147 /*
1148 * Borrow the debug_info structure needed for the source
1149 * resolving.
1150 */
1151 debug_info = g_hash_table_lookup(debug_it->debug_info_map,
1152 bt_stream_borrow_trace_const(
1153 bt_event_borrow_stream_const(in_event)));
1154
1155 if (debug_info) {
1156 /*
1157 * Perform the debug-info resolving and set the event fields
1158 * accordingly.
1159 */
1160 fill_debug_info_field(debug_info, vpid, ip, out_debug_info_field);
1161 } else {
1162 BT_LOGD("No debug information for this trace. Setting debug "
1163 "info fields to empty strings.");
1164 fill_debug_info_field_empty(out_debug_info_field);
1165 }
1166 end:
1167 return;
1168 }
1169
1170 static
1171 void update_event_statedump_if_needed(struct debug_info_msg_iter *debug_it,
1172 const bt_event *in_event)
1173 {
1174 const bt_field *event_common_ctx;
1175 const bt_field_class *event_common_ctx_fc;
1176 const bt_event_class *in_event_class = bt_event_borrow_class_const(in_event);
1177
1178 /*
1179 * If the event is an lttng_ust_statedump event AND has the right event
1180 * common context fields update the debug-info view for this process.
1181 */
1182 event_common_ctx = bt_event_borrow_common_context_field_const(in_event);
1183 if (!event_common_ctx) {
1184 goto end;
1185 }
1186
1187 event_common_ctx_fc = bt_field_borrow_class_const(event_common_ctx);
1188 if (is_event_common_ctx_dbg_info_compatible(event_common_ctx_fc,
1189 debug_it->ir_maps->debug_info_field_class_name)) {
1190 /* Checkout if it might be a one of lttng ust statedump events. */
1191 const char *in_event_name = bt_event_class_get_name(in_event_class);
1192 if (strncmp(in_event_name, LTTNG_UST_STATEDUMP_PREFIX,
1193 strlen(LTTNG_UST_STATEDUMP_PREFIX)) == 0) {
1194 /* Handle statedump events. */
1195 handle_event_statedump(debug_it, in_event);
1196 }
1197 }
1198 end:
1199 return;
1200 }
1201
1202 static
1203 bt_message *handle_event_message(struct debug_info_msg_iter *debug_it,
1204 const bt_message *in_message)
1205 {
1206 const bt_clock_snapshot *cs;
1207 const bt_clock_class *default_cc;
1208 const bt_packet *in_packet;
1209 bt_event_class *out_event_class;
1210 bt_packet *out_packet;
1211 bt_event *out_event;
1212
1213 bt_message *out_message = NULL;
1214
1215 /* Borrow the input event and its event class. */
1216 const bt_event *in_event =
1217 bt_message_event_borrow_event_const(in_message);
1218 const bt_event_class *in_event_class =
1219 bt_event_borrow_class_const(in_event);
1220
1221 update_event_statedump_if_needed(debug_it, in_event);
1222
1223 out_event_class = trace_ir_mapping_borrow_mapped_event_class(
1224 debug_it->ir_maps, in_event_class);
1225 if (!out_event_class) {
1226 out_event_class = trace_ir_mapping_create_new_mapped_event_class(
1227 debug_it->ir_maps, in_event_class);
1228 }
1229 BT_ASSERT(out_event_class);
1230
1231 /* Borrow the input and output packets. */
1232 in_packet = bt_event_borrow_packet_const(in_event);
1233 out_packet = trace_ir_mapping_borrow_mapped_packet(debug_it->ir_maps,
1234 in_packet);
1235
1236 default_cc = bt_stream_class_borrow_default_clock_class_const(
1237 bt_event_class_borrow_stream_class_const(in_event_class));
1238 if (default_cc) {
1239 /* Borrow event clock snapshot. */
1240 cs = bt_message_event_borrow_default_clock_snapshot_const(
1241 in_message);
1242
1243 /* Create an output event message. */
1244 out_message = bt_message_event_create_with_default_clock_snapshot(
1245 debug_it->input_iterator,
1246 out_event_class, out_packet,
1247 bt_clock_snapshot_get_value(cs));
1248 } else {
1249 out_message = bt_message_event_create(debug_it->input_iterator,
1250 out_event_class, out_packet);
1251 }
1252
1253 if (!out_message) {
1254 BT_LOGE("Error creating output event message.");
1255 goto error;
1256 }
1257
1258 out_event = bt_message_event_borrow_event(out_message);
1259
1260 /* Copy the original fields to the output event. */
1261 copy_event_content(in_event, out_event);
1262
1263 /*
1264 * Try to set the debug-info fields based on debug information that is
1265 * gathered so far.
1266 */
1267 fill_debug_info_event_if_needed(debug_it, in_event, out_event);
1268
1269 error:
1270 return out_message;
1271 }
1272
1273 static
1274 bt_message *handle_stream_begin_message(struct debug_info_msg_iter *debug_it,
1275 const bt_message *in_message)
1276 {
1277 const bt_stream *in_stream;
1278 bt_message *out_message;
1279 bt_stream *out_stream;
1280
1281 in_stream = bt_message_stream_beginning_borrow_stream_const(in_message);
1282 BT_ASSERT(in_stream);
1283
1284 /* Create a duplicated output stream. */
1285 out_stream = trace_ir_mapping_create_new_mapped_stream(
1286 debug_it->ir_maps, in_stream);
1287 if (!out_stream) {
1288 out_message = NULL;
1289 goto error;
1290 }
1291
1292 /* Create an output stream beginning message. */
1293 out_message = bt_message_stream_beginning_create(
1294 debug_it->input_iterator, out_stream);
1295 if (!out_message) {
1296 BT_LOGE("Error creating output stream beginning message: "
1297 "out-s-addr=%p", out_stream);
1298 }
1299 error:
1300 return out_message;
1301 }
1302
1303 static
1304 bt_message *handle_stream_end_message(struct debug_info_msg_iter *debug_it,
1305 const bt_message *in_message)
1306 {
1307 const bt_stream *in_stream;
1308 bt_message *out_message = NULL;
1309 bt_stream *out_stream;
1310
1311 in_stream = bt_message_stream_end_borrow_stream_const(in_message);
1312 BT_ASSERT(in_stream);
1313
1314 out_stream = trace_ir_mapping_borrow_mapped_stream(
1315 debug_it->ir_maps, in_stream);
1316 BT_ASSERT(out_stream);
1317
1318 /* Create an output stream end message. */
1319 out_message = bt_message_stream_end_create(debug_it->input_iterator,
1320 out_stream);
1321 if (!out_message) {
1322 BT_LOGE("Error creating output stream end message: out-s-addr=%p",
1323 out_stream);
1324 }
1325
1326 /* Remove stream from trace mapping hashtable. */
1327 trace_ir_mapping_remove_mapped_stream(debug_it->ir_maps, in_stream);
1328
1329 return out_message;
1330 }
1331
1332 static
1333 bt_message *handle_packet_begin_message(struct debug_info_msg_iter *debug_it,
1334 const bt_message *in_message)
1335 {
1336 bool has_default_clock_snapshot;
1337 const bt_clock_snapshot *cs;
1338 bt_message *out_message = NULL;
1339 bt_packet *out_packet;
1340
1341 const bt_packet *in_packet =
1342 bt_message_packet_beginning_borrow_packet_const(in_message);
1343 BT_ASSERT(in_packet);
1344
1345 /* This packet should not be already mapped. */
1346 BT_ASSERT(!trace_ir_mapping_borrow_mapped_packet(
1347 debug_it->ir_maps, in_packet));
1348
1349 out_packet = trace_ir_mapping_create_new_mapped_packet(debug_it->ir_maps,
1350 in_packet);
1351
1352 BT_ASSERT(out_packet);
1353
1354 has_default_clock_snapshot =
1355 bt_stream_class_packets_have_beginning_default_clock_snapshot(
1356 bt_stream_borrow_class_const(
1357 bt_packet_borrow_stream_const(in_packet)));
1358 if (has_default_clock_snapshot) {
1359 /* Borrow clock snapshot. */
1360 cs = bt_message_packet_beginning_borrow_default_clock_snapshot_const(
1361 in_message);
1362
1363 /* Create an output packet beginning message. */
1364 out_message = bt_message_packet_beginning_create_with_default_clock_snapshot(
1365 debug_it->input_iterator, out_packet,
1366 bt_clock_snapshot_get_value(cs));
1367 } else {
1368 out_message = bt_message_packet_beginning_create(
1369 debug_it->input_iterator, out_packet);
1370 }
1371 if (!out_message) {
1372 BT_LOGE("Error creating output packet beginning message: "
1373 "out-p-addr=%p", out_packet);
1374 }
1375
1376 return out_message;
1377 }
1378
1379 static
1380 bt_message *handle_packet_end_message(struct debug_info_msg_iter *debug_it,
1381 const bt_message *in_message)
1382 {
1383 bool has_default_clock_snapshot;
1384 const bt_clock_snapshot *cs;
1385 const bt_packet *in_packet;
1386 bt_message *out_message = NULL;
1387 bt_packet *out_packet;
1388
1389 in_packet = bt_message_packet_end_borrow_packet_const(in_message);
1390 BT_ASSERT(in_packet);
1391
1392 out_packet = trace_ir_mapping_borrow_mapped_packet(debug_it->ir_maps, in_packet);
1393 BT_ASSERT(out_packet);
1394
1395 has_default_clock_snapshot =
1396 bt_stream_class_packets_have_end_default_clock_snapshot(
1397 bt_stream_borrow_class_const(
1398 bt_packet_borrow_stream_const(in_packet)));
1399 if (has_default_clock_snapshot) {
1400 /* Borrow clock snapshot. */
1401 cs = bt_message_packet_end_borrow_default_clock_snapshot_const(
1402 in_message);
1403
1404 /* Create an outpute packet end message. */
1405 out_message = bt_message_packet_end_create_with_default_clock_snapshot(
1406 debug_it->input_iterator, out_packet,
1407 bt_clock_snapshot_get_value(cs));
1408 } else {
1409 out_message = bt_message_packet_end_create(
1410 debug_it->input_iterator, out_packet);
1411 }
1412
1413 if (!out_message) {
1414 BT_LOGE("Error creating output packet end message: "
1415 "out-p-addr=%p", out_packet);
1416 }
1417
1418 /* Remove packet from data mapping hashtable. */
1419 trace_ir_mapping_remove_mapped_packet(debug_it->ir_maps, in_packet);
1420
1421 return out_message;
1422 }
1423
1424 static
1425 bt_message *handle_msg_iterator_inactivity(struct debug_info_msg_iter *debug_it,
1426 const bt_message *in_message)
1427 {
1428 /*
1429 * This message type can be forwarded directly because it does
1430 * not refer to any objects in the trace class.
1431 */
1432 bt_message_get_ref(in_message);
1433 return (bt_message*) in_message;
1434 }
1435
1436 static
1437 bt_message *handle_stream_act_begin_message(struct debug_info_msg_iter *debug_it,
1438 const bt_message *in_message)
1439 {
1440 const bt_clock_snapshot *cs;
1441 const bt_clock_class *default_cc;
1442 bt_message *out_message = NULL;
1443 bt_stream *out_stream;
1444 uint64_t cs_value;
1445 bt_message_stream_activity_clock_snapshot_state cs_state;
1446
1447 const bt_stream *in_stream =
1448 bt_message_stream_activity_beginning_borrow_stream_const(
1449 in_message);
1450 BT_ASSERT(in_stream);
1451
1452 out_stream = trace_ir_mapping_borrow_mapped_stream(debug_it->ir_maps,
1453 in_stream);
1454 BT_ASSERT(out_stream);
1455
1456 out_message = bt_message_stream_activity_beginning_create(
1457 debug_it->input_iterator, out_stream);
1458 if (!out_message) {
1459 BT_LOGE("Error creating output stream activity beginning "
1460 "message: out-s-addr=%p", out_stream);
1461 goto error;
1462 }
1463
1464 default_cc = bt_stream_class_borrow_default_clock_class_const(
1465 bt_stream_borrow_class_const(in_stream));
1466 if (default_cc) {
1467 /* Borrow clock snapshot. */
1468 cs_state =
1469 bt_message_stream_activity_beginning_borrow_default_clock_snapshot_const(
1470 in_message, &cs);
1471
1472 if (cs_state == BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_KNOWN) {
1473 cs_value = bt_clock_snapshot_get_value(cs);
1474 bt_message_stream_activity_beginning_set_default_clock_snapshot(
1475 out_message, cs_value);
1476 } else {
1477 bt_message_stream_activity_beginning_set_default_clock_snapshot_state(
1478 out_message, cs_state);
1479 }
1480 }
1481
1482 error:
1483 return out_message;
1484 }
1485
1486 static
1487 bt_message *handle_stream_act_end_message(struct debug_info_msg_iter *debug_it,
1488 const bt_message *in_message)
1489 {
1490 const bt_clock_snapshot *cs;
1491 const bt_clock_class *default_cc;
1492 const bt_stream *in_stream;
1493 bt_message *out_message;
1494 bt_stream *out_stream;
1495 uint64_t cs_value;
1496 bt_message_stream_activity_clock_snapshot_state cs_state;
1497
1498 in_stream = bt_message_stream_activity_end_borrow_stream_const(
1499 in_message);
1500 BT_ASSERT(in_stream);
1501
1502 out_stream = trace_ir_mapping_borrow_mapped_stream(debug_it->ir_maps,
1503 in_stream);
1504 BT_ASSERT(out_stream);
1505
1506 out_message = bt_message_stream_activity_end_create(
1507 debug_it->input_iterator, out_stream);
1508 if (!out_message) {
1509 BT_LOGE("Error creating output stream activity end message: "
1510 "out-s-addr=%p", out_stream);
1511 goto error;
1512 }
1513
1514 default_cc = bt_stream_class_borrow_default_clock_class_const(
1515 bt_stream_borrow_class_const(in_stream));
1516
1517 if (default_cc) {
1518 cs_state =
1519 bt_message_stream_activity_end_borrow_default_clock_snapshot_const(
1520 in_message, &cs);
1521
1522 if (cs_state == BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_KNOWN ) {
1523 cs_value = bt_clock_snapshot_get_value(cs);
1524 bt_message_stream_activity_end_set_default_clock_snapshot(
1525 out_message, cs_value);
1526 } else {
1527 bt_message_stream_activity_end_set_default_clock_snapshot_state(
1528 out_message, cs_state);
1529 }
1530 }
1531
1532 error:
1533 return out_message;
1534 }
1535
1536 static
1537 bt_message *handle_discarded_events_message(struct debug_info_msg_iter *debug_it,
1538 const bt_message *in_message)
1539 {
1540 const bt_clock_snapshot *begin_cs, *end_cs;
1541 const bt_stream *in_stream;
1542 bool has_default_clock_snapshots;
1543 uint64_t discarded_events, begin_cs_value, end_cs_value;
1544 bt_property_availability prop_avail;
1545 bt_message *out_message = NULL;
1546 bt_stream *out_stream;
1547
1548 in_stream = bt_message_discarded_events_borrow_stream_const(
1549 in_message);
1550 BT_ASSERT(in_stream);
1551
1552 out_stream = trace_ir_mapping_borrow_mapped_stream(
1553 debug_it->ir_maps, in_stream);
1554 BT_ASSERT(out_stream);
1555
1556 has_default_clock_snapshots =
1557 bt_stream_class_discarded_events_have_default_clock_snapshots(
1558 bt_stream_borrow_class_const(in_stream));
1559 if (has_default_clock_snapshots) {
1560 begin_cs =
1561 bt_message_discarded_events_borrow_beginning_default_clock_snapshot_const(
1562 in_message);
1563 end_cs =
1564 bt_message_discarded_events_borrow_end_default_clock_snapshot_const(
1565 in_message);
1566
1567 begin_cs_value = bt_clock_snapshot_get_value(begin_cs);
1568 end_cs_value = bt_clock_snapshot_get_value(end_cs);
1569
1570 out_message =
1571 bt_message_discarded_events_create_with_default_clock_snapshots(
1572 debug_it->input_iterator, out_stream,
1573 begin_cs_value, end_cs_value);
1574 } else {
1575 out_message = bt_message_discarded_events_create(
1576 debug_it->input_iterator, out_stream);
1577 }
1578 if (!out_message) {
1579 BT_LOGE("Error creating output discarded events message: "
1580 "out-s-addr=%p", out_stream);
1581 goto error;
1582 }
1583
1584 prop_avail = bt_message_discarded_events_get_count(in_message,
1585 &discarded_events);
1586
1587 if (prop_avail == BT_PROPERTY_AVAILABILITY_NOT_AVAILABLE) {
1588 bt_message_discarded_events_set_count(out_message,
1589 discarded_events);
1590 }
1591
1592 error:
1593 return out_message;
1594 }
1595
1596 static
1597 bt_message *handle_discarded_packets_message(struct debug_info_msg_iter *debug_it,
1598 const bt_message *in_message)
1599 {
1600 const bt_clock_snapshot *begin_cs, *end_cs;
1601 bool has_default_clock_snapshots;
1602 const bt_stream *in_stream;
1603 uint64_t discarded_packets, begin_cs_value, end_cs_value;
1604 bt_property_availability prop_avail;
1605 bt_message *out_message = NULL;
1606 bt_stream *out_stream;
1607
1608 in_stream = bt_message_discarded_packets_borrow_stream_const(
1609 in_message);
1610 BT_ASSERT(in_stream);
1611
1612 out_stream = trace_ir_mapping_borrow_mapped_stream(
1613 debug_it->ir_maps, in_stream);
1614 BT_ASSERT(out_stream);
1615
1616 has_default_clock_snapshots =
1617 bt_stream_class_discarded_packets_have_default_clock_snapshots(
1618 bt_stream_borrow_class_const(in_stream));
1619 if (has_default_clock_snapshots) {
1620 begin_cs =
1621 bt_message_discarded_packets_borrow_beginning_default_clock_snapshot_const(
1622 in_message);
1623
1624 end_cs =
1625 bt_message_discarded_packets_borrow_end_default_clock_snapshot_const(
1626 in_message);
1627
1628 begin_cs_value = bt_clock_snapshot_get_value(begin_cs);
1629 end_cs_value = bt_clock_snapshot_get_value(end_cs);
1630
1631 out_message = bt_message_discarded_packets_create_with_default_clock_snapshots(
1632 debug_it->input_iterator, out_stream,
1633 begin_cs_value, end_cs_value);
1634 } else {
1635 out_message = bt_message_discarded_packets_create(
1636 debug_it->input_iterator, out_stream);
1637 }
1638 if (!out_message) {
1639 BT_LOGE("Error creating output discarded packet message: "
1640 "out-s-addr=%p", out_stream);
1641 goto error;
1642 }
1643
1644 prop_avail = bt_message_discarded_packets_get_count(in_message,
1645 &discarded_packets);
1646 if (prop_avail == BT_PROPERTY_AVAILABILITY_NOT_AVAILABLE) {
1647 bt_message_discarded_packets_set_count(out_message,
1648 discarded_packets);
1649 }
1650
1651 error:
1652 return out_message;
1653 }
1654
1655 static
1656 const bt_message *handle_message(struct debug_info_msg_iter *debug_it,
1657 const bt_message *in_message)
1658 {
1659 bt_message *out_message = NULL;
1660
1661 switch (bt_message_get_type(in_message)) {
1662 case BT_MESSAGE_TYPE_EVENT:
1663 out_message = handle_event_message(debug_it,
1664 in_message);
1665 break;
1666 case BT_MESSAGE_TYPE_PACKET_BEGINNING:
1667 out_message = handle_packet_begin_message(debug_it,
1668 in_message);
1669 break;
1670 case BT_MESSAGE_TYPE_PACKET_END:
1671 out_message = handle_packet_end_message(debug_it,
1672 in_message);
1673 break;
1674 case BT_MESSAGE_TYPE_STREAM_BEGINNING:
1675 out_message = handle_stream_begin_message(debug_it,
1676 in_message);
1677 break;
1678 case BT_MESSAGE_TYPE_STREAM_END:
1679 out_message = handle_stream_end_message(debug_it,
1680 in_message);
1681 break;
1682 case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY:
1683 out_message = handle_msg_iterator_inactivity(debug_it,
1684 in_message);
1685 break;
1686 case BT_MESSAGE_TYPE_STREAM_ACTIVITY_BEGINNING:
1687 out_message = handle_stream_act_begin_message(debug_it,
1688 in_message);
1689 break;
1690 case BT_MESSAGE_TYPE_STREAM_ACTIVITY_END:
1691 out_message = handle_stream_act_end_message(debug_it,
1692 in_message);
1693 break;
1694 case BT_MESSAGE_TYPE_DISCARDED_EVENTS:
1695 out_message = handle_discarded_events_message(debug_it,
1696 in_message);
1697 break;
1698 case BT_MESSAGE_TYPE_DISCARDED_PACKETS:
1699 out_message = handle_discarded_packets_message(debug_it,
1700 in_message);
1701 break;
1702 default:
1703 abort();
1704 break;
1705 }
1706
1707 return out_message;
1708 }
1709
1710 static
1711 int init_from_params(struct debug_info_component *debug_info_component,
1712 const bt_value *params)
1713 {
1714 const bt_value *value = NULL;
1715 int ret = 0;
1716
1717 BT_ASSERT(params);
1718
1719 value = bt_value_map_borrow_entry_value_const(params,
1720 "debug-info-field-name");
1721 if (value) {
1722 debug_info_component->arg_debug_info_field_name =
1723 g_strdup(bt_value_string_get(value));
1724 } else {
1725 debug_info_component->arg_debug_info_field_name =
1726 g_strdup(DEFAULT_DEBUG_INFO_FIELD_NAME);
1727 }
1728
1729 value = bt_value_map_borrow_entry_value_const(params, "debug-info-dir");
1730 if (value) {
1731 debug_info_component->arg_debug_dir =
1732 g_strdup(bt_value_string_get(value));
1733 } else {
1734 debug_info_component->arg_debug_dir = NULL;
1735 }
1736
1737
1738 value = bt_value_map_borrow_entry_value_const(params, "target-prefix");
1739 if (value) {
1740 debug_info_component->arg_target_prefix =
1741 g_strdup(bt_value_string_get(value));
1742 } else {
1743 debug_info_component->arg_target_prefix = NULL;
1744 }
1745
1746 value = bt_value_map_borrow_entry_value_const(params, "full-path");
1747 if (value) {
1748 debug_info_component->arg_full_path = bt_value_bool_get(value);
1749 } else {
1750 debug_info_component->arg_full_path = BT_FALSE;
1751 }
1752
1753 return ret;
1754 }
1755
1756 BT_HIDDEN
1757 bt_self_component_status debug_info_comp_init(
1758 bt_self_component_filter *self_comp,
1759 const bt_value *params, __attribute__((unused)) void *init_method_data)
1760 {
1761 int ret;
1762 struct debug_info_component *debug_info_comp;
1763 bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
1764
1765 BT_LOGI("Initializing debug_info component: "
1766 "comp-addr=%p, params-addr=%p", self_comp, params);
1767
1768 debug_info_comp = g_new0(struct debug_info_component, 1);
1769 if (!debug_info_comp) {
1770 BT_LOGE_STR("Failed to allocate one debug_info component.");
1771 goto error;
1772 }
1773
1774 bt_self_component_set_data(
1775 bt_self_component_filter_as_self_component(self_comp),
1776 debug_info_comp);
1777
1778 status = bt_self_component_filter_add_input_port(self_comp, "in",
1779 NULL, NULL);
1780 if (status != BT_SELF_COMPONENT_STATUS_OK) {
1781 goto error;
1782 }
1783
1784 status = bt_self_component_filter_add_output_port(self_comp, "out",
1785 NULL, NULL);
1786 if (status != BT_SELF_COMPONENT_STATUS_OK) {
1787 goto error;
1788 }
1789
1790 ret = init_from_params(debug_info_comp, params);
1791 if (ret) {
1792 BT_LOGE("Cannot configure debug_info component: "
1793 "debug_info-comp-addr=%p, params-addr=%p",
1794 debug_info_comp, params);
1795 goto error;
1796 }
1797
1798 goto end;
1799
1800 error:
1801 destroy_debug_info_comp(debug_info_comp);
1802 bt_self_component_set_data(
1803 bt_self_component_filter_as_self_component(self_comp),
1804 NULL);
1805
1806 if (status == BT_SELF_COMPONENT_STATUS_OK) {
1807 status = BT_SELF_COMPONENT_STATUS_ERROR;
1808 }
1809 end:
1810 return status;
1811 }
1812
1813 BT_HIDDEN
1814 void debug_info_comp_finalize(bt_self_component_filter *self_comp)
1815 {
1816 struct debug_info_component *debug_info =
1817 bt_self_component_get_data(
1818 bt_self_component_filter_as_self_component(
1819 self_comp));
1820 BT_LOGI("Finalizing debug_info self_component: comp-addr=%p",
1821 self_comp);
1822
1823 destroy_debug_info_comp(debug_info);
1824 }
1825
1826 BT_HIDDEN
1827 bt_self_message_iterator_status debug_info_msg_iter_next(
1828 bt_self_message_iterator *self_msg_iter,
1829 const bt_message_array_const msgs, uint64_t capacity,
1830 uint64_t *count)
1831 {
1832 bt_self_component_port_input_message_iterator *upstream_iterator = NULL;
1833 bt_message_iterator_status upstream_iterator_ret_status;
1834 struct debug_info_msg_iter *debug_info_msg_iter;
1835 struct debug_info_component *debug_info = NULL;
1836 bt_self_message_iterator_status status;
1837 bt_self_component *self_comp = NULL;
1838 bt_message_array_const input_msgs;
1839 const bt_message *out_message;
1840 uint64_t curr_msg_idx, i;
1841
1842 status = BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
1843
1844 self_comp = bt_self_message_iterator_borrow_component(self_msg_iter);
1845 BT_ASSERT(self_comp);
1846
1847 debug_info = bt_self_component_get_data(self_comp);
1848 BT_ASSERT(debug_info);
1849
1850 debug_info_msg_iter = bt_self_message_iterator_get_data(self_msg_iter);
1851 BT_ASSERT(debug_info_msg_iter);
1852
1853 upstream_iterator = debug_info_msg_iter->msg_iter;
1854 BT_ASSERT(upstream_iterator);
1855
1856 upstream_iterator_ret_status =
1857 bt_self_component_port_input_message_iterator_next(
1858 upstream_iterator, &input_msgs, count);
1859 if (upstream_iterator_ret_status != BT_MESSAGE_ITERATOR_STATUS_OK) {
1860 /*
1861 * No messages were returned. Not necessarily an error. Convert
1862 * the upstream message iterator status to a self status.
1863 */
1864 status = bt_common_message_iterator_status_to_self(
1865 upstream_iterator_ret_status);
1866 goto end;
1867 }
1868
1869 /*
1870 * There should never be more received messages than the capacity we
1871 * provided.
1872 */
1873 BT_ASSERT(*count <= capacity);
1874
1875 for (curr_msg_idx = 0; curr_msg_idx < *count; curr_msg_idx++) {
1876 out_message = handle_message(debug_info_msg_iter,
1877 input_msgs[curr_msg_idx]);
1878 if (!out_message) {
1879 goto handle_msg_error;
1880 }
1881
1882 msgs[curr_msg_idx] = out_message;
1883 /*
1884 * Drop our reference of the input message as we are done with
1885 * it and created a output copy.
1886 */
1887 bt_message_put_ref(input_msgs[curr_msg_idx]);
1888 }
1889
1890 goto end;
1891
1892 handle_msg_error:
1893 /*
1894 * Drop references of all the output messages created before the
1895 * failure.
1896 */
1897 for (i = 0; i < curr_msg_idx; i++) {
1898 bt_message_put_ref(msgs[i]);
1899 }
1900
1901 status = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
1902 end:
1903 return status;
1904 }
1905
1906 static
1907 void debug_info_msg_iter_destroy(struct debug_info_msg_iter *debug_info_msg_iter)
1908 {
1909 if (!debug_info_msg_iter) {
1910 goto end;
1911 }
1912
1913 if (debug_info_msg_iter->msg_iter) {
1914 bt_self_component_port_input_message_iterator_put_ref(
1915 debug_info_msg_iter->msg_iter);
1916 }
1917
1918 if (debug_info_msg_iter->ir_maps) {
1919 trace_ir_maps_destroy(debug_info_msg_iter->ir_maps);
1920 }
1921
1922 if (debug_info_msg_iter->debug_info_map) {
1923 g_hash_table_destroy(debug_info_msg_iter->debug_info_map);
1924 }
1925
1926 bt_fd_cache_fini(&debug_info_msg_iter->fd_cache);
1927 g_free(debug_info_msg_iter);
1928
1929 end:
1930 return;
1931 }
1932
1933 BT_HIDDEN
1934 bt_self_message_iterator_status debug_info_msg_iter_init(
1935 bt_self_message_iterator *self_msg_iter,
1936 bt_self_component_filter *self_comp,
1937 bt_self_component_port_output *self_port)
1938 {
1939 bt_self_message_iterator_status status = BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
1940 struct bt_self_component_port_input *input_port = NULL;
1941 bt_self_component_port_input_message_iterator *upstream_iterator = NULL;
1942 struct debug_info_msg_iter *debug_info_msg_iter = NULL;
1943 gchar *debug_info_field_name;
1944 int ret;
1945
1946 /* Borrow the upstream input port. */
1947 input_port = bt_self_component_filter_borrow_input_port_by_name(
1948 self_comp, "in");
1949 if (!input_port) {
1950 status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
1951 goto error;
1952 }
1953
1954 debug_info_msg_iter = g_new0(struct debug_info_msg_iter, 1);
1955 if (!debug_info_msg_iter) {
1956 status = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
1957 goto error;
1958 }
1959
1960 /* Create an iterator on the upstream component. */
1961 upstream_iterator = bt_self_component_port_input_message_iterator_create(
1962 input_port);
1963 if (!upstream_iterator) {
1964 status = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
1965 goto error;
1966 }
1967
1968 BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_MOVE_REF(
1969 debug_info_msg_iter->msg_iter, upstream_iterator);
1970
1971 /* Create hashtable that will contain debug info mapping. */
1972 debug_info_msg_iter->debug_info_map = g_hash_table_new_full(
1973 g_direct_hash, g_direct_equal, (GDestroyNotify) NULL,
1974 (GDestroyNotify) debug_info_destroy);
1975 if (!debug_info_msg_iter->debug_info_map) {
1976 status = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
1977 goto error;
1978 }
1979
1980 debug_info_msg_iter->self_comp =
1981 bt_self_component_filter_as_self_component(self_comp);
1982
1983 debug_info_msg_iter->debug_info_component = bt_self_component_get_data(
1984 bt_self_component_filter_as_self_component(
1985 self_comp));
1986
1987 debug_info_field_name =
1988 debug_info_msg_iter->debug_info_component->arg_debug_info_field_name;
1989
1990 debug_info_msg_iter->ir_maps = trace_ir_maps_create(
1991 bt_self_component_filter_as_self_component(self_comp),
1992 debug_info_field_name);
1993 if (!debug_info_msg_iter->ir_maps) {
1994 status = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
1995 goto error;
1996 }
1997
1998 ret = bt_fd_cache_init(&debug_info_msg_iter->fd_cache);
1999 if (ret) {
2000 status = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
2001 goto error;
2002 }
2003
2004 bt_self_message_iterator_set_data(self_msg_iter, debug_info_msg_iter);
2005 debug_info_msg_iter->input_iterator = self_msg_iter;
2006
2007 goto end;
2008
2009 error:
2010 debug_info_msg_iter_destroy(debug_info_msg_iter);
2011 end:
2012 return status;
2013 }
2014
2015 BT_HIDDEN
2016 bt_bool debug_info_msg_iter_can_seek_beginning(
2017 bt_self_message_iterator *self_msg_iter)
2018 {
2019 struct debug_info_msg_iter *debug_info_msg_iter =
2020 bt_self_message_iterator_get_data(self_msg_iter);
2021 BT_ASSERT(debug_info_msg_iter);
2022
2023 return bt_self_component_port_input_message_iterator_can_seek_beginning(
2024 debug_info_msg_iter->msg_iter);
2025 }
2026
2027 BT_HIDDEN
2028 bt_self_message_iterator_status debug_info_msg_iter_seek_beginning(
2029 bt_self_message_iterator *self_msg_iter)
2030 {
2031 struct debug_info_msg_iter *debug_info_msg_iter =
2032 bt_self_message_iterator_get_data(self_msg_iter);
2033 bt_message_iterator_status status = BT_MESSAGE_ITERATOR_STATUS_OK;
2034
2035 BT_ASSERT(debug_info_msg_iter);
2036
2037 /* Ask the upstream component to seek to the beginning. */
2038 status = bt_self_component_port_input_message_iterator_seek_beginning(
2039 debug_info_msg_iter->msg_iter);
2040 if (status != BT_MESSAGE_ITERATOR_STATUS_OK) {
2041 goto end;
2042 }
2043
2044 /* Clear this iterator data. */
2045 trace_ir_maps_clear(debug_info_msg_iter->ir_maps);
2046 g_hash_table_remove_all(debug_info_msg_iter->debug_info_map);
2047 end:
2048 return bt_common_message_iterator_status_to_self(status);
2049 }
2050
2051 BT_HIDDEN
2052 void debug_info_msg_iter_finalize(bt_self_message_iterator *it)
2053 {
2054 struct debug_info_msg_iter *debug_info_msg_iter;
2055
2056 debug_info_msg_iter = bt_self_message_iterator_get_data(it);
2057 BT_ASSERT(debug_info_msg_iter);
2058
2059 debug_info_msg_iter_destroy(debug_info_msg_iter);
2060 }
This page took 0.120817 seconds and 3 git commands to generate.