public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Gcov Internals
@ 2019-03-22 11:58 Sebastian Roland
  2019-03-25 14:16 ` Nathan Sidwell
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Roland @ 2019-03-22 11:58 UTC (permalink / raw)
  To: gcc

[-- Attachment #1: Type: text/plain, Size: 685 bytes --]

Hi,

I am currently trying to understand the internals of Gcov. Specifically 
I am wondering of the following:

1) Certain Basic Blocks are instrumented with counters that are 
incremented during execution. During compilation a destructor is 
registered that actually goes through a gcov_info struct and finds all 
counters in the appropriate gcov_fn_info struct(s). My question is how 
(and where in the source code) do the references to the various counters 
are linked to the gcov_info struct?

2) What exactly is the purpose of the constructor (__gcov_init()) and 
where are the values of the passed gcov_info struct set (probably 
related to 1)?

--Sebastian



[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 3992 bytes --]

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

* Re: Gcov Internals
  2019-03-22 11:58 Gcov Internals Sebastian Roland
@ 2019-03-25 14:16 ` Nathan Sidwell
  0 siblings, 0 replies; 2+ messages in thread
From: Nathan Sidwell @ 2019-03-25 14:16 UTC (permalink / raw)
  To: Sebastian Roland, gcc

On 3/22/19 7:58 AM, Sebastian Roland wrote:
> Hi,
> 
> I am currently trying to understand the internals of Gcov. Specifically 
> I am wondering of the following:
> 
> 1) Certain Basic Blocks are instrumented with counters that are 
> incremented during execution. During compilation a destructor is 
> registered that actually goes through a gcov_info struct and finds all 
> counters in the appropriate gcov_fn_info struct(s). My question is how 
> (and where in the source code) do the references to the various counters 
> are linked to the gcov_info struct?

gcc/coverage.c generates the increments and the spanning tree used to 
determine where to place them.
> 2) What exactly is the purpose of the constructor (__gcov_init()) and 
> where are the values of the passed gcov_info struct set (probably 
> related to 1)?

It's a global constructor, libgcc/libgcov-$something

natha

-- 
Nathan Sidwell

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

end of thread, other threads:[~2019-03-25 14:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-22 11:58 Gcov Internals Sebastian Roland
2019-03-25 14:16 ` Nathan Sidwell

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