public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: "idealities at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: systemtap@sourceware.org
Subject: [Bug tapsets/23879] print_ubacktrace can not print function name
Date: Tue, 13 Nov 2018 01:58:00 -0000	[thread overview]
Message-ID: <bug-23879-6586-7xdeUrlPUh@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-23879-6586@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=23879

--- Comment #3 from Shang Yuanchun <idealities at gmail dot com> ---
(In reply to Frank Ch. Eigler from comment #2)
> It depends how the two versions of the target program were compiled. 
> Perhaps the second one was stripped (including symbol info), so stap (and
> tools like gdb) would have no chance to resolve addresses to names.  Perhaps
> the unwind data was not generated the same way (possibly CFLAGS without
> -fasynchronous-unwind-tables?).
> 
> A comparison with "readelf -S" between the two binaries could help clear
> this up.
> 
> Also, that advice re. rerunning with -DDEBUG_UNWIND is a good one, the data
> would help.

Thanks.

Actually the first one was strippped (but with right print_ubacktrace()), the
second not:

$ file /bin/htop
/bin/htop: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically
linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0,
BuildID[sha1]=f124a5c165c15004fab233235b393e078a52f4f5, stripped

$ file ./htop
./htop: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically
linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0,
BuildID[sha1]=b6c11a7eda8d30b90a46f940fc9178e3665b399a, not stripped

I used CFLAGS and LDFLAGS as below, to make it same as package built by
archlinux (-fasynchronous-unwind-tables is added by your advice, but the
problem still occurs):

CFLAGS="-fasynchronous-unwind-tables -march=x86-64 -mtune=generic -O2 -pipe
-fstack-protector-strong -fno-plt "
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"


With -DDEBUG_UNWIND:

$ stap -v -DSTP_NO_BUILDID_CHECK -DDEBUG_UNWIND -e 'probe process.function("*")
{ print_ubacktrace(); exit() }' -x 1174
Pass 1: parsed user script and 470 library scripts using
75332virt/51916res/7208shr/44872data kb, in 90usr/20sys/112real ms.
Pass 2: analyzed script: 341 probes, 2 functions, 0 embeds, 0 globals using
77444virt/55156res/8208shr/46984data kb, in 10usr/10sys/15real ms.
Pass 3: translated to C into
"/tmp/stap9fZbm5/stap_c1cd55b8b696f02a065ad588361b3e36_90426_src.c" using
77884virt/55708res/8400shr/47424data kb, in 20usr/100sys/119real ms.
Pass 4: compiled C into "stap_c1cd55b8b696f02a065ad588361b3e36_90426.ko" in
3170usr/420sys/3493real ms.
Pass 5: starting run.
WARNING: Missing unwind data for a module, rerun with 'stap -d (unknown; retry
with -DDEBUG_UNWIND)'
_stp_stack_unwind_one_user:496: STARTING user unwind
 0x56235b12d100
_stp_stack_unwind_one_user:512: CONTINUING user unwind to depth 1
unwind:1483: pc=56235b12d100, 56235b12d100
unwind:1522: No module found for pc=56235b12d100
_stp_stack_unwind_one_user:537: ret=-22 PC=56235b12d100 SP=7ffedbacaaa8
Pass 5: run completed in 10usr/30sys/1238real ms.


readelf output:

