From patchwork Thu Nov 28 19:45:59 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: 180463 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp637227ile; Thu, 28 Nov 2019 13:30:40 -0800 (PST) X-Google-Smtp-Source: APXvYqzffcnuX9lfnP6X7pxNqQyrot1UJz319W+wwQeUI8bRAfSoRVHCrxWpIL1IHAOPGr1Hzi2I X-Received: by 2002:ae9:f711:: with SMTP id s17mr12116708qkg.238.1574976640547; Thu, 28 Nov 2019 13:30:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574976640; cv=none; d=google.com; s=arc-20160816; b=wUbL6sVtoboP3CgWMFRxxnGqN9Hg5UjDO3XZT0Aq+MfDUM1uKNye54Zj2GiNOOBBmL 1dJeCI0NB+KcOGXw8orno+miVNoPyet4Xs9dzQICIdN0cjwFwcs+knWHdW97nNLho1GK qRujmJCHU2nQfhd6AMQS8xmIkjGatjMil8LYDtdy4mHaK57eA3ZhQ7ShVozQKih8c4wS MPWdb6Y9pLfIefSXWx6YiIRvx+0ucvvqEHytAjhm+I7Ipoc/WZ+fiSQ5mS6E5Wv3qTtn IdmKvB9Nb/NlWGLXqCUwVElnAMfBM5DnzTpKLEbhMyRL/cS5FgDe+awAniaquU1faBIW 6NBQ== 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=cHVkaylNoydLTY4nbj39jRtqYAY0ZylLt+xXhgtOIDo=; b=YpSaEED1fpJ755AWfSA2WwKsxUKMpSftiC2GaPSMSb9McLdzF3cBYacMs0qs+G717M hMgT67HtvIBBDzJWUY5Ny5XWJJR4PDnYiNtD8WPCdE3kWP9US33NbhJWt4UNYCM10iOV m+7+B7xiC1lGWrFJFfYkhF7dhEgJHb1CzFlwISJOS7QrYNfMIMcqeg5kbIdf7Mo7gqf1 AWWdUxiuR1uDMQQF3+c0yOY8vHCZvb8Z+NAemVPUwF2ksBk6NwdPdzFO3QG4RAoa4Azc jjnN6X18p8W7YFkLd0/CUag5+h6epA7vHggrsgBqdQivLoNBVMHufByxLwZApAHVo9UR 1i2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="aq5bJ/2t"; 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 b73si13244086qkg.210.2019.11.28.13.30.40 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Nov 2019 13:30:40 -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="aq5bJ/2t"; 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]:53382 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iaRMy-0005w1-3K for patch@linaro.org; Thu, 28 Nov 2019 16:30:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49415) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iaPpO-0005h1-8d for qemu-devel@nongnu.org; Thu, 28 Nov 2019 14:51:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iaPkT-0006Wc-2V for qemu-devel@nongnu.org; Thu, 28 Nov 2019 14:46:47 -0500 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:38497) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iaPjw-0004uS-R1 for qemu-devel@nongnu.org; Thu, 28 Nov 2019 14:46:44 -0500 Received: by mail-wm1-x343.google.com with SMTP id z19so12823187wmk.3 for ; Thu, 28 Nov 2019 11:46:08 -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=cHVkaylNoydLTY4nbj39jRtqYAY0ZylLt+xXhgtOIDo=; b=aq5bJ/2tZo0aALMDdwz2F9WXwqSRrwAxd+JPToJf42+vwWV/v7XiEDIuau/L+SpIIx R8N2zkgVL+IRJtg2xe96v6YPXIVIoenjIJL/MGDKBBr7k0kRRSSm9kk+5O/HnQL9Gsfm ICcnJhEiWbbVCvRnsuxUf+Ga3c/F1NH/EXovxm5YmM5R3Cd+Zvus2+b5dTmmJJpJI5HR EZXKy5v6bZnPQTv6uL1eJ0ZQnWMrk5P/PWa7LVW6Iil+DoSEztDPqjQFmQPJwtAEvrAN Tga8AruCWC0r/RxZ5SHeNHrUFM2c/JPciRNaest/7P4GBnOJ8hTaD+S/+2eAQy3+tBtg B/BQ== 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=cHVkaylNoydLTY4nbj39jRtqYAY0ZylLt+xXhgtOIDo=; b=qgXXkRegy4V+oU/n7sgB0fkft+qgQnJhh1WbWK+1RMYUjWN3fplHl+/Cy/mKsYJwHD w4jqml+Q7oVL/ccnR07WDkZ3PINZsCnwp1CiqYGjVFGYopv4Pax/zD4aYeGFpgHy5luG Wtd4/vLuuZnObdkyErMMPpD+T0IOUxqhYKJf8jMXeJtyfYceO09/ZRercWjJccSnq0NH sQWy2TQqKRwVVNFsrIAnYG+eEVP51rH4XozX0sbbI2d922QX88l3E5fDTF1nkM/eL9bZ FRQooW7u/PT3mpCACg6NiB461fAHqqM+HBylBhT5dooaupIpLo2mqXVkV1rtoFnGuGF8 klvw== X-Gm-Message-State: APjAAAX05fGGi5o1DMM3mVSigSWeK22sXcDF11YX1bBAvFzQfJtuvIgG 1Xb8HYUBvcH+6+BcUXYrHx1n8A== X-Received: by 2002:a7b:c055:: with SMTP id u21mr11456859wmc.55.1574970365731; Thu, 28 Nov 2019 11:46:05 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id p9sm24335043wrs.55.2019.11.28.11.46.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Nov 2019 11:46:04 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 8D84A1FF8C; Thu, 28 Nov 2019 19:46:03 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 1/5] linux-user: convert target_mprotect debug to tracepoint Date: Thu, 28 Nov 2019 19:45:59 +0000 Message-Id: <20191128194603.24818-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191128194603.24818-1-alex.bennee@linaro.org> References: <20191128194603.24818-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::343 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: Riku Voipio , =?utf-8?q?Alex_Benn=C3=A9e?= , 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 --- linux-user/mmap.c | 17 +++++++++-------- linux-user/trace-events | 3 +++ 2 files changed, 12 insertions(+), 8 deletions(-) -- 2.20.1 diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 46a6e3a761a..66868762519 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,14 @@ 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 + if (TRACE_TARGET_MPROTECT_ENABLED) { + char prot_str[4]; + prot_str[0] = prot & PROT_READ ? 'r' : '-'; + prot_str[1] = prot & PROT_WRITE ? 'w' : '-'; + prot_str[2] = prot & PROT_EXEC ? 'x' : '-'; + prot_str[3] = 0; + trace_target_mprotect(start, len, prot_str); + } if ((start & ~TARGET_PAGE_MASK) != 0) return -TARGET_EINVAL; diff --git a/linux-user/trace-events b/linux-user/trace-events index 6df234bbb67..41d72e61abb 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, char *flags) "start=0x%"PRIx64 " len=0x%"PRIx64 " prot=%s"