From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3882 invoked by alias); 28 Jul 2007 00:02:52 -0000 Received: (qmail 3871 invoked by uid 22791); 28 Jul 2007 00:02:52 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 28 Jul 2007 00:02:50 +0000 Received: (qmail 4520 invoked from network); 28 Jul 2007 00:02:47 -0000 Received: from unknown (HELO localhost) (jimb@127.0.0.2) by mail.codesourcery.com with ESMTPA; 28 Jul 2007 00:02:47 -0000 To: "Oleg V. Zhylin" Cc: gdb@sourceware.org Subject: Re: gdb Stopped in pthread_create References: <555931.81190.qm@web56602.mail.re3.yahoo.com> From: Jim Blandy Date: Sat, 28 Jul 2007 01:40:00 -0000 In-Reply-To: <555931.81190.qm@web56602.mail.re3.yahoo.com> (Oleg V. Zhylin's message of "Tue, 24 Jul 2007 02:11:24 -0700 (PDT)") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: 2007-07/txt/msg00198.txt.bz2 "Oleg V. Zhylin" writes: > pthread_test.cpp demonstrates the problematic behavior. It is built > using > > g++ -g pthread_test.cpp -lpthread > > The version numbers are > > $ cat /proc/version > Linux version 2.6.21-1.3228.fc7 > (kojibuilder@xenbuilder2.fedora.redhat.com) (gcc version 4.1.2 20070502 > (Red Hat 4.1.2-12)) #1 SMP Tue Jun 12 15:37:31 EDT 2007 > > and gdb snapshot for July 24th > > $ gdb --version > GNU gdb 6.6.50.20070724 > > Below is the log of gdb session > > $ gdb a.out > GNU gdb 6.6.50.20070724 > Copyright (C) 2007 Free Software Foundation, Inc. > GDB is free software, covered by the GNU General Public License, and > you are > welcome to change it and/or distribute copies of it under certain > conditions. > Type "show copying" to see the conditions. > There is absolutely no warranty for GDB. Type "show warranty" for > details. > This GDB was configured as "i686-pc-linux-gnu"... > Using host libthread_db library "/lib/libthread_db.so.1". > (gdb) run > Starting program: /home/cartcs/Work/gdb/pthread_create/a.out > [Thread debugging using libthread_db enabled] > [New Thread 0xb7f336d0 (LWP 22251)] > > [3]+ Stopped gdb a.out Hi, Oleg. Thanks for the test case. I was unable to reproduce this problem using the current GDB sources on my Fedora Core 6 system. I'll be upgrading my machine to Fedora Core 7 soon; I'll give it a try then. $ cat pthread_test.cpp #include #include void Sleep(unsigned long ulMilliseconds) { struct timeval timeout; timeout.tv_sec = 0; timeout.tv_usec = ulMilliseconds * 1000; select(1, NULL, NULL, NULL, &timeout); } static void* threadFunc( void* lpParam ) { Sleep(3000); } int main() { pthread_attr_t attr; int n; bool res = false; if ( (n = ::pthread_attr_init(&attr)) != 0) { return -1; } pthread_t tid; if ( (n = ::pthread_create(&tid, &attr, threadFunc, 0)) == 0) { res = true; } if ( (n = ::pthread_attr_destroy(&attr)) != 0) { return -2; } if (!res) { return -3; } Sleep(5000); return 0; } $ g++ -g pthread_test.cpp -lpthread -o pthread_test $ ../pub/bin/gdb pthread_test GNU gdb 6.6.50.20070727-cvs Copyright (C) 2007 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i686-pc-linux-gnu"... Using host libthread_db library "/lib/libthread_db.so.1". (gdb) run Starting program: /home/jimb/gdb/bug/pthread_test [Thread debugging using libthread_db enabled] [New Thread 0xb7f9a6d0 (LWP 15004)] [New Thread 0xb7f99b90 (LWP 15007)] [Thread 0xb7f99b90 (LWP 15007) exited] Program exited normally. (gdb)