$ LANG=en_US.UTF-8 readelf -S ./htop
There are 27 section headers, starting at offset 0x33b18:

Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [ 0]                   NULL             0000000000000000  00000000
       0000000000000000  0000000000000000           0     0     0
  [ 1] .interp           PROGBITS         00000000000002a8  000002a8
       000000000000001c  0000000000000000   A       0     0     1
  [ 2] .note.ABI-tag     NOTE             00000000000002c4  000002c4
       0000000000000020  0000000000000000   A       0     0     4
  [ 3] .note.gnu.build-i NOTE             00000000000002e4  000002e4
       0000000000000024  0000000000000000   A       0     0     4
  [ 4] .gnu.hash         GNU_HASH         0000000000000308  00000308
       0000000000000fa0  0000000000000000   A       5     0     8
  [ 5] .dynsym           DYNSYM           00000000000012a8  000012a8
       00000000000029d0  0000000000000018   A       6     1     8
  [ 6] .dynstr           STRTAB           0000000000003c78  00003c78
       00000000000019b8  0000000000000000   A       0     0     1
  [ 7] .gnu.version      VERSYM           0000000000005630  00005630
       000000000000037c  0000000000000002   A       5     0     2
  [ 8] .gnu.version_r    VERNEED          00000000000059b0  000059b0
       00000000000000a0  0000000000000000   A       6     2     8
  [ 9] .rela.dyn         RELA             0000000000005a50  00005a50
       00000000000055b0  0000000000000018   A       5     0     8
  [10] .init             PROGBITS         000000000000b000  0000b000
       000000000000001b  0000000000000000  AX       0     0     4
  [11] .text             PROGBITS         000000000000b020  0000b020
       0000000000014df5  0000000000000000  AX       0     0     16
  [12] .fini             PROGBITS         000000000001fe18  0001fe18
       000000000000000d  0000000000000000  AX       0     0     4
  [13] .rodata           PROGBITS         0000000000020000  00020000
       00000000000034a0  0000000000000000   A       0     0     16
  [14] .eh_frame_hdr     PROGBITS         00000000000234a0  000234a0
       0000000000000a84  0000000000000000   A       0     0     4
  [15] .eh_frame         PROGBITS         0000000000023f28  00023f28
       0000000000003df0  0000000000000000   A       0     0     8
  [16] .init_array       INIT_ARRAY       0000000000029c50  00028c50
       0000000000000008  0000000000000008  WA       0     0     8
  [17] .fini_array       FINI_ARRAY       0000000000029c58  00028c58
       0000000000000008  0000000000000008  WA       0     0     8
  [18] .data.rel.ro      PROGBITS         0000000000029c60  00028c60
       0000000000000d90  0000000000000000  WA       0     0     32
  [19] .dynamic          DYNAMIC          000000000002a9f0  000299f0
       00000000000001d0  0000000000000010  WA       6     0     8
  [20] .got              PROGBITS         000000000002abc0  00029bc0
       0000000000000438  0000000000000008  WA       0     0     8
  [21] .data             PROGBITS         000000000002b000  0002a000
       0000000000002a80  0000000000000000  WA       0     0     32
  [22] .bss              NOBITS           000000000002da80  0002ca80
       0000000000000eb0  0000000000000000  WA       0     0     32
  [23] .comment          PROGBITS         0000000000000000  0002ca80
       000000000000001a  0000000000000001  MS       0     0     1
  [24] .symtab           SYMTAB           0000000000000000  0002caa0
       0000000000004218  0000000000000018          25   260     8
  [25] .strtab           STRTAB           0000000000000000  00030cb8
       0000000000002d5f  0000000000000000           0     0     1
  [26] .shstrtab         STRTAB           0000000000000000  00033a17
       00000000000000fd  0000000000000000           0     0     1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  l (large), p (processor specific)

-- 
You are receiving this mail because:
You are the assignee for the bug.

  parent reply	other threads:[~2018-11-13  1:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-12  9:52 [Bug tapsets/23879] New: " idealities at gmail dot com
2018-11-12  9:53 ` [Bug tapsets/23879] " idealities at gmail dot com
2018-11-12 14:28 ` fche at redhat dot com
2018-11-13  1:58 ` idealities at gmail dot com [this message]
2018-11-13  5:35 ` idealities at gmail dot com
2019-08-21 14:05 ` fche at redhat dot com
2019-08-22  0:12 ` fche at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-23879-6586-7xdeUrlPUh@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=systemtap@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).