From patchwork Thu Mar 31 11:35:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Huber X-Patchwork-Id: 52501 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DE23B3838013 for ; Thu, 31 Mar 2022 11:35:39 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from dedi548.your-server.de (dedi548.your-server.de [85.10.215.148]) by sourceware.org (Postfix) with ESMTPS id 79171385800E for ; Thu, 31 Mar 2022 11:35:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 79171385800E 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 sslproxy01.your-server.de ([78.46.139.224]) by dedi548.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nZt5F-000OPi-Gs; Thu, 31 Mar 2022 13:35:21 +0200 Received: from [82.100.198.138] (helo=mail.embedded-brains.de) by sslproxy01.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nZt5F-000Fie-DM; Thu, 31 Mar 2022 13:35:21 +0200 Received: from localhost (localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 0BA3A480115; Thu, 31 Mar 2022 13:35:21 +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 HtaWanTwff06; Thu, 31 Mar 2022 13:35:20 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 9BC43480110; Thu, 31 Mar 2022 13:35:20 +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 vEB3YGRQZSHA; Thu, 31 Mar 2022 13:35:20 +0200 (CEST) Received: from zimbra.eb.localhost (unknown [192.168.96.242]) by mail.embedded-brains.de (Postfix) with ESMTPSA id 842564800B1; Thu, 31 Mar 2022 13:35:20 +0200 (CEST) From: Sebastian Huber To: gcc-patches@gcc.gnu.org Subject: [RFC/gcov 00/12] Add merge-stream subcommand to gcov-tool Date: Thu, 31 Mar 2022 13:35:03 +0200 Message-Id: <20220331113515.35764-1-sebastian.huber@embedded-brains.de> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Authenticated-Sender: smtp-embedded@poldinet.de X-Virus-Scanned: Clear (ClamAV 0.103.5/26498/Thu Mar 31 10:19:05 2022) X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" This patch set is a proof of concept. The aim is to better support gcov in free-standing environments. For example, you can run a test executable which dumps all gcov info objects in a serial data stream using __gcov_info_to_gcda() and the new __gcov_filename_to_gcfn(). It could be encoded as base64. It could be also compressed. On the host you unpack the encoded data stream and feed it into gcov-tool using the new "merge-stream" subcommand: gcov-tool --help Usage: gcov-tool [OPTION]... SUB_COMMAND [OPTION]... Offline tool to handle gcda counts -h, --help Print this help, then exit -v, --version Print version number, then exit merge-stream [options] [stream-file] Merge coverage stream file (or stdin) and coverage file contents -v, --verbose Verbose mode -w, --weight Set weights (float point values) Example: base64 -d log.txt | gcov-tool merge-stream The patch set does not change the format of gcda files. TODO: * Documentation * Tests Sebastian Huber (12): gcov-tool: Allow merging of empty profile lists gcov: Add mode to all gcov_open() gcov: Add open mode parameter to gcov_do_dump() gcov: Make gcov_seek() static gcov: Add __gcov_filename_to_gcfn() gcov-tool: Support file input from stdin gcov: Use xstrdup() gcov: Move prepend to list to read_gcda_file() gcov: Move gcov_open() to caller of read_gcda_file() gcov: Fix integer types in ftw_read_file() gcov: Record EOF error during read gcov-tool: Add merge-stream subcommand gcc/gcov-io.cc | 76 ++++++++++++++----- gcc/gcov-io.h | 35 +++++---- gcc/gcov-tool.cc | 107 +++++++++++++++++++++----- libgcc/gcov.h | 17 ++++- libgcc/libgcov-driver-system.c | 7 +- libgcc/libgcov-driver.c | 42 ++++++++-- libgcc/libgcov-util.c | 135 +++++++++++++++++++++++++-------- libgcc/libgcov.h | 3 - 8 files changed, 326 insertions(+), 96 deletions(-)