[binutils-gdb] Fix error case in coffread.c
Tom Tromey
tromey@sourceware.org
Thu Jan 8 21:33:24 GMT 2026
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7a5af285bb7ce4cf6bbf0d82b26be700dbabba91
commit 7a5af285bb7ce4cf6bbf0d82b26be700dbabba91
Author: Tom Tromey <tromey@adacore.com>
Date: Thu Jan 8 14:11:08 2026 -0700
Fix error case in coffread.c
coffread.c is the last spot (that I know of) that incorrectly calls
perror_with_name when a BFD function fails. The issue here is that
perror_with_name examines errno, but BFD failures do not set this.
This patch changes this to use error and bfd_errmsg.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31041
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diff:
---
gdb/coffread.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 54dcc7c765f..c7b55f37fdb 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -761,7 +761,8 @@ coff_symtab_read (minimal_symbol_reader &reader,
/* Position to read the symbol table. */
val = bfd_seek (objfile->obfd.get (), symtab_offset, 0);
if (val < 0)
- perror_with_name (objfile_name (objfile));
+ error (_("Error reading symbols from %s: %s"),
+ objfile_name (objfile), bfd_errmsg (bfd_get_error ()));
coffread_objfile = objfile;
nlist_bfd_global = objfile->obfd.get ();
More information about the Gdb-cvs
mailing list