From: Tom Tromey <tom@tromey.com>
To: Aaron Merey via Gdb-patches <gdb-patches@sourceware.org>
Cc: simon.marchi@polymtl.ca, Aaron Merey <amerey@redhat.com>,
tom@tromey.com, lsix@lancelotsix.com
Subject: Re: [PATCH 2/3] gdb: Add soname to build-id mapping for corefiles
Date: Wed, 17 Nov 2021 07:17:38 -0700 [thread overview]
Message-ID: <877dd6euil.fsf@tromey.com> (raw)
In-Reply-To: <20211117032441.719270-1-amerey@redhat.com> (Aaron Merey via Gdb-patches's message of "Tue, 16 Nov 2021 22:24:41 -0500")
>>>>> "Aaron" == Aaron Merey via Gdb-patches <gdb-patches@sourceware.org> writes:
>> Can you explain why we are opening bfd->filename? Doesn't "abfd"
>> represent the exact same thing than "bfd"? So why can't we use "bfd"
>> directly to look up the soname?
Aaron> bfd->flags does not contain the correct value. This causes the check
Aaron> for ET_DYN to fail even for shared libraries. Also bfd->build_id always
Aaron> seems to be NULL. Opening "abfd" with gdb_bfd_open and passing it to
Aaron> bfd_check_format populates flags and build_id with the correct values.
Aaron> Passing "bfd" to bfd_check_format still does not populate these fields
Aaron> with the correct values.
Aaron> It looks like this happens because the format of "abfd" is initially
Aaron> set to bfd_unknown. In this case bfd_check_format rereads the file and
Aaron> updates some fields with the correct values, including flags and build_id.
Aaron> Since format of "bfd" is instead bfd_object, bfd_check_format returns
Aaron> early and skips updating any fields.
This seems strange to me.
At first I was surprised that re-opening the BFD like this wouldn't
simply return the same BFD, since gdb uses a BFD cache. However, now I
see that corelow isn't using the cache:
bfd = bfd_map[filename] = bfd_openr (expanded_fname.get (),
"binary");
(as opposed to using gdb_bfd_openr here.)
If re-opening and then calling bfd_check_format sets the flags
correctly, then I suppose the question is just why the call in
build_file_mappings isn't doing that:
if (bfd == nullptr || !bfd_check_format (bfd, bfd_object))
Possibly the answer is that corelow passes "binary" as the target, but
your code does:
Aaron> + gdb_bfd_ref_ptr abfd = gdb_bfd_open (bfd->filename, gnutarget);
But then I wonder why "binary" is appropriate in corelow.
Tom
next prev parent reply other threads:[~2021-11-17 14:22 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-10 1:47 [PATCH v4 0/3] Add debuginfod core file support Aaron Merey
2021-11-10 1:47 ` [PATCH 1/3] gdb: Add aliases for read_core_file_mappings callbacks Aaron Merey
2021-11-14 2:20 ` Simon Marchi
2021-11-17 3:39 ` Aaron Merey
2021-11-10 1:47 ` [PATCH 2/3] gdb: Add soname to build-id mapping for corefiles Aaron Merey
2021-11-14 2:36 ` Simon Marchi
2021-11-17 3:24 ` Aaron Merey
2021-11-17 14:17 ` Tom Tromey [this message]
2021-11-17 21:16 ` Aaron Merey
2022-01-26 1:40 ` Aaron Merey
2022-02-09 2:31 ` Aaron Merey
2022-02-17 16:01 ` Andrew Burgess
2021-11-10 1:47 ` [PATCH 3/3] PR gdb/27570: missing support for debuginfod in core_target::build_file_mappings Aaron Merey
2021-11-14 2:56 ` Simon Marchi
2021-11-17 3:28 ` Aaron Merey
2022-01-26 1:42 ` Aaron Merey
2022-02-09 2:31 ` Aaron Merey
-- strict thread matches above, loose matches on Subject: below --
2021-08-12 4:24 [PATCH v3 0/3] Add debuginfod core file support Aaron Merey
2021-08-12 4:24 ` [PATCH 2/3] gdb: Add soname to build-id mapping for corefiles Aaron Merey
2021-08-15 14:51 ` Lancelot SIX
2021-08-17 13:58 ` Simon Marchi
2021-08-19 2:22 ` Aaron Merey
2021-09-29 1:12 ` Aaron Merey
2021-11-04 1:32 ` Simon Marchi
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=877dd6euil.fsf@tromey.com \
--to=tom@tromey.com \
--cc=amerey@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=lsix@lancelotsix.com \
--cc=simon.marchi@polymtl.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).