lttng_enable_kernel_userspace_probe_event_ok $SESSION_NAME "$ENABLE_EXPR" $PROBE_EVENT_NAME
start_lttng_tracing_ok $SESSION_NAME
- eval "$ELF_TEST_BIN" > /dev/null
+ LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$TESTDIR/utils/testapp/userspace-probe-elf-binary/.libs" "$ELF_TEST_BIN" > /dev/null
stop_lttng_tracing_ok $SESSION_NAME
validate_trace $PROBE_EVENT_NAME "$TRACE_PATH"
lttng_enable_kernel_userspace_probe_event_ok $SESSION_NAME "$ENABLE_EXPR" $PROBE_EVENT_NAME
start_lttng_tracing_ok $SESSION_NAME
- eval "$ELF_TEST_BIN" > /dev/null
+ LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$TESTDIR/utils/testapp/userspace-probe-elf-binary/.libs" "$ELF_TEST_BIN" > /dev/null
stop_lttng_tracing_ok $SESSION_NAME
validate_trace $PROBE_EVENT_NAME "$TRACE_PATH"
PROVIDER="foobar"
PROBE="tp1"
ENABLE_EXPR="sdt:$SDT_TEST_BIN:$PROVIDER:$PROBE"
+ SESSION_NAME="${FUNCNAME[0]}"
diag "Userspace probe on SDT tracepoint enabled and traced"
lttng_enable_kernel_userspace_probe_event_ok $SESSION_NAME "$ENABLE_EXPR" $PROBE_EVENT_NAME
start_lttng_tracing_ok $SESSION_NAME
- eval "$SDT_TEST_BIN" > /dev/null
+ LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$TESTDIR/utils/testapp/userspace-probe-sdt-binary/.libs" "$SDT_TEST_BIN" > /dev/null
stop_lttng_tracing_ok $SESSION_NAME
validate_trace $PROBE_EVENT_NAME "$TRACE_PATH"
lttng_enable_kernel_userspace_probe_event_ok $SESSION_NAME "$ENABLE_EXPR" $PROBE_EVENT_NAME
start_lttng_tracing_ok $SESSION_NAME
- eval "$SDT_TEST_BIN" > /dev/null
+ LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$TESTDIR/utils/testapp/userspace-probe-sdt-binary/.libs" "$SDT_TEST_BIN" > /dev/null
stop_lttng_tracing_ok $SESSION_NAME
validate_trace $PROBE_EVENT_NAME "$TRACE_PATH"
lttng_enable_kernel_userspace_probe_event_ok $SESSION_NAME "$ENABLE_EXPR" $PROBE_EVENT_NAME
start_lttng_tracing_ok $SESSION_NAME
- eval "$SDT_TEST_BIN" > /dev/null
+ LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$TESTDIR/utils/testapp/userspace-probe-sdt-binary/.libs" "$SDT_TEST_BIN" > /dev/null
stop_lttng_tracing_ok $SESSION_NAME
validate_trace $PROBE_EVENT_NAME "$TRACE_PATH"
lttng_enable_kernel_userspace_probe_event_ok $SESSION_NAME "$ENABLE_EXPR" $PROBE_EVENT_NAME
start_lttng_tracing_ok $SESSION_NAME
- eval "$SDT_TEST_BIN" > /dev/null
+ LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$TESTDIR/utils/testapp/userspace-probe-sdt-binary/.libs" "$SDT_TEST_BIN" > /dev/null
stop_lttng_tracing_ok $SESSION_NAME
validate_trace $PROBE_EVENT_NAME "$TRACE_PATH"
lttng_enable_kernel_userspace_probe_event_ok $SESSION_NAME "$ENABLE_EXPR" $PROBE_EVENT_NAME
start_lttng_tracing_ok $SESSION_NAME
- eval "$SDT_TEST_BIN" > /dev/null
+ LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$TESTDIR/utils/testapp/userspace-probe-sdt-binary/.libs" "$SDT_TEST_BIN" > /dev/null
stop_lttng_tracing_ok $SESSION_NAME
validate_trace $PROBE_EVENT_NAME "$TRACE_PATH"
lttng_enable_kernel_userspace_probe_event_ok $SESSION_NAME "$ENABLE_EXPR" $PROBE_EVENT_NAME
start_lttng_tracing_ok $SESSION_NAME
- LD_PRELOAD="$SDT_TEST_BIN_DIR/libzzz.so" eval "$SDT_TEST_BIN" > /dev/null
+ LD_PRELOAD="$SDT_TEST_BIN_DIR/libzzz.so" LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$TESTDIR/utils/testapp/userspace-probe-sdt-binary/.libs" "$SDT_TEST_BIN" > /dev/null
stop_lttng_tracing_ok $SESSION_NAME
validate_trace $PROBE_EVENT_NAME "$TRACE_PATH"
lttng_enable_kernel_userspace_probe_event_ok $SESSION_NAME "$ENABLE_EXPR" $PROBE_EVENT_NAME
start_lttng_tracing_ok $SESSION_NAME
- eval "$SDT_TEST_BIN" > /dev/null
+ LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$TESTDIR/utils/testapp/userspace-probe-sdt-binary/.libs" "$SDT_TEST_BIN" > /dev/null
stop_lttng_tracing_ok $SESSION_NAME
validate_trace $PROBE_EVENT_NAME "$TRACE_PATH"
shift
for i in $(seq 1 "$nr"); do
- $USERSPACE_PROBE_ELF_TESTAPP_BIN "$@"
+ # This userspace probe test has to instrument the actual elf
+ # binary and not the generated libtool wrapper. However, we
+ # can't invoke the wrapper either since it will re-link the test
+ # application binary on its first invocation, resulting in a new
+ # binary with an 'lt-*' prefix under the .libs folder. The
+ # relinking stage adds the .libs folder to the 'lt-*' binary's
+ # rpath.
+ #
+ # To ensure the binary (inode) that instrumented is the same as
+ # what is running, set LD_LIBRARY_PATH to find the .libs folder
+ # that contains the libfoo.so library and invoke the binary
+ # directly.
+ LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$TESTDIR/utils/testapp/userspace-probe-elf-binary/.libs" $USERSPACE_PROBE_ELF_TESTAPP_BIN "$@"
done
}
libzzz_la_SOURCES = libzzz.c libzzz.h
libzzz_la_LDFLAGS = -module -shared -avoid-version \
- -rpath $(abs_builddir)
+ -rpath $(libdir)
libbar_la_SOURCES = libbar.c libbar.h
libbar_la_LDFLAGS = -module -shared -avoid-version \
- -rpath $(abs_builddir)
+ -rpath $(libdir)
libbar_la_LIBADD = libzzz.la
libfoo_la_SOURCES = libfoo.c libfoo.h
libfoo_la_LDFLAGS = -module -shared -avoid-version \
- -rpath $(abs_builddir)
+ -rpath $(libdir)
libfoo_la_LIBADD = libbar.la
CLEANFILES = libfoo.so libfoo.so.debug libbar.so libbar.so.debug \
libtp_la_SOURCES = libbar-tp.h libbar-tp.c libfoo-tp.h libfoo-tp.c \
libzzz-tp.h libzzz-tp.c
-libtp_la_LDFLAGS = -module -shared -rpath $(abs_builddir)
+libtp_la_LDFLAGS = -module -shared -rpath $(libdir)
# Extract debug symbols
libfoo.so.debug: libfoo.la
libfoo_la_SOURCES = libfoo.h libfoo.c
libfoo_la_LIBADD = foobar_provider.o
libfoo_la_CFLAGS = -I$(abs_builddir)
-libfoo_la_LDFLAGS = -module -shared -avoid-version -rpath $(abs_builddir)/.libs/
+libfoo_la_LDFLAGS = -module -shared -avoid-version -rpath $(libdir)
nodist_libfoo_la_SOURCES = $(abs_builddir)/foobar_provider.h
libbar_la_SOURCES = libbar.h libbar.c
libbar_la_LIBADD = foobar_provider.o
libbar_la_CFLAGS = -I$(abs_builddir)
-libbar_la_LDFLAGS = -module -shared -avoid-version -rpath $(abs_builddir)/.libs/
+libbar_la_LDFLAGS = -module -shared -avoid-version -rpath $(libdir)
nodist_libbar_la_SOURCES = $(abs_builddir)/foobar_provider.h
libzzz_la_SOURCES = libzzz.h libzzz.c
libzzz_la_LIBADD = foobar_provider.o
libzzz_la_CFLAGS = -I$(abs_builddir)
-libzzz_la_LDFLAGS = -module -shared -avoid-version -rpath $(abs_builddir)/.libs/
+libzzz_la_LDFLAGS = -module -shared -avoid-version -rpath $(libdir)
nodist_libzzz_la_SOURCES = $(abs_builddir)/foobar_provider.h
dtrace_verbose = $(dtrace_verbose_@AM_V@)