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

* [Bug gcov-profile/44779] The gcov library does not adequately handle functions with constructor/destructor attributes
  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 ` rguenth at gcc dot gnu dot org
  2010-07-02 11:30 ` jay dot vaughan at thalesgroup dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-07-02  9:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2010-07-02 09:16 -------
Can you provide a testcase that when executed shows the issue?


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


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


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

* [Bug gcov-profile/44779] The gcov library does not adequately handle functions with constructor/destructor attributes
  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
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jay dot vaughan at thalesgroup dot com @ 2010-07-02 11:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jay dot vaughan at thalesgroup dot com  2010-07-02 11:29 -------
Created an attachment (id=21066)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21066&action=view)
Makefile for testcase.

This the Makefile for a testunit that will demonstrate this behaviour.


-- 


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


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

* [Bug gcov-profile/44779] The gcov library does not adequately handle functions with constructor/destructor attributes
  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
  4 siblings, 0 replies; 6+ messages in thread
From: jay dot vaughan at thalesgroup dot com @ 2010-07-02 11:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jay dot vaughan at thalesgroup dot com  2010-07-02 11:30 -------
Created an attachment (id=21067)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21067&action=view)
This is the test application program sources for the testunit. 

This file is the test application, to be wrapped by the test library, to
demonstrate the behaviour of this bug.


-- 


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


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

* [Bug gcov-profile/44779] The gcov library does not adequately handle functions with constructor/destructor attributes
  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
                   ` (2 preceding siblings ...)
  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
  4 siblings, 0 replies; 6+ messages in thread
From: jay dot vaughan at thalesgroup dot com @ 2010-07-02 11:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jay dot vaughan at thalesgroup dot com  2010-07-02 11:31 -------
Created an attachment (id=21068)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21068&action=view)
This is the test library sources for the testunit. 

This file is the test library, which is wrapped around the application, to
demonstrate the behaviour of this bug.


-- 


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


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

* [Bug gcov-profile/44779] The gcov library does not adequately handle functions with constructor/destructor attributes
  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
                   ` (3 preceding siblings ...)
  2010-07-02 11:31 ` jay dot vaughan at thalesgroup dot com
@ 2010-07-02 11:32 ` jay dot vaughan at thalesgroup dot com
  4 siblings, 0 replies; 6+ messages in thread
From: jay dot vaughan at thalesgroup dot com @ 2010-07-02 11:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jay dot vaughan at thalesgroup dot com  2010-07-02 11:32 -------
To use the sources provided as a test unit:

1. First, 'make clean'.
2. Then, 'make test.app' - notice the coverage of the constructor/destructor
functions.
3. Then, 'make test.lib' - notice coverage.


-- 

jay dot vaughan at thalesgroup dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jay dot vaughan at
                   |                            |thalesgroup dot com


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).