Tests: flt.lttng-utils.debug-info: update debug-info tests
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Sat, 13 Jul 2019 14:39:21 +0000 (10:39 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Sat, 20 Jul 2019 13:42:13 +0000 (09:42 -0400)
* Convert the currently disabled Python bindings based debug-info
  testcase to a `sink.text.details` based test.
* Update debug-info test trace using a recently changed `libhello_so`
  file.
* Move all debug-info test files to
  `tests/plugins/flt.lttng-utils.debug-info/`
* Move `tests/data/debug-info/README.md` content to `CONTRIBUTING.adoc`
* Update `tests/data/plugins/flt.lttng-utils.debug-info/README.md` to
  explain how to generate the debug-info test trace.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I67b8fa729e462137fb3e584c0f1eaf472256e3c9
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1704
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
81 files changed:
tests/Makefile.am
tests/data/ctf-traces/succeed/debug-info/channel0_0 [new file with mode: 0644]
tests/data/ctf-traces/succeed/debug-info/metadata [new file with mode: 0644]
tests/data/debug-info/Makefile [deleted file]
tests/data/debug-info/README.md [deleted file]
tests/data/debug-info/i386-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug [deleted file]
tests/data/debug-info/i386-linux-gnu/build_id/libhello_so [deleted file]
tests/data/debug-info/i386-linux-gnu/debug_link/libhello_so [deleted file]
tests/data/debug-info/i386-linux-gnu/debug_link/libhello_so.debug [deleted file]
tests/data/debug-info/i386-linux-gnu/dwarf_full/libhello_so [deleted file]
tests/data/debug-info/i386-linux-gnu/elf_only/libhello_so [deleted file]
tests/data/debug-info/libhello.c [deleted file]
tests/data/debug-info/libhello.h [deleted file]
tests/data/debug-info/main.c [deleted file]
tests/data/debug-info/powerpc-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug [deleted file]
tests/data/debug-info/powerpc-linux-gnu/build_id/libhello_so [deleted file]
tests/data/debug-info/powerpc-linux-gnu/debug_link/libhello_so [deleted file]
tests/data/debug-info/powerpc-linux-gnu/debug_link/libhello_so.debug [deleted file]
tests/data/debug-info/powerpc-linux-gnu/dwarf_full/libhello_so [deleted file]
tests/data/debug-info/powerpc-linux-gnu/elf_only/libhello_so [deleted file]
tests/data/debug-info/powerpc64le-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug [deleted file]
tests/data/debug-info/powerpc64le-linux-gnu/build_id/libhello_so [deleted file]
tests/data/debug-info/powerpc64le-linux-gnu/debug_link/libhello_so [deleted file]
tests/data/debug-info/powerpc64le-linux-gnu/debug_link/libhello_so.debug [deleted file]
tests/data/debug-info/powerpc64le-linux-gnu/dwarf_full/libhello_so [deleted file]
tests/data/debug-info/powerpc64le-linux-gnu/elf_only/libhello_so [deleted file]
tests/data/debug-info/tp.c [deleted file]
tests/data/debug-info/tp.h [deleted file]
tests/data/debug-info/trace/metadata [deleted file]
tests/data/debug-info/trace/stream_0_0 [deleted file]
tests/data/debug-info/x86_64-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug [deleted file]
tests/data/debug-info/x86_64-linux-gnu/build_id/libhello_so [deleted file]
tests/data/debug-info/x86_64-linux-gnu/debug_link/libhello_so [deleted file]
tests/data/debug-info/x86_64-linux-gnu/debug_link/libhello_so.debug [deleted file]
tests/data/debug-info/x86_64-linux-gnu/dwarf_full/libhello_so [deleted file]
tests/data/debug-info/x86_64-linux-gnu/elf_only/libhello_so [deleted file]
tests/data/plugins/flt.lttng-utils.debug-info/Makefile [new file with mode: 0644]
tests/data/plugins/flt.lttng-utils.debug-info/README.md [new file with mode: 0644]
tests/data/plugins/flt.lttng-utils.debug-info/i386-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug [new file with mode: 0755]
tests/data/plugins/flt.lttng-utils.debug-info/i386-linux-gnu/build_id/libhello_so [new file with mode: 0755]
tests/data/plugins/flt.lttng-utils.debug-info/i386-linux-gnu/debug_link/libhello_so [new file with mode: 0755]
tests/data/plugins/flt.lttng-utils.debug-info/i386-linux-gnu/debug_link/libhello_so.debug [new file with mode: 0755]
tests/data/plugins/flt.lttng-utils.debug-info/i386-linux-gnu/dwarf_full/libhello_so [new file with mode: 0755]
tests/data/plugins/flt.lttng-utils.debug-info/i386-linux-gnu/elf_only/libhello_so [new file with mode: 0755]
tests/data/plugins/flt.lttng-utils.debug-info/libhello.c [new file with mode: 0644]
tests/data/plugins/flt.lttng-utils.debug-info/libhello.h [new file with mode: 0644]
tests/data/plugins/flt.lttng-utils.debug-info/main.c [new file with mode: 0644]
tests/data/plugins/flt.lttng-utils.debug-info/powerpc-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug [new file with mode: 0755]
tests/data/plugins/flt.lttng-utils.debug-info/powerpc-linux-gnu/build_id/libhello_so [new file with mode: 0755]
tests/data/plugins/flt.lttng-utils.debug-info/powerpc-linux-gnu/debug_link/libhello_so [new file with mode: 0755]
tests/data/plugins/flt.lttng-utils.debug-info/powerpc-linux-gnu/debug_link/libhello_so.debug [new file with mode: 0755]
tests/data/plugins/flt.lttng-utils.debug-info/powerpc-linux-gnu/dwarf_full/libhello_so [new file with mode: 0755]
tests/data/plugins/flt.lttng-utils.debug-info/powerpc-linux-gnu/elf_only/libhello_so [new file with mode: 0755]
tests/data/plugins/flt.lttng-utils.debug-info/powerpc64le-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug [new file with mode: 0755]
tests/data/plugins/flt.lttng-utils.debug-info/powerpc64le-linux-gnu/build_id/libhello_so [new file with mode: 0755]
tests/data/plugins/flt.lttng-utils.debug-info/powerpc64le-linux-gnu/debug_link/libhello_so [new file with mode: 0755]
tests/data/plugins/flt.lttng-utils.debug-info/powerpc64le-linux-gnu/debug_link/libhello_so.debug [new file with mode: 0755]
tests/data/plugins/flt.lttng-utils.debug-info/powerpc64le-linux-gnu/dwarf_full/libhello_so [new file with mode: 0755]
tests/data/plugins/flt.lttng-utils.debug-info/powerpc64le-linux-gnu/elf_only/libhello_so [new file with mode: 0755]
tests/data/plugins/flt.lttng-utils.debug-info/tp.c [new file with mode: 0644]
tests/data/plugins/flt.lttng-utils.debug-info/tp.h [new file with mode: 0644]
tests/data/plugins/flt.lttng-utils.debug-info/trace-debug-info.expect [new file with mode: 0644]
tests/data/plugins/flt.lttng-utils.debug-info/x86_64-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug [new file with mode: 0755]
tests/data/plugins/flt.lttng-utils.debug-info/x86_64-linux-gnu/build_id/libhello_so [new file with mode: 0755]
tests/data/plugins/flt.lttng-utils.debug-info/x86_64-linux-gnu/debug_link/libhello_so [new file with mode: 0755]
tests/data/plugins/flt.lttng-utils.debug-info/x86_64-linux-gnu/debug_link/libhello_so.debug [new file with mode: 0755]
tests/data/plugins/flt.lttng-utils.debug-info/x86_64-linux-gnu/dwarf_full/libhello_so [new file with mode: 0755]
tests/data/plugins/flt.lttng-utils.debug-info/x86_64-linux-gnu/elf_only/libhello_so [new file with mode: 0755]
tests/plugins/flt.lttng-utils.debug-info/Makefile.am
tests/plugins/flt.lttng-utils.debug-info/test_bin_info_i386-linux-gnu
tests/plugins/flt.lttng-utils.debug-info/test_bin_info_powerpc-linux-gnu
tests/plugins/flt.lttng-utils.debug-info/test_bin_info_powerpc64le-linux-gnu
tests/plugins/flt.lttng-utils.debug-info/test_bin_info_x86_64-linux-gnu
tests/plugins/flt.lttng-utils.debug-info/test_dwarf_i386-linux-gnu
tests/plugins/flt.lttng-utils.debug-info/test_dwarf_powerpc-linux-gnu
tests/plugins/flt.lttng-utils.debug-info/test_dwarf_powerpc64le-linux-gnu
tests/plugins/flt.lttng-utils.debug-info/test_dwarf_x86_64-linux-gnu
tests/plugins/flt.lttng-utils.debug-info/test_lttng_utils_debug_info [deleted file]
tests/plugins/flt.lttng-utils.debug-info/test_lttng_utils_debug_info.py [deleted file]
tests/plugins/flt.lttng-utils.debug-info/test_succeed [new file with mode: 0755]
tests/utils/utils.sh

index ad8ded962cb1f55aadc5192a15db9fb1b8989092..c2bf42a58161d91e914f628e2c31fb6426f3ba51 100644 (file)
@@ -79,10 +79,11 @@ TESTS_PLUGINS = \
 if !ENABLE_BUILT_IN_PLUGINS
 if ENABLE_PYTHON_BINDINGS
 TESTS_PLUGINS += plugins/src.ctf.fs/query/test_query
+endif
 
 if ENABLE_DEBUG_INFO
-TESTS_PLUGINS += plugins/flt.lttng-utils.debug-info/test_lttng_utils_debug_info
-endif
+TESTS_PLUGINS += \
+       plugins/flt.lttng-utils.debug-info/test_succeed
 endif
 endif
 
diff --git a/tests/data/ctf-traces/succeed/debug-info/channel0_0 b/tests/data/ctf-traces/succeed/debug-info/channel0_0
new file mode 100644 (file)
index 0000000..35b979b
Binary files /dev/null and b/tests/data/ctf-traces/succeed/debug-info/channel0_0 differ
diff --git a/tests/data/ctf-traces/succeed/debug-info/metadata b/tests/data/ctf-traces/succeed/debug-info/metadata
new file mode 100644 (file)
index 0000000..1d0228d
--- /dev/null
@@ -0,0 +1,127 @@
+/* CTF 1.8 */
+
+typealias integer { size = 8; align = 8; signed = false; } := uint8_t;
+typealias integer { size = 16; align = 8; signed = false; } := uint16_t;
+typealias integer { size = 32; align = 8; signed = false; } := uint32_t;
+typealias integer { size = 64; align = 8; signed = false; } := uint64_t;
+typealias integer { size = 64; align = 8; signed = false; } := unsigned long;
+typealias integer { size = 5; align = 1; signed = false; } := uint5_t;
+typealias integer { size = 27; align = 1; signed = false; } := uint27_t;
+
+trace {
+       major = 1;
+       minor = 8;
+       uuid = "d2270f5a-7a70-4521-860b-954f054e046b";
+       byte_order = le;
+       packet.header := struct {
+               uint32_t magic;
+               uint8_t  uuid[16];
+               uint32_t stream_id;
+               uint64_t stream_instance_id;
+       };
+};
+
+env {
+       hostname = "raton";
+       domain = "ust";
+       tracer_name = "lttng-ust";
+       tracer_major = 2;
+       tracer_minor = 11;
+};
+
+clock {
+       name = "monotonic";
+       uuid = "c56ad62a-6a35-4722-9807-d8e0f118a367";
+       description = "Monotonic Clock";
+       freq = 1000000000; /* Frequency, in Hz */
+       /* clock value offset from Epoch is: offset * (1/freq) */
+       offset = 1563264475374722151;
+};
+
+typealias integer {
+       size = 27; align = 1; signed = false;
+       map = clock.monotonic.value;
+} := uint27_clock_monotonic_t;
+
+typealias integer {
+       size = 32; align = 8; signed = false;
+       map = clock.monotonic.value;
+} := uint32_clock_monotonic_t;
+
+typealias integer {
+       size = 64; align = 8; signed = false;
+       map = clock.monotonic.value;
+} := uint64_clock_monotonic_t;
+
+struct packet_context {
+       uint64_clock_monotonic_t timestamp_begin;
+       uint64_clock_monotonic_t timestamp_end;
+       uint64_t content_size;
+       uint64_t packet_size;
+       uint64_t packet_seq_num;
+       unsigned long events_discarded;
+       uint32_t cpu_id;
+};
+
+struct event_header_compact {
+       enum : uint5_t { compact = 0 ... 30, extended = 31 } id;
+       variant <id> {
+               struct {
+                       uint27_clock_monotonic_t timestamp;
+               } compact;
+               struct {
+                       uint32_t id;
+                       uint64_clock_monotonic_t timestamp;
+               } extended;
+       } v;
+} align(8);
+
+struct event_header_large {
+       enum : uint16_t { compact = 0 ... 65534, extended = 65535 } id;
+       variant <id> {
+               struct {
+                       uint32_clock_monotonic_t timestamp;
+               } compact;
+               struct {
+                       uint32_t id;
+                       uint64_clock_monotonic_t timestamp;
+               } extended;
+       } v;
+} align(8);
+
+event {
+       name = "lttng_ust_statedump:bin_info";
+       id = 0;
+       stream_id = 0;
+       loglevel = 13;
+       fields := struct {
+               integer { size = 64; align = 8; signed = 0; encoding = none; base = 16; } _baddr;
+               integer { size = 64; align = 8; signed = 0; encoding = none; base = 10; } _memsz;
+               string _path;
+               integer { size = 8; align = 8; signed = 0; encoding = none; base = 10; } _is_pic;
+               integer { size = 8; align = 8; signed = 0; encoding = none; base = 10; } _has_build_id;
+               integer { size = 8; align = 8; signed = 0; encoding = none; base = 10; } _has_debug_link;
+       };
+};
+
+stream {
+       id = 0;
+       event.header := struct event_header_large;
+       packet.context := struct packet_context;
+       event.context := struct {
+               integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _vpid;
+               integer { size = 64; align = 8; signed = 0; encoding = none; base = 16; } _ip;
+       };
+};
+
+event {
+       name = "my_provider:my_first_tracepoint";
+       id = 1;
+       stream_id = 0;
+       loglevel = 13;
+       fields := struct {
+               string _my_string_field;
+               integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _my_integer_field;
+       };
+};
+
diff --git a/tests/data/debug-info/Makefile b/tests/data/debug-info/Makefile
deleted file mode 100644 (file)
index 2820805..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-BUILD_ID_PREFIX=cd
-BUILD_ID_SUFFIX=d98cdd87f7fe64c13b6daad553987eafd40cbb
-BUILD_ID=$(BUILD_ID_PREFIX)$(BUILD_ID_SUFFIX)
-
-BUILD_DIR ?= build
-
-OBJS=$(BUILD_DIR)/dwarf_full/libhello_so \
-     $(BUILD_DIR)/elf_only/libhello_so \
-     $(BUILD_DIR)/build_id/libhello_so \
-     $(BUILD_DIR)/debug_link/libhello_so
-
-all: $(OBJS)
-
-%.o: %.c
-       $(CC) -gdwarf -fdebug-prefix-map=$(CURDIR)=. -fPIC -c -I. -o $@ $<
-
-# Master copy: ELF with DWARF and build-id
-$(BUILD_DIR)/dwarf_full/libhello_so: tp.o libhello.o
-       mkdir -p $(@D)
-       $(CC) -shared -gdwarf -llttng-ust -ldl -Wl,-soname,libhello.so -Wl,--build-id=0x$(BUILD_ID) -o $@ $^
-
-# ELF only, no debug symbols, no build-d
-$(BUILD_DIR)/elf_only/libhello_so: $(BUILD_DIR)/dwarf_full/libhello_so
-       mkdir -p $(@D)
-       objcopy -g $< $@.tmp
-       objcopy --remove-section=.note.gnu.build-id $@.tmp
-       mv $@.tmp $@
-
-# ELF with external build-id DWARF
-$(BUILD_DIR)/build_id/libhello_so: $(BUILD_DIR)/dwarf_full/libhello_so
-       mkdir -p $(@D)/.build-id/$(BUILD_ID_PREFIX)
-       objcopy --only-keep-debug $< $(@D)/.build-id/$(BUILD_ID_PREFIX)/$(BUILD_ID_SUFFIX).debug
-       objcopy -g $< $@
-
-# ELF with external debug link DWARF
-$(BUILD_DIR)/debug_link/libhello_so: $(BUILD_DIR)/dwarf_full/libhello_so
-       mkdir -p $(@D)
-       objcopy --remove-section=.note.gnu.build-id $< $@.tmp
-       objcopy --only-keep-debug $@.tmp $(@D)/libhello_so.debug
-       objcopy -g $@.tmp
-       cd $(@D) && objcopy --add-gnu-debuglink=libhello_so.debug $(@F).tmp
-       mv $@.tmp $@
-
-clean:
-       rm -f *.o
-
-dist-clean: clean
-       rm -rf $(BUILD_DIR)
-
-.PHONY: all clean dist-clean
diff --git a/tests/data/debug-info/README.md b/tests/data/debug-info/README.md
deleted file mode 100644 (file)
index 1912194..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-debug-info-data
-==============
-
-This directory contains pre-generated ELF and DWARF files used to test
-the debug info analysis feature, including lookup of DWARF debugging
-information via build ID and debug link methods, as well as the source
-files used to generate them.
-
-The generated files are:
-
-* `ARCH/dwarf_full/libhello_so` (ELF and DWARF)
-* `ARCH/elf_only/libhello_so` (ELF only)
-* `ARCH/build_id/libhello_so` (ELF with separate DWARF via build ID)
-* `ARCH/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug` (DWARF for build ID)
-* `ARCH/debug_link/libhello_so` (ELF with separate DWARF via debug link)
-* `ARCH/debug_link/libhello_so.debug` (DWARF for debug link)
-
-We use a suffix of "_so" instead of ".so" since some distributions
-build systems will consider ".so" files as artifacts from a previous
-build that were "left-over" and will remove them prior to the build.
-
-All files are generated from the four (4) following source files:
-
-* libhello.c
-* libhello.h
-* tp.c
-* tp.h
-
-The generated executables were built using a native GNU toolchain on either
-Ubuntu 16.04 or 18.04 depending on the architecture.
-
-To regenerate them, you can use the included Makefile or follow these steps:
-
-## Generate the object files
-
-    $ gcc -gdwarf -fdebug-prefix-map=$(pwd)=. -fPIC -c -I. tp.c libhello.c
-
-## Combined ELF and DWARF
-
-    $ build_id_prefix=cd
-    $ build_id_suffix=d98cdd87f7fe64c13b6daad553987eafd40cbb
-    $ build_id="$build_id_prefix$build_id_suffix"
-    $ mkdir dwarf_full
-    $ gcc -shared -g -llttng-ust -ldl -Wl,-soname,libhello.so -Wl,--build-id=0x$build_id -o dwarf_full/libhello_so tp.o libhello.o
-
-## ELF only
-
-    $ mkdir elf_only
-    $ objcopy -g dwarf_full/libhello_so elf_only/libhello_so
-    $ objcopy --remove-section=.note.gnu.build-id elf_only/libhello_so
-
-## ELF and DWARF with Build ID
-
-    $ mkdir -p build_id/.build-id/$build_id_prefix
-    $ objcopy --only-keep-debug dwarf_full/libhello_so build_id/.build-id/$build_id_prefix/$build_id_suffix.debug
-    $ objcopy -g dwarf_full/libhello_so build_id/libhello_so
-
-##  ELF and DWARF with Debug Link
-
-    $ mkdir debug_link
-    $ objcopy --remove-section=.note.gnu.build-id dwarf_full/libhello_so debug_link/libhello_so
-    $ objcopy --only-keep-debug debug_link/libhello_so debug_link/libhello_so.debug
-    $ objcopy -g debug_link/libhello_so
-    $ cd debug_link && objcopy --add-gnu-debuglink=libhello_so.debug libhello_so && cd ..
-
-
-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" } }
diff --git a/tests/data/debug-info/i386-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug b/tests/data/debug-info/i386-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug
deleted file mode 100755 (executable)
index ba371f5..0000000
Binary files a/tests/data/debug-info/i386-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug and /dev/null differ
diff --git a/tests/data/debug-info/i386-linux-gnu/build_id/libhello_so b/tests/data/debug-info/i386-linux-gnu/build_id/libhello_so
deleted file mode 100755 (executable)
index 218e668..0000000
Binary files a/tests/data/debug-info/i386-linux-gnu/build_id/libhello_so and /dev/null differ
diff --git a/tests/data/debug-info/i386-linux-gnu/debug_link/libhello_so b/tests/data/debug-info/i386-linux-gnu/debug_link/libhello_so
deleted file mode 100755 (executable)
index 4dcfdc5..0000000
Binary files a/tests/data/debug-info/i386-linux-gnu/debug_link/libhello_so and /dev/null differ
diff --git a/tests/data/debug-info/i386-linux-gnu/debug_link/libhello_so.debug b/tests/data/debug-info/i386-linux-gnu/debug_link/libhello_so.debug
deleted file mode 100755 (executable)
index 1ede770..0000000
Binary files a/tests/data/debug-info/i386-linux-gnu/debug_link/libhello_so.debug and /dev/null differ
diff --git a/tests/data/debug-info/i386-linux-gnu/dwarf_full/libhello_so b/tests/data/debug-info/i386-linux-gnu/dwarf_full/libhello_so
deleted file mode 100755 (executable)
index 08390c8..0000000
Binary files a/tests/data/debug-info/i386-linux-gnu/dwarf_full/libhello_so and /dev/null differ
diff --git a/tests/data/debug-info/i386-linux-gnu/elf_only/libhello_so b/tests/data/debug-info/i386-linux-gnu/elf_only/libhello_so
deleted file mode 100755 (executable)
index 84c31e2..0000000
Binary files a/tests/data/debug-info/i386-linux-gnu/elf_only/libhello_so and /dev/null differ
diff --git a/tests/data/debug-info/libhello.c b/tests/data/debug-info/libhello.c
deleted file mode 100644 (file)
index 95382b5..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * libhello.c
- *
- * Debug Info - Tests
- *
- * Copyright 2016 Antoine Busque <antoine.busque@efficios.com>
- *
- * Author: Antoine Busque <antoine.busque@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>
-#define TRACEPOINT_DEFINE
-#include "tp.h"
-
-void foo()
-{
-        tracepoint(my_provider, my_first_tracepoint, 42, "hello, tracer");
-        printf("foo\n");
-}
-
-void bar()
-{
-        tracepoint(my_provider, my_first_tracepoint, 57,
-                   "recoltes et semailles");
-        printf("bar\n");
-}
-
-void baz()
-{
-        tracepoint(my_provider, my_other_tracepoint, 1729);
-        printf("baz\n");
-}
diff --git a/tests/data/debug-info/libhello.h b/tests/data/debug-info/libhello.h
deleted file mode 100644 (file)
index b3f8893..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * libhello.h
- *
- * Debug Info - Tests
- *
- * Copyright 2016 Antoine Busque <antoine.busque@efficios.com>
- *
- * Author: Antoine Busque <antoine.busque@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.
- */
-
-#ifndef _LIBHELLO_H
-#define _LIBHELLO_H
-
-void foo();
-void bar();
-void baz();
-
-#endif  /* _LIBHELLO_H */
diff --git a/tests/data/debug-info/main.c b/tests/data/debug-info/main.c
deleted file mode 100644 (file)
index e272bc1..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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;
-}
diff --git a/tests/data/debug-info/powerpc-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug b/tests/data/debug-info/powerpc-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug
deleted file mode 100755 (executable)
index 6fa1499..0000000
Binary files a/tests/data/debug-info/powerpc-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug and /dev/null differ
diff --git a/tests/data/debug-info/powerpc-linux-gnu/build_id/libhello_so b/tests/data/debug-info/powerpc-linux-gnu/build_id/libhello_so
deleted file mode 100755 (executable)
index 49c6249..0000000
Binary files a/tests/data/debug-info/powerpc-linux-gnu/build_id/libhello_so and /dev/null differ
diff --git a/tests/data/debug-info/powerpc-linux-gnu/debug_link/libhello_so b/tests/data/debug-info/powerpc-linux-gnu/debug_link/libhello_so
deleted file mode 100755 (executable)
index 23efdc8..0000000
Binary files a/tests/data/debug-info/powerpc-linux-gnu/debug_link/libhello_so and /dev/null differ
diff --git a/tests/data/debug-info/powerpc-linux-gnu/debug_link/libhello_so.debug b/tests/data/debug-info/powerpc-linux-gnu/debug_link/libhello_so.debug
deleted file mode 100755 (executable)
index a95eed2..0000000
Binary files a/tests/data/debug-info/powerpc-linux-gnu/debug_link/libhello_so.debug and /dev/null differ
diff --git a/tests/data/debug-info/powerpc-linux-gnu/dwarf_full/libhello_so b/tests/data/debug-info/powerpc-linux-gnu/dwarf_full/libhello_so
deleted file mode 100755 (executable)
index ef39d51..0000000
Binary files a/tests/data/debug-info/powerpc-linux-gnu/dwarf_full/libhello_so and /dev/null differ
diff --git a/tests/data/debug-info/powerpc-linux-gnu/elf_only/libhello_so b/tests/data/debug-info/powerpc-linux-gnu/elf_only/libhello_so
deleted file mode 100755 (executable)
index d1e7322..0000000
Binary files a/tests/data/debug-info/powerpc-linux-gnu/elf_only/libhello_so and /dev/null differ
diff --git a/tests/data/debug-info/powerpc64le-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug b/tests/data/debug-info/powerpc64le-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug
deleted file mode 100755 (executable)
index b419832..0000000
Binary files a/tests/data/debug-info/powerpc64le-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug and /dev/null differ
diff --git a/tests/data/debug-info/powerpc64le-linux-gnu/build_id/libhello_so b/tests/data/debug-info/powerpc64le-linux-gnu/build_id/libhello_so
deleted file mode 100755 (executable)
index f740eb0..0000000
Binary files a/tests/data/debug-info/powerpc64le-linux-gnu/build_id/libhello_so and /dev/null differ
diff --git a/tests/data/debug-info/powerpc64le-linux-gnu/debug_link/libhello_so b/tests/data/debug-info/powerpc64le-linux-gnu/debug_link/libhello_so
deleted file mode 100755 (executable)
index 01e0c6b..0000000
Binary files a/tests/data/debug-info/powerpc64le-linux-gnu/debug_link/libhello_so and /dev/null differ
diff --git a/tests/data/debug-info/powerpc64le-linux-gnu/debug_link/libhello_so.debug b/tests/data/debug-info/powerpc64le-linux-gnu/debug_link/libhello_so.debug
deleted file mode 100755 (executable)
index 86364a3..0000000
Binary files a/tests/data/debug-info/powerpc64le-linux-gnu/debug_link/libhello_so.debug and /dev/null differ
diff --git a/tests/data/debug-info/powerpc64le-linux-gnu/dwarf_full/libhello_so b/tests/data/debug-info/powerpc64le-linux-gnu/dwarf_full/libhello_so
deleted file mode 100755 (executable)
index 3874f11..0000000
Binary files a/tests/data/debug-info/powerpc64le-linux-gnu/dwarf_full/libhello_so and /dev/null differ
diff --git a/tests/data/debug-info/powerpc64le-linux-gnu/elf_only/libhello_so b/tests/data/debug-info/powerpc64le-linux-gnu/elf_only/libhello_so
deleted file mode 100755 (executable)
index 067b472..0000000
Binary files a/tests/data/debug-info/powerpc64le-linux-gnu/elf_only/libhello_so and /dev/null differ
diff --git a/tests/data/debug-info/tp.c b/tests/data/debug-info/tp.c
deleted file mode 100644 (file)
index e893355..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * tp.c
- *
- * Debug Info - Tests
- *
- * Copyright 2016 Antoine Busque <antoine.busque@efficios.com>
- *
- * Author: Antoine Busque <antoine.busque@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.
- */
-#define TRACEPOINT_CREATE_PROBES
-
-#include "tp.h"
diff --git a/tests/data/debug-info/tp.h b/tests/data/debug-info/tp.h
deleted file mode 100644 (file)
index 1a3660e..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * tp.h
- *
- * Debug Info - Tests
- *
- * Copyright 2016 Antoine Busque <antoine.busque@efficios.com>
- *
- * Author: Antoine Busque <antoine.busque@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.
- */
-
-#undef TRACEPOINT_PROVIDER
-#define TRACEPOINT_PROVIDER my_provider
-
-#undef TRACEPOINT_INCLUDE
-#define TRACEPOINT_INCLUDE "./tp.h"
-
-#if !defined(_TP_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
-#define _TP_H
-
-#include <lttng/tracepoint.h>
-
-TRACEPOINT_EVENT(
-    my_provider,
-    my_first_tracepoint,
-    TP_ARGS(
-        int, my_integer_arg,
-        char*, my_string_arg
-    ),
-    TP_FIELDS(
-        ctf_string(my_string_field, my_string_arg)
-        ctf_integer(int, my_integer_field, my_integer_arg)
-    )
-)
-
-TRACEPOINT_EVENT(
-    my_provider,
-    my_other_tracepoint,
-    TP_ARGS(
-        int, my_int
-    ),
-    TP_FIELDS(
-        ctf_integer(int, some_field, my_int)
-    )
-)
-
-#endif /* _TP_H */
-
-#include <lttng/tracepoint-event.h>
diff --git a/tests/data/debug-info/trace/metadata b/tests/data/debug-info/trace/metadata
deleted file mode 100644 (file)
index 1388b29..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/* 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);
-};
-
diff --git a/tests/data/debug-info/trace/stream_0_0 b/tests/data/debug-info/trace/stream_0_0
deleted file mode 100644 (file)
index 582f445..0000000
Binary files a/tests/data/debug-info/trace/stream_0_0 and /dev/null differ
diff --git a/tests/data/debug-info/x86_64-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug b/tests/data/debug-info/x86_64-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug
deleted file mode 100755 (executable)
index 41e2cfb..0000000
Binary files a/tests/data/debug-info/x86_64-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug and /dev/null differ
diff --git a/tests/data/debug-info/x86_64-linux-gnu/build_id/libhello_so b/tests/data/debug-info/x86_64-linux-gnu/build_id/libhello_so
deleted file mode 100755 (executable)
index 0edfd79..0000000
Binary files a/tests/data/debug-info/x86_64-linux-gnu/build_id/libhello_so and /dev/null differ
diff --git a/tests/data/debug-info/x86_64-linux-gnu/debug_link/libhello_so b/tests/data/debug-info/x86_64-linux-gnu/debug_link/libhello_so
deleted file mode 100755 (executable)
index 0c12601..0000000
Binary files a/tests/data/debug-info/x86_64-linux-gnu/debug_link/libhello_so and /dev/null differ
diff --git a/tests/data/debug-info/x86_64-linux-gnu/debug_link/libhello_so.debug b/tests/data/debug-info/x86_64-linux-gnu/debug_link/libhello_so.debug
deleted file mode 100755 (executable)
index 082f513..0000000
Binary files a/tests/data/debug-info/x86_64-linux-gnu/debug_link/libhello_so.debug and /dev/null differ
diff --git a/tests/data/debug-info/x86_64-linux-gnu/dwarf_full/libhello_so b/tests/data/debug-info/x86_64-linux-gnu/dwarf_full/libhello_so
deleted file mode 100755 (executable)
index f8d3e41..0000000
Binary files a/tests/data/debug-info/x86_64-linux-gnu/dwarf_full/libhello_so and /dev/null differ
diff --git a/tests/data/debug-info/x86_64-linux-gnu/elf_only/libhello_so b/tests/data/debug-info/x86_64-linux-gnu/elf_only/libhello_so
deleted file mode 100755 (executable)
index bffdaab..0000000
Binary files a/tests/data/debug-info/x86_64-linux-gnu/elf_only/libhello_so and /dev/null differ
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/Makefile b/tests/data/plugins/flt.lttng-utils.debug-info/Makefile
new file mode 100644 (file)
index 0000000..2820805
--- /dev/null
@@ -0,0 +1,50 @@
+BUILD_ID_PREFIX=cd
+BUILD_ID_SUFFIX=d98cdd87f7fe64c13b6daad553987eafd40cbb
+BUILD_ID=$(BUILD_ID_PREFIX)$(BUILD_ID_SUFFIX)
+
+BUILD_DIR ?= build
+
+OBJS=$(BUILD_DIR)/dwarf_full/libhello_so \
+     $(BUILD_DIR)/elf_only/libhello_so \
+     $(BUILD_DIR)/build_id/libhello_so \
+     $(BUILD_DIR)/debug_link/libhello_so
+
+all: $(OBJS)
+
+%.o: %.c
+       $(CC) -gdwarf -fdebug-prefix-map=$(CURDIR)=. -fPIC -c -I. -o $@ $<
+
+# Master copy: ELF with DWARF and build-id
+$(BUILD_DIR)/dwarf_full/libhello_so: tp.o libhello.o
+       mkdir -p $(@D)
+       $(CC) -shared -gdwarf -llttng-ust -ldl -Wl,-soname,libhello.so -Wl,--build-id=0x$(BUILD_ID) -o $@ $^
+
+# ELF only, no debug symbols, no build-d
+$(BUILD_DIR)/elf_only/libhello_so: $(BUILD_DIR)/dwarf_full/libhello_so
+       mkdir -p $(@D)
+       objcopy -g $< $@.tmp
+       objcopy --remove-section=.note.gnu.build-id $@.tmp
+       mv $@.tmp $@
+
+# ELF with external build-id DWARF
+$(BUILD_DIR)/build_id/libhello_so: $(BUILD_DIR)/dwarf_full/libhello_so
+       mkdir -p $(@D)/.build-id/$(BUILD_ID_PREFIX)
+       objcopy --only-keep-debug $< $(@D)/.build-id/$(BUILD_ID_PREFIX)/$(BUILD_ID_SUFFIX).debug
+       objcopy -g $< $@
+
+# ELF with external debug link DWARF
+$(BUILD_DIR)/debug_link/libhello_so: $(BUILD_DIR)/dwarf_full/libhello_so
+       mkdir -p $(@D)
+       objcopy --remove-section=.note.gnu.build-id $< $@.tmp
+       objcopy --only-keep-debug $@.tmp $(@D)/libhello_so.debug
+       objcopy -g $@.tmp
+       cd $(@D) && objcopy --add-gnu-debuglink=libhello_so.debug $(@F).tmp
+       mv $@.tmp $@
+
+clean:
+       rm -f *.o
+
+dist-clean: clean
+       rm -rf $(BUILD_DIR)
+
+.PHONY: all clean dist-clean
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/README.md b/tests/data/plugins/flt.lttng-utils.debug-info/README.md
new file mode 100644 (file)
index 0000000..6d20c5c
--- /dev/null
@@ -0,0 +1,108 @@
+debug-info-data
+==============
+
+This directory contains pre-generated ELF and DWARF files used to test
+the debug info analysis feature, including lookup of DWARF debugging
+information via build ID and debug link methods, as well as the source
+files used to generate them.
+
+The generated files are:
+
+* `ARCH/dwarf_full/libhello_so` (ELF and DWARF)
+* `ARCH/elf_only/libhello_so` (ELF only)
+* `ARCH/build_id/libhello_so` (ELF with separate DWARF via build ID)
+* `ARCH/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug` (DWARF for build ID)
+* `ARCH/debug_link/libhello_so` (ELF with separate DWARF via debug link)
+* `ARCH/debug_link/libhello_so.debug` (DWARF for debug link)
+
+We use a suffix of "_so" instead of ".so" since some distributions
+build systems will consider ".so" files as artifacts from a previous
+build that were "left-over" and will remove them prior to the build.
+
+All files are generated from the four (4) following source files:
+
+* libhello.c
+* libhello.h
+* tp.c
+* tp.h
+
+The generated executables were built using a native GNU toolchain on either
+Ubuntu 16.04 or 18.04 depending on the architecture.
+
+To regenerate them, you can use the included Makefile or follow these steps:
+
+## Generate the object files
+
+    $ gcc -gdwarf -fdebug-prefix-map=$(pwd)=. -fPIC -c -I. tp.c libhello.c
+
+## Combined ELF and DWARF
+
+    $ build_id_prefix=cd
+    $ build_id_suffix=d98cdd87f7fe64c13b6daad553987eafd40cbb
+    $ build_id="$build_id_prefix$build_id_suffix"
+    $ mkdir dwarf_full
+    $ gcc -shared -g -llttng-ust -ldl -Wl,-soname,libhello.so -Wl,--build-id=0x$build_id -o dwarf_full/libhello_so tp.o libhello.o
+
+## ELF only
+
+    $ mkdir elf_only
+    $ objcopy -g dwarf_full/libhello_so elf_only/libhello_so
+    $ objcopy --remove-section=.note.gnu.build-id elf_only/libhello_so
+
+## ELF and DWARF with Build ID
+
+    $ mkdir -p build_id/.build-id/$build_id_prefix
+    $ objcopy --only-keep-debug dwarf_full/libhello_so build_id/.build-id/$build_id_prefix/$build_id_suffix.debug
+    $ objcopy -g dwarf_full/libhello_so build_id/libhello_so
+
+##  ELF and DWARF with Debug Link
+
+    $ mkdir debug_link
+    $ objcopy --remove-section=.note.gnu.build-id dwarf_full/libhello_so debug_link/libhello_so
+    $ objcopy --only-keep-debug debug_link/libhello_so debug_link/libhello_so.debug
+    $ objcopy -g debug_link/libhello_so
+    $ cd debug_link && objcopy --add-gnu-debuglink=libhello_so.debug libhello_so && cd ..
+
+
+Test program
+------------
+The trace provided in `tests/data/ctf-traces/succeed/debug-info/` was generated
+using lttng-ust in a LTTng session configured to contain only the bare minimum
+to do the debug-info resolution. You can generate such trace by following these
+steps:
+
+1. Compile the example binary:
+    $ ln -s x86_64-linux-gnu/dwarf_full/libhello_so libhello.so
+    $ gcc -I. -o debug_info_app main.c -L. -lhello -llttng-ust -ldl -Wl,--rpath=.
+
+2. In order to have paths to binary and shared objects that are not relative
+   to the file system they were built on, we used a simple trick of copying
+   the following files to the root directory ('/') like this:
+
+    $ sudo cp x86_64-linux-gnu/dwarf_full/libhello_so /libhello_so
+    $ sudo cp ./debug_info_app /
+
+3. Create symbolic link to the `/libhello_so` file with the `/libhello.so` name.
+    $ sudo ln -s /libhello_so /libhello.so
+
+4. Create the LTTng tracing session using the following commands:
+    $ cd /
+    $ sudo lttng create
+    $ sudo lttng add-context -u -t vpid -t ip
+    $ sudo lttng enable-event -u my_provider:my_first_tracepoint
+    $ sudo lttng enable-event -u lttng_ust_statedump:bin_info --filter='path=="/libhello_so"'
+    $ sudo lttng enable-event -u lttng_ust_statedump:bin_info --filter='path=="[linux-vdso.so.1]"'
+    $ sudo lttng start
+    $ sudo /debug_info_app
+    $ sudo lttng stop
+
+5. Copy the resulting trace back into the Babeltrace repository.
+
+When running babeltrace with the `--debug-info-target-prefix` option or
+`target-prefix` component paramater set to the directory containing the right
+`libhello_so` file. In the example used above, the `libhello_so` file is in the
+`x86_64-linux-gnu/dwarf_full/` directory.
+In the printed trace, the `my_provider:my_first_tracepoint` events should
+contain information similar to this:
+
+    debug_info = { bin = "libhello_so+0x2349", func = "foo+0xd2", src = "libhello.c:35" }
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/i386-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug b/tests/data/plugins/flt.lttng-utils.debug-info/i386-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug
new file mode 100755 (executable)
index 0000000..ba371f5
Binary files /dev/null and b/tests/data/plugins/flt.lttng-utils.debug-info/i386-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug differ
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/i386-linux-gnu/build_id/libhello_so b/tests/data/plugins/flt.lttng-utils.debug-info/i386-linux-gnu/build_id/libhello_so
new file mode 100755 (executable)
index 0000000..218e668
Binary files /dev/null and b/tests/data/plugins/flt.lttng-utils.debug-info/i386-linux-gnu/build_id/libhello_so differ
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/i386-linux-gnu/debug_link/libhello_so b/tests/data/plugins/flt.lttng-utils.debug-info/i386-linux-gnu/debug_link/libhello_so
new file mode 100755 (executable)
index 0000000..4dcfdc5
Binary files /dev/null and b/tests/data/plugins/flt.lttng-utils.debug-info/i386-linux-gnu/debug_link/libhello_so differ
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/i386-linux-gnu/debug_link/libhello_so.debug b/tests/data/plugins/flt.lttng-utils.debug-info/i386-linux-gnu/debug_link/libhello_so.debug
new file mode 100755 (executable)
index 0000000..1ede770
Binary files /dev/null and b/tests/data/plugins/flt.lttng-utils.debug-info/i386-linux-gnu/debug_link/libhello_so.debug differ
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/i386-linux-gnu/dwarf_full/libhello_so b/tests/data/plugins/flt.lttng-utils.debug-info/i386-linux-gnu/dwarf_full/libhello_so
new file mode 100755 (executable)
index 0000000..08390c8
Binary files /dev/null and b/tests/data/plugins/flt.lttng-utils.debug-info/i386-linux-gnu/dwarf_full/libhello_so differ
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/i386-linux-gnu/elf_only/libhello_so b/tests/data/plugins/flt.lttng-utils.debug-info/i386-linux-gnu/elf_only/libhello_so
new file mode 100755 (executable)
index 0000000..84c31e2
Binary files /dev/null and b/tests/data/plugins/flt.lttng-utils.debug-info/i386-linux-gnu/elf_only/libhello_so differ
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/libhello.c b/tests/data/plugins/flt.lttng-utils.debug-info/libhello.c
new file mode 100644 (file)
index 0000000..95382b5
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * libhello.c
+ *
+ * Debug Info - Tests
+ *
+ * Copyright 2016 Antoine Busque <antoine.busque@efficios.com>
+ *
+ * Author: Antoine Busque <antoine.busque@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>
+#define TRACEPOINT_DEFINE
+#include "tp.h"
+
+void foo()
+{
+        tracepoint(my_provider, my_first_tracepoint, 42, "hello, tracer");
+        printf("foo\n");
+}
+
+void bar()
+{
+        tracepoint(my_provider, my_first_tracepoint, 57,
+                   "recoltes et semailles");
+        printf("bar\n");
+}
+
+void baz()
+{
+        tracepoint(my_provider, my_other_tracepoint, 1729);
+        printf("baz\n");
+}
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/libhello.h b/tests/data/plugins/flt.lttng-utils.debug-info/libhello.h
new file mode 100644 (file)
index 0000000..b3f8893
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * libhello.h
+ *
+ * Debug Info - Tests
+ *
+ * Copyright 2016 Antoine Busque <antoine.busque@efficios.com>
+ *
+ * Author: Antoine Busque <antoine.busque@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.
+ */
+
+#ifndef _LIBHELLO_H
+#define _LIBHELLO_H
+
+void foo();
+void bar();
+void baz();
+
+#endif  /* _LIBHELLO_H */
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/main.c b/tests/data/plugins/flt.lttng-utils.debug-info/main.c
new file mode 100644 (file)
index 0000000..e272bc1
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * 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;
+}
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/powerpc-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug b/tests/data/plugins/flt.lttng-utils.debug-info/powerpc-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug
new file mode 100755 (executable)
index 0000000..6fa1499
Binary files /dev/null and b/tests/data/plugins/flt.lttng-utils.debug-info/powerpc-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug differ
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/powerpc-linux-gnu/build_id/libhello_so b/tests/data/plugins/flt.lttng-utils.debug-info/powerpc-linux-gnu/build_id/libhello_so
new file mode 100755 (executable)
index 0000000..49c6249
Binary files /dev/null and b/tests/data/plugins/flt.lttng-utils.debug-info/powerpc-linux-gnu/build_id/libhello_so differ
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/powerpc-linux-gnu/debug_link/libhello_so b/tests/data/plugins/flt.lttng-utils.debug-info/powerpc-linux-gnu/debug_link/libhello_so
new file mode 100755 (executable)
index 0000000..23efdc8
Binary files /dev/null and b/tests/data/plugins/flt.lttng-utils.debug-info/powerpc-linux-gnu/debug_link/libhello_so differ
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/powerpc-linux-gnu/debug_link/libhello_so.debug b/tests/data/plugins/flt.lttng-utils.debug-info/powerpc-linux-gnu/debug_link/libhello_so.debug
new file mode 100755 (executable)
index 0000000..a95eed2
Binary files /dev/null and b/tests/data/plugins/flt.lttng-utils.debug-info/powerpc-linux-gnu/debug_link/libhello_so.debug differ
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/powerpc-linux-gnu/dwarf_full/libhello_so b/tests/data/plugins/flt.lttng-utils.debug-info/powerpc-linux-gnu/dwarf_full/libhello_so
new file mode 100755 (executable)
index 0000000..ef39d51
Binary files /dev/null and b/tests/data/plugins/flt.lttng-utils.debug-info/powerpc-linux-gnu/dwarf_full/libhello_so differ
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/powerpc-linux-gnu/elf_only/libhello_so b/tests/data/plugins/flt.lttng-utils.debug-info/powerpc-linux-gnu/elf_only/libhello_so
new file mode 100755 (executable)
index 0000000..d1e7322
Binary files /dev/null and b/tests/data/plugins/flt.lttng-utils.debug-info/powerpc-linux-gnu/elf_only/libhello_so differ
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/powerpc64le-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug b/tests/data/plugins/flt.lttng-utils.debug-info/powerpc64le-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug
new file mode 100755 (executable)
index 0000000..b419832
Binary files /dev/null and b/tests/data/plugins/flt.lttng-utils.debug-info/powerpc64le-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug differ
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/powerpc64le-linux-gnu/build_id/libhello_so b/tests/data/plugins/flt.lttng-utils.debug-info/powerpc64le-linux-gnu/build_id/libhello_so
new file mode 100755 (executable)
index 0000000..f740eb0
Binary files /dev/null and b/tests/data/plugins/flt.lttng-utils.debug-info/powerpc64le-linux-gnu/build_id/libhello_so differ
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/powerpc64le-linux-gnu/debug_link/libhello_so b/tests/data/plugins/flt.lttng-utils.debug-info/powerpc64le-linux-gnu/debug_link/libhello_so
new file mode 100755 (executable)
index 0000000..01e0c6b
Binary files /dev/null and b/tests/data/plugins/flt.lttng-utils.debug-info/powerpc64le-linux-gnu/debug_link/libhello_so differ
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/powerpc64le-linux-gnu/debug_link/libhello_so.debug b/tests/data/plugins/flt.lttng-utils.debug-info/powerpc64le-linux-gnu/debug_link/libhello_so.debug
new file mode 100755 (executable)
index 0000000..86364a3
Binary files /dev/null and b/tests/data/plugins/flt.lttng-utils.debug-info/powerpc64le-linux-gnu/debug_link/libhello_so.debug differ
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/powerpc64le-linux-gnu/dwarf_full/libhello_so b/tests/data/plugins/flt.lttng-utils.debug-info/powerpc64le-linux-gnu/dwarf_full/libhello_so
new file mode 100755 (executable)
index 0000000..3874f11
Binary files /dev/null and b/tests/data/plugins/flt.lttng-utils.debug-info/powerpc64le-linux-gnu/dwarf_full/libhello_so differ
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/powerpc64le-linux-gnu/elf_only/libhello_so b/tests/data/plugins/flt.lttng-utils.debug-info/powerpc64le-linux-gnu/elf_only/libhello_so
new file mode 100755 (executable)
index 0000000..067b472
Binary files /dev/null and b/tests/data/plugins/flt.lttng-utils.debug-info/powerpc64le-linux-gnu/elf_only/libhello_so differ
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/tp.c b/tests/data/plugins/flt.lttng-utils.debug-info/tp.c
new file mode 100644 (file)
index 0000000..e893355
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * tp.c
+ *
+ * Debug Info - Tests
+ *
+ * Copyright 2016 Antoine Busque <antoine.busque@efficios.com>
+ *
+ * Author: Antoine Busque <antoine.busque@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.
+ */
+#define TRACEPOINT_CREATE_PROBES
+
+#include "tp.h"
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/tp.h b/tests/data/plugins/flt.lttng-utils.debug-info/tp.h
new file mode 100644 (file)
index 0000000..1a3660e
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * tp.h
+ *
+ * Debug Info - Tests
+ *
+ * Copyright 2016 Antoine Busque <antoine.busque@efficios.com>
+ *
+ * Author: Antoine Busque <antoine.busque@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.
+ */
+
+#undef TRACEPOINT_PROVIDER
+#define TRACEPOINT_PROVIDER my_provider
+
+#undef TRACEPOINT_INCLUDE
+#define TRACEPOINT_INCLUDE "./tp.h"
+
+#if !defined(_TP_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
+#define _TP_H
+
+#include <lttng/tracepoint.h>
+
+TRACEPOINT_EVENT(
+    my_provider,
+    my_first_tracepoint,
+    TP_ARGS(
+        int, my_integer_arg,
+        char*, my_string_arg
+    ),
+    TP_FIELDS(
+        ctf_string(my_string_field, my_string_arg)
+        ctf_integer(int, my_integer_field, my_integer_arg)
+    )
+)
+
+TRACEPOINT_EVENT(
+    my_provider,
+    my_other_tracepoint,
+    TP_ARGS(
+        int, my_int
+    ),
+    TP_FIELDS(
+        ctf_integer(int, some_field, my_int)
+    )
+)
+
+#endif /* _TP_H */
+
+#include <lttng/tracepoint-event.h>
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/trace-debug-info.expect b/tests/data/plugins/flt.lttng-utils.debug-info/trace-debug-info.expect
new file mode 100644 (file)
index 0000000..047ef8f
--- /dev/null
@@ -0,0 +1,131 @@
+Trace class:
+  Stream class (ID 0):
+    Supports packets: Yes
+    Packets have beginning default clock snapshot: Yes
+    Packets have end default clock snapshot: Yes
+    Supports discarded events: Yes
+    Discarded events have default clock snapshots: Yes
+    Supports discarded packets: Yes
+    Discarded packets have default clock snapshots: Yes
+    Default clock class:
+      Name: monotonic
+      Description: Monotonic Clock
+      Frequency (Hz): 1,000,000,000
+      Precision (cycles): 0
+      Offset (s): 1,563,264,475
+      Offset (cycles): 374,722,151
+      Origin is Unix epoch: Yes
+      UUID: c56ad62a-6a35-4722-9807-d8e0f118a367
+    Packet context field class: Structure (1 member):
+      cpu_id: Unsigned integer (32-bit, Base 10)
+    Event common context field class: Structure (3 members):
+      vpid: Signed integer (32-bit, Base 10)
+      ip: Unsigned integer (64-bit, Base 16)
+      debug_info: Structure (3 members):
+        bin: String
+        func: String
+        src: String
+    Event class `lttng_ust_statedump:bin_info` (ID 0):
+      Log level: Debug (line)
+      Payload field class: Structure (6 members):
+        baddr: Unsigned integer (64-bit, Base 16)
+        memsz: Unsigned integer (64-bit, Base 10)
+        path: String
+        is_pic: Unsigned integer (8-bit, Base 10)
+        has_build_id: Unsigned integer (8-bit, Base 10)
+        has_debug_link: Unsigned integer (8-bit, Base 10)
+    Event class `my_provider:my_first_tracepoint` (ID 1):
+      Log level: Debug (line)
+      Payload field class: Structure (2 members):
+        my_string_field: String
+        my_integer_field: Signed integer (32-bit, Base 10)
+
+[Unknown]
+{Trace 0, Stream class ID 0, Stream ID 0}
+Stream beginning:
+  Trace:
+    Environment (5 entries):
+      domain: ust
+      hostname: raton
+      tracer_major: 2
+      tracer_minor: 11
+      tracer_name: lttng-ust
+    Stream (ID 0, Class ID 0)
+
+[21,705,969,336,938 cycles, 1,563,286,181,344,059,089 ns from origin]
+{Trace 0, Stream class ID 0, Stream ID 0}
+Packet beginning:
+  Context:
+    cpu_id: 0
+
+[21,705,976,167,081 cycles, 1,563,286,181,350,889,232 ns from origin]
+{Trace 0, Stream class ID 0, Stream ID 0}
+Event `lttng_ust_statedump:bin_info` (Class ID 0):
+  Common context:
+    vpid: 9746
+    ip: 0x7f09:b7d2:922b
+    debug_info:
+      bin: 
+      func: 
+      src: 
+  Payload:
+    baddr: 0x7ffc:bd1e:1000
+    memsz: 0
+    path: [linux-vdso.so.1]
+    is_pic: 0
+    has_build_id: 0
+    has_debug_link: 0
+
+[21,705,976,183,716 cycles, 1,563,286,181,350,905,867 ns from origin]
+{Trace 0, Stream class ID 0, Stream ID 0}
+Event `lttng_ust_statedump:bin_info` (Class ID 0):
+  Common context:
+    vpid: 9746
+    ip: 0x7f09:b7d2:922b
+    debug_info:
+      bin: 
+      func: 
+      src: 
+  Payload:
+    baddr: 0x7f09:b7f9:8000
+    memsz: 2,114,208
+    path: /libhello_so
+    is_pic: 1
+    has_build_id: 1
+    has_debug_link: 0
+
+[21,705,977,090,044 cycles, 1,563,286,181,351,812,195 ns from origin]
+{Trace 0, Stream class ID 0, Stream ID 0}
+Event `my_provider:my_first_tracepoint` (Class ID 1):
+  Common context:
+    vpid: 9746
+    ip: 0x7f09:b7f9:a349
+    debug_info:
+      bin: libhello_so+0x2349
+      func: foo+0xd2
+      src: libhello.c:35
+  Payload:
+    my_string_field: hello, tracer
+    my_integer_field: 42
+
+[21,705,977,161,190 cycles, 1,563,286,181,351,883,341 ns from origin]
+{Trace 0, Stream class ID 0, Stream ID 0}
+Event `my_provider:my_first_tracepoint` (Class ID 1):
+  Common context:
+    vpid: 9746
+    ip: 0x7f09:b7f9:a448
+    debug_info:
+      bin: libhello_so+0x2448
+      func: bar+0xd2
+      src: libhello.c:41
+  Payload:
+    my_string_field: recoltes et semailles
+    my_integer_field: 57
+
+[21,706,180,381,092 cycles, 1,563,286,181,555,103,243 ns from origin]
+{Trace 0, Stream class ID 0, Stream ID 0}
+Packet end
+
+[Unknown]
+{Trace 0, Stream class ID 0, Stream ID 0}
+Stream end
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/x86_64-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug b/tests/data/plugins/flt.lttng-utils.debug-info/x86_64-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug
new file mode 100755 (executable)
index 0000000..41e2cfb
Binary files /dev/null and b/tests/data/plugins/flt.lttng-utils.debug-info/x86_64-linux-gnu/build_id/.build-id/cd/d98cdd87f7fe64c13b6daad553987eafd40cbb.debug differ
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/x86_64-linux-gnu/build_id/libhello_so b/tests/data/plugins/flt.lttng-utils.debug-info/x86_64-linux-gnu/build_id/libhello_so
new file mode 100755 (executable)
index 0000000..0edfd79
Binary files /dev/null and b/tests/data/plugins/flt.lttng-utils.debug-info/x86_64-linux-gnu/build_id/libhello_so differ
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/x86_64-linux-gnu/debug_link/libhello_so b/tests/data/plugins/flt.lttng-utils.debug-info/x86_64-linux-gnu/debug_link/libhello_so
new file mode 100755 (executable)
index 0000000..0c12601
Binary files /dev/null and b/tests/data/plugins/flt.lttng-utils.debug-info/x86_64-linux-gnu/debug_link/libhello_so differ
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/x86_64-linux-gnu/debug_link/libhello_so.debug b/tests/data/plugins/flt.lttng-utils.debug-info/x86_64-linux-gnu/debug_link/libhello_so.debug
new file mode 100755 (executable)
index 0000000..082f513
Binary files /dev/null and b/tests/data/plugins/flt.lttng-utils.debug-info/x86_64-linux-gnu/debug_link/libhello_so.debug differ
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/x86_64-linux-gnu/dwarf_full/libhello_so b/tests/data/plugins/flt.lttng-utils.debug-info/x86_64-linux-gnu/dwarf_full/libhello_so
new file mode 100755 (executable)
index 0000000..f8d3e41
Binary files /dev/null and b/tests/data/plugins/flt.lttng-utils.debug-info/x86_64-linux-gnu/dwarf_full/libhello_so differ
diff --git a/tests/data/plugins/flt.lttng-utils.debug-info/x86_64-linux-gnu/elf_only/libhello_so b/tests/data/plugins/flt.lttng-utils.debug-info/x86_64-linux-gnu/elf_only/libhello_so
new file mode 100755 (executable)
index 0000000..bffdaab
Binary files /dev/null and b/tests/data/plugins/flt.lttng-utils.debug-info/x86_64-linux-gnu/elf_only/libhello_so differ
index a076b3e804f2310bdbe6544d608508303a03fd95..44f17db4c7c6b772798bd2fe4cc39e59e846a187 100644 (file)
@@ -11,8 +11,7 @@ dist_check_SCRIPTS = \
        test_dwarf_powerpc64le-linux-gnu \
        test_dwarf_powerpc-linux-gnu \
        test_dwarf_x86_64-linux-gnu \
