public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug tapsets/23799] New: sprint_ustack() returns empty strings while sprint_ubacktrace() does not
@ 2018-10-19 18:59 agentzh at gmail dot com
  2018-10-19 19:01 ` [Bug tapsets/23799] " agentzh at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: agentzh at gmail dot com @ 2018-10-19 18:59 UTC (permalink / raw)
  To: systemtap

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

            Bug ID: 23799
           Summary: sprint_ustack() returns empty strings while
                    sprint_ubacktrace() does not
           Product: systemtap
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tapsets
          Assignee: systemtap at sourceware dot org
          Reporter: agentzh at gmail dot com
  Target Milestone: ---

Consider the following minimal C program:

```
int foo(void) {
    return 3;
}

int bar(void) {
    return foo();
}

int main(void) {
    bar();
    return 0;
}
```

Compile and link it like this:

```
gcc -g test.c
```

And then run the following stap oneliner:

```
stap -e 'probe process.function("foo") { printf("{%s}\n{%s}",
sprint_ustack(ubacktrace()), sprint_ubacktrace()); }' -c ./a.out --ldd
```

And the output is

```
{}
{foo+0x4 [a.out]
bar+0x9 [a.out]
main+0x9 [a.out]
__libc_start_main+0xea [libc-2.26.so]
_start+0x2a [a.out]}
```

The weird thing is that `sprint_ustack(ubacktrace())` returns an empty string
while `sprint_ubacktrace()` does not. Why the difference? Is there a bug in
`sprint_ustack()`? Any hints on debugging this thing?

Thanks!

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tapsets/23799] sprint_ustack() returns empty strings while sprint_ubacktrace() does not
  2018-10-19 18:59 [Bug tapsets/23799] New: sprint_ustack() returns empty strings while sprint_ubacktrace() does not agentzh at gmail dot com
@ 2018-10-19 19:01 ` agentzh at gmail dot com
  2018-10-19 21:15 ` agentzh at gmail dot com
  2018-10-19 22:12 ` agentzh at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: agentzh at gmail dot com @ 2018-10-19 19:01 UTC (permalink / raw)
  To: systemtap

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

--- Comment #1 from agentzh <agentzh at gmail dot com> ---
Oh, BTW, I'm using the latest stap master on x86_64 (Fedora 26, kernel
4.16.16).

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tapsets/23799] sprint_ustack() returns empty strings while sprint_ubacktrace() does not
  2018-10-19 18:59 [Bug tapsets/23799] New: sprint_ustack() returns empty strings while sprint_ubacktrace() does not agentzh at gmail dot com
  2018-10-19 19:01 ` [Bug tapsets/23799] " agentzh at gmail dot com
@ 2018-10-19 21:15 ` agentzh at gmail dot com
  2018-10-19 22:12 ` agentzh at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: agentzh at gmail dot com @ 2018-10-19 21:15 UTC (permalink / raw)
  To: systemtap

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

--- Comment #2 from agentzh <agentzh at gmail dot com> ---
Using `print_ustack(ubacktrace())` works:

```
$ stap -e 'probe process.function("foo") { print_ustack(ubacktrace()); }' -c
./a.out --ldd
 0x40048b : foo+0x4/0xb [/mnt/home/agentzh/git/ylang/a.out]
 0x40049b : bar+0x9/0xb [/mnt/home/agentzh/git/ylang/a.out]
 0x4004a6 : main+0x9/0x13 [/mnt/home/agentzh/git/ylang/a.out]
 0x7f3e87d0ffea : __libc_start_main+0xea/0x1c0 [/usr/lib64/libc-2.26.so]
 0x4003da : _start+0x2a/0x30 [/mnt/home/agentzh/git/ylang/a.out]
```

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tapsets/23799] sprint_ustack() returns empty strings while sprint_ubacktrace() does not
  2018-10-19 18:59 [Bug tapsets/23799] New: sprint_ustack() returns empty strings while sprint_ubacktrace() does not agentzh at gmail dot com
  2018-10-19 19:01 ` [Bug tapsets/23799] " agentzh at gmail dot com
  2018-10-19 21:15 ` agentzh at gmail dot com
@ 2018-10-19 22:12 ` agentzh at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: agentzh at gmail dot com @ 2018-10-19 22:12 UTC (permalink / raw)
  To: systemtap

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

agentzh <agentzh at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from agentzh <agentzh at gmail dot com> ---
Committed a fix to master already.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-10-19 22:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-19 18:59 [Bug tapsets/23799] New: sprint_ustack() returns empty strings while sprint_ubacktrace() does not agentzh at gmail dot com
2018-10-19 19:01 ` [Bug tapsets/23799] " agentzh at gmail dot com
2018-10-19 21:15 ` agentzh at gmail dot com
2018-10-19 22:12 ` agentzh at gmail dot com

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).