This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Fix for gdb.threads/staticthreads.exp failure on Linux
- From: Doug Evans <dje at google dot com>
- To: Paul Pluzhnikov <ppluzhnikov at google dot com>
- Cc: Michael Snyder <msnyder at vmware dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Wed, 15 Jul 2009 18:25:30 -0700
- Subject: Re: [patch] Fix for gdb.threads/staticthreads.exp failure on Linux
- References: <20090605222214.66E2976BC4@localhost> <8ac60eac0906151139w23c6cc2ag9307d73232753f65@mail.gmail.com> <8ac60eac0906220910p5750f455u1e3dc462035d50b6@mail.gmail.com> <4A3FC8CA.5070700@vmware.com> <8ac60eac0906221321r45c43a13g87a830f8dd3487ea@mail.gmail.com>
On Mon, Jun 22, 2009 at 1:21 PM, Paul Pluzhnikov<ppluzhnikov@google.com> wrote:
> On Mon, Jun 22, 2009 at 11:09 AM, Michael Snyder<msnyder@vmware.com> wrote:
>
>> Have you, or could you, run regression testing in i686?
>
> This is glibc-version related, rather than x86_64 vs. i686:
>
> Using glibc-2.7: "runtest gdb.threads/staticthreads.exp" gives:
>
> ?# of expected passes ? ? ? ? ? ?8
> ?# of known failures ? ? ? ? ? ? 1
>
> in both i686 and x86_64 modes.
>
> But using glibc-2.3.6 (which is my target):
>
> ?FAIL: gdb.threads/staticthreads.exp: running to main in runto
> ?FAIL: gdb.threads/staticthreads.exp: Continue to main's call of sem_post
> ?FAIL: gdb.threads/staticthreads.exp: handle SIG32 helps
>
> ? ? ? ? ? ? ? ? ?=== gdb Summary ===
>
> ?# of expected passes ? ? ? ? ? ?6
> ?# of unexpected failures ? ? ? ?3
> ?# of known failures ? ? ? ? ? ? 1
>
> again in both i686 and x86_64 modes.
>
> Thanks,
> --
> Paul Pluzhnikov
>
I looked into this a bit.
I think(!) this is the glibc patch that fixes things.
2007-05-16 Roland McGrath <roland@redhat.com>
* td_ta_thr_iter.c (iterate_thread_list): Make FAKE_EMPTY bool.
Use th_unique=0 in fake descriptor before initialization.
Regardless, this is indeed glibc specific, and older glibcs fail while
newer ones pass.
I like the patch. If thread enumeration fails during
try_thread_db_load_1 we ignore it and leave gdb to try again later.
When we get to this point we've already verified libthread_db is
(mostly) happy.
I kinda wonder, though, if that works then maybe gdb shouldn't do
thread enumeration at all here.
Running the testcase with --target_board=native-gdbserver doesn't have
this problem. Some research as to what gdbserver is doing would be
illuminating. "consistency is good": can you research what's
happening in gdbserver that it works there, and see if it's reasonable
to do the same thing in gdb?
[digression: GDB does use glibc's support for determining the glibc
version, but here we want the glibc version of libthread_db so that's
out. Hmmm, though it looks like the existing use of
gnu_get_libc_version is to get the libthread_db version which can be
different now that we have libthread-db-search-path. ... This seems
like a problem, though in practice I suspect it's ok. [grep for
gnu_get_libc_version in linux-thread-db.c]]
I think a comment needs to be added to your patch, probably to the
call site of thread_db_find_new_threads_silently, that thoroughly
explains what's going on (assuming that's still the best solution).
btw, the reason for the 1 known failure is, I'm guessing, because gdb
was built with the same toolchain that uses the older glibc, but the
test was run using a native toolchain that uses a newer glibc and the
mismatch is sufficient to trigger the failure. At least that explains
things in my sandbox. If I rebuild gdb with native gcc, or set
libthread-db-search-path to find the newer glibc, the kfail goes away.