This is the mail archive of the binutils@sources.redhat.com 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]

Patch to readelf dwarf2 support


This patch updates readelf to support linkonce.wi sections (which GCC may
one day use) and emits info about the CU before failing (which I found
useful for debugging bogus output from GCC).  Applied.

2000-12-04  Jason Merrill  <jason@redhat.com>

	* readelf.c (process_section_headers): Handle linkonce.wi sections.
	(display_debug_section): Likewise.
	(display_debug_info): Display CU header before bailing.

*** readelf.c.~1~	Mon Dec  4 16:23:02 2000
--- readelf.c	Mon Dec  4 16:23:36 2000
*************** process_section_headers (file)
*** 2765,2770 ****
--- 2765,2774 ----
  	      )
  	    request_dump (i, DEBUG_DUMP);
  	}
+       /* linkonce section to be combined with .debug_info at link time.  */
+       else if ((do_debugging || do_debug_info)
+ 	       && strncmp (name, ".gnu.linkonce.wi.", 17) == 0)
+ 	request_dump (i, DEBUG_DUMP);
        else if (do_debug_frames && strcmp (name, ".eh_frame") == 0)
  	request_dump (i, DEBUG_DUMP);
      }
*************** display_debug_info (section, start, file
*** 6323,6340 ****
        cu_offset = start - section_begin;
        start += compunit.cu_length + sizeof (external->cu_length);
  
        if (compunit.cu_version != 2)
  	{
  	  warn (_("Only version 2 DWARF debug information is currently supported.\n"));
  	  continue;
  	}
  
-       printf (_("  Compilation Unit:\n"));
-       printf (_("   Length:        %ld\n"), compunit.cu_length);
-       printf (_("   Version:       %d\n"), compunit.cu_version);
-       printf (_("   Abbrev Offset: %ld\n"), compunit.cu_abbrev_offset);
-       printf (_("   Pointer Size:  %d\n"), compunit.cu_pointer_size);
- 
        if (first_abbrev != NULL)
  	free_abbrevs ();
  
--- 6327,6344 ----
        cu_offset = start - section_begin;
        start += compunit.cu_length + sizeof (external->cu_length);
  
+       printf (_("  Compilation Unit @ %lx:\n"), cu_offset);
+       printf (_("   Length:        %ld\n"), compunit.cu_length);
+       printf (_("   Version:       %d\n"), compunit.cu_version);
+       printf (_("   Abbrev Offset: %ld\n"), compunit.cu_abbrev_offset);
+       printf (_("   Pointer Size:  %d\n"), compunit.cu_pointer_size);
+ 
        if (compunit.cu_version != 2)
  	{
  	  warn (_("Only version 2 DWARF debug information is currently supported.\n"));
  	  continue;
  	}
  
        if (first_abbrev != NULL)
  	free_abbrevs ();
  
*************** display_debug_section (section, file)
*** 7044,7049 ****
--- 7048,7055 ----
  		  "debug section data");
  
    /* See if we know how to display the contents of this section.  */
+   if (strncmp (name, ".gnu.linkonce.wi.", 17) == 0)
+     name = ".debug_info";  
    for (i = NUM_ELEM (debug_displays); i--;)
      if (strcmp (debug_displays[i].name, name) == 0)
        {

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