-       test_lttng_utils_debug_info \
-       test_lttng_utils_debug_info.py
+       test_succeed
 
 noinst_PROGRAMS =
 
index 484f6380359ac2ed5a6030552ef80bf025360a1a..553778c268ac07f34bc746d8d95f5be6be1dea95 100755 (executable)
@@ -27,9 +27,11 @@ fi
 # shellcheck source=../../utils/utils.sh
 source "$UTILSSH"
 
-debug_info_data="${BT_DEBUG_INFO_PATH}/i386-linux-gnu"
+this_dir_relative="plugins/flt.lttng-utils.debug-info"
+this_dir_build="$BT_TESTS_BUILDDIR/$this_dir_relative"
+debug_info_data="$BT_TESTS_DATADIR/$this_dir_relative/i386-linux-gnu"
 
-"${BT_TESTS_BUILDDIR}/plugins/flt.lttng-utils.debug-info/test_bin_info" \
+"$this_dir_build/test_bin_info" \
        --foo-addr=0x1c8d \
        --printf-offset=0xda \
        --printf-lineno=36 \
index 9a9ffbd38ea5b01ae7da0bb13e37c0f32248675c..eacce8621375ef764777729c2555c53e89aa21c6 100755 (executable)
@@ -27,9 +27,11 @@ fi
 # shellcheck source=../../utils/utils.sh
 source "$UTILSSH"
 
