From: Tom de Vries <tdevries@suse.de>
To: Simon Marchi <simark@simark.ca>, gdb-patches@sourceware.org
Subject: Re: [pushed] [gdb/testsuite] Fix gdb.threads/dlopen-libpthread.exp for upstream glibc
Date: Wed, 11 Jan 2023 18:20:24 +0100 [thread overview]
Message-ID: <5f94e5f9-fdd1-f85c-63f2-1750744d69a3@suse.de> (raw)
In-Reply-To: <7d3e66c6-0665-df09-fc08-0fba2bd23d80@simark.ca>
On 1/11/23 17:20, Simon Marchi wrote:
>
>
> On 1/11/23 04:17, Tom de Vries via Gdb-patches wrote:
>> On 1/10/23 19:05, Simon Marchi wrote:
>>>> Attached patch fixes things.
>>>>
>>>> WDYT?
>>>>
>>>> Thanks,
>>>> - Tom
>>>
>>>
>>> Here:
>>>
>>>> # We link the exec without -lpthread, but libpthread.so may already be loaded at main
>>>> # due to LD_PRELOAD.
>>>> set libpthread_maybe_preloaded 0
>>>> set binfile [standard_output_file $executable]
>>>> if { [has_dependency $binfile libpthread\\.so] == 1 } {
>>>> set libpthread_maybe_preloaded 1
>>>> }
>>>
>>> Ok, so this works because ldd is influenced by LD_PRELOAD, I didn't
>>> know.
>>>
>>
>> Yes, while lddtree is not, which had me confused for a while.
>>
>>>>
>>>> # We link the shlib with -lpthread, but since glibc 2.34 libpthread has been
>>>> # merged with libc, so libpthread.so may not be a dependency.
>>>> set libpthread_missing 0
>>>> if { [has_dependency $binfile libpthread\\.so] == 0 } {
>>>> set libpthread_missing 1
>>>> }
>>>
>>> The two has_dependency calls use $binfile. Should one of them use
>>> $binfile_lib? The second one I think.
>>
>> Yes, thanks for catching this.
>>
>> I'll commit after another build & test cycle.
>
> Hmm, I still see the failure. I think the second has_dependency doesn't
> work. It returns 1 when it shouldn't, because of the
> dlopen-libpthread.so.d line:
>
> output of ldd /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.threads/dlopen-libpthread/dlopen-libpthread.so is
> linux-vdso.so.1 (0x00007ffc809ee000)^M
> libc.so.6 => /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.threads/dlopen-libpthread/dlopen-libpthread.so.d/libc.so.6 (0x00007f0a5cf03000)^M
> /lib64/ld-linux-x86-64.so.2 (0x00007f0a5d132000)^M
>
> This directory is created by build_executable_own_libs in
> lib/prelink-support.exp (used by the test).
>
> Tweaking the regexp to include a forward slash makes it work for me:
>
Hi Simon,
thanks for letting me know, and sorry for this ongoing annoyance.
I tested it this morning on three data points (openSUSE Leap 15.4,
Ubuntu 22.04 with and without LD_PRELOAD=), and all looked fine.
But after you mentioned the FAIL, I did a clean build from trunk and
managed to reproduce it. I'm not sure what went wrong, either I tested
the wrong test-case or I tested a different version of the patch.
Anyway, your suggestion fixes the FAIL for me as well.
I'll commit this asap.
Thanks,
- Tom
> diff --git a/gdb/testsuite/gdb.threads/dlopen-libpthread.exp b/gdb/testsuite/gdb.threads/dlopen-libpthread.exp
> index 134265ff470..c97e0284475 100644
> --- a/gdb/testsuite/gdb.threads/dlopen-libpthread.exp
> +++ b/gdb/testsuite/gdb.threads/dlopen-libpthread.exp
> @@ -68,14 +68,14 @@ if { !$have_probe } {
> # due to LD_PRELOAD.
> set libpthread_maybe_preloaded 0
> set binfile [standard_output_file $executable]
> -if { [has_dependency $binfile libpthread\\.so] == 1 } {
> +if { [has_dependency $binfile /libpthread\\.so] == 1 } {
> set libpthread_maybe_preloaded 1
> }
>
> # We link the shlib with -lpthread, but since glibc 2.34 libpthread has been
> # merged with libc, so libpthread.so may not be a dependency.
> set libpthread_missing 0
> -if { [has_dependency $binfile_lib libpthread\\.so] == 0 } {
> +if { [has_dependency $binfile_lib /libpthread\\.so] == 0 } {
> set libpthread_missing 1
> }
>
> Simon
prev parent reply other threads:[~2023-01-11 17:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-30 15:54 Tom de Vries
2023-01-04 16:54 ` Simon Marchi
2023-01-10 17:23 ` Tom de Vries
2023-01-10 18:05 ` Simon Marchi
2023-01-11 9:17 ` Tom de Vries
2023-01-11 16:20 ` Simon Marchi
2023-01-11 17:20 ` Tom de Vries [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5f94e5f9-fdd1-f85c-63f2-1750744d69a3@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
--cc=simark@simark.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).