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
--- /dev/null
+/* 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;
+ };
+};
+
+++ /dev/null
-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
+++ /dev/null
-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" } }
+++ /dev/null
-/*
- * 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");
-}
+++ /dev/null
-/*
- * 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 */
+++ /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
-/*
- * 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"
+++ /dev/null
-/*
- * 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>
+++ /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);
-};
-
--- /dev/null
+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
--- /dev/null
+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" }
--- /dev/null
+/*
+ * 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");
+}
--- /dev/null
+/*
+ * 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 */
--- /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
+/*
+ * 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"
--- /dev/null
+/*
+ * 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>
--- /dev/null
+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
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 =
# 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 \
# 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 \
# 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 \
# 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 \
# 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"
# 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"
# 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"
# 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/"
+++ /dev/null
-#!/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"
+++ /dev/null
-#
-# 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')
--- /dev/null
+#!/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
# 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 ###