Current lookup order for e.g. /lib/libc.so.6 is:

1) /lib/libc.so.6
2) /lib/.debug/libc.so.6
3) /usr/lib/debug/lib/libc.so.6

That does not work, because it will first read /lib/libc.so.6, see the
debuglink pointing to "libc.so.6" and again try to lookup /lib/libc.so.6. This
patch changes that order to: 

1) /usr/lib/debug/lib/libc.so.6
2) /lib/.debug/libc.so.6
3) /lib/libc.so.6

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

Index: libunwind-indt-split/src/dwarf/Gfind_proc_info-lsb.c
===================================================================
--- libunwind-indt-split.orig/src/dwarf/Gfind_proc_info-lsb.c
+++ libunwind-indt-split/src/dwarf/Gfind_proc_info-lsb.c
@@ -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);
        }
     }
 
@@ -191,7 +191,8 @@
       else
        basedir[0] = 0;
 
-      strcpy (newname, basedir);
+      strcpy (newname, debugdir);
+      strcat (newname, basedir);
       strcat (newname, "/");
       strcat (newname, linkbuf);
       ret = load_debug_frame (newname, buf, bufsize, -1);
@@ -206,8 +207,7 @@
 
       if (ret == 1 && is_local == 1)
        {
-         strcpy (newname, debugdir);
-         strcat (newname, basedir);
+         strcpy (newname, basedir);
          strcat (newname, "/");
          strcat (newname, linkbuf);
          ret = load_debug_frame (newname, buf, bufsize, -1);

-- 
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