[3.4 patch] relocate profile data file

Grigory Zagorodnev grigory_zagorodnev@linux.intel.com
Wed May 4 20:39:00 GMT 2005


Hi,

Attached is the libgconv patch that allows .gcda files relocation when 
running instrumented executable on system other than executable been 
built on (cross-profiling). This is the solution of problem discussed a 
while ago http://gcc.gnu.org/ml/gcc/2005-04/msg01290.html.

In particular the patch allows to:
1\ automatically create directory structure if does not exist
2\ relocate filename basing on value of two optional environment variables:
	GCOV_PREFIX contains the prefix to add to the absolute paths
	in the object file.
	GCOV_PREFIX_STRIP indicates the how many initial directory names
	to strip off the hardwired absolute paths. Default is 0.

Tested on x86_64-redhat-linux. Is it Ok for 3.4 branch?

2005-05-04  Grigory Zagorodnev  <grigory.zagorodnev@intel.com>
             H.J. Lu  <hongjiu.lu@intel.com>

	Cross-profiling support: relocate .gcda files when
	running at system other than executable been built on.

	* gcov-io.c (gcov_open): When in libgcov library
	use given data file relocation prefix to build file name.
	* gcov-io.h (gcov_open): Updated proto to accept
	data file relocation prefix.
	* libgcov.c (create_file_directory): New function.
	(gcov_prefix): New static variable to hold data file
	relocation prefix.
	(gcov_version): Use relocation prefix.
	(gcov_exit): Always try to create directory for output
	file. Relocate filename at each use.
	(__gcov_init): Initialize directory relocation prefix
	if required. Strip off leading directories from
	the initial filename.
	* tsystem.h: include filenames.h
	(DIR_SEPARATOR): Macro copied from system.h.
	(DIR_SEPARATOR_2): Likewise.
	* doc/gcov.texi (Cross-profiling): New node documenting
	cross-profiling management.
	* doc/invoke.texi (-fprofile-arcs): xref to cross-profiling.

---
Grigory Zagorodnev
Intel Corporation
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: libgcov.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050504/397a94e3/attachment.ksh>


More information about the Gcc-patches mailing list