From patchwork Thu Dec 19 10:49:28 2019 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: 182092 Delivered-To: patch@linaro.org Received: by 2002:a92:d0a:0:0:0:0:0 with SMTP id 10csp320362iln; Thu, 19 Dec 2019 03:02:15 -0800 (PST) X-Google-Smtp-Source: APXvYqze7FPds8sdPRweiYlWm91js9iR5WMwAl7aCkkw+FILFu/t2rG65qXg1Cr2oo9fGIsbMR6a X-Received: by 2002:a9d:62c2:: with SMTP id z2mr3611184otk.309.1576753335923; Thu, 19 Dec 2019 03:02:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576753335; cv=none; d=google.com; s=arc-20160816; b=gB0akZfTPuBV0frPeYIDyPyPKsCvEI4c3weHatIFb5TKaIgTL4B6C/ztaBcAYjGDcl klVgSdoAcgeZmI4GRJQJLCSKSjEy8USlHWtboaP7hmS/2bMtYeGw9joG2A0xkpBImR1P bd/Y8pw42XA5awscb/UK/5G61KBrIgvyOutzNgnTG++9gHei7PodhEHKQN/vI7cTPCR5 lPnWzAo7+hJ/Pi/fu+kNvdoGa1OjvbDxQ+5jLIDqimBJBjM/zR/jqLXqcD8Gdmi2BU+X wQ/J1J0VeCvokVnz/4a7clS5i8JCvdMl4GUnL+nCzrvpk34YA8+6UUQPfNauCp8F7U4A Y+HA== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=KM2z5lJatvSo38TN3JEp2tBoGC1lMW5rj5gagTwUU00=; b=fcc5xTu8kLTEIv5jCYE90fsgpUGcH+U3e/+t2JJIYzSGFAnoW5YJt/5/Iga8VRvQC6 4l2QMrilqjbwrh2vEsLZJpVxW7LyGHowlcz/m5uRuUds8on2FoVGqH/9cMGZGjZv4xxQ k7M+fC6kjbeFlZgWos+AVPzhbGgrztWk4RuZVCzCMBHwDTO3rsWFHYIrjBKMkxVXxHJ9 IShp9blJIv/TYDx1+KGxPr7j1iYCAJIyZutsPJHnQroO4ef+zZo5J8e4LNK/HkkslUNb bIC4mz4zCnia5rdUNOok0M1NaMmChuG+p2LCqDccPktJYg3FWrwuTnnXkbUmY+CKFtP3 SmKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ZnEnwskn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id w9si3240408otl.138.2019.12.19.03.02.15 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Dec 2019 03:02:15 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ZnEnwskn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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]:39044 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihtZP-00070R-8t for patch@linaro.org; Thu, 19 Dec 2019 06:02:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56776) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihtWb-0003lR-M1 for qemu-devel@nongnu.org; Thu, 19 Dec 2019 05:59:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihtWa-0000nH-81 for qemu-devel@nongnu.org; Thu, 19 Dec 2019 05:59:21 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:36783) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihtWZ-0000iG-Vn for qemu-devel@nongnu.org; Thu, 19 Dec 2019 05:59:20 -0500 Received: by mail-wm1-x332.google.com with SMTP id p17so5154272wma.1 for ; Thu, 19 Dec 2019 02:59:19 -0800 (PST) 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=KM2z5lJatvSo38TN3JEp2tBoGC1lMW5rj5gagTwUU00=; b=ZnEnwskn0ws31+evRZJXKY5mZ+iCjYMuIC0PeZtrjOoUapF2ygtXdzTuGgLhYuK/q2 Q1TlPaTKrcKAvIOP+1T2ch+lmZv/IQ8DNkrFgSdpJdoox9XzdzWgvv4X1iLiDj2doQ3S lXUS8q3HqT1dIUxRVw1xEcA3tzJJLvzCRPrrziRxg7cdWJfoWymJYKmBbcn2UnZ2i27c dnm+A9DKaF4MmZOEYw9yHg9fcxgG+48qtPYsGkehYrnOmefbAk3oNwpUXXUrnIbFyFDj NfUw0Eaqe+vQKALBBGzZXfUsNCp19Kz4uyFztRvp9BwnW8mi+OttvSmTpYqQmdFGSpHT uyZw== 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=KM2z5lJatvSo38TN3JEp2tBoGC1lMW5rj5gagTwUU00=; b=GmS7mUeY3yFw4LtOLfrGkBKjZbFxbwjAdR3Xn4PUYok9/oauG/uFCX1MpqI7nRpcm7 7PlGfIxlOhhItnb2bVhcp+O2tEnZAKHfuQFkUIEY0WlfTNiOvCcA2xPPx4YLeuuH8uew B7WgV/cFJGbn4ZyMgSwCRuj6Et+7r0s9l5RkvtXstFU+DPIEHUvS1NWn+WDB+rWv6wwZ zpJPwMB9qAB6Sigz1H9xhYTNUIU6pYb7jUrw8frKQDj8XTrhsYzHr4nw3qL22obLhsU0 ekdPugOnKaVYDNT7yifztrZZWQRtPX/8VvPOn1uMQwPUNG2fQdH0V8dJS6TpnaAW7rSa HS/A== X-Gm-Message-State: APjAAAXzGvwIGHDmMkSHqJgB3Gf9YOL6TwtAYjxh37HwUVD8t6yFFF2i K9uzdQE0CVEBegCH+cE2jXGS1g== X-Received: by 2002:a1c:2187:: with SMTP id h129mr3304548wmh.44.1576753158797; Thu, 19 Dec 2019 02:59:18 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id g7sm6091078wrq.21.2019.12.19.02.59.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2019 02:59:15 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 45D501FFA9; Thu, 19 Dec 2019 10:49:36 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 19/25] linux-user: convert target_mprotect debug to tracepoint Date: Thu, 19 Dec 2019 10:49:28 +0000 Message-Id: <20191219104934.866-20-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191219104934.866-1-alex.bennee@linaro.org> References: <20191219104934.866-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::332 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , 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" It is a pain to re-compile when you need to debug and tracepoints are a fairly low impact way to instrument QEMU. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson Reviewed-by: Laurent Vivier Message-Id: <20191205122518.10010-2-alex.bennee@linaro.org> -- 2.20.1 diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 46a6e3a761a..26a83e74069 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -17,7 +17,7 @@ * along with this program; if not, see . */ #include "qemu/osdep.h" - +#include "trace.h" #include "qemu.h" //#define DEBUG_MMAP @@ -66,13 +66,7 @@ int target_mprotect(abi_ulong start, abi_ulong len, int prot) abi_ulong end, host_start, host_end, addr; int prot1, ret; -#ifdef DEBUG_MMAP - printf("mprotect: start=0x" TARGET_ABI_FMT_lx - "len=0x" TARGET_ABI_FMT_lx " prot=%c%c%c\n", start, len, - prot & PROT_READ ? 'r' : '-', - prot & PROT_WRITE ? 'w' : '-', - prot & PROT_EXEC ? 'x' : '-'); -#endif + trace_target_mprotect(start, len, prot); if ((start & ~TARGET_PAGE_MASK) != 0) return -TARGET_EINVAL; diff --git a/linux-user/trace-events b/linux-user/trace-events index 6df234bbb67..8419243de4e 100644 --- a/linux-user/trace-events +++ b/linux-user/trace-events @@ -11,3 +11,6 @@ user_handle_signal(void *env, int target_sig) "env=%p signal %d" user_host_signal(void *env, int host_sig, int target_sig) "env=%p signal %d (target %d(" user_queue_signal(void *env, int target_sig) "env=%p signal %d" user_s390x_restore_sigregs(void *env, uint64_t sc_psw_addr, uint64_t env_psw_addr) "env=%p frame psw.addr 0x%"PRIx64 " current psw.addr 0x%"PRIx64 + +# mmap.c +target_mprotect(uint64_t start, uint64_t len, int flags) "start=0x%"PRIx64 " len=0x%"PRIx64 " prot=0x%x"