Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 May 2011 09:27:24 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-hackers@freebsd.org
Cc:        Raphael Kubo da Costa <kubito@gmail.com>
Subject:   Re: Problem with running simple pthreads program under gdb-7.2 (Invalid selected thread)
Message-ID:  <201105260927.24922.jhb@freebsd.org>
In-Reply-To: <87pqn6jo33.fsf@gmail.com>
References:  <BANLkTikfUObTtRAaMVFdG_-0e39ibB5GLg@mail.gmail.com> <87pqn6jo33.fsf@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday, May 25, 2011 8:35:28 pm Raphael Kubo da Costa wrote:
> Dmitry Krivenok <krivenok.dmitry@gmail.com> 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 
<http://gnu.org/licenses/gpl.html>;
> > 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:
> > <http://www.gnu.org/software/gdb/bugs/>...
> > 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105260927.24922.jhb>