-debug_info_data="${BT_DEBUG_INFO_PATH}/powerpc-linux-gnu"
+this_dir_relative="plugins/flt.lttng-utils.debug-info"
+this_dir_build="$BT_TESTS_BUILDDIR/$this_dir_relative"
+debug_info_data="$BT_TESTS_DATADIR/$this_dir_relative/powerpc-linux-gnu"
 
-"${BT_TESTS_BUILDDIR}/plugins/flt.lttng-utils.debug-info/test_bin_info" \
+"$this_dir_build/test_bin_info" \
        --foo-addr=0x23bc \
        --printf-offset=0x114 \
        --printf-lineno=36 \
index 061a27a4cbd2afdc9555b30bd1cff256eb8c13a9..706e1e79641dbd8936c4212fbf2ef7cf4485a196 100755 (executable)
@@ -27,9 +27,11 @@ fi
 # shellcheck source=../../utils/utils.sh
 source "$UTILSSH"
 
-debug_info_data="${BT_DEBUG_INFO_PATH}/powerpc64le-linux-gnu"
+this_dir_relative="plugins/flt.lttng-utils.debug-info"
+this_dir_build="$BT_TESTS_BUILDDIR/$this_dir_relative"
+debug_info_data="$BT_TESTS_DATADIR/$this_dir_relative/powerpc64le-linux-gnu"
 
