[PATCH] build-id files shouldn't have to be symlinks

Simon Arlott <[email protected]>
Newsgroups gmane.linux.oprofile
Message-ID <[email protected]>
find_debuginfo_file_by_build requires the file in /usr/lib/debug/.build-id/
to be a symlink, but this is not the case on Ubuntu 14.10 where the -dbg
packages put normal files directly into /usr/lib/debug/.build-id/
---
Index: oprofile-1.0.0/libutil++/bfd_support.cpp
===================================================================
--- oprofile-1.0.0.orig/libutil++/bfd_support.cpp
+++ oprofile-1.0.0/libutil++/bfd_support.cpp
@@ -92,8 +92,8 @@ static bool find_debuginfo_file_by_build
 {
 	size_t build_id_fname_size = strlen (DEBUGDIR) + (sizeof "/.build-id/" - 1) + 1
 			+ (2 * build_id_size) + (sizeof ".debug" - 1) + 1;
-	char * buildid_symlink = (char *) xmalloc(build_id_fname_size);
-	char * sptr = buildid_symlink;
+	char * build_id_fname = (char *) xmalloc(build_id_fname_size);
+	char * sptr = build_id_fname;
 	unsigned char * bptr = buildid;
 	bool retval = false;
 	size_t build_id_segment_len = strlen("/.build-id/");
@@ -110,14 +110,12 @@ static bool find_debuginfo_file_by_build
 
 	strcpy(sptr, ".debug");
 
-	if (access (buildid_symlink, F_OK) == 0) {
-		debug_filename = op_realpath (buildid_symlink);
-		if (debug_filename.compare(buildid_symlink)) {
-			retval = true;
-			cverb << vbfd << "Using build-id symlink" << endl;
-		}
+	if (access(build_id_fname, R_OK) == 0) {
+		debug_filename = string(build_id_fname);
+		retval = true;
+		cverb << vbfd << "Using build-id file" << endl;
 	}
-	free(buildid_symlink);
+	free(build_id_fname);
 	if (!retval)
 		cverb << vbfd << "build-id file not found; falling back to CRC method." << endl;
 

-- 
Simon Arlott

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.