question about dwarf.c

Tom Tromey tromey@redhat.com
Thu Aug 12 17:51:00 GMT 2010


I recently happened across an object with non-zero LMA and VMAs for the
.debug_info section.  Trying to dump this section with "readelf -wi"
caused readelf to crash.

The crash occurs because the call to process_abbrev_section subtracts
out the section address, thus passing an invalid pointer to
process_abbrev_section.

Can someone explain the reason for this?  I don't understand it.

FWIW, the appended patch stops the crash for me.

Tom

*** dwarf.c.~1.71.~	2010-08-05 10:17:53.000000000 -0600
--- dwarf.c	2010-08-12 11:28:53.000000000 -0600
***************
*** 2078,2084 ****
  	process_abbrev_section
  	  ((unsigned char *) debug_displays [abbrev_sec].section.start
  	   + compunit.cu_abbrev_offset
!            - debug_displays [abbrev_sec].section.address,
  	   (unsigned char *) debug_displays [abbrev_sec].section.start
  	   + debug_displays [abbrev_sec].section.size);
  
--- 2078,2084 ----
  	process_abbrev_section
  	  ((unsigned char *) debug_displays [abbrev_sec].section.start
  	   + compunit.cu_abbrev_offset
!            /* - debug_displays [abbrev_sec].section.address */,
  	   (unsigned char *) debug_displays [abbrev_sec].section.start
  	   + debug_displays [abbrev_sec].section.size);
  



More information about the Binutils mailing list