public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Aaron Merey <amerey@redhat.com>, gdb-patches@sourceware.org
Cc: tom@tromey.com, lsix@lancelotsix.com
Subject: Re: [PATCH 2/3] gdb: Add soname to build-id mapping for corefiles
Date: Sat, 13 Nov 2021 21:36:28 -0500	[thread overview]
Message-ID: <efbfa36a-5e9c-e662-ef52-93a4137ba9d0@polymtl.ca> (raw)
In-Reply-To: <20211110014755.532490-3-amerey@redhat.com>

> @@ -1183,8 +1201,23 @@ linux_read_core_file_mappings
>        descdata += addr_size;
>        char * filename = filenames;
>        filenames += strlen ((char *) filenames) + 1;
> +      const bfd_build_id *build_id = nullptr;
> +      auto vma_map_it = vma_map.find (start);
> +
> +      /* Map filename to the build-id associated with this start vma,
> +	 if such a build-id was found.  Otherwise use the build-id
> +	 already associated with this filename if it exists. */
> +      if (vma_map_it != vma_map.end ())
> +	filename_map[filename] = build_id = vma_map_it->second;

Please avoid doing two assignments in one statement.

> @@ -1586,6 +1587,40 @@ gdb_bfd_scan_elf_dyntag (const int desired_dyntag, bfd *abfd, CORE_ADDR *ptr,
>    return 0;
>  }
>  
> +/* See solib.h.  */
> +
> +gdb::optional<std::string>
> +gdb_bfd_read_elf_soname (struct bfd *bfd)
> +{
> +  gdb_assert (bfd != nullptr);
> +
> +  gdb_bfd_ref_ptr abfd = gdb_bfd_open (bfd->filename, gnutarget);

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?

Simon

  reply	other threads:[~2021-11-14  2:37 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 [this message]
2021-11-17  3:24     ` Aaron Merey
2021-11-17 14:17       ` Tom Tromey
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=efbfa36a-5e9c-e662-ef52-93a4137ba9d0@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=amerey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=lsix@lancelotsix.com \
    --cc=tom@tromey.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).