[valgrind] [Bug 387773] Files in .gnu_debugaltlink should be resolved relative to .debug file, not symlink.

2018-01-13 Thread Mark Wielaard
https://bugs.kde.org/show_bug.cgi?id=387773

Mark Wielaard  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|REOPENED|RESOLVED

--- Comment #3 from Mark Wielaard  ---
Tested additional fix in Fedora and committed now as

commit 7d0403032250c8985ae99a96af7bcd9190ad654b
Author: Mark Wielaard 
Date:   Sat Jan 13 14:33:50 2018 +0100

Additional fix for gnu debug alt file resolving.

Also handle the case where the symlink itself contains a relative path.
Then we need to add the symlink dir before it.

https://bugs.kde.org/show_bug.cgi?id=387773

-- 
You are receiving this mail because:
You are watching all bug changes.

[valgrind] [Bug 387773] Files in .gnu_debugaltlink should be resolved relative to .debug file, not symlink.

2018-01-02 Thread Mark Wielaard
https://bugs.kde.org/show_bug.cgi?id=387773

Mark Wielaard  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Ever confirmed|0   |1
 Resolution|FIXED   |---

--- Comment #2 from Mark Wielaard  ---
This is still not completely correct. If the symlink itself contains a relative
path then we need to add the symlink dir before it. Something like the
following:

diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c
index c19ff212b..70c28e629 100644
--- a/coregrind/m_debuginfo/readelf.c
+++ b/coregrind/m_debuginfo/readelf.c
@@ -1582,6 +1582,24 @@ static HChar* readlink_path (const HChar *path)
   return NULL;
}

+  if (buf[0] == '/')
+return buf;
+
+  /* Relative path, add link dir.  */
+  HChar *linkdirptr;
+  SizeT linkdir_len = VG_(strlen)(path);
+  if ((linkdirptr = VG_(strrchr)(path, '/')) != NULL)
+linkdir_len -= VG_(strlen)(linkdirptr + 1);
+
+  SizeT buflen = VG_(strlen)(buf);
+  SizeT needed = linkdir_len + buflen + 1;
+  if (bufsiz < needed)
+buf = ML_(dinfo_realloc)("readlink_path.linkdir", buf, needed);
+
+  VG_(memmove)(buf + linkdir_len, buf, buflen);
+  VG_(memcpy)(buf, path, linkdir_len);
+  buf[needed - 1] = '\0';
+
   return buf;
 }

-- 
You are receiving this mail because:
You are watching all bug changes.

[valgrind] [Bug 387773] Files in .gnu_debugaltlink should be resolved relative to .debug file, not symlink.

2017-12-12 Thread Mark Wielaard
https://bugs.kde.org/show_bug.cgi?id=387773

Mark Wielaard  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|UNCONFIRMED |RESOLVED

--- Comment #1 from Mark Wielaard  ---
commit be82bb5f9dfecd854c53eda321d1914f28f19790
Author: Mark Wielaard 
Date:   Sat Dec 9 23:01:29 2017 +0100

Fix gnu debug alt file resolving.

https://bugs.kde.org/show_bug.cgi?id=387773

The path to the alt file is relative to the actual debug file.
Make sure that we got the real file, not a (build-id) symlink.
Also handle the case where a debug or alt file is an absolute path.

-- 
You are receiving this mail because:
You are watching all bug changes.