From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH] Use gdb_bfd_openr in corelow.c
Date: Mon, 2 Mar 2026 09:31:29 -0700 [thread overview]
Message-ID: <20260302163129.610391-1-tromey@adacore.com> (raw)
corelow.c has a couple of calls to bfd_openr, each followed by a call
to new_reference. It's cleaner to use the provided gdb_bfd_openr
wrapper.
---
gdb/corelow.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/gdb/corelow.c b/gdb/corelow.c
index a28a707c293..84f44bc680e 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -451,10 +451,7 @@ core_target::build_file_mappings ()
gdb_bfd_ref_ptr abfd;
if (expanded_fname != nullptr && !build_id_mismatch)
- {
- struct bfd *b = bfd_openr (expanded_fname.get (), "binary");
- abfd = gdb_bfd_ref_ptr::new_reference (b);
- }
+ abfd = gdb_bfd_openr (expanded_fname.get (), "binary");
if ((expanded_fname == nullptr
|| abfd == nullptr
@@ -474,9 +471,8 @@ core_target::build_file_mappings ()
type. */
expanded_fname
= make_unique_xstrdup (bfd_get_filename (abfd.get ()));
- struct bfd *b = bfd_openr (expanded_fname.get (), "binary");
- gdb_assert (b != nullptr);
- abfd = gdb_bfd_ref_ptr::new_reference (b);
+ abfd = gdb_bfd_openr (expanded_fname.get (), "binary");
+ gdb_assert (abfd != nullptr);
}
}
base-commit: c995b827636ecaad5454cc89bd7fc226c6a4fd33
--
2.53.0
next reply other threads:[~2026-03-02 16:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-02 16:31 Tom Tromey [this message]
2026-03-02 16:55 ` Keith Seitz
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=20260302163129.610391-1-tromey@adacore.com \
--to=tromey@adacore.com \
--cc=gdb-patches@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