From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dedi548.your-server.de (dedi548.your-server.de [85.10.215.148]) by sourceware.org (Postfix) with ESMTPS id E1FA839A3C0E for ; Fri, 23 Jul 2021 09:17:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E1FA839A3C0E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embedded-brains.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embedded-brains.de Received: from sslproxy02.your-server.de ([78.47.166.47]) by dedi548.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1m6rJO-0005Vg-QJ; Fri, 23 Jul 2021 11:17:42 +0200 Received: from [82.100.198.138] (helo=mail.embedded-brains.de) by sslproxy02.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m6rJO-000Xvq-NI; Fri, 23 Jul 2021 11:17:42 +0200 Received: from localhost (localhost.localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 618CE2A1610; Fri, 23 Jul 2021 11:17:42 +0200 (CEST) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id NAEMrWZlbrlY; Fri, 23 Jul 2021 11:17:42 +0200 (CEST) Received: from localhost (localhost.localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 01E602A165B; Fri, 23 Jul 2021 11:17:42 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.eb.localhost Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id rmh5VsROhY9c; Fri, 23 Jul 2021 11:17:41 +0200 (CEST) Received: from shuber-nb-linux.eb.localhost (unknown [10.10.171.10]) by mail.embedded-brains.de (Postfix) with ESMTPSA id C37D92A1610; Fri, 23 Jul 2021 11:17:41 +0200 (CEST) Subject: Re: [PATCH v2] gcov: Add __gcov_info_to_gdca() To: =?UTF-8?Q?Martin_Li=c5=a1ka?= , gcc-patches@gcc.gnu.org References: <20210713201553.108947-1-sebastian.huber@embedded-brains.de> <946c22c1-af94-713c-6d72-867a50c7bd48@suse.cz> From: Sebastian Huber Message-ID: Date: Fri, 23 Jul 2021 11:17:41 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <946c22c1-af94-713c-6d72-867a50c7bd48@suse.cz> Content-Type: multipart/mixed; boundary="------------187D8988FBF882646CC16216" Content-Language: en-US X-Authenticated-Sender: smtp-embedded@poldinet.de X-Virus-Scanned: Clear (ClamAV 0.103.2/26241/Fri Jul 23 10:20:30 2021) X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Jul 2021 09:17:47 -0000 This is a multi-part message in MIME format. --------------187D8988FBF882646CC16216 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable On 23/07/2021 08:52, Martin Li=C5=A1ka wrote: >> >>> It would be nice having a test-case that can test your approach. >> >> The problem is that you need the linker set to get access to the gcov=20 >> information. The test program of the commit message works on my Linux=20 >> machine. I am not sure if it is generic enough for the test suite.=20 >> Instead of printing the information we could compare it against an=20 >> expected output so that we have a self-contained test program. >=20 > Yep, that would be nice. I tried to run the attached test case as=20 "gcc/testsuite/gcc.dg/gcov-info-to-gcda.c". However, I get this error: Invoking the compiler as /tmp/sh/b-gcc-git-linux/gcc/xgcc=20 -B/tmp/sh/b-gcc-git-linux/gcc/=20 /home/EB/sebastian_h/src/gcc/gcc/testsuite/gcc.dg/gcov-info-to-gcda.c=20 -fdiagnostics-plain-output -fprofile-arcs -fprofile-info-section=20 -lm -o ./gcov-info-to-gcda.exe Setting timeout to 300 Executing on host: /tmp/sh/b-gcc-git-linux/gcc/xgcc=20 -B/tmp/sh/b-gcc-git-linux/gcc/=20 /home/EB/sebastian_h/src/gcc/gcc/testsuite/gcc.dg/gcov-info-to-gcda.c=20 -fdiagnostics-plain-output -fprofile-arcs -fprofile-info-section=20 -lm -o ./gcov-info-to-gcda.exe (timeout =3D 300) spawn -ignore SIGHUP /tmp/sh/b-gcc-git-linux/gcc/xgcc=20 -B/tmp/sh/b-gcc-git-linux/gcc/=20 /home/EB/sebastian_h/src/gcc/gcc/testsuite/gcc.dg/gcov-info-to-gcda.c=20 -fdiagnostics-plain-output -fprofile-arcs -fprofile-info-section -lm -o=20 ./gcov-info-to-gcda.exe pid is 79704 -79704 /home/EB/sebastian_h/src/gcc/gcc/testsuite/gcc.dg/gcov-info-to-gcda.c:5:1= 0:=20 fatal error: gcov.h: No such file or directory compilation terminated. Is it possible to do such kind of tests? I also have to link to -lgcov? --=20 embedded brains GmbH Herr Sebastian HUBER Dornierstr. 4 82178 Puchheim Germany email: sebastian.huber@embedded-brains.de phone: +49-89-18 94 741 - 16 fax: +49-89-18 94 741 - 08 Registergericht: Amtsgericht M=C3=BCnchen Registernummer: HRB 157899 Vertretungsberechtigte Gesch=C3=A4ftsf=C3=BChrer: Peter Rasmussen, Thomas= D=C3=B6rfler Unsere Datenschutzerkl=C3=A4rung finden Sie hier: https://embedded-brains.de/datenschutzerklaerung/ --------------187D8988FBF882646CC16216 Content-Type: text/x-csrc; charset=UTF-8; name="gcov-info-to-gcda.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="gcov-info-to-gcda.c" /* { dg-do run } */ /* { dg-skip-if "profile-info-section" { powerpc-ibm-aix* } } */ /* { dg-options "-fprofile-arcs -fprofile-info-section" } */ #include extern const struct gcov_info *my_info; static unsigned counter; static void filename (const char *f, void *arg) { if (arg != &counter) __builtin_abort (); if (__builtin_strcmp (f, __FILE__) != 0) __builtin_abort (); } static void dump (const void *d, unsigned n, void *arg) { unsigned *m = (unsigned *)arg; if (m != &counter) __builtin_abort (); if (*m == 0) { const unsigned *u = d; if (*u != 0x67636461) __builtin_abort (); } *m += n; } static void * allocate (unsigned length, void *arg) { if (arg != &counter) __builtin_abort (); return __builtin_malloc (length); } int main() { __asm__ volatile (".set my_info, .LPBX2"); __gcov_info_to_gcda (my_info, filename, dump, allocate, &counter); return 0; } --------------187D8988FBF882646CC16216--