You are not logged in.

#1 2018-11-11 14:55:32

ideal
Member
From: Hangzhou
Registered: 2018-11-11
Posts: 6
Website

SystemTap: print_ubacktrace() can not get function name

I am not sure if I am posting at the right place. If I am wrong, I am sorry.

I install SystemTap from PKGBUILD mainly like this:

build() {
  cd "${pkgname}-${pkgver}"
  ./configure \
    --prefix=/usr \
    --sbindir=/usr/bin \
    --sysconfdir=/etc \
    --libexecdir=/usr/lib/"${pkgname}" \
    --libdir=/usr/lib/"${pkgname}" \
    --mandir=/usr/share/man/ \
    --localstatedir=/var \
    --enable-pie \
    --disable-docs \
    --enable-htmldocs
  make
}
$ stap --version
Systemtap translator/driver (version 4.0/0.174, non-git sources)
Copyright (C) 2005-2018 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
tested kernel versions: 2.6.18 ... 4.19-rc7
enabled features: AVAHI BPF PYTHON2 PYTHON3 LIBSQLITE3 LIBXML2 NLS NSS READLINE

I created a add.c for test:

#include <stdio.h>

int add()
{
    int a;

    while (1) {
        a += 100;
    }

    return a;
}

int main()
{
    return add();
}

and compile it like this:

$ gcc add.c -g -o add

Then I run ./add and get its pid and run stap like this:

$ stap  -v  -DSTP_NO_BUILDID_CHECK -e 'probe process.function("*") { print_ubacktrace(); exit() }' -x 17629
Pass 1: parsed user script and 473 library scripts using 119380virt/88408res/7632shr/81152data kb, in 160usr/40sys/203real ms.
Pass 2: analyzed script: 11 probes, 2 functions, 0 embeds, 0 globals using 120964virt/91212res/8568shr/82736data kb, in 10usr/0sys/7real ms.
Pass 3: translated to C into "/tmp/staptoXvmT/stap_2361e87b2b10fc8a3b192726a134db47_4545_src.c" using 121216virt/91816res/8824shr/82988data kb, in 40usr/330sys/376real ms.
Pass 4: compiled C into "stap_2361e87b2b10fc8a3b192726a134db47_4545.ko" in 3690usr/520sys/3959real ms.
Pass 5: starting run.
WARNING: Missing unwind data for a module, rerun with 'stap -d (unknown; retry with -DDEBUG_UNWIND)'
 0x5583c923411d
Pass 5: run completed in 10usr/40sys/644real ms.

Only an address 0x5583c923411d is printed, with out its function name. I searched and still can not fix it. Does someone know the reason and give some clue? Thank you in advance.

Last edited by ideal (2018-11-12 09:15:33)

Offline

#2 2018-11-11 15:48:04

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,653
Website

Re: SystemTap: print_ubacktrace() can not get function name

Welcome to the Arch Linux forums, ideal. Please edit your post to include code tags around your terminal output/PKGBUILD snippet, it helps make your post more readable.

https://wiki.archlinux.org/index.php/Co … s_and_code


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#3 2018-11-12 09:16:57

ideal
Member
From: Hangzhou
Registered: 2018-11-11
Posts: 6
Website

Re: SystemTap: print_ubacktrace() can not get function name

WorMzy wrote:

Welcome to the Arch Linux forums, ideal. Please edit your post to include code tags around your terminal output/PKGBUILD snippet, it helps make your post more readable.

https://wiki.archlinux.org/index.php/Co … s_and_code

Sorry. Edited.

Offline

#4 2018-11-12 09:26:46

ideal
Member
From: Hangzhou
Registered: 2018-11-11
Posts: 6
Website

Re: SystemTap: print_ubacktrace() can not get function name

I have found some clues. If i use systemtap attaching to process which originated from packages of archlinux, e.g. htop, it can print right user backtrace:

$ stap -v  -e 'probe process.function("*") { print_ubacktrace(); exit() }' -x 4924
Pass 1: parsed user script and 470 library scripts using 75324virt/51500res/6800shr/44864data kb, in 100usr/10sys/110real ms.
Pass 2: analyzed script: 234 probes, 2 functions, 0 embeds, 0 globals using 77040virt/54192res/7668shr/46580data kb, in 10usr/0sys/11real ms.
Pass 3: translated to C into "/tmp/stapOV3tv1/stap_1bc1f6af99b98d562e15bc3b6e4ee1a2_52098_src.c" using 77184virt/54628res/7924shr/46724data kb, in 10usr/100sys/111real ms.
Pass 4: compiled C into "stap_1bc1f6af99b98d562e15bc3b6e4ee1a2_52098.ko" in 3070usr/460sys/3418real ms.
Pass 5: starting run.
WARNING: Missing unwind data for a module, rerun with 'stap -d (unknown; retry with -DDEBUG_UNWIND)'
 0x55c3c7f8f9c0 : ProcessList_scan+0x0/0x1a0 [/usr/bin/htop]
 0x55c3c7f90497 : ScreenManager_run+0x107/0x11e0 [/usr/bin/htop]
 0x55c3c7f86c51 : main+0x451/0x660 [/usr/bin/htop]
 0x7f067850d223
Pass 5: run completed in 10usr/20sys/1033real ms.

However, if i compile htop mannully or make and install it from PKGBUILD, and use systemtap attaching to this htop:

$ stap -v -DSTP_NO_BUILDID_CHECK -e 'probe process.function("*") { print_ubacktrace(); exit() }' -x 5465
Pass 1: parsed user script and 470 library scripts using 75332virt/51852res/7144shr/44872data kb, in 90usr/10sys/106real ms.
Pass 2: analyzed script: 341 probes, 2 functions, 0 embeds, 0 globals using 77444virt/55028res/8080shr/46984data kb, in 10usr/0sys/14real ms.
Pass 3: using cached /root/.systemtap/cache/3d/stap_3d92b79fdcedbfc63746fbaa7ff985f2_90414.c
Pass 4: using cached /root/.systemtap/cache/3d/stap_3d92b79fdcedbfc63746fbaa7ff985f2_90414.ko
Pass 5: starting run.
WARNING: Missing unwind data for a module, rerun with 'stap -d (unknown; retry with -DDEBUG_UNWIND)'
 0x5608a9394100
Pass 5: run completed in 10usr/20sys/1038real ms.

This time it can not print right user backtrace.

The only difference i think is the compiler version. My gcc version is 8.2.1 20180831 (GCC). (However i do not know the version of gcc which built archlinux packages).

Maybe it is the compatible error between new gcc versions and systemtap (or its dependencies like elfutils), have not figured out yet.

Offline

Board footer

Powered by FluxBB