diff options
Diffstat (limited to 'Documentation/gcov.txt')
-rw-r--r-- | Documentation/gcov.txt | 25 |
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 | |||
188 | GCOV_PROFILE := n or GCOV_PROFILE_basename.o := n in the | 188 | GCOV_PROFILE := n or GCOV_PROFILE_basename.o := n in the |
189 | corresponding Makefile. | 189 | corresponding Makefile. |
190 | 190 | ||
191 | Problem: Files copied from sysfs appear empty or incomplete. | ||
192 | Cause: Due to the way seq_file works, some tools such as cp or tar | ||
193 | may not correctly copy files from sysfs. | ||
194 | Solution: Use 'cat' to read .gcda files and 'cp -d' to copy links. | ||
195 | Alternatively use the mechanism shown in Appendix B. | ||
196 | |||
191 | 197 | ||
192 | Appendix A: gather_on_build.sh | 198 | Appendix A: gather_on_build.sh |
193 | ============================== | 199 | ============================== |
194 | 200 | ||
195 | Sample script to gather coverage meta files on the build machine | 201 | Sample script to gather coverage meta files on the build machine |
196 | (see 6a): | 202 | (see 6a): |
197 | |||
198 | #!/bin/bash | 203 | #!/bin/bash |
199 | 204 | ||
200 | KSRC=$1 | 205 | KSRC=$1 |
@@ -226,7 +231,7 @@ Appendix B: gather_on_test.sh | |||
226 | Sample script to gather coverage data files on the test machine | 231 | Sample script to gather coverage data files on the test machine |
227 | (see 6b): | 232 | (see 6b): |
228 | 233 | ||
229 | #!/bin/bash | 234 | #!/bin/bash -e |
230 | 235 | ||
231 | DEST=$1 | 236 | DEST=$1 |
232 | GCDA=/sys/kernel/debug/gcov | 237 | GCDA=/sys/kernel/debug/gcov |
@@ -236,11 +241,13 @@ if [ -z "$DEST" ] ; then | |||
236 | exit 1 | 241 | exit 1 |
237 | fi | 242 | fi |
238 | 243 | ||
239 | find $GCDA -name '*.gcno' -o -name '*.gcda' | tar cfz $DEST -T - | 244 | TEMPDIR=$(mktemp -d) |
245 | echo Collecting data.. | ||
246 | find $GCDA -type d -exec mkdir -p $TEMPDIR/\{\} \; | ||
247 | find $GCDA -name '*.gcda' -exec sh -c 'cat < $0 > '$TEMPDIR'/$0' {} \; | ||
248 | find $GCDA -name '*.gcno' -exec sh -c 'cp -d $0 '$TEMPDIR'/$0' {} \; | ||
249 | tar czf $DEST -C $TEMPDIR sys | ||
250 | rm -rf $TEMPDIR | ||
240 | 251 | ||
241 | if [ $? -eq 0 ] ; then | 252 | echo "$DEST successfully created, copy to build system and unpack with:" |
242 | echo "$DEST successfully created, copy to build system and unpack with:" | 253 | echo " tar xfz $DEST" |
243 | echo " tar xfz $DEST" | ||
244 | else | ||
245 | echo "Could not create file $DEST" | ||
246 | fi | ||