* [PATCH] Use gdb_bfd_openr in corelow.c
@ 2026-03-02 16:31 Tom Tromey
2026-03-02 16:55 ` Keith Seitz
0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2026-03-02 16:31 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-02 16:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-02 16:31 [PATCH] Use gdb_bfd_openr in corelow.c Tom Tromey
2026-03-02 16:55 ` Keith Seitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox