From: Simon Marchi <simon.marchi@polymtl.ca>
To: "Carlos O'Donell" <carlos@redhat.com>,
Florian Weimer <fweimer@redhat.com>,
libc-alpha@sourceware.org
Cc: gdb@sourceware.org
Subject: Re: [PATCH] nptl: Export libthread_db-used symbols under GLIBC_PRIVATE
Date: Tue, 29 Jun 2021 10:20:32 -0400 [thread overview]
Message-ID: <959aa579-81b0-6b63-ae03-d9e1a15d2856@polymtl.ca> (raw)
In-Reply-To: <26256d31-616d-2fc7-7788-937776287791@redhat.com>
On 2021-06-27 6:25 p.m., Carlos O'Donell wrote:> On 6/20/21 8:38 AM, Simon Marchi via Libc-alpha wrote:
>> On 2021-06-17 3:23 p.m., Florian Weimer via Gdb wrote:
>>> Kevin, this *almost* gives us the perfect debugging experience with your
>>> patched GDB in Fedora 35, according to my preliminary tests. A build
>>> with the patch is running here:
>>>
>>> <https://koji.fedoraproject.org/koji/buildinfo?buildID=1773177>
>>>
>>> However, it seems that GDB still needs pthread_create in the .symtab to
>>> trigger loading of libpthread_db. A fully stripped libc.so.6 without
>>> .symtab does not trigger loading in my experiments. (The other symbols
>>> we preserve for valgrind's sake and are immaterial to GDB.) In other
>>> words,
>>
>> Stupid question, but: since pthread_create is a function exposed by the
>> libc.so shared library, won't there still be an entry for it in .dynsym?
>
> No question is stupid. Thank you for asking.
>
> Yes, there *must* be a .dynsym entry for pthread_create in libc.so.6 in
> order for the dynamic loader to bind the reference to the definition.
>
>> And if so, shouldn't GDB see it?
>
> It should. Today gdb is only using the internal lookup_minimal_symbol()
> API in order to trigger libthread_db loading, and it's not clear to me
> if that will load *all* of the dynamic symbols during gdb startup.
>
> Someone would need to debug the minsyms.c API to see if something isn't
> working as expected.
>
> gdb/minsyms.c:
>
> 1267 When files contain multiple sources of symbol information, it is
> 1268 possible for the minimal symbol table to contain many duplicate entries.
> 1269 As an example, SVR4 systems use ELF formatted object files, which
> 1270 usually contain at least two different types of symbol tables (a
> 1271 standard ELF one and a smaller dynamic linking table), as well as
> 1272 DWARF debugging information for files compiled with -g.
>
> So it sounds like the data is loadable, and mergeable, but it appears that
> it's not all there at early startup in gdb.
My intuition is that the .dynsym symbols are normally loaded and result
in minimal symbols in GDB:
https://gitlab.com/gnutools/gdb/-/blob/master/gdb/elfread.c#L1102-1128
But there may be some filtering that prevents the symbols like
pthread_create from making their way into the minimal symbols database.
I'll have to try using the container that Florian pointed to
(registry.fedoraproject.org/fedora:rawhide).
Simon
next prev parent reply other threads:[~2021-06-29 14:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-17 19:23 Florian Weimer
2021-06-20 12:38 ` Simon Marchi
2021-06-27 22:25 ` Carlos O'Donell
2021-06-29 14:20 ` Simon Marchi [this message]
2021-06-29 14:24 ` Florian Weimer
2021-06-28 2:10 ` Carlos O'Donell
2021-06-28 8:34 ` Florian Weimer
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=959aa579-81b0-6b63-ae03-d9e1a15d2856@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--cc=carlos@redhat.com \
--cc=fweimer@redhat.com \
--cc=gdb@sourceware.org \
--cc=libc-alpha@sourceware.org \
/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).