-"${BT_TESTS_BUILDDIR}/plugins/flt.lttng-utils.debug-info/test_bin_info" \
+"$this_dir_build/test_bin_info" \
        --foo-addr=0x2e7c \
        --printf-offset=0x190 \
        --printf-lineno=36 \
index b50da5cedded4fe72db140b149a0de22e31692e5..4804f75c48187a5ad36f15e30a7659df39f776b3 100755 (executable)
@@ -27,9 +27,11 @@ fi
 # shellcheck source=../../utils/utils.sh
 source "$UTILSSH"
 
-debug_info_data="${BT_DEBUG_INFO_PATH}/x86_64-linux-gnu"
+this_dir_relative="plugins/flt.lttng-utils.debug-info"
+this_dir_build="$BT_TESTS_BUILDDIR/$this_dir_relative"
+debug_info_data="$BT_TESTS_DATADIR/$this_dir_relative/x86_64-linux-gnu"
 
-"${BT_TESTS_BUILDDIR}/plugins/flt.lttng-utils.debug-info/test_bin_info" \
+"$this_dir_build/test_bin_info" \
        --foo-addr=0x2277 \
        --printf-offset=0xf0 \
        --printf-lineno=36 \
index d02227f63c1fab60c9cd1d55b7e898f0b624e86b..14cb3b1dd0d9eb40c3eccaa3fa69b8c3d2410dd4 100755 (executable)
@@ -27,4 +27,9 @@ fi
 # shellcheck source=../../utils/utils.sh
 source "$UTILSSH"
 
