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

Reply via email to