public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: fnf@toadfish.ninemoons.com
To: binutils@sourceware.cygnus.com
Subject: revised patch for objdump'ing core files
Date: Tue, 26 Oct 1999 16:46:00 -0000	[thread overview]
Message-ID: <199910262354.QAA24845@toadfish.ninemoons.com> (raw)

Some time back, I submitted a patch that allowed objdump to recognize
and dump core files.  However that patch had a couple of problems with
properly handling ambiguously recognized files, particularly
bfd_object files.

I believe this patch fixes that.  This patch is modeled after how
display_bfd works in size.c, by moving the actual code to process the
bfd out of display_bfd and into a separate function called by
display_bfd, once a match is found.

Could someone please review this and check it in if it looks OK now?
Thanks!

-Fred

  1999-10-26  Fred Fish  <fnf@cygnus.com>

	* objdump.c (display_bfd): Break into two functions.  The
	actual dumping code moves to dump_bfd.  If bfd is not
	unambiguously recognized as a bfd_object, attempt to dump
	it as a bfd_core.
	(dump_bfd): New function.

Index: objdump.c
===================================================================
RCS file: /cvs/binutils/binutils/binutils/objdump.c,v
retrieving revision 1.12
diff -c -p -r1.12 objdump.c
*** objdump.c	1999/09/19 22:39:49	1.12
--- objdump.c	1999/10/26 23:33:50
*************** bfd *abfd;
*** 2042,2064 ****
    bfd_print_private_bfd_data (abfd, stdout);
  }
  
  static void
! display_bfd (abfd)
       bfd *abfd;
  {
-   char **matching;
- 
-   if (!bfd_check_format_matches (abfd, bfd_object, &matching))
-     {
-       nonfatal (bfd_get_filename (abfd));
-       if (bfd_get_error () == bfd_error_file_ambiguously_recognized)
- 	{
- 	  list_matching_formats (matching);
- 	  free (matching);
- 	}
-       return;
-     }
- 
    /* If we are adjusting section VMA's, change them all now.  Changing
       the BFD information is a hack.  However, we must do it, or
       bfd_find_nearest_line will not do the right thing.  */
--- 2042,2053 ----
    bfd_print_private_bfd_data (abfd, stdout);
  }
  
+ /* Dump selected contents of ABFD */
+ 
  static void
! dump_bfd (abfd)
       bfd *abfd;
  {
    /* If we are adjusting section VMA's, change them all now.  Changing
       the BFD information is a hack.  However, we must do it, or
       bfd_find_nearest_line will not do the right thing.  */
*************** display_bfd (abfd)
*** 2131,2136 ****
--- 2120,2160 ----
      {
        free (dynsyms);
        dynsyms = NULL;
+     }
+ }
+ 
+ static void
+ display_bfd (abfd)
+      bfd *abfd;
+ {
+   char **matching;
+ 
+   if (bfd_check_format_matches (abfd, bfd_object, &matching))
+     {
+       dump_bfd (abfd);
+       return;
+     }
+ 
+   if (bfd_get_error () == bfd_error_file_ambiguously_recognized)
+     {
+       nonfatal (bfd_get_filename (abfd));
+       list_matching_formats (matching);
+       free (matching);
+       return;
+     }
+ 
+   if (bfd_check_format_matches (abfd, bfd_core, &matching))
+     {
+       dump_bfd (abfd);
+       return;
+     }
+ 
+   nonfatal (bfd_get_filename (abfd));
+ 
+   if (bfd_get_error () == bfd_error_file_ambiguously_recognized)
+     {
+       list_matching_formats (matching);
+       free (matching);
      }
  }
  

                 reply	other threads:[~1999-10-26 16:46 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=199910262354.QAA24845@toadfish.ninemoons.com \
    --to=fnf@toadfish.ninemoons.com \
    --cc=binutils@sourceware.cygnus.com \
    /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).