-"${BT_TESTS_BUILDDIR}/plugins/flt.lttng-utils.debug-info/test_dwarf" "${BT_DEBUG_INFO_PATH}/i386-linux-gnu"
+this_dir_relative="plugins/flt.lttng-utils.debug-info"
+this_dir_build="$BT_TESTS_BUILDDIR/$this_dir_relative"
+debug_info_data="$BT_TESTS_DATADIR/$this_dir_relative/i386-linux-gnu"
+
+"$this_dir_build/test_dwarf" \
+       "$debug_info_data"
index eb4c3b02aa1cd09dc99fe35da140a8cd972487db..742fbad057bff90aa5715d15ea411b7eec45fa33 100755 (executable)
@@ -27,4 +27,9 @@ fi
 # shellcheck source=../../utils/utils.sh
 source "$UTILSSH"
 
-"${BT_TESTS_BUILDDIR}/plugins/flt.lttng-utils.debug-info/test_dwarf" "${BT_DEBUG_INFO_PATH}/powerpc-linux-gnu"
+this_dir_relative="plugins/flt.lttng-utils.debug-info"
+this_dir_build="$BT_TESTS_BUILDDIR/$this_dir_relative"
+debug_info_data="$BT_TESTS_DATADIR/$this_dir_relative/powerpc-linux-gnu"
+
+"$this_dir_build/test_dwarf" \
+       "$debug_info_data"
index ee4ba4add6b8d3284bcfd7e857ee6d3df2cbf07a..c14ffadcf77c65cda48c04dcce7f5b85b35a3274 100755 (executable)
@@ -27,4 +27,9 @@ fi
 # shellcheck source=../../utils/utils.sh
 source "$UTILSSH"
 
