From: Tom Tromey <tom@tromey.com>
To: Aaron Merey via Gdb-patches <gdb-patches@sourceware.org>
Cc: tom@tromey.com, Aaron Merey <amerey@redhat.com>,
aburgess@redhat.com, lsix@lancelot.com
Subject: Re: [PATCH 1/2] gdb: Add soname to build-id mapping for core files
Date: Fri, 11 Mar 2022 08:23:47 -0700 [thread overview]
Message-ID: <877d90ms1o.fsf@tromey.com> (raw)
In-Reply-To: <20220308003046.171070-1-amerey@redhat.com> (Aaron Merey via Gdb-patches's message of "Mon, 7 Mar 2022 19:30:46 -0500")
>>>>> Aaron Merey via Gdb-patches <gdb-patches@sourceware.org> writes:
Hi again.
> + if (soname.get () != nullptr)
I don't think you need the .get here.
> + std::unordered_map<char *, const bfd_build_id *> filename_map;
I suspect this code is intended to use the contents of the string as the
key -- but this will actually use the pointer value as the key.
If the pointer value is intended, some comment somewhere to that effect
-- explaining why it's an ok approach -- would be good to have.
> + if (sec->flags & SEC_LOAD
> + && get_elf_backend_data (cbfd)->elf_backend_core_find_build_id
> + (cbfd, (bfd_vma) sec->filepos))
The get_elf_backend_data call has to have parens around it according to
GNU / gdb style.
> + /* Read the soname from the string table. */
> + gdb::byte_vector dynstr_buf;
> + if (!gdb_bfd_get_full_section_contents (abfd.get (), dynstr, &dynstr_buf))
> + return {};
> +
> + return make_unique_xstrdup ((char *) dynstr_buf.data () + idx);
What if the data isn't \0-terminated? Maybe some size checking (not
sure if needed) and make_unique_xstrndup would be safer.
Tom
next prev parent reply other threads:[~2022-03-11 15:23 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-03 1:34 [PATCH 0/2] Add debuginfod core file support Aaron Merey
2022-03-03 1:35 ` [PATCH 1/2] gdb: Add soname to build-id mapping for core files Aaron Merey
2022-03-04 14:53 ` Tom Tromey
2022-03-08 0:30 ` Aaron Merey
2022-03-11 15:23 ` Tom Tromey [this message]
2022-03-11 21:44 ` Aaron Merey
2022-03-18 19:03 ` Tom Tromey
2022-03-21 18:21 ` Aaron Merey
2022-03-03 1:35 ` [PATCH 2/2] PR gdb/27570: missing support for debuginfod in core_target::build_file_mappings Aaron Merey
2022-03-04 15:20 ` Tom Tromey
2022-03-08 0:33 ` Aaron Merey
2022-03-11 15:27 ` Tom Tromey
2022-03-11 21:49 ` Aaron Merey
2022-03-21 18:22 ` Aaron Merey
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=877d90ms1o.fsf@tromey.com \
--to=tom@tromey.com \
--cc=aburgess@redhat.com \
--cc=amerey@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=lsix@lancelot.com \
/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).