[lttng-dev] Trying to understand use of lttng enable-event --kernel --userspace-probe=

Brian Hutchinson b.hutchman at gmail.com
Thu May 18 15:28:38 EDT 2023

On Thu, May 18, 2023 at 3:16 PM Mathieu Desnoyers
<mathieu.desnoyers at efficios.com> wrote:
> On 2023-05-18 15:07, Brian Hutchinson wrote:
> [...]
> >>
> >> If you attach to an ELF symbol (function), then there is no USDT in
> >> play, so it should not be related to the issue you have.
> >
> > That is what I was thinking which is why I wanted to try it.
> >
> >>
> >> But if your functions happen to be inlined, then there will be nothing
> >> to attach to. Perhaps this is what happens there ?
> >
> > I don't see any evidence of anything being inlined in this module.  I
> > grepped the code to verify.
> >
> > Back to being stumped/stuck.
> Make sure to check the resulting assembler and ELF symbol tables.
> The compiler is free to inline various functions unless they are
> explicitly marked as __attribute__((noinline)). Also, if LTO is enabled,

I could put that in the code just to make sure.  It's a big function
so doubt it but I'll try anything at this point ha, ha.

I wondered if optimization could be doing it.

I can provide the standard yocto environment script that's being
source that was generated for the sdk:

$ cat environment-setup-aarch64-poky-linux

# Check for LD_LIBRARY_PATH being set, which can break SDK and
generally is a bad practice
# http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN80
# http://xahlee.info/UnixResource_dir/_/ldpath.html
# Only disable this check if you are absolutely know what you are doing!
if [ ! -z "${LD_LIBRARY_PATH:-}" ]; then
   echo "Your environment is misconfigured, you probably need to
   echo "but please check why this was set in the first place and that
it's safe to unset."
   echo "The SDK will not operate correctly in most cases when
   echo "For more references see:"
   echo "  http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN80"
   echo "  http://xahlee.info/UnixResource_dir/_/ldpath.html"
   return 1
export SDKTARGETSYSROOT=/opt/poky/3.1.24/sysroots/aarch64-poky-linux
export PATH=/opt/poky/3.1.24/sysroots/x86_64-pokysdk-linux/usr/bin:/opt/poky/3.1.24/sysroots/x86_64-pokysdk-linux/usr/sbin:/opt/poky/3.1.24/sysroots/x86_64-pokysdk-linux/bin:/opt/poky/3.1.24/sysroots/x86_64-pokysdk-linux/sbin:/opt/poky/3.1.24/sysroots/x86_64-pokysdk-linux/usr/
export PKG_CONFIG_PATH=$SDKTARGETSYSROOT/usr/lib/pkgconfig:$SDKTARGETSYSROOT/usr/share/pkgconfig
export CONFIG_SITE=/opt/poky/3.1.24/site-config-aarch64-poky-linux
export OECORE_NATIVE_SYSROOT="/opt/poky/3.1.24/sysroots/x86_64-pokysdk-linux"
export OECORE_BASELIB="lib"
export OECORE_TARGET_ARCH="aarch64"
export OECORE_TARGET_OS="linux"
unset command_not_found_handle
export CC="aarch64-poky-linux-gcc  -mcpu=cortex-a53+crc+crypto
-fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat
-Wformat-security -Werror=format-security --sysroot=$SDKTARGETSYSROOT"
export CXX="aarch64-poky-linux-g++  -mcpu=cortex-a53+crc+crypto
-fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat
-Wformat-security -Werror=format-security --sysroot=$SDKTARGETSYSROOT"
export CPP="aarch64-poky-linux-gcc -E  -mcpu=cortex-a53+crc+crypto
-fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat
-Wformat-security -Werror=format-security --sysroot=$SDKTARGETSYSROOT"
export AS="aarch64-poky-linux-as "
export LD="aarch64-poky-linux-ld  --sysroot=$SDKTARGETSYSROOT"
export GDB=aarch64-poky-linux-gdb
export STRIP=aarch64-poky-linux-strip
export RANLIB=aarch64-poky-linux-ranlib
export OBJCOPY=aarch64-poky-linux-objcopy
export OBJDUMP=aarch64-poky-linux-objdump
export READELF=aarch64-poky-linux-readelf
export AR=aarch64-poky-linux-ar
export NM=aarch64-poky-linux-nm
export M4=m4
export TARGET_PREFIX=aarch64-poky-linux-
export CONFIGURE_FLAGS="--target=aarch64-poky-linux
--host=aarch64-poky-linux --build=x86_64-linux
export CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types "
export CXXFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types "
export LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed
-fstack-protector-strong -Wl,-z,relro,-z,now"
export CPPFLAGS=""
export OECORE_SDK_VERSION="3.1.24"
export ARCH=arm64
export CROSS_COMPILE=aarch64-poky-linux-

# Append environment subscripts
if [ -d "$OECORE_TARGET_SYSROOT/environment-setup.d" ]; then
   for envfile in $OECORE_TARGET_SYSROOT/environment-setup.d/*.sh; do
           . $envfile
if [ -d "$OECORE_NATIVE_SYSROOT/environment-setup.d" ]; then
   for envfile in $OECORE_NATIVE_SYSROOT/environment-setup.d/*.sh; do
           . $envfile

> further optimization can be done at link-time.
> One purpose of the UST tracepoints is to be less fragile with respect to
> specific optimizations done by the compiler and linker, thus
> guaranteeing that whatever is instrumented with a tracepoint is indeed
> available for tracing.
> Also, double-check that the path you pass to --userspace-probe really
> targets your executable or .so binary file, and is not just a symbolic link.

It is full path.
> Thanks,
> Mathieu
> --
> Mathieu Desnoyers
> EfficiOS Inc.
> https://www.efficios.com

More information about the lttng-dev mailing list