diff options
authorPeter Oberparleiter <>2009-06-30 11:41:20 -0700
committerLinus Torvalds <>2009-06-30 18:55:59 -0700
commit972c71a3183ab41c0b1a9e50842be7e3e980954f (patch)
parentb01e8dc34379f4ba2f454390e340a025edbaaa7e (diff)
gcov: fix documentation
Commonly available versions of cp and tar don't work well with special files created using seq_file. Mention this problem in the gcov documentation and update the helper script example to work around these problems. Signed-off-by: Peter Oberparleiter <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
1 files changed, 16 insertions, 9 deletions
diff --git a/Documentation/gcov.txt b/Documentation/gcov.txt
index e716aadb3a33..40ec63352760 100644
--- a/Documentation/gcov.txt
+++ b/Documentation/gcov.txt
@@ -188,13 +188,18 @@ Solution: Exclude affected source files from profiling by specifying
GCOV_PROFILE := n or GCOV_PROFILE_basename.o := n in the
corresponding Makefile.
+Problem: Files copied from sysfs appear empty or incomplete.
+Cause: Due to the way seq_file works, some tools such as cp or tar
+ may not correctly copy files from sysfs.
+Solution: Use 'cat' to read .gcda files and 'cp -d' to copy links.
+ Alternatively use the mechanism shown in Appendix B.
Appendix A:
Sample script to gather coverage meta files on the build machine
(see 6a):
@@ -226,7 +231,7 @@ Appendix B:
Sample script to gather coverage data files on the test machine
(see 6b):
+#!/bin/bash -e
@@ -236,11 +241,13 @@ if [ -z "$DEST" ] ; then
exit 1
-find $GCDA -name '*.gcno' -o -name '*.gcda' | tar cfz $DEST -T -
+TEMPDIR=$(mktemp -d)
+echo Collecting data..
+find $GCDA -type d -exec mkdir -p $TEMPDIR/\{\} \;
+find $GCDA -name '*.gcda' -exec sh -c 'cat < $0 > '$TEMPDIR'/$0' {} \;
+find $GCDA -name '*.gcno' -exec sh -c 'cp -d $0 '$TEMPDIR'/$0' {} \;
+tar czf $DEST -C $TEMPDIR sys
+rm -rf $TEMPDIR
-if [ $? -eq 0 ] ; then
- echo "$DEST successfully created, copy to build system and unpack with:"
- echo " tar xfz $DEST"
- echo "Could not create file $DEST"
+echo "$DEST successfully created, copy to build system and unpack with:"
+echo " tar xfz $DEST"