This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Jay Vaughan<jay.vaughan@thalesgroup.com> writes:The coverage code runs a constructor at the default initialization priority. Since your code is running at a higher priority, it runs before coverage has been initialized.
I can change the priority - I tried using 65535 (lowest priority?) but still I get no coverage for code executed during the constructor phase.
Please send replies to the list, not just to me. Thanks.
All constructors with any priority run before constructors with no priority. That is, constructors with no priority have the lowest priority of all.
Ideally you could call __gcov_init (info) at the start of your constructor. The problem is that __gcov_init takes an argument, a pointer to a struct gcov_info, and you should really pass the same pointer as the default constructor will pass. But there is no way for your code to get that value.
This seems like a real oversight in the design of the coverage system .. I wonder if there is any chance to fix this, easily, to allow for coverage of constructor/destructor code in libraries? I'm not familiar with who is wearing the coverage hat for GCC, maybe you know? I should report this issue, if it can be fixed in future releases.. do you think its feasible?
It's an oversight, yes. Constructor priorities are not widely used. Please do go ahead and open a bug report about this. It should not be too hard to make it possible for constructor priority code to arrange for coverage. I think the developers would be reluctant to require the coverage constructors to use a priority, since many systems do not support constructor priorities.
I've been unable to find the gcov constructor code in our gcc sources (4.4.4) .. if a constructor is being used, I can adjust my priority so that it gets executed after coverage constructor, but I can't see where the constructor is created .. got any hints here? Maybe I could solve my problem with constructor priorities, after all ..
The constructor is created directly by the compiler. In gcc 4.4 it's done by the call to cgraph_build_static_cdtor in gcc/coverage.c. Ian
-- ; Thales Austria GmbH Jay Vaughan, Programmer Scheydgasse 41 jay.vaughan@thalesgroup.com 1210 Vienna AUSTRIA ===============================================================================
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |