coff dwarf2 fix

Mark E. snowball3@bigfoot.com
Mon Jan 29 17:18:00 GMT 2001


Hi guys,
I can confirm my idea that the coff_find_nearest_line needs a minor fix.
Using a small sample program compiled with -gcoff, -gstabs+, and -gcoff; addr2line 
successfully printed the line numbers from programs compiled with coff and dwarf2 debug 
info but not with stabs info. With the fix, addr2line successfully prints line numbers 
from all three debug formats. Tested with DJGPP.

2001-01-29  Mark Elbrecht  <snowball3@bigfoot.com>

	* coffgen.c (coff_find_nearest_line): If stabs info is successfully
	  found, do not attempt to find dwarf2 info before returning.

Index: src/bfd/coffgen.c
===================================================================
RCS file: /cvs/src/src/bfd/coffgen.c,v
retrieving revision 1.18
diff -c -p -r1.18 coffgen.c
*** coffgen.c	2001/01/23 11:45:52	1.18
--- coffgen.c	2001/01/30 01:09:01
*************** coff_find_nearest_line (abfd, section, s
*** 2188,2201 ****
  					     &coff_data(abfd)->line_info))
      return false;
  
    /* Also try examining DWARF2 debugging information.  */
    if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
  				     filename_ptr, functionname_ptr,
  				     line_ptr, 0,
  				     &coff_data(abfd)->dwarf2_find_line_info))
-     return true;
- 
- if (found)
      return true;
  
    *filename_ptr = 0;
--- 2188,2201 ----
  					     &coff_data(abfd)->line_info))
      return false;
  
+   if (found)
+     return true;
+ 
    /* Also try examining DWARF2 debugging information.  */
    if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
  				     filename_ptr, functionname_ptr,
  				     line_ptr, 0,
  				     &coff_data(abfd)->dwarf2_find_line_info))
      return true;
  
    *filename_ptr = 0;



More information about the Binutils mailing list