From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17556 invoked by alias); 1 May 2009 17:02:24 -0000 Received: (qmail 17435 invoked by uid 22791); 1 May 2009 17:02:22 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS 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.43rc1) with ESMTP; Fri, 01 May 2009 17:02:13 +0000 Received: from zps76.corp.google.com (zps76.corp.google.com [172.25.146.76]) by smtp-out.google.com with ESMTP id n41H289M031184 for ; Fri, 1 May 2009 18:02:09 +0100 Received: from qw-out-1920.google.com (qwc5.prod.google.com [10.241.193.133]) by zps76.corp.google.com with ESMTP id n41H120e023302 for ; Fri, 1 May 2009 10:02:06 -0700 Received: by qw-out-1920.google.com with SMTP id 5so1817731qwc.26 for ; Fri, 01 May 2009 10:02:06 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.82.15 with SMTP id z15mr2263542qck.32.1241197324408; Fri, 01 May 2009 10:02:04 -0700 (PDT) In-Reply-To: <20090501164905.GA32287@caradoc.them.org> References: <8ac60eac0904291330m78b43c47p1cc9b8379e31e923@mail.gmail.com> <20090430185551.GB10734@adacore.com> <8ac60eac0904301211x245c8b7cp546042d832eb1fe@mail.gmail.com> <8ac60eac0904301618j61051e9du38b34afbc7ed64a3@mail.gmail.com> <83eiv9e1bb.fsf@gnu.org> <8ac60eac0905010849m7dc29bb5h171a703fa79d8b76@mail.gmail.com> <20090501164905.GA32287@caradoc.them.org> Date: Fri, 01 May 2009 17:02:00 -0000 Message-ID: <8ac60eac0905011002r73ced485j5643f9de3a7b0d01@mail.gmail.com> Subject: Re: [patch][rfc] Allow GDB to search for the right libthread_db.so.1 From: Paul Pluzhnikov To: Paul Pluzhnikov , Eli Zaretskii , brobecker@adacore.com, teawater@gmail.com, tromey@redhat.com, bauerman@br.ibm.com, gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-05/txt/msg00029.txt.bz2 On Fri, May 1, 2009 at 9:49 AM, Daniel Jacobowitz wrote: > Have you tried this? Yes. It's slightly better than what I said: GDB knows about the original (main) thread, and the thread that crashed, but knows no other threads. Here is a sample session. $ cat thread-crash.c #include void *fn(void *p) { if (p) { char *cp = 0; cp[1] = 'a'; /* crash! */ } sleep(60); return 0; } #define N 5 int main() { pthread_t tid[N]; int i; for (i = 0; i < N; ++i) pthread_create(tid+i, 0, fn, i == N-1 ? &i : 0); for (i = 0; i < N; ++i) pthread_join(tid[i], 0); return 0; } First with a patched gdb: $ /home/ppluzhnikov/Archive/sourceware.org/gdb/build/gdb/gdb ./thread-crash-64-v10 GNU gdb (GDB) 6.8.50.20090430-cvs Copyright (C) 2009 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 "x86_64-unknown-linux-gnu". For bug reporting instructions, please see: ... (gdb) r [Thread debugging using libthread_db enabled] [New Thread 0x40800950 (LWP 32344)] [New Thread 0x41001950 (LWP 32345)] [New Thread 0x41802950 (LWP 32346)] [New Thread 0x42003950 (LWP 32347)] [New Thread 0x42804950 (LWP 32348)] Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x42804950 (LWP 32348)] 0x00000000004005ab in fn (p=0x7fffffffda0c) at thread-crash.c:7 7 cp[1] = 'a'; /* crash! */ (gdb) inf thread * 6 Thread 0x42804950 (LWP 32348) 0x00000000004005ab in fn (p=0x7fffffffda0c) at thread-crash.c:7 5 Thread 0x42003950 (LWP 32347) 0x00007ffff78ffb81 in nanosleep () from /lib/libc.so.6 4 Thread 0x41802950 (LWP 32346) 0x00007ffff78ffb81 in nanosleep () from /lib/libc.so.6 3 Thread 0x41001950 (LWP 32345) 0x00007ffff78ffb81 in nanosleep () from /lib/libc.so.6 2 Thread 0x40800950 (LWP 32344) 0x00007ffff78ffb81 in nanosleep () from /lib/libc.so.6 1 Thread 0x7ffff7fda6e0 (LWP 32341) 0x00007ffff7bd127f in __lll_unlock_wake_private () from /lib/libpthread.so.0 (gdb) q And now with current CVS Head: $ /home/ppluzhnikov/Archive/sourceware.org/gdb/build2/gdb/gdb ./thread-crash-64-v10 GNU gdb (GDB) 6.8.50.20090501-cvs Copyright (C) 2009 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 "x86_64-unknown-linux-gnu". For bug reporting instructions, please see: ... (gdb) r warning: Cannot initialize thread debugging library: versions of libpthread and libthread_db do not match warning: Cannot initialize thread debugging library: versions of libpthread and libthread_db do not match [New LWP 32375] Program received signal SIGSEGV, Segmentation fault. [Switching to LWP 32375] 0x00000000004005ab in fn (p=0x7fffffffda0c) at thread-crash.c:7 7 cp[1] = 'a'; /* crash! */ (gdb) inf thread * 2 LWP 32375 0x00000000004005ab in fn (p=0x7fffffffda0c) at thread-crash.c:7 1 LWP 32368 0x00007ffff7939b01 in clone () from /lib/libc.so.6 -- Paul Pluzhnikov