From owner-freebsd-hackers@FreeBSD.ORG Wed May 25 18:20:07 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8D6911065687 for ; Wed, 25 May 2011 18:20:07 +0000 (UTC) (envelope-from krivenok.dmitry@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 0B1638FC08 for ; Wed, 25 May 2011 18:20:06 +0000 (UTC) Received: by bwz12 with SMTP id 12so15931bwz.13 for ; Wed, 25 May 2011 11:20:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=wNVPlgkORP8GPLvU5a1Ch5i545Xd5swGhJ/GxZtJGto=; b=uWooP3CXERMQmgyP6ojPdnTiJiCz5IxDTDynWAlqQ3vZbCYPbdpNO8S0kB0Bisnd3D bmIXEs40qfmB2ksdbgSWBU3FOOJhnNFkHzD8woodzBgUjImRJUFC743t99rgYgLVXB5w 2dy45j9TCV8/X3UCueytQzIGmr1mEliS/V3rc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=O6GbFgxAtWeYkQqXwqtlce/Pmrn7FRoAxAKQOH3jY8R+Ts1nypIX47h3+PDf+Fqib0 2NYGjsOID3fxR4lvEZhbO/u5X/wrfq6SbQ04OPENqKw/194aMel7qPczL2uOQpBepMj9 Bq5AxEqAGxHvqa1QNXMIejmTDs12zBBeBAikA= MIME-Version: 1.0 Received: by 10.204.41.206 with SMTP id p14mr1277753bke.53.1306345829294; Wed, 25 May 2011 10:50:29 -0700 (PDT) Received: by 10.204.85.100 with HTTP; Wed, 25 May 2011 10:50:29 -0700 (PDT) Date: Wed, 25 May 2011 21:50:29 +0400 Message-ID: From: Dmitry Krivenok To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Subject: Problem with running simple pthreads program under gdb-7.2 (Invalid selected thread) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 May 2011 18:20:07 -0000 Hello, I wrote very simple Pthreads program to demonstrate the problem with gdb-7.2 installed from ports on my FreeBSD-8.2 (amd64). /////////////////////////////////////////////////////////////////////////////// #include #include #include void* run(void* arg) { return 0; } int main(int argc, char** argv) { pthread_t tid; int r; r = pthread_create(&tid, NULL, &run, NULL); assert(!r); r = pthread_join(tid, NULL); assert(!r); return 0; } /////////////////////////////////////////////////////////////////////////////// I compiled it as follows $ gcc -Wall -g -O0 -pthread -o t t.c $ and then run under base gdb-6.1.1 $ gdb --args t GNU gdb 6.1.1 [FreeBSD] Copyright 2004 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 "amd64-marcel-freebsd"... (gdb) r Starting program: /big/work/coverage/csxroot/src/t/t [New LWP 100071] [New Thread 800a041c0 (LWP 100071)] [New Thread 800a0ae40 (LWP 100170)] [Thread 800a0ae40 (LWP 100170) exited] Program exited normally. (gdb) q $ As you can see program exited normally w/o any errors. Then I run the same program under gdb-7.2 $ /usr/local/bin/gdb72 --args t GNU gdb (GDB) 7.2 [GDB v7.2 for FreeBSD] Copyright (C) 2010 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-portbld-freebsd8.2". For bug reporting instructions, please see: ... Reading symbols from /big/work/coverage/csxroot/src/t/t...done. (gdb) r Starting program: /big/work/coverage/csxroot/src/t/t [New LWP 100162] [New Thread 800a041c0 (LWP 100162)] [New Thread 800a0ae40 (LWP 100171)] [Thread 800a0ae40 (LWP 100171) exited] Invalid selected thread. (gdb) q A debugging session is active. Inferior 1 [process 7756] will be killed. Quit anyway? (y or n) y $ In this case I got "Invalid selected thread." right after the thread has exited. Looks like gdb is unable to switch to another thread. What's wrong here? Thanks! -- Sincerely yours, Dmitry V. Krivenok e-mail: krivenok.dmitry@gmail.com skype: krivenok_dmitry jabber: krivenok_dmitry@jabber.ru icq: 242-526-443