This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug runtime/11898] New: cannot unwind through some glibc functions


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]