Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 172275 - sys-devel/gcc 4.1.2 - gcov fails to analyze multipath program
Summary: sys-devel/gcc 4.1.2 - gcov fails to analyze multipath program
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-26 08:56 UTC by Yuri Karaban
Modified: 2009-04-20 00:40 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri Karaban 2007-03-26 08:56:02 UTC
For example I have test program located in 'test/main.cc', which just contain one empty main function.

1. Compiling it

g++ --coverage -c -o test/main.o test/main.cc
g++ --coverage -o main test/main.o

2. Running

./main

3. Trying to run gcov (with no success)

% gcov ./test/main.cc
main.gcno:cannot open graph file

% (cd test ; gcov main.cc)
File 'test/main.cc'
Lines executed:100.00% of 1
test/main.cc:creating 'main.cc.gcov'
test/main.cc:cannot open source file

So there is no way to run gcov successfully.

In first case, when running from toplevel directory, it simply can't find main.gcno (it is searching it in current directory but it should search in directory 'test' because full source name is test/main.cc).

In second case, when running from 'test' directory it can't find the source. It is searching for test/main.cc, but current directory already 'test'.
Comment 1 Doug Goldstein (RETIRED) gentoo-dev 2007-04-29 15:46:42 UTC
The proper GCC flags are -fprofile-arcs and -ftest-coverage. The gcov documentation does not reference --coverage anywhere.
Comment 2 Yuri Karaban 2007-04-29 16:25:57 UTC
--coverage documented in gcc manual

`--coverage'
     This option is used to compile and link code instrumented for
     coverage analysis.  The option is a synonym for `-fprofile-arcs'
     `-ftest-coverage' (when compiling) and `-lgcov' (when linking).
     See the documentation for those options for more details.

So it is no matter what to specify either --coverage or -fprofile-arcs -ftest-coverage 
Comment 3 Mark Loeser (RETIRED) gentoo-dev 2009-04-20 00:40:05 UTC
This is incredibly old and I can't see how this would be a gentoo only bug.  Please bring this upstream if you wish to pursue it since if it was expected behaviour it would have been fixed by now.