OLD | NEW |
(Empty) | |
| 1 .TH lcov 1 "LCOV 1.7" 2008\-11\-17 "User Manuals" |
| 2 .SH NAME |
| 3 lcov \- a graphical GCOV front\-end |
| 4 .SH SYNOPSIS |
| 5 .B lcov |
| 6 .RB [ \-h | \-\-help ] |
| 7 .RB [ \-v | \-\-version ] |
| 8 .RB [ \-q | \-\-quiet ] |
| 9 .RS 5 |
| 10 .br |
| 11 .RB [ \-z | \-\-zerocounters ] |
| 12 .RB [ \-c | \-\-capture ] |
| 13 .br |
| 14 .RB [ \-a | \-\-add\-tracefile |
| 15 .IR tracefile ] |
| 16 .br |
| 17 .RB [ \-e | \-\-extract |
| 18 .IR tracefile ] |
| 19 .br |
| 20 .RB [ \-r | \-\-remove |
| 21 .IR tracefile ] |
| 22 .br |
| 23 .RB [ \-l | \-\-list |
| 24 .IR tracefile ] |
| 25 .br |
| 26 .RB [ \-\-diff |
| 27 .IR "tracefile diff" ] |
| 28 .br |
| 29 .RB [ \-i | \-\-initial ] |
| 30 .RB [ \-t | \-\-test\-name |
| 31 .IR testname ] |
| 32 .br |
| 33 .RB [ \-o | \-\-output\-file |
| 34 .IR filename ] |
| 35 .br |
| 36 .RB [ \-d | \-\-directory |
| 37 .IR directory ] |
| 38 .br |
| 39 .RB [ \-f | \-\-follow ] |
| 40 .br |
| 41 .RB [ \-k | \-\-kernel\-directory |
| 42 .IR directory ] |
| 43 .br |
| 44 .RB [ \-b | \-\-base\-directory |
| 45 .IR directory ] |
| 46 .br |
| 47 .RB [ \-\-convert\-filenames ] |
| 48 .RB [ \-\-strip |
| 49 .IR depth ] |
| 50 .RB [ \-\-path |
| 51 .IR path ] |
| 52 .br |
| 53 .RB [ \-\-checksum ] |
| 54 .RB [ \-\-no\-checksum ] |
| 55 .br |
| 56 .RB [ \-\-compat\-libtool ] |
| 57 .RB [ \-\-no\-compat\-libtool ] |
| 58 .br |
| 59 .RB [ \-\-gcov\-tool |
| 60 .IR tool ] |
| 61 .RB [ \-\-ignore\-errors |
| 62 .IR errors ] |
| 63 .br |
| 64 .RB [ \-\-no\-recursion ] |
| 65 .SH DESCRIPTION |
| 66 .B lcov |
| 67 is a graphical front\-end for GCC's coverage testing tool gcov. It collects |
| 68 gcov data for multiple source files and creates HTML pages containing the |
| 69 source code annotated with coverage information. It also adds overview pages |
| 70 for easy navigation within the file structure. |
| 71 |
| 72 Use |
| 73 .B lcov |
| 74 to collect coverage data and |
| 75 .B genhtml |
| 76 to create HTML pages. Coverage data can either be collected from the |
| 77 currently running Linux kernel or from a user space application. To do this, |
| 78 you have to complete the following preparation steps: |
| 79 |
| 80 For Linux kernel coverage: |
| 81 .RS |
| 82 Follow the installation instructions for the gcov\-kernel patch: |
| 83 .I http://ltp.sourceforge.net/coverage/gcov.php |
| 84 |
| 85 .RE |
| 86 For user space application coverage: |
| 87 .RS |
| 88 Compile the application with GCC using the options |
| 89 "\-fprofile\-arcs" and "\-ftest\-coverage". |
| 90 .RE |
| 91 |
| 92 Please note that this man page refers to the output format of |
| 93 .B lcov |
| 94 as ".info file" or "tracefile" and that the output of GCOV |
| 95 is called ".da file". |
| 96 .SH OPTIONS |
| 97 |
| 98 |
| 99 .B \-a |
| 100 .I tracefile |
| 101 .br |
| 102 .B \-\-add\-tracefile |
| 103 .I tracefile |
| 104 .br |
| 105 .RS |
| 106 Add contents of |
| 107 .IR tracefile . |
| 108 |
| 109 Specify several tracefiles using the \-a switch to combine the coverage data |
| 110 contained in these files by adding up execution counts for matching test and |
| 111 filename combinations. |
| 112 |
| 113 The result of the add operation will be written to stdout or the tracefile |
| 114 specified with \-o. |
| 115 |
| 116 Only one of \-z, \-c, \-a, \-e, \-r, \-l and \-\-diff may be specified |
| 117 at a time. |
| 118 |
| 119 .RE |
| 120 |
| 121 .B \-b |
| 122 .I directory |
| 123 .br |
| 124 .B \-\-base\-directory |
| 125 .I directory |
| 126 .br |
| 127 .RS |
| 128 .RI "Use " directory |
| 129 as base directory for relative paths. |
| 130 |
| 131 Use this option to specify the base directory of a build\-environment |
| 132 when lcov produces error messages like: |
| 133 |
| 134 .RS |
| 135 ERROR: could not read source file /home/user/project/subdir1/subdir2/subdir1/sub
dir2/file.c |
| 136 .RE |
| 137 |
| 138 In this example, use /home/user/project as base directory. |
| 139 |
| 140 This option is required when using lcov on projects built with libtool or |
| 141 similar build environments that work with a base directory, i.e. environments, |
| 142 where the current working directory when invoking the compiler is not the same |
| 143 directory in which the source code file is located. |
| 144 |
| 145 Note that this option will not work in environments where multiple base |
| 146 directories are used. In that case repeat the lcov call for each base directory |
| 147 while using the \-\-ignore\-errors option to prevent lcov from exiting when the |
| 148 first source code file could not be found. This way you can get partial coverage |
| 149 information for each base directory which can then be combined using the \-a |
| 150 option. |
| 151 .RE |
| 152 |
| 153 .B \-c |
| 154 .br |
| 155 .B \-\-capture |
| 156 .br |
| 157 .RS |
| 158 Capture coverage data. |
| 159 |
| 160 By default captures the current kernel execution counts and writes the |
| 161 resulting coverage data to the standard output. Use the \-\-directory |
| 162 option to capture counts for a user space program. |
| 163 |
| 164 The result of the capture operation will be written to stdout or the tracefile |
| 165 specified with \-o. |
| 166 |
| 167 Only one of \-z, \-c, \-a, \-e, \-r, \-l and \-\-diff may be specified |
| 168 at a time. |
| 169 .RE |
| 170 |
| 171 .B \-\-checksum |
| 172 .br |
| 173 .B \-\-no\-checksum |
| 174 .br |
| 175 .RS |
| 176 Specify whether to generate checksum data when writing tracefiles. |
| 177 |
| 178 Use \-\-checksum to enable checksum generation or \-\-no\-checksum to |
| 179 disable it. Checksum generation is |
| 180 .B disabled |
| 181 by default. |
| 182 |
| 183 When checksum generation is enabled, a checksum will be generated for each |
| 184 source code line and stored along with the coverage data. This checksum will |
| 185 be used to prevent attempts to combine coverage data from different source |
| 186 code versions. |
| 187 |
| 188 If you don't work with different source code versions, disable this option |
| 189 to speed up coverage data processing and to reduce the size of tracefiles. |
| 190 .RE |
| 191 |
| 192 .B \-\-compat\-libtool |
| 193 .br |
| 194 .B \-\-no\-compat\-libtool |
| 195 .br |
| 196 .RS |
| 197 Specify whether to enable libtool compatibility mode. |
| 198 |
| 199 Use \-\-compat\-libtool to enable libtool compatibility mode or \-\-no\-compat\-
libtool |
| 200 to disable it. The libtool compatibility mode is |
| 201 .B enabled |
| 202 by default. |
| 203 |
| 204 When libtool compatibility mode is enabled, lcov will assume that the source |
| 205 code relating to a .da file located in a directory named ".libs" can be |
| 206 found in its parent directory. |
| 207 |
| 208 If you have directories named ".libs" in your build environment but don't use |
| 209 libtool, disable this option to prevent problems when capturing coverage data. |
| 210 .RE |
| 211 |
| 212 .B \-\-convert\-filenames |
| 213 .br |
| 214 .RS |
| 215 Convert filenames when applying diff. |
| 216 |
| 217 Use this option together with \-\-diff to rename the file names of processed |
| 218 data sets according to the data provided by the diff. |
| 219 .RE |
| 220 |
| 221 .B \-\-diff |
| 222 .I tracefile |
| 223 .I difffile |
| 224 .br |
| 225 .RS |
| 226 Convert coverage data in |
| 227 .I tracefile |
| 228 using source code diff file |
| 229 .IR difffile . |
| 230 |
| 231 Use this option if you want to merge coverage data from different source code |
| 232 levels of a program, e.g. when you have data taken from an older version |
| 233 and want to combine it with data from a more current version. |
| 234 .B lcov |
| 235 will try to map source code lines between those versions and adjust the coverage |
| 236 data respectively. |
| 237 .I difffile |
| 238 needs to be in unified format, i.e. it has to be created using the "\-u" option |
| 239 of the |
| 240 .B diff |
| 241 tool. |
| 242 |
| 243 Note that lines which are not present in the old version will not be counted |
| 244 as instrumented, therefore tracefiles resulting from this operation should |
| 245 not be interpreted individually but together with other tracefiles taken |
| 246 from the newer version. Also keep in mind that converted coverage data should |
| 247 only be used for overview purposes as the process itself introduces a loss |
| 248 of accuracy. |
| 249 |
| 250 The result of the diff operation will be written to stdout or the tracefile |
| 251 specified with \-o. |
| 252 |
| 253 Only one of \-z, \-c, \-a, \-e, \-r, \-l and \-\-diff may be specified |
| 254 at a time. |
| 255 .RE |
| 256 |
| 257 .B \-d |
| 258 .I directory |
| 259 .br |
| 260 .B \-\-directory |
| 261 .I directory |
| 262 .br |
| 263 .RS |
| 264 Use .da files in |
| 265 .I directory |
| 266 instead of kernel. |
| 267 |
| 268 If you want to work on coverage data for a user space program, use this |
| 269 option to specify the location where the program was compiled (that's |
| 270 where the counter files ending with .da will be stored). |
| 271 |
| 272 Note that you may specify this option more than once. |
| 273 .RE |
| 274 |
| 275 .B \-e |
| 276 .I tracefile |
| 277 .I pattern |
| 278 .br |
| 279 .B \-\-extract |
| 280 .I tracefile |
| 281 .I pattern |
| 282 .br |
| 283 .RS |
| 284 Extract data from |
| 285 .IR tracefile . |
| 286 |
| 287 Use this switch if you want to extract coverage data for only a particular |
| 288 set of files from a tracefile. Additional command line parameters will be |
| 289 interpreted as shell wildcard patterns (note that they may need to be |
| 290 escaped accordingly to prevent the shell from expanding them first). |
| 291 Every file entry in |
| 292 .I tracefile |
| 293 which matches at least one of those patterns will be extracted. |
| 294 |
| 295 The result of the extract operation will be written to stdout or the tracefile |
| 296 specified with \-o. |
| 297 |
| 298 Only one of \-z, \-c, \-a, \-e, \-r, \-l and \-\-diff may be specified |
| 299 at a time. |
| 300 .RE |
| 301 |
| 302 .B \-f |
| 303 .br |
| 304 .B \-\-follow |
| 305 .br |
| 306 .RS |
| 307 Follow links when searching for .da files. |
| 308 .RE |
| 309 |
| 310 .B \-\-gcov\-tool |
| 311 .I tool |
| 312 .br |
| 313 .RS |
| 314 Specify the location of the gcov tool. |
| 315 .RE |
| 316 |
| 317 .B \-h |
| 318 .br |
| 319 .B \-\-help |
| 320 .br |
| 321 .RS |
| 322 Print a short help text, then exit. |
| 323 .RE |
| 324 |
| 325 .B \-\-ignore\-errors |
| 326 .I errors |
| 327 .br |
| 328 .RS |
| 329 Specify a list of errors after which to continue processing. |
| 330 |
| 331 Use this option to specify a list of one or more classes of errors after which |
| 332 lcov should continue processing instead of aborting. |
| 333 |
| 334 .I errors |
| 335 can be a comma\-separated list of the following keywords: |
| 336 |
| 337 .B gcov: |
| 338 the gcov tool returned with a non\-zero return code. |
| 339 |
| 340 .B source: |
| 341 the source code file for a data set could not be found. |
| 342 .RE |
| 343 |
| 344 .B \-i |
| 345 .br |
| 346 .B \-\-initial |
| 347 .RS |
| 348 Capture initial zero coverage data. |
| 349 |
| 350 Run lcov with \-c and this option on the directories containing .bb, .bbg |
| 351 or .gcno files before running any test case. The result is a "baseline" |
| 352 coverage data file that contains zero coverage for every instrumented line. |
| 353 Combine this data file (using lcov \-a) with coverage data files captured |
| 354 after a test run to ensure that the percentage of total lines covered is |
| 355 correct even when not all source code files were loaded during the test. |
| 356 |
| 357 Recommended procedure when capturing data for a test case: |
| 358 |
| 359 1. create baseline coverage data file |
| 360 .RS |
| 361 # lcov \-c \-i \-d appdir \-o app_base.info |
| 362 .br |
| 363 |
| 364 .RE |
| 365 2. perform test |
| 366 .RS |
| 367 # appdir/test |
| 368 .br |
| 369 |
| 370 .RE |
| 371 3. create test coverage data file |
| 372 .RS |
| 373 # lcov \-c \-d appdir \-o app_test.info |
| 374 .br |
| 375 |
| 376 .RE |
| 377 4. combine baseline and test coverage data |
| 378 .RS |
| 379 # lcov \-a app_base.info \-a app_test.info \-o app_total.info |
| 380 .br |
| 381 |
| 382 .RE |
| 383 .RE |
| 384 |
| 385 .B \-k |
| 386 .I subdirectory |
| 387 .br |
| 388 .B \-\-kernel\-directory |
| 389 .I subdirectory |
| 390 .br |
| 391 .RS |
| 392 Capture kernel coverage data only from |
| 393 .IR subdirectory . |
| 394 |
| 395 Use this option if you don't want to get coverage data for all of the |
| 396 kernel, but only for specific subdirectories. |
| 397 |
| 398 Note that you may specify this option more than once. |
| 399 .RE |
| 400 |
| 401 .B \-l |
| 402 .I tracefile |
| 403 .br |
| 404 .B \-\-list |
| 405 .I tracefile |
| 406 .br |
| 407 .RS |
| 408 List the contents of the |
| 409 .IR tracefile . |
| 410 |
| 411 Only one of \-z, \-c, \-a, \-e, \-r, \-l and \-\-diff may be specified |
| 412 at a time. |
| 413 .RE |
| 414 |
| 415 .B \-\-no\-recursion |
| 416 .br |
| 417 .RS |
| 418 Use this option if you want to get coverage data for the specified directory |
| 419 only without processing subdirectories. |
| 420 .RE |
| 421 |
| 422 .B \-o |
| 423 .I tracefile |
| 424 .br |
| 425 .B \-\-output\-file |
| 426 .I tracefile |
| 427 .br |
| 428 .RS |
| 429 Write data to |
| 430 .I tracefile |
| 431 instead of stdout. |
| 432 |
| 433 Specify "\-" as a filename to use the standard output. |
| 434 |
| 435 By convention, lcov\-generated coverage data files are called "tracefiles" and |
| 436 should have the filename extension ".info". |
| 437 .RE |
| 438 |
| 439 .B \-\-path |
| 440 .I path |
| 441 .br |
| 442 .RS |
| 443 Strip path from filenames when applying diff. |
| 444 |
| 445 Use this option together with \-\-diff to tell lcov to disregard the specified |
| 446 initial path component when matching between tracefile and diff filenames. |
| 447 .RE |
| 448 |
| 449 .B \-q |
| 450 .br |
| 451 .B \-\-quiet |
| 452 .br |
| 453 .RS |
| 454 Do not print progress messages. |
| 455 |
| 456 This option is implied when no output filename is specified to prevent |
| 457 progress messages to mess with coverage data which is also printed to |
| 458 the standard output. |
| 459 .RE |
| 460 |
| 461 .B \-r |
| 462 .I tracefile |
| 463 .I pattern |
| 464 .br |
| 465 .B \-\-remove |
| 466 .I tracefile |
| 467 .I pattern |
| 468 .br |
| 469 .RS |
| 470 Remove data from |
| 471 .IR tracefile . |
| 472 |
| 473 Use this switch if you want to remove coverage data for a particular |
| 474 set of files from a tracefile. Additional command line parameters will be |
| 475 interpreted as shell wildcard patterns (note that they may need to be |
| 476 escaped accordingly to prevent the shell from expanding them first). |
| 477 Every file entry in |
| 478 .I tracefile |
| 479 which matches at least one of those patterns will be removed. |
| 480 |
| 481 The result of the remove operation will be written to stdout or the tracefile |
| 482 specified with \-o. |
| 483 |
| 484 Only one of \-z, \-c, \-a, \-e, \-r, \-l and \-\-diff may be specified |
| 485 at a time. |
| 486 .RE |
| 487 |
| 488 .B \-\-strip |
| 489 .I depth |
| 490 .br |
| 491 .RS |
| 492 Strip path components when applying diff. |
| 493 |
| 494 Use this option together with \-\-diff to tell lcov to disregard the specified |
| 495 number of initial directories when matching tracefile and diff filenames. |
| 496 .RE |
| 497 |
| 498 .B \-t |
| 499 .I testname |
| 500 .br |
| 501 .B \-\-test\-name |
| 502 .I testname |
| 503 .br |
| 504 .RS |
| 505 Specify test name to be stored in the tracefile. |
| 506 |
| 507 This name identifies a coverage data set when more than one data set is merged |
| 508 into a combined tracefile (see option \-a). |
| 509 |
| 510 Valid test names can consist of letters, decimal digits and the underscore |
| 511 character ("_"). |
| 512 .RE |
| 513 |
| 514 .B \-v |
| 515 .br |
| 516 .B \-\-version |
| 517 .br |
| 518 .RS |
| 519 Print version number, then exit. |
| 520 .RE |
| 521 |
| 522 .B \-z |
| 523 .br |
| 524 .B \-\-zerocounters |
| 525 .br |
| 526 .RS |
| 527 Reset all execution counts to zero. |
| 528 |
| 529 By default tries to reset kernel execution counts. Use the \-\-directory |
| 530 option to reset all counters of a user space program. |
| 531 |
| 532 Only one of \-z, \-c, \-a, \-e, \-r, \-l and \-\-diff may be specified |
| 533 at a time. |
| 534 .RE |
| 535 |
| 536 .SH FILES |
| 537 |
| 538 .I /etc/lcovrc |
| 539 .RS |
| 540 The system\-wide configuration file. |
| 541 .RE |
| 542 |
| 543 .I ~/.lcovrc |
| 544 .RS |
| 545 The per\-user configuration file. |
| 546 .RE |
| 547 |
| 548 .SH AUTHOR |
| 549 Peter Oberparleiter <Peter.Oberparleiter@de.ibm.com> |
| 550 |
| 551 .SH SEE ALSO |
| 552 .BR lcovrc (5), |
| 553 .BR genhtml (1), |
| 554 .BR geninfo (1), |
| 555 .BR genpng (1), |
| 556 .BR gendesc (1), |
| 557 .BR gcov (1) |
OLD | NEW |