public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@sourceware.org>
To: bfd-cvs@sourceware.org
Subject: [binutils-gdb] objdump -g on gcc COFF/PE files
Date: Thu,  6 Apr 2023 00:26:10 +0000 (GMT)	[thread overview]
Message-ID: <20230406002610.D24833857353@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ff93c7b1a208996747759c4533d1d7d6acb41bce

commit ff93c7b1a208996747759c4533d1d7d6acb41bce
Author: Alan Modra <amodra@gmail.com>
Date:   Thu Apr 6 09:24:01 2023 +0930

    objdump -g on gcc COFF/PE files
    
    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.
    
            * 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 symcount,
   if (dhandle == NULL)
     return NULL;
 
+  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;
 
   if (bfd_get_flavour (abfd) == bfd_target_aout_flavour)
     {
       if (! read_symbol_stabs_debugging_info (abfd, syms, symcount, dhandle,
 					      &found))
-	goto err_exit;
+	return NULL;
     }
 
   /* 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 symcount,
       && symcount > 0)
     {
       if (! parse_coff (abfd, syms, symcount, dhandle))
-	goto err_exit;
+	return NULL;
       found = true;
     }
 
@@ -80,7 +83,6 @@ read_debugging_info (bfd *abfd, asymbol **syms, long symcount,
       if (! no_messages)
 	non_fatal (_("%s: no recognized debugging information"),
 		   bfd_get_filename (abfd));
-    err_exit:
       return NULL;
     }

                 reply	other threads:[~2023-04-06  0:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230406002610.D24833857353@sourceware.org \
    --to=amodra@sourceware.org \
    --cc=bfd-cvs@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).