From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1062) id D24833857353; Thu, 6 Apr 2023 00:26:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D24833857353 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Alan Modra To: bfd-cvs@sourceware.org Subject: [binutils-gdb] objdump -g on gcc COFF/PE files X-Act-Checkin: binutils-gdb X-Git-Author: Alan Modra X-Git-Refname: refs/heads/master X-Git-Oldrev: 6ff1cef1b40ccaa45bbbd765d81d750c2dc4f0ac X-Git-Newrev: ff93c7b1a208996747759c4533d1d7d6acb41bce Message-Id: <20230406002610.D24833857353@sourceware.org> Date: Thu, 6 Apr 2023 00:26:10 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Apr 2023 00:26:10 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dff93c7b1a208= 996747759c4533d1d7d6acb41bce commit ff93c7b1a208996747759c4533d1d7d6acb41bce Author: Alan Modra Date: Thu Apr 6 09:24:01 2023 +0930 objdump -g on gcc COFF/PE files =20 objdump -g can't be used much. Trying to dump PE files invariably seems to run into "debug_name_type: no current file" or similar errors, because parse_coff expects a C_FILE symbol to be the first symbol. Dumping -gstabs output works since the N_SO stab is present. Pre-setting the file name won't hurt stabs dumping. =20 * rddbg.c (read_debugging_info): Call debug_set_filename. Diff: --- binutils/rddbg.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/binutils/rddbg.c b/binutils/rddbg.c index 944b4069f95..d9c172e38a4 100644 --- a/binutils/rddbg.c +++ b/binutils/rddbg.c @@ -53,15 +53,18 @@ read_debugging_info (bfd *abfd, asymbol **syms, long sy= mcount, if (dhandle =3D=3D NULL) return NULL; =20 + if (!debug_set_filename (dhandle, bfd_get_filename (abfd))) + return NULL; + if (! read_section_stabs_debugging_info (abfd, syms, symcount, dhandle, &found)) - goto err_exit; + return NULL; =20 if (bfd_get_flavour (abfd) =3D=3D bfd_target_aout_flavour) { if (! read_symbol_stabs_debugging_info (abfd, syms, symcount, dhandl= e, &found)) - goto err_exit; + return NULL; } =20 /* Try reading the COFF symbols if we didn't find any stabs in COFF @@ -71,7 +74,7 @@ read_debugging_info (bfd *abfd, asymbol **syms, long symc= ount, && symcount > 0) { if (! parse_coff (abfd, syms, symcount, dhandle)) - goto err_exit; + return NULL; found =3D true; } =20 @@ -80,7 +83,6 @@ read_debugging_info (bfd *abfd, asymbol **syms, long symc= ount, if (! no_messages) non_fatal (_("%s: no recognized debugging information"), bfd_get_filename (abfd)); - err_exit: return NULL; }