From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 40438 invoked by alias); 25 Mar 2019 14:16:55 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 40421 invoked by uid 89); 25 Mar 2019 14:16:54 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Google-DKIM-Signature:sender, HX-Received:a25, HX-Spam-Relays-External:sk:mail-yw, HX-HELO:sk:mail-yw X-HELO: mail-yw1-f50.google.com Received: from mail-yw1-f50.google.com (HELO mail-yw1-f50.google.com) (209.85.161.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 25 Mar 2019 14:16:52 +0000 Received: by mail-yw1-f50.google.com with SMTP id e76so7140422ywa.9 for ; Mon, 25 Mar 2019 07:16:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=07R12cS+qiT//FAW2I3pw283kWJXGUzBNCzR3BTczOg=; b=d7UpWPzxQz57L6EAg/5ds+vPlL6Y9HyMhJER1pQVPXzukAfvIRYf3yDzT3/jpkY1Xl avjNQyn1g6FMpeQynMo1k2vGeSHt6WIq2f7ryQ/pGvFU2ReSGZ949CThFOXHsOBXS+sZ lFFZobX1O4WId9jOHsoT2MuSIMY0BMoNfh/P4SUmKBkzTnalGH3mX7jw26lt6mwjvZ1/ dTjw7XSf7qPn6dFKnGSNJ+s8+o8QtTyczgCJu3nb8meYaIFxt5bsDzFdxQ7fp5BKKe8n hixrz/3DY3OF7tqFyISadj7YGvEKLjWIRWPNtK3SG916Ry17QDT09iimEH9bAsXag+eI 167w== Return-Path: Received: from ?IPv6:2620:10d:c0a3:1407:a082:4266:10a7:7567? ([2620:10d:c091:200::3:a02c]) by smtp.googlemail.com with ESMTPSA id 139sm3007154ywk.83.2019.03.25.07.16.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Mar 2019 07:16:50 -0700 (PDT) Sender: Nathan Sidwell Subject: Re: Gcov Internals To: Sebastian Roland , gcc@gcc.gnu.org References: <62cfe271-bfc3-f918-d1d5-c6ab3bfe025a@gmail.com> From: Nathan Sidwell Message-ID: <17b3a8aa-74d8-8953-6e41-8e5b05bd10c2@acm.org> Date: Mon, 25 Mar 2019 14:16:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.0 MIME-Version: 1.0 In-Reply-To: <62cfe271-bfc3-f918-d1d5-c6ab3bfe025a@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2019-03/txt/msg00198.txt.bz2 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