public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug runtime/11898] New: cannot unwind through some glibc functions
@ 2010-08-10 11:07 mjw at redhat dot com
  2010-08-10 11:12 ` [Bug runtime/11898] " mjw at redhat dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: mjw at redhat dot com @ 2010-08-10 11:07 UTC (permalink / raw)
  To: systemtap

There seems to be some problem unwinding through some glibc/libpthread functions.

$ cat foo.c
#include <pthread.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>

pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;

void foo(int n)
{
  printf("foo %d\n", n);
  if (n == 0)
    {
      puts("trying to get mutex");
      pthread_mutex_lock(&m);
      puts("got it...");
      sleep(1);
      exit(0);
    }
  foo(--n);
}

void* run_thread(void* v)
{
  foo(5);
}

int main()
{
  puts("go main!");
  pthread_t th;
  // Take lock, so thread doesn't get it immediately.
  pthread_mutex_lock(&m);
  pthread_create(&th, 0, &run_thread, 0);
  sleep(1);
  pthread_mutex_unlock(&m);

  for(;;) ;
}

$ gcc -g -o foo foo.c -lpthread

$ stap -d ./foo --ldd -e \
  'probe syscall.write,syscall.exit,syscall.futex,syscall.nanosleep
   { if (pid() == target()) { log(name); print_ubacktrace(); } }' \
  -c ./foo

futex
 0x300300579e : __pthread_initialize_minimal+0xae/0x3a0 [libpthread-2.12.so]
 0x30030051c9 : _init+0x9/0x480 [libpthread-2.12.so]
futex
 0x30030057ee : __pthread_initialize_minimal+0xfe/0x3a0 [libpthread-2.12.so]
 0x30030051c9 : _init+0x9/0x480 [libpthread-2.12.so]
nanosleep
 0x30028a6b2d : __nanosleep_nocancel+0x24/0x57 [libc-2.12.so]
 0x30028a69a0 : sleep+0xe0/0x1e0 [libc-2.12.so]
 0x4007b7 : main+0x41/0x5a [foo]
 0x300281ec5d : __libc_start_main+0xfd/0x1d0 [libc-2.12.so]
 0x400639 : _start+0x29/0x2c [foo]
futex
 0x300300e034 : __lll_lock_wait+0x24/0x30 [libpthread-2.12.so]
 0x3003009345 : _L_lock_868+0xf/0x1b [libpthread-2.12.so]
futex
 0x300300e1b5 : __lll_unlock_wake+0x25/0x30 [libpthread-2.12.so]
 0x300300a707 : _L_unlock_657+0xf/0x28 [libpthread-2.12.so]
nanosleep
 0x30028a6b2d : __nanosleep_nocancel+0x24/0x57 [libc-2.12.so]
 0x30028a69a0 : sleep+0xe0/0x1e0 [libc-2.12.so]
 0x400744 : foo+0x50/0x6a [foo]
 0x40075c : foo+0x68/0x6a [foo]
 0x40075c : foo+0x68/0x6a [foo]
 0x40075c : foo+0x68/0x6a [foo]
 0x40075c : foo+0x68/0x6a [foo]
 0x40075c : foo+0x68/0x6a [foo]
 0x400774 : run_thread+0x16/0x18 [foo]
 0x30030077e1 : start_thread+0xd1/0x3d4 [libpthread-2.12.so]
 0x30028e151d : __clone+0x6d/0x90 [libc-2.12.so]
go main!
foo 5
foo 4
foo 3
foo 2
foo 1
foo 0
trying to get mutex
got it...
write
 0x30028d422d : __write_nocancel+0x24/0x57 [libc-2.12.so]
 0x30028713c3 : _IO_file_write@@GLIBC_2.2.5+0x43/0xa0 [libc-2.12.so]
exit
 0x4007c1 : main+0x4b/0x5a [foo]
exit
 0x30028a6e58 : _exit+0x38/0x50 [libc-2.12.so]
 0x3002835f92 : exit+0x92/0x130 [libc-2.12.so]
 0x40074e : foo+0x5a/0x6a [foo]
 0x40075c : foo+0x68/0x6a [foo]
 0x40075c : foo+0x68/0x6a [foo]
 0x40075c : foo+0x68/0x6a [foo]
 0x40075c : foo+0x68/0x6a [foo]
 0x40075c : foo+0x68/0x6a [foo]
 0x400774 : run_thread+0x16/0x18 [foo]
 0x30030077e1 : start_thread+0xd1/0x3d4 [libpthread-2.12.so]
 0x30028e151d : __clone+0x6d/0x90 [libc-2.12.so]
WARNING: Number of errors: 0, skipped probes: 12

-- 
           Summary: cannot unwind through some glibc functions
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: runtime
        AssignedTo: systemtap at sources dot redhat dot com
        ReportedBy: mjw at redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=11898

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

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

* [Bug runtime/11898] cannot unwind through some glibc functions
  2010-08-10 11:07 [Bug runtime/11898] New: cannot unwind through some glibc functions mjw at redhat dot com
@ 2010-08-10 11:12 ` mjw at redhat dot com
  2010-08-10 11:17 ` mjw at redhat dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: mjw at redhat dot com @ 2010-08-10 11:12 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From mjw at redhat dot com  2010-08-10 11:12 -------
Adding -DDEBUG_UNWIND you can see the issue after/in 0x300300a707 :
_L_unlock_657+0xf/0x28 [libpthread-2.12.so]:

processCFI:435: unimplemented call frame instruction: 0x16

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=11898

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

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

* [Bug runtime/11898] cannot unwind through some glibc functions
  2010-08-10 11:07 [Bug runtime/11898] New: cannot unwind through some glibc functions mjw at redhat dot com
  2010-08-10 11:12 ` [Bug runtime/11898] " mjw at redhat dot com
