Current implementation fails to find separate debug symbols when .gnu_debuglink
is set to the same name of the target ELF basename (e.g. "libc.so.6" for
/lib/libc.so.6). This patch fixes this by ignoring separate debug files that
contain a .gnu_debuglink section.

It also fixes a small typo in a related Debug() line.

Signed-off-by: Anderson Lizardo <[EMAIL PROTECTED]>
Signed-off-by: Bruna Moreira <[EMAIL PROTECTED]>
---
 src/dwarf/Gfind_proc_info-lsb.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Index: libunwind-indt-split-v2/src/dwarf/Gfind_proc_info-lsb.c
===================================================================
--- libunwind-indt-split-v2.orig/src/dwarf/Gfind_proc_info-lsb.c
+++ libunwind-indt-split-v2/src/dwarf/Gfind_proc_info-lsb.c
@@ -153,7 +153,7 @@
          Debug (4, "read %d bytes of .debug_frame from offset %d\n",
                 *bufsize, sec_hdrs[i].sh_offset);
        }
-      else if (is_local >= 0 && strcmp (secname, ".gnu_debuglink") == 0)
+      else if (strcmp (secname, ".gnu_debuglink") == 0)
        {
          linksize = sec_hdrs[i].sh_size;
          linkbuf = malloc (linksize);
@@ -162,7 +162,7 @@
          fread (linkbuf, 1, linksize, f);
 
          Debug (4, "read %d bytes of .gnu_debuglink from offset %d\n",
-                *bufsize, sec_hdrs[i].sh_offset);
+                linksize, sec_hdrs[i].sh_offset);
        }
     }
 
@@ -171,6 +171,13 @@
 
   fclose (f);
 
+  /* Ignore separate debug files which contain a .gnu_debuglink section. */
+  if (linkbuf && is_local == -1)
+    {
+      free (linkbuf);
+      return 1;
+    }
+
   if (*buf == NULL && linkbuf != NULL && memchr (linkbuf, 0, linksize) != NULL)
     {
       char *newname, *basedir, *p;

-- 
Anderson Lizardo
Instituto Nokia de Tecnologia (INdT)
Manaus - Brazil


_______________________________________________
Libunwind-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/libunwind-devel

Reply via email to