diff options
author | Bernd Edlinger <edlinger@gcc.gnu.org> | 2017-06-05 19:27:30 +0000 |
---|---|---|
committer | Bernd Edlinger <edlinger@gcc.gnu.org> | 2017-06-05 19:27:30 +0000 |
commit | 676519f7138e4ab3938fe4427c3515ca37fe7976 (patch) | |
tree | 7e870093fa932a90587c27490e54116a476f9c85 /gcc/gcov-io.c | |
parent | 7b95ed64c90de3f9e8a2eb47f8ddd9a8344e559b (diff) | |
download | gcc-676519f7138e4ab3938fe4427c3515ca37fe7976.zip gcc-676519f7138e4ab3938fe4427c3515ca37fe7976.tar.gz gcc-676519f7138e4ab3938fe4427c3515ca37fe7976.tar.bz2 |
invoke.texi: Document the -fprofile-abs-path option.
2017-06-05 Bernd Edlinger <bernd.edlinger@hotmail.de>
* doc/invoke.texi: Document the -fprofile-abs-path option.
* common.opt (fprofile-abs-path): New option.
* gcov-io.h (gcov_write_filename): Declare.
* gcov-io.c (gcov_write_filename): New function.
* coverage.c (coverage_begin_function): Use gcov_write_filename.
* profile.c (output_location): Likewise.
gcc/testsuite:
2017-06-05 Bernd Edlinger <bernd.edlinger@hotmail.de>
* gcc.misc-tests/gcov-1a.c: New test.
From-SVN: r248894
Diffstat (limited to 'gcc/gcov-io.c')
-rw-r--r-- | gcc/gcov-io.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/gcc/gcov-io.c b/gcc/gcov-io.c index 64dedd5..2ce26f4 100644 --- a/gcc/gcov-io.c +++ b/gcc/gcov-io.c @@ -357,6 +357,38 @@ gcov_write_string (const char *string) #endif #if !IN_LIBGCOV +/* Write FILENAME to coverage file. Sets error flag on file + error, overflow flag on overflow */ + +GCOV_LINKAGE void +gcov_write_filename (const char *filename) +{ + if (profile_abs_path_flag && filename && filename[0] + && !(IS_DIR_SEPARATOR (filename[0]) +#if HAVE_DOS_BASED_FILE_SYSTEM + || filename[1] == ':' +#endif + )) + { + char *buf = getcwd (NULL, 0); + if (buf != NULL && buf[0]) + { + size_t len = strlen (buf); + buf = (char*)xrealloc (buf, len + strlen (filename) + 2); + if (!IS_DIR_SEPARATOR (buf[len - 1])) + strcat (buf, "/"); + strcat (buf, filename); + gcov_write_string (buf); + free (buf); + return; + } + } + + gcov_write_string (filename); +} +#endif + +#if !IN_LIBGCOV /* Write a tag TAG and reserve space for the record length. Return a value to be used for gcov_write_length. */ |