From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17186 invoked by alias); 1 Nov 2008 21:41:30 -0000 Received: (qmail 17067 invoked by uid 22791); 1 Nov 2008 21:41:29 -0000 X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.33.17) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 01 Nov 2008 21:40:36 +0000 Received: from zps75.corp.google.com (zps75.corp.google.com [172.25.146.75]) by smtp-out.google.com with ESMTP id mA1LeRwb029630 for ; Sat, 1 Nov 2008 21:40:28 GMT Received: from wa-out-1112.google.com (wahv27.prod.google.com [10.114.248.27]) by zps75.corp.google.com with ESMTP id mA1LePad012192 for ; Sat, 1 Nov 2008 14:40:26 -0700 Received: by wa-out-1112.google.com with SMTP id v27so1037747wah.21 for ; Sat, 01 Nov 2008 14:40:25 -0700 (PDT) MIME-Version: 1.0 Received: by 10.114.95.1 with SMTP id s1mr11384963wab.13.1225575625643; Sat, 01 Nov 2008 14:40:25 -0700 (PDT) In-Reply-To: <490C75B4.20001@gmail.com> References: <49065BBD.3050800@gmail.com> <4906615E.50606@gmail.com> <8ac60eac0810271836saf8c28pb1392b77c7926be0@mail.gmail.com> <4907B915.5040101@gmail.com> <8ac60eac0810281920r4bf71400hc8171bdee3c92ca@mail.gmail.com> <490909B3.2080307@gmail.com> <8ac60eac0810291830g46604c3eye8365240c48007d0@mail.gmail.com> <490BBEF4.1040801@gmail.com> <8ac60eac0810312346l638f3011n66d7681444329486@mail.gmail.com> <490C75B4.20001@gmail.com> Date: Sat, 01 Nov 2008 21:41:00 -0000 Message-ID: <8ac60eac0811011440g46fcd9a6uda48e1c3b25eb776@mail.gmail.com> Subject: Re: "Cannot find new threads" on Fedora 9, but not on CentOS 5 (?) From: Paul Pluzhnikov To: ajloft@umich.edu Cc: gdb@sourceware.org, Tom Tromey Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2008-11/txt/msg00004.txt.bz2 On Sat, Nov 1, 2008 at 8:28 AM, Andrew Lofthouse wrote: > I'm going to be getting a bunch of spam, now, huh? This wasn't the first message so quoted. I find gmail spam filtering to be extremely effective: I only get about 1 spam/month through. >> One thing that may have changed is prelink addresses -- >> IIRC, Fedora runs prelink at 2 week intervals. > > Okay, it must have been prelink. Indeed. I did '/usr/sbin/prelink -ua', and now I can reproduce this on the thread-so test case (with 32-bit kernel). Reproduces with current GDB CVS head... The problem is a (now almost 3 year old) bug in glibc: http://sources.redhat.com/bugzilla/show_bug.cgi?id=2328 for which a patch has been available for 2 years, but came from the "wrong" person :-( In this case, GDB gets notified about libpthread load before libpthread has been relocated: GNU gdb Fedora (6.8-1.fc9) Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i386-redhat-linux-gnu"... (gdb) r Starting program: /tmp/a.out [Thread debugging using libthread_db enabled] Error while reading shared library symbols: Cannot find new threads: generic error Cannot find new threads: generic error (gdb) bt #0 0x0011f1a1 in _dl_debug_state () at dl-debug.c:76 #1 0x00122a2b in dl_open_worker (a=0xbfc4a9ec) at dl-open.c:366 #2 0x0011e4f6 in _dl_catch_error (objname=0xbfc4aa14, errstring=0xbfc4aa10, mallocedp=0xbfc4aa1b, operate=0x122820 , args=0xbfc4a9ec) at dl-error.c:178 #3 0x001222f2 in _dl_open (file=0x8048574 "./thread-so.so", mode=, caller_dlopen=0x8048479, nsid=-2, argc=1, argv=0xbfc4ac64, env=0xbfc4ac6c) at dl-open.c:596 #4 0x0012fc2c in dlopen_doit (a=0xbfc4ab80) at dlopen.c:66 #5 0x0011e4f6 in _dl_catch_error (objname=0x133058, errstring=0x13305c, mallocedp=0x133054, operate=0x12fb90 , args=0xbfc4ab80) at dl-error.c:178 #6 0x0013005c in _dlerror_run (operate=0x12fb90 , args=) at dlerror.c:164 #7 0x0012fb61 in __dlopen (file=0x8048574 "./thread-so.so", mode=1) at dlopen.c:87 #8 0x08048479 in main () at thread-so-main.c:6 (gdb) p &stack_used $1 = (list_t *) 0x2ba110 (gdb) x/x $1 0x2ba110 : 0x00016110 (gdb) shell nm /lib/libpthread.so.0 | grep stack_used 00016110 d stack_used ### NOTE: stack_used points to ### non-relocated (and unreadable) self! (gdb) fr 8 #8 0x08048479 in main () at thread-so-main.c:6 6 void *h = dlopen("./thread-so.so", RTLD_LAZY); (gdb) b 7 Breakpoint 1 at 0x804847c: file thread-so-main.c, line 7. (gdb) c Continuing. [New Thread 0xb803e6c0 (LWP 32044)] [Switching to Thread 0xb803e6c0 (LWP 32044)] Breakpoint 1, main () at thread-so-main.c:7 7 void (*fn)(void) = dlsym(h, "foo"); (gdb) x/x $1 0x2ba110 : 0x002ba110 ### NOTE: stack_used now points to relocated self. The 'stack_used' a head of thread list, and libthread_db can not work correctly if it observes the wrong (unreadable) value. I don't know what it takes to make Uli apply the patch to fix this :( Perhaps Tom can have a friendly chat with him? Cheers, -- Paul Pluzhnikov