From nobody Tue Feb 10 15:45:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1574976520; cv=none; d=zohomail.com; s=zohoarc; b=lbpIQrvi7EOnG2wzAmCkcSQ+IwR9p5miKPuX3MPewstJJart1RL1a8J4QZ/w58yQDJ+t/7tuUxx1cgjTzIClAnoMkTZqkfJnDP3L2iITj4fJd5EYcnNxHw7l9nHz74ItBRAx+GM8acIxGNvA7UOPa1K33vIySkdSHPs1cazImF4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574976520; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=cHVkaylNoydLTY4nbj39jRtqYAY0ZylLt+xXhgtOIDo=; b=UioaFHCjY6ky+WbVzEtX7BPUL72z2e+hB0z9DuTFJ0ae4xSTIbhmlFbXA+Ki6olvOW+4C1MT/IFraq3mc3/V21dNXxz3MXWor30krBPb/wJSuoHu5xick1Jti9Lx/EDD0d0Co6oFGcpSfmhRKomcN4GnEQqUEiyyD19w8ynxuTY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 157497652022746.53241158948492; Thu, 28 Nov 2019 13:28:40 -0800 (PST) Received: from localhost ([::1]:53370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iaRL3-0004PE-ER for importer@patchew.org; Thu, 28 Nov 2019 16:28:37 -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) 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) 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-Google-Smtp-Source: APXvYqxgva5Fbsr15ZBZx/gLGLlrh0LNutneNJiwPoII/GI6nQzPk5fBOOo5bTq3WBNimIDU1oEBww== X-Received: by 2002:a7b:c055:: with SMTP id u21mr11456859wmc.55.1574970365731; Thu, 28 Nov 2019 11:46:05 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=20Benn=C3=A9e?= , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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=C3=A9e --- linux-user/mmap.c | 17 +++++++++-------- linux-user/trace-events | 3 +++ 2 files changed, 12 insertions(+), 8 deletions(-) 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" =20 //#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; =20 -#ifdef DEBUG_MMAP - printf("mprotect: start=3D0x" TARGET_ABI_FMT_lx - "len=3D0x" TARGET_ABI_FMT_lx " prot=3D%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] =3D prot & PROT_READ ? 'r' : '-'; + prot_str[1] =3D prot & PROT_WRITE ? 'w' : '-'; + prot_str[2] =3D prot & PROT_EXEC ? 'x' : '-'; + prot_str[3] =3D 0; + trace_target_mprotect(start, len, prot_str); + } =20 if ((start & ~TARGET_PAGE_MASK) !=3D 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=3D%p s= ignal %d" user_host_signal(void *env, int host_sig, int target_sig) "env=3D%p signal= %d (target %d(" user_queue_signal(void *env, int target_sig) "env=3D%p signal %d" user_s390x_restore_sigregs(void *env, uint64_t sc_psw_addr, uint64_t env_p= sw_addr) "env=3D%p frame psw.addr 0x%"PRIx64 " current psw.addr 0x%"PRIx64 + +# mmap.c +target_mprotect(uint64_t start, uint64_t len, char *flags) "start=3D0x%"PR= Ix64 " len=3D0x%"PRIx64 " prot=3D%s" --=20 2.20.1