From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13677 invoked by alias); 4 Nov 2019 09:19: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 13669 invoked by uid 89); 4 Nov 2019 09:19:54 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-5.7 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 spammy=mnt, services, wish X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 04 Nov 2019 09:19:53 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id D2CB9B292; Mon, 4 Nov 2019 09:19:50 +0000 (UTC) Subject: Re: GCC's instrumentation and the target environment To: David Taylor , gcc@gcc.gnu.org References: <25767.1572632020@usendtaylorx2l> From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Message-ID: <194f90a5-6a02-b8ee-d454-fe1338a2f542@suse.cz> Date: Mon, 04 Nov 2019 09:19:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: <25767.1572632020@usendtaylorx2l> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2019-11/txt/msg00018.txt.bz2 On 11/1/19 7:13 PM, David Taylor wrote: > I wish to use GCC based instrumentation on an embedded target. And I > am finding that GCC's libgcov.a is not well suited to my needs. > > Ideally, all the application entry points and everthing that knows > about the internals of the implementation would be in separate files > from everything that does i/o or otherwise uses 'system services'. > > Right now GCC has libgcov-driver.c which includes both gcov-io.c and > libgcov-driver-system.c. Hello. > > What I'd like is a stable API between the routines that 'collect' the > data and the routines that do the i/o. With the i/o routines being > non-static and in a separate file from the others that is not > #include'd. > > I want them to be replaceable by the application. Depending upon > circumstances I can imagine the routines doing network i/o, disk i/o, > or using a serial port. What's difference in between i/o and disk i/o? What about using a NFS file system into which you can save the data (via -fprofile-dir=/mnt/mynfs/...)? I can imagine dump into stderr for example. That can be quite easily doable. Martin > > I want one version of libgcov.a for all three with three different > sets of i/o routines that I can build into the application. If the > internals of instrumentation changes, I want to not have to change the > i/o routines or anything in the application. > > If you think of it in disk driver terms, some of the routines in > libgcov.a provide a DDI -- an interface of routines that the > application call call. For applications that exit, one of the > routines is called at program exit. For long running applications, > there are routines in the DDI to dump and flush the accumulated > information. > > And the i/o routines can be thought of as providing a DKI -- what the > library libgcov.a expects of the environment -- for example, fopen and > fwrite. > > There's also the inhibit_libc define. While if you don't have headers > you might have a hard time including or some of the other > header files, if the environment has a way of doing i/o or saving the > results, there is no real reason why it should not be possible to > provide instrumentation. > > Comments? >