@ 2010-08-10 11:17 ` mjw at redhat dot com
  2010-08-11 19:22 ` roland at gnu dot org
  2010-08-16 18:29 ` fche at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: mjw at redhat dot com @ 2010-08-10 11:17 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From mjw at redhat dot com  2010-08-10 11:17 -------
Since this is DW_CFA_val_expression, it is an answer to
http://sourceware.org/bugzilla/show_bug.cgi?id=10857#c1 "Have such expressions
been seen in the wild?".

Yes they have...

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=11898

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

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

* [Bug runtime/11898] cannot unwind through some glibc functions
  2010-08-10 11:07 [Bug runtime/11898] New: cannot unwind through some glibc functions mjw at redhat dot com
  2010-08-10 11:12 ` [Bug runtime/11898] " mjw at redhat dot com
  2010-08-10 11:17 ` mjw at redhat dot com
@ 2010-08-11 19:22 ` roland at gnu dot org
  2010-08-16 18:29 ` fche at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: roland at gnu dot org @ 2010-08-11 19:22 UTC (permalink / raw)
  To: systemtap



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |10857


http://sourceware.org/bugzilla/show_bug.cgi?id=11898

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

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

* [Bug runtime/11898] cannot unwind through some glibc functions
  2010-08-10 11:07 [Bug runtime/11898] New: cannot unwind through some glibc functions mjw at redhat dot com
                   ` (2 preceding siblings ...)
  2010-08-11 19:22 ` roland at gnu dot org
@ 2010-08-16 18:29 ` fche at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: fche at redhat dot com @ 2010-08-16 18:29 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From fche at redhat dot com  2010-08-16 18:28 -------


*** This bug has been marked as a duplicate of 10857 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


http://sourceware.org/bugzilla/show_bug.cgi?id=11898

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

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

end of thread, other threads:[~2010-08-16 18:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-10 11:07 [Bug runtime/11898] New: cannot unwind through some glibc functions mjw at redhat dot com
2010-08-10 11:12 ` [Bug runtime/11898] " mjw at redhat dot com
2010-08-10 11:17 ` mjw at redhat dot com
2010-08-11 19:22 ` roland at gnu dot org
2010-08-16 18:29 ` fche at redhat 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).