/tests/cli/test_packet_seq_num
/tests/cli/test_trace_read
/tests/cli/test_trace_copy
+/tests/cli/test_debug_info
/tests/cli/test_convert_args
/tests/bin/intersection/bt_python_helper.py
/tests/bin/intersection/test_intersection
AC_CONFIG_FILES([tests/cli/test_trace_read], [chmod +x tests/cli/test_trace_read])
AC_CONFIG_FILES([tests/cli/test_trace_copy], [chmod +x tests/cli/test_trace_copy])
+AC_CONFIG_FILES([tests/cli/test_debug_info], [chmod +x tests/cli/test_debug_info])
AC_CONFIG_FILES([tests/cli/intersection/test_intersection], [chmod +x tests/cli/intersection/test_intersection])
AC_CONFIG_FILES([tests/cli/test_convert_args], [chmod +x tests/cli/test_convert_args])
AC_CONFIG_FILES([tests/cli/intersection/bt_python_helper.py])
test_packet_seq_num \
test_convert_args \
intersection/test_intersection \
- test_trace_copy
+ test_trace_copy \
+ test_debug_info
if USE_PYTHON
TESTS += intersection/test_multi_trace_intersection.py
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) - 2017 Julien Desfossez <jdesfossez@efficios.com>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License, version 2 only, as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 51
+# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+CURDIR=$(dirname $0)
+TESTDIR=$CURDIR/..
+
+BABELTRACE_BIN=@abs_top_builddir@/cli/babeltrace
+
+BT_TREE_PATH=@abs_top_srcdir@/
+DEBUG_INFO_TRACE=${BT_TREE_PATH}/tests/debug-info-data/trace/
+
+source $TESTDIR/utils/tap/tap.sh
+
+NUM_TESTS=1
+
+plan_tests $NUM_TESTS
+
+$BABELTRACE_BIN --debug-info-target-prefix ${BT_TREE_PATH} ${DEBUG_INFO_TRACE} 2>/dev/null \
+ | @GREP@ 'debug_info = { bin = "libhello_so+0x15a6", func = "bar+0xa9", src = "libhello.c:13" }' >/dev/null
+ok $? "Extract debug information"
$ objcopy --only-keep-debug libhello_debug_link_so libhello_debug_link_so.debug
$ strip -g libhello_debug_link_so
$ objcopy --add-gnu-debuglink=libhello_debug_link_so.debug libhello_debug_link_so
+
+
+Test program
+------------
+An executable linked to this library can be compiled from the `main.c` source file.
+To compile it, you can do:
+
+ $ ln -s libhello_so libhello.so
+ $ gcc -I. -o test main.c -L. -lhello_build_id -llttng-ust -ldl -Wl,--rpath=.
+
+The trace provided in this directory was generated with lttng-ust running this
+program and stripped to contain only the bare minimum. When running babeltrace
+with the `--debug-info-target-prefix` option pointing to the source tree of
+Babeltrace, the `my_provider:my_first_tracepoint` events should contain this
+information:
+
+ debug_info = { bin = "libhello_so+0x166b", func = "baz+0x9c", src = "libhello.c:20" } }
--- /dev/null
+/*
+ * main.c
+ *
+ * Debug Info - Main
+ *
+ * Copyright 2017 Julien Desfossez <jdesfossez@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <stdio.h>
+#include "libhello.h"
+#include "tp.h"
+
+int main()
+{
+ foo();
+ bar();
+ baz();
+ return 0;
+}
--- /dev/null
+/* CTF 1.8 */
+
+trace {
+ major = 1;
+ minor = 8;
+ uuid = "c4f5ad74-2d9a-4a17-9633-3e9e49d5f773";
+ byte_order = le;
+ packet.header := struct {
+ integer { size = 32; align = 8; signed = false; encoding = none; base = decimal; byte_order = le; } magic;
+ integer { size = 8; align = 8; signed = false; encoding = none; base = decimal; byte_order = le; } uuid[16];
+ integer { size = 32; align = 8; signed = false; encoding = none; base = decimal; byte_order = le; } stream_id;
+ integer { size = 64; align = 8; signed = false; encoding = none; base = decimal; byte_order = le; } stream_instance_id;
+ } align(8);
+};
+
+env {
+ hostname = "sinkpad";
+ domain = "ust";
+ tracer_name = "lttng-ust";
+ tracer_major = 2;
+ tracer_minor = 10;
+};
+
+clock {
+ name = monotonic;
+ uuid = "00000000-0000-0000-0000-000000000000";
+ description = "Monotonic Clock";
+ freq = 1000000000;
+ precision = 1;
+ offset_s = 0;
+ offset = 1497619475540462738;
+ absolute = TRUE;
+};
+
+stream {
+ id = 0;
+ event.header := struct {
+ enum : integer { size = 5; align = 1; signed = false; encoding = none; base = decimal; byte_order = le; } { "compact" = 0 ... 30, "extended" = 31 } id;
+ variant <id> {
+ struct {
+ integer { size = 64; align = 1; signed = false; encoding = none; base = decimal; byte_order = le; map = clock.monotonic.value; } timestamp;
+ } align(1) compact;
+ struct {
+ integer { size = 32; align = 8; signed = false; encoding = none; base = decimal; byte_order = le; } id;
+ integer { size = 64; align = 8; signed = false; encoding = none; base = decimal; byte_order = le; map = clock.monotonic.value; } timestamp;
+ } align(8) extended;
+ } v;
+ } align(8);
+
+ packet.context := struct {
+ integer { size = 64; align = 8; signed = false; encoding = none; base = decimal; byte_order = le; map = clock.monotonic.value; } timestamp_begin;
+ integer { size = 64; align = 8; signed = false; encoding = none; base = decimal; byte_order = le; map = clock.monotonic.value; } timestamp_end;
+ integer { size = 64; align = 8; signed = false; encoding = none; base = decimal; byte_order = le; } content_size;
+ integer { size = 64; align = 8; signed = false; encoding = none; base = decimal; byte_order = le; } packet_size;
+ integer { size = 64; align = 8; signed = false; encoding = none; base = decimal; byte_order = le; } packet_seq_num;
+ integer { size = 64; align = 8; signed = false; encoding = none; base = decimal; byte_order = le; } events_discarded;
+ integer { size = 32; align = 8; signed = false; encoding = none; base = decimal; byte_order = le; } cpu_id;
+ } align(8);
+
+ event.context := struct {
+ integer { size = 32; align = 8; signed = true; encoding = none; base = decimal; byte_order = le; } _vpid;
+ integer { size = 64; align = 8; signed = false; encoding = none; base = hexadecimal; byte_order = le; } _ip;
+ } align(8);
+};
+
+event {
+ name = "lttng_ust_statedump:bin_info";
+ id = 0;
+ stream_id = 0;
+ loglevel = 13;
+ fields := struct {
+ integer { size = 64; align = 8; signed = false; encoding = none; base = hexadecimal; byte_order = le; } _baddr;
+ integer { size = 64; align = 8; signed = false; encoding = none; base = decimal; byte_order = le; } _memsz;
+ string { encoding = UTF8; } _path;
+ integer { size = 8; align = 8; signed = false; encoding = none; base = decimal; byte_order = le; } _is_pic;
+ integer { size = 8; align = 8; signed = false; encoding = none; base = decimal; byte_order = le; } _has_build_id;
+ integer { size = 8; align = 8; signed = false; encoding = none; base = decimal; byte_order = le; } _has_debug_link;
+ } align(8);
+};
+
+event {
+ name = "my_provider:my_first_tracepoint";
+ id = 1;
+ stream_id = 0;
+ loglevel = 13;
+ fields := struct {
+ string { encoding = UTF8; } _my_string_field;
+ integer { size = 32; align = 8; signed = true; encoding = none; base = decimal; byte_order = le; } _my_integer_field;
+ } align(8);
+};
+