* revised patch for objdump'ing core files
@ 1999-10-26 16:46 fnf
0 siblings, 0 replies; only message in thread
From: fnf @ 1999-10-26 16:46 UTC (permalink / raw)
To: binutils
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);
}
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1999-10-26 16:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-10-26 16:46 revised patch for objdump'ing core files fnf
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).