This is the mail archive of the binutils-cvs@sourceware.org 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]
Other format: [Raw text]

[binutils-gdb] Improve the find_nearest_line function for the MIPS target so that it tries harder to find a functio


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=46d09186d340407fdcf066fea25444682e989512

commit 46d09186d340407fdcf066fea25444682e989512
Author: Nick Clifton <nickc@redhat.com>
Date:   Tue Feb 6 17:00:25 2018 +0000

    Improve the find_nearest_line function for the MIPS target so that it tries harder to find a function name.
    
    	PR 22789
    	* elfxx-mips.c (_bfd_mips_elf_find_nearest_line): If the dwarf
    	functions failed to find the function name, try the generic elf
    	find function instead.

Diff:
---
 bfd/ChangeLog    |  7 +++++++
 bfd/elfxx-mips.c | 28 ++++++++++++++++++++++------
 2 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 14ed147..4ce4fc0 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2018-02-06  MiloÅ¡ StojanoviÄ?  <milos.stojanovic@rt-rk.com>
+
+	PR 22789
+	* elfxx-mips.c (_bfd_mips_elf_find_nearest_line): If the dwarf
+	functions failed to find the function name, try the generic elf
+	find function instead.
+
 2018-02-06  Sergio Durigan Junior  <sergiodj@redhat.com>
 
 	* coff-rs6000.c (xcoff_write_archive_contents_old): Use
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index ab65894..246d51c 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -12666,13 +12666,29 @@ _bfd_mips_elf_find_nearest_line (bfd *abfd, asymbol **symbols,
 				     line_ptr, discriminator_ptr,
 				     dwarf_debug_sections,
 				     ABI_64_P (abfd) ? 8 : 0,
-				     &elf_tdata (abfd)->dwarf2_find_line_info))
-    return TRUE;
+				     &elf_tdata (abfd)->dwarf2_find_line_info)
+      || _bfd_dwarf1_find_nearest_line (abfd, symbols, section, offset,
+					filename_ptr, functionname_ptr,
+					line_ptr))
+    {
+      /* PR 22789: If the function name or filename was not found through
+	 the debug information, then try an ordinary lookup instead.  */
+      if ((functionname_ptr != NULL && *functionname_ptr == NULL)
+	  || (filename_ptr != NULL && *filename_ptr == NULL))
+	{
+	  /* Do not override already discovered names.  */
+	  if (functionname_ptr != NULL && *functionname_ptr != NULL)
+	    functionname_ptr = NULL;
 
-  if (_bfd_dwarf1_find_nearest_line (abfd, symbols, section, offset,
-				     filename_ptr, functionname_ptr,
-				     line_ptr))
-    return TRUE;
+	  if (filename_ptr != NULL && *filename_ptr != NULL)
+	    filename_ptr = NULL;
+
+	  _bfd_elf_find_function (abfd, symbols, section, offset,
+				  filename_ptr, functionname_ptr);
+	}
+
+      return TRUE;
+    }
 
   msec = bfd_get_section_by_name (abfd, ".mdebug");
   if (msec != NULL)


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