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]

Re: elf64_alpha_find_nearest_line fails for compaq execs


Your patch works for executables generated with the compaq
compiler, but not for those made with gcc.  The problem is that
_bfd_elf_find_nearest_line can find the function name, so it
returns true; but it doesn't get the filename or line number.  A
slight modification of your patch to test that the line number
was set fixes this.  With the patch below both compaq and gcc
executables work fine.

Curt

--- elf64-alpha.c.orig	Mon Jan 29 10:19:42 2001
+++ elf64-alpha.c	Mon Jan 29 10:36:31 2001
@@ -2081,6 +2081,14 @@
 {
   asection *msec;
 
+  /* Begin with the generic ELF find_nearest_line routine.  This avoids
+     confusion when a compiler emits complete dwarf2 debug info, and a
+     minimal mdebug procedure descriptor.  */
+  if (_bfd_elf_find_nearest_line (abfd, section, symbols, offset,
+				  filename_ptr, functionname_ptr, line_ptr)
+      && *line_ptr)
+    return true;
+
   msec = bfd_get_section_by_name (abfd, ".mdebug");
   if (msec != NULL)
     {
@@ -2157,11 +2165,7 @@
       msec->flags = origflags;
     }
 
-  /* Fall back on the generic ELF find_nearest_line routine.  */
-
-  return _bfd_elf_find_nearest_line (abfd, section, symbols, offset,
-				     filename_ptr, functionname_ptr,
-				     line_ptr);
+  return false;
 }
 
 /* Structure used to pass information to alpha_elf_output_extsym.  */


Richard Henderson <rth@redhat.com> writes:
> Date: Fri, 26 Jan 2001 16:14:58 -0800
> On Thu, Jan 25, 2001 at 03:17:12PM -0800, Curtis L. Janssen wrote:
> > The problem seems to be that elf64_alpha_find_nearest_line tries
> > to find the line number from ecoff info before falling back to
> > dwarf2.  It thinks it found something; however, the info is
> > incorrect.  The Compaq compiler uses dwarf2 so the problem can
> > be fixed by checking for dwarf2 info first. This doesn't break
> > code generated by gcc.  Here is is patch that implements this
> > fix:
> 
> Try the following instead.  I think it should have the same
> effect without adding more code.
> 
> 
> r~
> 
> 
> Index: elf64-alpha.c
> ===================================================================
> RCS file: /cvs/src/src/bfd/elf64-alpha.c,v
> retrieving revision 1.19
> diff -c -p -d -r1.19 elf64-alpha.c
> *** elf64-alpha.c	2001/01/27 00:04:09	1.19
> --- elf64-alpha.c	2001/01/27 00:12:43
> *************** elf64_alpha_find_nearest_line (abfd, sec
> *** 2105,2110 ****
> --- 2105,2117 ----
>   {
>     asection *msec;
>   
> +   /* Begin with the generic ELF find_nearest_line routine.  This avoids
> +      confusion when a compiler emits complete dwarf2 debug info, and a
> +      minimal mdebug procedure descriptor.  */
> +   if (_bfd_elf_find_nearest_line (abfd, section, symbols, offset,
> + 				  filename_ptr, functionname_ptr, line_ptr))
> +     return true;
> + 
>     msec = bfd_get_section_by_name (abfd, ".mdebug");
>     if (msec != NULL)
>       {
> *************** elf64_alpha_find_nearest_line (abfd, sec
> *** 2181,2191 ****
>         msec->flags = origflags;
>       }
>   
> !   /* Fall back on the generic ELF find_nearest_line routine.  */
> ! 
> !   return _bfd_elf_find_nearest_line (abfd, section, symbols, offset,
> ! 				     filename_ptr, functionname_ptr,
> ! 				     line_ptr);
>   }
>   
>   /* Structure used to pass information to alpha_elf_output_extsym.  */
> --- 2188,2194 ----
>         msec->flags = origflags;
>       }
>   
> !   return false;
>   }
>   
>   /* Structure used to pass information to alpha_elf_output_extsym.  */
> 

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