This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: Fix for PR6483


Hi Guys,

  I have had this patch in my tree for a little while and it has done
  no harm, so I have decided to check it in.  It allows the -g option
  to objdump to try display DWARF debug information if it cannot find
  any STABS or IEEE debug information in the file it is dumping.

Cheers
  Nick

binutils/ChangeLog
2008-06-12  Nick Clifton  <nickc@redhat.com>

	PR binutils/6483
	* objdump.c (dump_bfd): If the -g option found no STABS or IEEE
	debug information to display, try dumping DWARF information
	instead.
	* rddbg.c (read_debugging_info): Add a parameter to suppress the
	display of a warning message when no debug information is found.
	* budbg.h (read_debugging_info): Update prototype.
	* objcopy.c (copy_object): Continue to allow read_debugging_info
	to produce warning messages.
	* doc/binutils.texi (--debugging): Document new behaviour of the
	-g/--debugging option.

Index: budbg.h
===================================================================
RCS file: /cvs/src/src/binutils/budbg.h,v
retrieving revision 1.7
diff -c -3 -p -r1.7 budbg.h
*** budbg.h	5 Jul 2007 16:54:45 -0000	1.7
--- budbg.h	12 Jun 2008 11:28:53 -0000
***************
*** 26,32 ****
  
  /* Routine used to read generic debugging information.  */
  
! extern void *read_debugging_info (bfd *, asymbol **, long);
  
  /* Routine used to print generic debugging information.  */
  
--- 26,32 ----
  
  /* Routine used to read generic debugging information.  */
  
! extern void *read_debugging_info (bfd *, asymbol **, long, bfd_boolean);
  
  /* Routine used to print generic debugging information.  */
  
Index: objcopy.c
===================================================================
RCS file: /cvs/src/src/binutils/objcopy.c,v
retrieving revision 1.121
diff -c -3 -p -r1.121 objcopy.c
*** objcopy.c	16 Apr 2008 08:24:21 -0000	1.121
--- objcopy.c	12 Jun 2008 11:28:54 -0000
*************** copy_object (bfd *ibfd, bfd *obfd)
*** 1674,1680 ****
       have been created, but before their contents are set.  */
    dhandle = NULL;
    if (convert_debugging)
!     dhandle = read_debugging_info (ibfd, isympp, symcount);
  
    if (strip_symbols == STRIP_DEBUG
        || strip_symbols == STRIP_ALL
--- 1674,1680 ----
       have been created, but before their contents are set.  */
    dhandle = NULL;
    if (convert_debugging)
!     dhandle = read_debugging_info (ibfd, isympp, symcount, FALSE);
  
    if (strip_symbols == STRIP_DEBUG
        || strip_symbols == STRIP_ALL
Index: objdump.c
===================================================================
RCS file: /cvs/src/src/binutils/objdump.c,v
retrieving revision 1.140
diff -c -3 -p -r1.140 objdump.c
*** objdump.c	28 Apr 2008 08:30:23 -0000	1.140
--- objdump.c	12 Jun 2008 11:28:55 -0000
*************** dump_bfd (bfd *abfd)
*** 2937,2943 ****
      {
        void *dhandle;
  
!       dhandle = read_debugging_info (abfd, syms, symcount);
        if (dhandle != NULL)
  	{
  	  if (!print_debugging_info (stdout, dhandle, abfd, syms,
--- 2937,2943 ----
      {
        void *dhandle;
  
!       dhandle = read_debugging_info (abfd, syms, symcount, TRUE);
        if (dhandle != NULL)
  	{
  	  if (!print_debugging_info (stdout, dhandle, abfd, syms,
*************** dump_bfd (bfd *abfd)
*** 2949,2954 ****
--- 2949,2960 ----
  	      exit_status = 1;
  	    }
  	}
+       /* PR 6483: If there was no STABS or IEEE debug
+ 	 info in the file, try DWARF instead.  */
+       else if (! dump_dwarf_section_info)
+ 	{
+ 	  dump_dwarf (abfd);
+ 	}
      }
  
    if (syms)
Index: rddbg.c
===================================================================
RCS file: /cvs/src/src/binutils/rddbg.c,v
retrieving revision 1.13
diff -c -3 -p -r1.13 rddbg.c
*** rddbg.c	5 Jul 2007 16:54:45 -0000	1.13
--- rddbg.c	12 Jun 2008 11:28:55 -0000
*************** static void free_saved_stabs (void);
*** 45,51 ****
     pointer.  */
  
  void *
! read_debugging_info (bfd *abfd, asymbol **syms, long symcount)
  {
    void *dhandle;
    bfd_boolean found;
--- 45,51 ----
     pointer.  */
  
  void *
! read_debugging_info (bfd *abfd, asymbol **syms, long symcount, bfd_boolean no_messages)
  {
    void *dhandle;
    bfd_boolean found;
*************** read_debugging_info (bfd *abfd, asymbol 
*** 84,91 ****
  
    if (! found)
      {
!       non_fatal (_("%s: no recognized debugging information"),
! 		 bfd_get_filename (abfd));
        return NULL;
      }
  
--- 84,92 ----
  
    if (! found)
      {
!       if (! no_messages)
! 	non_fatal (_("%s: no recognized debugging information"),
! 		   bfd_get_filename (abfd));
        return NULL;
      }
  
Index: doc/binutils.texi
===================================================================
RCS file: /cvs/src/src/binutils/doc/binutils.texi,v
retrieving revision 1.128
diff -c -3 -p -r1.128 binutils.texi
*** doc/binutils.texi	30 Apr 2008 07:27:17 -0000	1.128
--- doc/binutils.texi	12 Jun 2008 11:28:56 -0000
*************** for more information on demangling.
*** 1693,1703 ****
  
  @item -g
  @itemx --debugging
! Display debugging information.  This attempts to parse debugging
! information stored in the file and print it out using a C like syntax.
! Only certain types of debugging information have been implemented.
! Some other types are supported by @command{readelf -w}.
! @xref{readelf}.
  
  @item -e
  @itemx --debugging-tags
--- 1693,1703 ----
  
  @item -g
  @itemx --debugging
! Display debugging information.  This attempts to parse STABS and IEEE
! debugging format information stored in the file and print it out using
! a C like syntax.  If neither of these formats are found this option
! falls back on the @option{-W} option to print any DWARF information in
! the file.
  
  @item -e
  @itemx --debugging-tags

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]