-"${BT_TESTS_BUILDDIR}/plugins/flt.lttng-utils.debug-info/test_dwarf" "${BT_DEBUG_INFO_PATH}/powerpc64le-linux-gnu"
+this_dir_relative="plugins/flt.lttng-utils.debug-info"
+this_dir_build="$BT_TESTS_BUILDDIR/$this_dir_relative"
+debug_info_data="$BT_TESTS_DATADIR/$this_dir_relative/powerpc64le-linux-gnu"
+
+"$this_dir_build/test_dwarf" \
+       "$debug_info_data"
index ef5416fda3f5d6789f4cc87c8d262585e09939a7..175ce8a4486063e200d5a8acabab2f3084f832be 100755 (executable)
@@ -27,4 +27,9 @@ fi
 # shellcheck source=../../utils/utils.sh
 source "$UTILSSH"
 
-"${BT_TESTS_BUILDDIR}/plugins/flt.lttng-utils.debug-info/test_dwarf" "${BT_DEBUG_INFO_PATH}/x86_64-linux-gnu"
+this_dir_relative="plugins/flt.lttng-utils.debug-info"
+this_dir_build="$BT_TESTS_BUILDDIR/$this_dir_relative"
+debug_info_data="$BT_TESTS_DATADIR/$this_dir_relative/x86_64-linux-gnu"
+
+"$this_dir_build/test_dwarf" \
+       "$debug_info_data/"
diff --git a/tests/plugins/flt.lttng-utils.debug-info/test_lttng_utils_debug_info b/tests/plugins/flt.lttng-utils.debug-info/test_lttng_utils_debug_info
deleted file mode 100755 (executable)
index c177272..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) 2017 Philippe Proulx <pproulx@efficios.com>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; only version 2
-# of the License.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-#
-
-if [ "x${BT_TESTS_SRCDIR:-}" != "x" ]; then
-       UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh"
-else
-       UTILSSH="$(dirname "$0")/../../utils/utils.sh"
-fi
-
-# shellcheck source=../../utils/utils.sh
-source "$UTILSSH"
-
-export BT_DEBUG_INFO_PATH
-
-run_python_bt2_test "${BT_TESTS_SRCDIR}/plugins/flt.lttng-utils.debug-info" \
-       "test_lttng_utils_debug_info.py"
diff --git a/tests/plugins/flt.lttng-utils.debug-info/test_lttng_utils_debug_info.py b/tests/plugins/flt.lttng-utils.debug-info/test_lttng_utils_debug_info.py
deleted file mode 100644 (file)
index a79ca47..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-# Copyright (C) 2019 EfficiOS Inc.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; only version 2
-# of the License.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-#
-
-import unittest
-import os.path
-import bt2
-import os
-
-
-@unittest.skip('depends on Python bindings, which are broken')
-class LttngUtilsDebugInfoTestCase(unittest.TestCase):
-    def test_debug_info(self):
-        debug_info_data_path = os.environ['BT_DEBUG_INFO_PATH']
-        trace_path = os.path.join(debug_info_data_path, 'trace')
-        target_prefix = os.path.join(debug_info_data_path, '..', '..')
-        src = bt2.ComponentSpec('ctf', 'fs', trace_path)
-        flt = bt2.ComponentSpec(
-            'lttng-utils', 'debug-info', {'target-prefix': target_prefix}
-        )
-        it = bt2.TraceCollectionNotificationIterator(src, flt, [bt2.EventNotification])
-        notifs = list(it)
-        debug_info = notifs[2].event['debug_info']
-        self.assertEqual(debug_info['bin'], 'libhello_so+0x14d4')
-        self.assertEqual(debug_info['func'], 'foo+0xa9')
-        self.assertEqual(debug_info['src'], 'libhello.c:7')
-        debug_info = notifs[3].event['debug_info']
-        self.assertEqual(debug_info['bin'], 'libhello_so+0x15a6')
-        self.assertEqual(debug_info['func'], 'bar+0xa9')
-        self.assertEqual(debug_info['src'], 'libhello.c:13')
diff --git a/tests/plugins/flt.lttng-utils.debug-info/test_succeed b/tests/plugins/flt.lttng-utils.debug-info/test_succeed
new file mode 100755 (executable)
index 0000000..b57b7a7
--- /dev/null
@@ -0,0 +1,59 @@
+#!/bin/bash
+#
+# Copyright (C) 2019 Philippe Proulx <pproulx@efficios.com>
+# Copyright (C) 2019 Francis Deslauriers <francis.deslauriers@efficios.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; only version 2
+# of the License.
+#
+# 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+# This test validates that a `src.ctf.fs` component successfully reads
+# specific CTF traces and creates the expected messages.
+#
+# Such CTF traces to open either exist (in `tests/ctf-traces/succeed`)
+# or are generated by this test using local trace generators.
+
+SH_TAP=1
+
+if [ "x${BT_TESTS_SRCDIR:-}" != "x" ]; then
+       UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh"
+else
+       UTILSSH="$(dirname "$0")/../../utils/utils.sh"
+fi
+
+# shellcheck source=../../../utils/utils.sh
+source "$UTILSSH"
+
+this_dir_relative="plugins/flt.lttng-utils.debug-info"
+this_dir_build="$BT_TESTS_BUILDDIR/$this_dir_relative"
+succeed_trace_dir="$BT_CTF_TRACES_PATH/succeed"
+expect_dir="$BT_TESTS_DATADIR/$this_dir_relative"
+binary_artefact_dir="$BT_TESTS_DATADIR/$this_dir_relative"
+
+test_debug_info() {
+       local name="$1"
+       local local_args=(
+               "-c" "flt.lttng-utils.debug-info"
+               "-p" "target-prefix=\"$binary_artefact_dir/x86_64-linux-gnu/dwarf_full\""
+               "-c" "sink.text.details"
+               "-p" "with-trace-name=no,with-stream-name=no"
+       )
+
+       bt_diff_cli "$expect_dir/trace-$name.expect" "/dev/null" \
+               "$succeed_trace_dir/$name" "${local_args[@]}"
+       ok $? "Trace '$name' gives the expected output"
+}
+
+plan_tests 1
+
+test_debug_info debug-info
index 27a5f3ee903e4fd85d165a151fcf3955ab58383c..baef441a3718f71ca883be12c10d474359ecc256 100644 (file)
@@ -129,7 +129,6 @@ export BT_TESTS_SED_BIN
 # Data files path
 BT_TESTS_DATADIR="${BT_TESTS_SRCDIR}/data"
 BT_CTF_TRACES_PATH="${BT_TESTS_DATADIR}/ctf-traces"
-BT_DEBUG_INFO_PATH="${BT_TESTS_DATADIR}/debug-info"
 
 
 ### Diff Functions ###
This page took 0.054777 seconds and 4 git commands to generate.