From patchwork Thu Jul 5 16:03:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 141202 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2141674ljj; Thu, 5 Jul 2018 09:28:26 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcR+Qaszp/oUcMxhul5rktfyqyMFCJV2kL5C0f5u5jcF6VImUMtWH7U+Mhh7T0uy2ONrRb3 X-Received: by 2002:a37:50c3:: with SMTP id e186-v6mr5552742qkb.91.1530808106089; Thu, 05 Jul 2018 09:28:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530808106; cv=none; d=google.com; s=arc-20160816; b=mEu9gX836Hs+7h8tD2IGs3/0kDDSeN2+TQVqd0VboENWhbEriCCJcjDsvzGU/jtIpN xOgXk3EcG4EciF3XCO6podpEFOoCH05I86uC3toBuuIGrD73JR9DG/pwwXRo+G3YJ+HL A04qGFY0MLbyX3r94HOp3V5csaz2ucCCI8X4pLgT0SWvyptj4JAC2y3PG3QtcuOwK81O reBYBuAcg7kvE6fRuH4+jw2hIpKRHbSjwaCF8rlJv+8+NtG/j3oKvlp2BojoAX6YeZTH +LhEvjRq8Up5qVZxaikPZawBoFCx6xOIEUfJfLulKUYmX4qGZsTP2jXxigawbmKRgViw 8fzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=26jHJcKVZxrJ3kF/okCbHv+dP0VTbKpXYEPZSYP8zmE=; b=J2URoFD3Z8yP//iJ5CCtj6q/PaXcHH6//h8OPAfT7Sm5QppderF61n3krDWf+M5u1M DWRPKJ7WldRfmPSWTMee8yiYjeO6Xz/RZGfSJqLHY4BWpCPDoZO50KIgdry/FKX2/S6A CBBe+Hqw4a3MSKvWR7/j+tEPrY5d67OpJ0k9sYFsGnjegdARQR4txN4MkRc66YEiVZKM n9uejEj501dYc3eeVMthiOA6cRXPWwqnYjAO9WEeD8SmqcUO0JoDkDWnSS/2ecq3OAqs Hwwx42Cd/3fnxKSx3vp7yvvf9Tz8XXIu7g/M2LJwlqSRcb8PkByppSQiqPm1n1SWV3Vv 1Bqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=jfGAHLmp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id x4-v6si4036585qtp.106.2018.07.05.09.28.25 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 05 Jul 2018 09:28:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=jfGAHLmp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:53689 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fb77J-0003Ct-H1 for patch@linaro.org; Thu, 05 Jul 2018 12:28:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54903) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fb6jQ-0008QY-N6 for qemu-devel@nongnu.org; Thu, 05 Jul 2018 12:03:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fb6jP-000831-2n for qemu-devel@nongnu.org; Thu, 05 Jul 2018 12:03:44 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:37193) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fb6jO-00082c-Rs for qemu-devel@nongnu.org; Thu, 05 Jul 2018 12:03:43 -0400 Received: by mail-wr1-x42b.google.com with SMTP id q10-v6so1472605wrd.4 for ; Thu, 05 Jul 2018 09:03:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=26jHJcKVZxrJ3kF/okCbHv+dP0VTbKpXYEPZSYP8zmE=; b=jfGAHLmp5SOzjFQF7Gf025C5A2Y9HbkvxFgGkfGFMSSPUv4o1QRXtzZ4OGNJEHq8Ww UIFlMhc6jVT92fz6S9qQ5r1nZxJ3/NXTPU7S+ghmUPISQ6DjUeulopGpr/WiPzqCbJMp ApNGqQHfzLEsFdeO9+l9B5coLmkMFFiNU3gF4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=26jHJcKVZxrJ3kF/okCbHv+dP0VTbKpXYEPZSYP8zmE=; b=DQEcMgeM5qmNW7fgMcQGC/ZS3CKrHGeiLQKvA6izizI1H/EYBF5I5itcaeoFwUu3Dn bKV24rPGGQM0uxq6sbpWNsG2Q9YfFEI7FvvrDwEyIjUXe8vKLDIBNjd5myCt84FncA9u kVDeHCN6snEGvr7Jatz8ynSjVHC9YnihJZO6BQYNytOIdXGpFmj5IlGRKi+1s6fEYagv fjoyKQeUZQzgldFqwdo5Q95s6X6KfpQ1VR2T5t+sqSp9Wm5dZN2oskeg7hL1+mRCsoJg MaPhHvbCZBSYxi/joYU2OezrKQqz0JbtuSA0TsiJRNlf8ZDyJwz7SPLPGKR+YNr97aj5 yk0Q== X-Gm-Message-State: APt69E0x9lDzPjtIs/CfnEgAIn8ctvXyekeoedysYw0jrkE1f2lAClZH niXfrIeF5urmCPmHsCgVjsjmKg== X-Received: by 2002:adf:fb43:: with SMTP id c3-v6mr5392164wrs.32.1530806621738; Thu, 05 Jul 2018 09:03:41 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id h12-v6sm2529014wmb.3.2018.07.05.09.03.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jul 2018 09:03:37 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 395A53E0B71; Thu, 5 Jul 2018 17:03:30 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Thu, 5 Jul 2018 17:03:20 +0100 Message-Id: <20180705160329.30386-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180705160329.30386-1-alex.bennee@linaro.org> References: <20180705160329.30386-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42b Subject: [Qemu-devel] [PULL v3 11/20] linux-user: add gcov support to preexit_cleanup X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" As we don't always take the normal exit path when running a guest we can skip the normal exit destructors where gcov normally dumps it's info. The GCC manual suggests long running programs use __gcov_dump() to flush out the coverage state periodically so we use that here. Signed-off-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé -- 2.17.1 diff --git a/linux-user/exit.c b/linux-user/exit.c index aed8713fae..14e94e28fa 100644 --- a/linux-user/exit.c +++ b/linux-user/exit.c @@ -19,10 +19,17 @@ #include "qemu/osdep.h" #include "qemu.h" +#ifdef CONFIG_GCOV +extern void __gcov_dump(void); +#endif + void preexit_cleanup(CPUArchState *env, int code) { #ifdef TARGET_GPROF _mcleanup(); +#endif +#ifdef CONFIG_GCOV + __gcov_dump(); #endif gdb_exit(env, code); }