libunwind-devel
[Top][All Lists]
Advanced

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

[Libunwind-devel] [PATCH 2/6] Fix .gnu_debuglink lookup for separate deb


From: anderson . lizardo
Subject: [Libunwind-devel] [PATCH 2/6] Fix .gnu_debuglink lookup for separate debug symbols
Date: Thu, 17 Jul 2008 10:23:24 -0300
User-agent: quilt/0.46-1

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 <address@hidden>
Signed-off-by: Bruna Moreira <address@hidden>
---
 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




reply via email to

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