From owner-freebsd-hackers@FreeBSD.ORG Thu May 26 13:30:37 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 039881065672 for ; Thu, 26 May 2011 13:30:37 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id CE08F8FC0A for ; Thu, 26 May 2011 13:30:36 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 846DE46B0A; Thu, 26 May 2011 09:30:36 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 226F78A04F; Thu, 26 May 2011 09:30:36 -0400 (EDT) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Thu, 26 May 2011 09:27:24 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110325; KDE/4.5.5; amd64; ; ) References: <87pqn6jo33.fsf@gmail.com> In-Reply-To: <87pqn6jo33.fsf@gmail.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201105260927.24922.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Thu, 26 May 2011 09:30:36 -0400 (EDT) Cc: Raphael Kubo da Costa Subject: Re: 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: Thu, 26 May 2011 13:30:37 -0000 On Wednesday, May 25, 2011 8:35:28 pm Raphael Kubo da Costa wrote: > Dmitry Krivenok writes: > > > 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. > > In my case, I get the following error when running your program (and > many others) with the gdb72 package (installed via portmaster -PP > devel/gdb): > > (gdb) r > Starting program: /tmp/test-base > [New LWP 100315] > Cannot get thread info, Thread ID=100315, generic error > (gdb) q > A debugging session is active. > > Inferior 1 [process 84832] will be killed. > > Quit anyway? (y or n) y > > If I compile the port myself, I can't run any binary (PR ports/152896, > which has been unanswered despite my efforts): > > Reading symbols from /usr/local/bin/gdb72...I'm sorry, Dave, I can't > do that. Symbol format `elf64-x86-64-freebsd' unknown. You need to unininstall libreadline, or turn off the hack to try to use libreadline from ports. There is no easy way to fix the gdb build to use /usr/local only for the bits that need readline and not have it use the wrong binutils headers from /usr/local as well. -- John Baldwin