bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nm --line-numbers crash on Solaris


From: Alan Modra
Subject: Re: nm --line-numbers crash on Solaris
Date: Wed, 1 May 2002 16:13:04 +0930
User-agent: Mutt/1.3.25i

On Mon, Apr 29, 2002 at 11:41:29AM +0200, Bjørn Reese wrote:
> The nm utility crashes on Solaris if used with the --line-numbers
> option on an object without debugging symbols.

Thanks.  I'm committing the following, which is slightly different
from your patch in that we'll continue looping over syms and
relocs if bfd_find_nearest_line doesn't return a filename.

binutils//ChangeLog
        * nm.c (print_symbol): Check returned filename from
        bfd_find_nearest_line is non-NULL.

Index: binutils//nm.c
===================================================================
RCS file: /cvs/src/src/binutils/nm.c,v
retrieving revision 1.19
diff -u -p -r1.19 nm.c
--- binutils//nm.c      30 Jan 2002 05:00:07 -0000      1.19
+++ binutils//nm.c      1 May 2002 06:41:10 -0000
@@ -1291,7 +1291,8 @@ print_symbol (abfd, sym, archive_bfd)
                                 bfd_asymbol_name (*r->sym_ptr_ptr)) == 0
                      && bfd_find_nearest_line (abfd, secs[i], syms,
                                                r->address, &filename,
-                                               &functionname, &lineno))
+                                               &functionname, &lineno)
+                     && filename != NULL)
                    {
                      /* We only print the first one we find.  */
                      printf ("\t%s:%u", filename, lineno);

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



reply via email to

[Prev in Thread] Current Thread [Next in Thread]