public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug gcov-profile/44779]  New: The gcov library does not adequately handle functions with constructor/destructor attributes
@ 2010-07-02  8:13 jay dot vaughan at thalesgroup dot com
  2010-07-02  9:16 ` [Bug gcov-profile/44779] " rguenth at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: jay dot vaughan at thalesgroup dot com @ 2010-07-02  8:13 UTC (permalink / raw)
  To: gcc-bugs

I am developing a software system which has the requirement (as it is
safety-critical), that we report full coverage of our modules as part of the
validation process.

One aspect of this software system is the inclusion of a library - lets call it
libguardian - which is wrapped around all applications being run on our custom
system, using LD_PRELOAD.  The purpose of libguardian is to obtain valid
conditions for continued launch prior to the execution of main() by the runtime
in the wrapped application.  To this end, libguardian defines a constructor and
destructor pair of functions that obtain the valid conditions required for
continued launch, and clean up/report on exit of the application.

This libguardian, and associated applications, works perfectly fine.  However,
it is not possible to capture coverage information for these functions due to
limits in gcov.

The constructor/destructor methods are defined thus:


#define GUARDIAN_CONSTRUCTOR_DESTRUCTOR_PRIORITY     65535
/* NOTE: this priority can also be 101! */

void guardian_constructor(void)  __attribute__
((constructor(GUARDIAN_CONSTRUCTOR_DESTRUCTOR_PRIORITY)));

void guardian_destructor(void)  __attribute__
((destructor(GUARDIAN_CONSTRUCTOR_DESTRUCTOR_PRIORITY)));


If the guardian_constructor() finds conditions unsavory for continued execution
in our environment, it exit()'s immediately. In this circumstance, coverage is
lost (or not provided) by gcov's atexit/destructor methods, as it appears that
*priority* of known constructors is not accounted for in the gcov library, nor
is there an atexit() handler that can adequately sort these priorities.


-- 
           Summary: The gcov library does not adequately handle functions
                    with constructor/destructor attributes
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: gcov-profile
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jay dot vaughan at thalesgroup dot com
  GCC host triplet: i586-redhat-linux-


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44779


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-07-02 11:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-02  8:13 [Bug gcov-profile/44779] New: The gcov library does not adequately handle functions with constructor/destructor attributes jay dot vaughan at thalesgroup dot com
2010-07-02  9:16 ` [Bug gcov-profile/44779] " rguenth at gcc dot gnu dot org
2010-07-02 11:30 ` jay dot vaughan at thalesgroup dot com
2010-07-02 11:30 ` jay dot vaughan at thalesgroup dot com
2010-07-02 11:31 ` jay dot vaughan at thalesgroup dot com
2010-07-02 11:32 ` jay dot vaughan at thalesgroup dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).