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

William Cohen <[email protected]>
Newsgroups gmane.linux.oprofile
Message-ID <[email protected]>
On 03/28/2015 12:50 PM, Simon Arlott wrote:
> 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/
> ---

Hi Simon,

Thanks for the patch.  I reviewed it today and it looked fine.  The patch has been checked in and pushed to the upstream oprofile repository.

-Will

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


------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
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.