From patchwork Wed Aug 7 12:43:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13756219 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5B4B1C52D6F for ; Wed, 7 Aug 2024 12:44:38 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sbg0j-00083w-5R; Wed, 07 Aug 2024 08:43:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sbg0e-0007zI-B3 for qemu-devel@nongnu.org; Wed, 07 Aug 2024 08:43:20 -0400 Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sbg0c-0005OY-7L for qemu-devel@nongnu.org; Wed, 07 Aug 2024 08:43:20 -0400 Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2ef2cce8be8so18578631fa.1 for ; Wed, 07 Aug 2024 05:43:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723034596; x=1723639396; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jaQO+2U4Q3+FxA+WUglfjEa6HzrZrjuAodkM2Cay3Ww=; b=rnHRcneI9cIq9DV4cXcj6D46/dv4vxGRgeaYkWxDCA5khUqiNe50AQsqm+ovR2ZgbR IJQxh4W+AVjD233XFWb//LiTFVcaXt6pH3d7Ch4gkkIgOhIOSWfa/O2c/x/NIGEbePMt OATdXN5ncWmzjZ3M4zcRAN2QScQyAqtNaZWNW3GgxCnzI948aLz4fsFLFCwj88XHK2Xc lkKw9EnGN2q56XktAitJIhFFYCzOXm8IR0SojGb+a3FLnQ4HHexG3csHbxwiQfpDGOvn 2jsoJR1NJNowYZIUFGk0RDdJ6anBQ4uswa6YW4zvBzSLyHkUPtvwNjpnM5ZPL0du6z4J LeFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723034596; x=1723639396; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jaQO+2U4Q3+FxA+WUglfjEa6HzrZrjuAodkM2Cay3Ww=; b=Txm6Woab/LqFPr6AMO0r4Hb9ws2OEN8IzqsDXMNhJBdq1xwoORkxwrh+iljn1RDnl1 8vt/xVgcXtZELmR8hPx2CrHJ2AMhZF3X99X7TNyO3RkkvypixVt/l7VU7xHFJ4ZPa3+J aIjEBRlyX8+d23VUAqtaK8CRIbHZGJ20uhs2zJpBIAOqLUM7Eejgq6FbUlax6XOmag9h fNlSLqJBMbnMZM3Q+08OA+QcBftdOEIh/OlP1Jvjk1+rU5OxEAJV8p2dWMyfFSsWFBII pDZpY5UmvWof7rgFnZYvAylHJRA9DFv+lnLHtTbJlfoAHorU9tXLlGFqvifMyF45Cl5n HMQg== X-Gm-Message-State: AOJu0YxmDH2TenTN1dNoX2yg4iT2KyaCNS5ItCHmDomWTkOLojRwEKYx d7fzl3fvz+xg0fiZOhu1x/RUSBsHVI10OfI+ccdD5gNGLW3yzwoBeH8GBao0h+PrJlvJ0c4Vf3g x X-Google-Smtp-Source: AGHT+IFdgiA6JncU5pMswQQfZgXEob1ST9AC/LJ6nEukGJ4a18PDqkyaE7z2anTl9YAnMWgYma/6pw== X-Received: by 2002:a2e:8789:0:b0:2ef:2247:9881 with SMTP id 38308e7fff4ca-2f15ab0416cmr136361881fa.31.1723034595466; Wed, 07 Aug 2024 05:43:15 -0700 (PDT) Received: from m1x-phil.lan ([176.187.212.120]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36bbcf0cc58sm15922573f8f.2.2024.08.07.05.43.14 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 07 Aug 2024 05:43:15 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Zach van Rijn , Richard Henderson , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v3 1/5] linux-user: Correct print_sockaddr() format Date: Wed, 7 Aug 2024 14:43:02 +0200 Message-ID: <20240807124306.52903-2-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240807124306.52903-1-philmd@linaro.org> References: <20240807124306.52903-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22b; envelope-from=philmd@linaro.org; helo=mail-lj1-x22b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org When the %addr argument can not be accessed, a double comma is logged (the final qemu_log call prepend a comma). Call print_raw_param with last=1 to avoid the extra comma. Remove spurious space. Signed-off-by: Philippe Mathieu-Daudé Acked-by: Ilya Leoshkevich --- linux-user/strace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index b4d1098170..73f81e66fc 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -434,9 +434,9 @@ print_sockaddr(abi_ulong addr, abi_long addrlen, int last) } unlock_user(sa, addr, 0); } else { - print_raw_param("0x"TARGET_ABI_FMT_lx, addr, 0); + print_raw_param("0x"TARGET_ABI_FMT_lx, addr, 1); } - qemu_log(", "TARGET_ABI_FMT_ld"%s", addrlen, get_comma(last)); + qemu_log(","TARGET_ABI_FMT_ld"%s", addrlen, get_comma(last)); } static void From patchwork Wed Aug 7 12:43:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13756214 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 691CEC3DA7F for ; Wed, 7 Aug 2024 12:43:52 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sbg0r-0008Mf-0S; Wed, 07 Aug 2024 08:43:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sbg0k-0008GE-Rd for qemu-devel@nongnu.org; Wed, 07 Aug 2024 08:43:28 -0400 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sbg0i-0005Oy-Vc for qemu-devel@nongnu.org; Wed, 07 Aug 2024 08:43:26 -0400 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2f1870c355cso18416751fa.1 for ; Wed, 07 Aug 2024 05:43:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723034601; x=1723639401; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=62bCHMKIXQfxUU/cuSogWzhBCjagyaLhvUECd2A5+LY=; b=evb2L3zbf7MH2Moxxu2vtCPGsnE4Bbyh8RMpmSQcsJvLU3/Nxr/2oaN3z9Mzxm/7CD LLReFvrtrMVbzuuagXM2AtXumyIQKxVyiKrVu0w0t+7v5WxfyLvn0/9uHJwYqyrPc8F4 Bw6czIsPg8TVomt1sX7qnvqx3JnjgsEL0O4UtM186Y5fI+mSeFvrHROQBzi62fAhZduh HOSgsfPCDJ0ai+3CGzojeSQVSHt2eI+zsmJz/mZuaH4euLgOuccwW0F8i3bjEKTBfJ3p +v7PsddsO7jCxI7USxP8Eab+UGENQet/THq/v4AnGZTsb5poATb3ZK6eLq+NemJ9Cuoc /GZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723034601; x=1723639401; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=62bCHMKIXQfxUU/cuSogWzhBCjagyaLhvUECd2A5+LY=; b=CoFcjc3ESrqNm0tBqLP5igc0uuFi8MMzssQEf37nmeA5E6tOXz2hUdhTpxcByeXhRl tH1AnutmBlUwJ0FFS6puzFkKnvp9F+Lfu2MJlK1EWq77ZYuyn7zcLRlKI5bkB/frUypU 4JY0+rXz5CAN8jaSw6/lX7ropPb2No64bL1lx65xG6g8fN63YJpXnSULvu4kfi0wGYXD llsTOLK1yh8GxfWnaHNy5VnRamn4PqOs/czQE+7hVITJ20ojipkUiAuKZLI7vtNjDHsM LNNe/Ef9F3t7jxEj1RkEQIEz6TU+rkVwjV29ome5/C5rxt254PUxGa/8lWcolIZ1RTWP O+5Q== X-Gm-Message-State: AOJu0YxaCASt+f4LPbAoFRaJC1p9n7LqzFzWkY5teHN6Pu7k3QU2w3RY +NQimBZQudbPk7i50iY4q38r2hqdAAuwK15aLZ3CqthyFBoJHHGtl0PQhdqWsiAEu7sH8Z5nQoP H X-Google-Smtp-Source: AGHT+IGNyie40yiMy2CPapLOo/TozQaIABAds+fJKEMxxdJwP9PKqr4IWctGyIt2+2H5YUkMM4bwRg== X-Received: by 2002:a2e:9c90:0:b0:2ef:2c87:3bd7 with SMTP id 38308e7fff4ca-2f15ab0c200mr114613611fa.37.1723034601460; Wed, 07 Aug 2024 05:43:21 -0700 (PDT) Received: from m1x-phil.lan ([176.187.212.120]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42905971d06sm26898975e9.19.2024.08.07.05.43.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 07 Aug 2024 05:43:20 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Zach van Rijn , Richard Henderson , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v3 2/5] linux-user: Display sockaddr buffer as pointer Date: Wed, 7 Aug 2024 14:43:03 +0200 Message-ID: <20240807124306.52903-3-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240807124306.52903-1-philmd@linaro.org> References: <20240807124306.52903-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22a; envelope-from=philmd@linaro.org; helo=mail-lj1-x22a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Rather than 'raw param', display as pointer to get "NULL" instead of "0x00000000". Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Ilya Leoshkevich --- linux-user/strace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index 73f81e66fc..80f64ff40c 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -434,7 +434,7 @@ print_sockaddr(abi_ulong addr, abi_long addrlen, int last) } unlock_user(sa, addr, 0); } else { - print_raw_param("0x"TARGET_ABI_FMT_lx, addr, 1); + print_pointer(addr, 1); } qemu_log(","TARGET_ABI_FMT_ld"%s", addrlen, get_comma(last)); } From patchwork Wed Aug 7 12:43:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13756218 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B9B5BC3DA7F for ; Wed, 7 Aug 2024 12:44:28 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sbg0t-0008U9-Fi; Wed, 07 Aug 2024 08:43:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sbg0p-0008M5-AA for qemu-devel@nongnu.org; Wed, 07 Aug 2024 08:43:31 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sbg0n-0005PH-L2 for qemu-devel@nongnu.org; Wed, 07 Aug 2024 08:43:31 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-428fb103724so4959785e9.1 for ; Wed, 07 Aug 2024 05:43:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723034607; x=1723639407; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rnPHm5qmilosKgT5p/Ig2S4/TLxu+gWuPX7v2WagT94=; b=rrRVLWJ08phpqd9sCmMeUxhyCA0aYwbbbUEY2PYonWDzVgyBzuO+W7ms4KyalBafts /FN26EjN+azqT/enTZf9itI1v105bUSaKvPWIVktRD5YP6NSFZ/jc1JerlhN3AxPhcKc l/Tgn9JLndr2VliTw1JDL63RFB9rDeBZqKIME1GHTLpYb93sesImLn+JGTJxI4FRmk4j YH/ZO+mLbM0kbf4KIkeG8B/fTWUv6Abycbivc3ZWzVnOHmbZtHnEkBrqOyxlyGgg6oVJ 1/LsRrthAnAOGfS0xzhUPldp08v+yvDqoVUUR31BgfzE15Lu38nMMTePkXvGCZoDSk4T T/Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723034607; x=1723639407; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rnPHm5qmilosKgT5p/Ig2S4/TLxu+gWuPX7v2WagT94=; b=Dk2+GwTb+Oa+F96k4O5h7AZszFgq+X31jzaol3Q+rm79WPte06K99aFJs8D43gYWvv 6gWg7UMyY79iQUCcYz0ECMa5so/mE7sziYMq+FS239C2W8Z86z2jfDgb2ZW1GaW1FbBi KUkyMoQYh9xiAPWxdXC/mVlUf2NMFyUgyJKsDY95gKDgIKLezBmxDi23SJZUVMD5Xn6i 3cgsGKqPqBiooCf5h/iat+G1BTEimWSDR6xsCGx6N58AXXimOLb0IzfKWyEdtCZ8TYLH 1TArI5YrcxPw/s/1q/BKti7ebWqcw5N/jQ5zP1D+yPSos+bkqhKHh5LjZFVMfXr+irTh SfXQ== X-Gm-Message-State: AOJu0Yw/7TusnTSpYGJBz8A08ett5ArO/mDxWFltQBx9G7j5Xaum1ObY 2T12UDgz6uzqUSf49hrsF2nbu+TJ0gtEnEmEcLolZKy8nQkfM97Np9hMU2eoFE54TrA+jqO3D3b Y X-Google-Smtp-Source: AGHT+IEXPuxpBtD+YwzrJfgE3tp7qPiqSCNmhmOvLrwW/Xa0K3MCDfLRc1ny4HnC1N9Xu4WBZ9VzGw== X-Received: by 2002:a5d:54d0:0:b0:368:318a:a191 with SMTP id ffacd0b85a97d-36bf0dad2d0mr1439151f8f.8.1723034607304; Wed, 07 Aug 2024 05:43:27 -0700 (PDT) Received: from m1x-phil.lan ([176.187.212.120]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4290598f195sm27847505e9.28.2024.08.07.05.43.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 07 Aug 2024 05:43:26 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Zach van Rijn , Richard Henderson , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v3 3/5] linux-user: Factor print_buf_len() out Date: Wed, 7 Aug 2024 14:43:04 +0200 Message-ID: <20240807124306.52903-4-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240807124306.52903-1-philmd@linaro.org> References: <20240807124306.52903-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Ilya Leoshkevich --- linux-user/strace.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index 80f64ff40c..210ff86afc 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -1655,6 +1655,13 @@ print_buf(abi_long addr, abi_long len, int last) } } +static void +print_buf_len(abi_long addr, abi_long len, int last) +{ + print_buf(addr, len, 0); + print_raw_param(TARGET_ABI_FMT_ld, len, last); +} + /* * Prints out raw parameter using given format. Caller needs * to do byte swapping if needed. @@ -2742,8 +2749,7 @@ static void do_print_sendrecv(const char *name, abi_long arg1) qemu_log("%s(", name); print_sockfd(sockfd, 0); - print_buf(msg, len, 0); - print_raw_param(TARGET_ABI_FMT_ld, len, 0); + print_buf_len(msg, len, 0); print_flags(msg_flags, flags, 1); qemu_log(")"); } @@ -2761,8 +2767,7 @@ static void do_print_msgaddr(const char *name, abi_long arg1) qemu_log("%s(", name); print_sockfd(sockfd, 0); - print_buf(msg, len, 0); - print_raw_param(TARGET_ABI_FMT_ld, len, 0); + print_buf_len(msg, len, 0); print_flags(msg_flags, flags, 0); print_sockaddr(addr, addrlen, 0); qemu_log(")"); From patchwork Wed Aug 7 12:43:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13756215 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 32C1AC52D6F for ; Wed, 7 Aug 2024 12:43:53 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sbg0y-0000T6-Pn; Wed, 07 Aug 2024 08:43:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sbg0v-0000F8-HV for qemu-devel@nongnu.org; Wed, 07 Aug 2024 08:43:37 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sbg0t-0005PZ-SA for qemu-devel@nongnu.org; Wed, 07 Aug 2024 08:43:37 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-42817f1eb1fso11750855e9.1 for ; Wed, 07 Aug 2024 05:43:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723034613; x=1723639413; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RpWIKWWe5ixWDtiVxOKLp+Lsc4k9VqF1doDZjHB6Yj4=; b=IInkAKM10xipG/W6k2wTx+SRbrzWQJ87K115O67elcap3eDAka9ULldzrCN/no1z+U H6lgQfTJ/SciAR7V4NQGxTOl564byowSxdSyFhF8Tc0eZLpnGCJnx9PuHUDDYHekcps/ gOkYet81qs8hfw9zg/eSrIPlbKw9wM8JTxSdAQxaUNlPZ0wpw7TU4KllXiW+OFB7eklo BSR349nFkOsrzLGJcaux/kdCII+lHvvqCLp2HNOucEQRErYNI8IJY/uLQJ6v45NGIPZo dCI23gA3n4wZUPc7vF6eI/nzZdm0lxwNhXwhQOMG6hmz65UsGqO6/dLjNDUSTelk3WwX UDRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723034613; x=1723639413; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RpWIKWWe5ixWDtiVxOKLp+Lsc4k9VqF1doDZjHB6Yj4=; b=HxJFq6ub+mx2C0DM0QIgl/I/SutRNFYKEQYJsSGrrB19s+NLl6uHIuuUnwPe44nD0h PZu9BuI5Ta8J5oApxTW+mMsO5BlAPeR1qIo3yTEEl5uov78BhiObE+gOkBu5epev9mbU hOE0iRMxWmS4KePAN7ESI67PvyQILZe556KMK2nVzzPiFFF31mA/CAR7LoUfvW7BqUX4 ypJqH29ldTz5KSO9EeViy5cWLmtN6YA8VKZT0o1ohfwll0eGuOHq7hiRzMeBa16+8cHh lJXQqZTFrkdUUSqRKAyTH0eE7ulBH8k327f8TikMyT4gSOpTNtxwAVFFyj8ql0CsUvyh weFQ== X-Gm-Message-State: AOJu0YyLGeIGD8JWdw7j3SK4hOktQKOjt9W4/cXoDJEbWxQSgBylG8dC auFVWRYHDhyoIL/x4V7RM4Xyd0MyfSisf3+Y3E2855W+Q9fmfL8FfFimAw/1T04FQyxgha36d94 D X-Google-Smtp-Source: AGHT+IGHZcDQ8rE1wsFbjTo/aEaj72VTzl7StTe0h8wuh9gw31p3m0RF8vxvNO/OhyDv/mJY6in6yw== X-Received: by 2002:a05:600c:154c:b0:426:6389:94c4 with SMTP id 5b1f17b1804b1-428e6b956edmr116126765e9.37.1723034613204; Wed, 07 Aug 2024 05:43:33 -0700 (PDT) Received: from m1x-phil.lan ([176.187.212.120]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4290580cf79sm27443265e9.48.2024.08.07.05.43.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 07 Aug 2024 05:43:32 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Zach van Rijn , Richard Henderson , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v3 4/5] linux-user: Add strace for sendto() Date: Wed, 7 Aug 2024 14:43:05 +0200 Message-ID: <20240807124306.52903-5-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240807124306.52903-1-philmd@linaro.org> References: <20240807124306.52903-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Ilya Leoshkevich --- linux-user/strace.c | 15 +++++++++++++++ linux-user/strace.list | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index 210ff86afc..98ef26b917 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -3127,6 +3127,21 @@ print_bind(CPUArchState *cpu_env, const struct syscallname *name, } #endif +#ifdef TARGET_NR_sendto +static void +print_sendto(CPUArchState *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) +{ + print_syscall_prologue(name); + print_sockfd(arg0, 0); + print_buf_len(arg1, arg2, 0); + print_flags(msg_flags, arg3, 0); + print_sockaddr(arg4, arg5, 1); + print_syscall_epilogue(name); +} +#endif + #if defined(TARGET_NR_stat) || defined(TARGET_NR_stat64) || \ defined(TARGET_NR_lstat) || defined(TARGET_NR_lstat64) static void diff --git a/linux-user/strace.list b/linux-user/strace.list index dfd4237d14..5a86419e7d 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -1285,7 +1285,7 @@ { TARGET_NR_sendmsg, "sendmsg" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_sendto -{ TARGET_NR_sendto, "sendto" , NULL, NULL, NULL }, +{ TARGET_NR_sendto, "sendto" , NULL, print_sendto, NULL }, #endif #ifdef TARGET_NR_setdomainname { TARGET_NR_setdomainname, "setdomainname" , NULL, NULL, NULL }, From patchwork Wed Aug 7 12:43:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13756216 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 59E86C3DA7F for ; Wed, 7 Aug 2024 12:44:10 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sbg1B-0001IH-KY; Wed, 07 Aug 2024 08:43:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sbg13-0000o0-65 for qemu-devel@nongnu.org; Wed, 07 Aug 2024 08:43:46 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sbg10-0005Q0-Jq for qemu-devel@nongnu.org; Wed, 07 Aug 2024 08:43:44 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-428119da952so11823645e9.0 for ; Wed, 07 Aug 2024 05:43:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723034619; x=1723639419; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Pq1dTXzDXbRYVMh0ReJZN5GzV4YwZOctS4OmQtmosdA=; b=wq6tzVYgt5gfg6wgGuk4r5ia1NCr+XwFhTr5vUMdGT6ltYVA0ZyHpGOzXBFRvsQm4y aKfnL7rFqgOlDBQYGCh8X0GAd84j80zMaHfNDbLBKRejwxCRNFQdfNibAum0E+udB6UM g64v5CtGhxKy3IdKLoU3uxX7aoRLgFtsO7KFzkmU6vv/fXd/pDekWDLSO9Uoi9psCZoK kZyCI7oY6SQQ/OtTgcXSN6MJ+VQpeHYxJK9oOM++s4glTgRN6jXYhn+twkvqlOwQO47h 9OdFxTwdTOOt5wwWUwQ8XGhcVltuCZGb4aniEmbmg96ngFnZsDQVE+nuUAGlarKqSJKs h8eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723034619; x=1723639419; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Pq1dTXzDXbRYVMh0ReJZN5GzV4YwZOctS4OmQtmosdA=; b=u0F1gb77BMdkrbw65sgw2SoINYEq4lMg9n+vdw1uYPrl7cLATOs57HYQcT1R4NNAOW EIQQTZt4yS1LYfI8PG1a1dT8l9b7QRLb8VnUftJLlY/jtS0kx8LnlkaxYZDEShAEoVBg 2YawaJ5p+LaqKigw36mJbktXFMwpIdNLxUoybCj3QXyMZsJhPnzVtVF1dTPZzb5c0h3f NbDXFS+5U5FDVnLODLUxHCkaXiz2jgCyHOnDEn8r3voTToJyaLRn9Sog7AgXxa4MVuw+ zLBddmt+/Ze0668e7ZUCS3vOq8QZ1V5Ri/UfrciQ+OtrjiG4JqDNh7QNcrVeheSt5d6S ClQw== X-Gm-Message-State: AOJu0YyX25ypOvtVyx0X7InH8o6Wj9ikfPs1QKwvQ2GHMrYvnP3KNycW 53Z19kVq2+lNphaxztS1Ftz9TZyuGX+xdjFq7EcaHH5qKwbsJj5vc+7I/9H+JYFVKpcFQXk2Awa Q X-Google-Smtp-Source: AGHT+IH7S9E81PNnWavpi60hV7FbzEEzmSAiqmRxVasdEigs0LJE+vXIWJEju5IhoLjvD4dlrSsiJQ== X-Received: by 2002:a05:600c:1f05:b0:427:d8f2:550 with SMTP id 5b1f17b1804b1-428e6b043c1mr119371385e9.14.1723034619003; Wed, 07 Aug 2024 05:43:39 -0700 (PDT) Received: from m1x-phil.lan ([176.187.212.120]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429059a6703sm27553805e9.37.2024.08.07.05.43.37 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 07 Aug 2024 05:43:38 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Zach van Rijn , Richard Henderson , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v3 5/5] linux-user: Add strace for recvfrom() Date: Wed, 7 Aug 2024 14:43:06 +0200 Message-ID: <20240807124306.52903-6-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240807124306.52903-1-philmd@linaro.org> References: <20240807124306.52903-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- linux-user/strace.c | 19 +++++++++++++++++++ linux-user/strace.list | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index 98ef26b917..d76907fdc9 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -3127,6 +3127,25 @@ print_bind(CPUArchState *cpu_env, const struct syscallname *name, } #endif +#ifdef TARGET_NR_recvfrom +static void +print_recvfrom(CPUArchState *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) +{ + abi_ulong addrlen; + + get_user_ualx(addrlen, arg5, 0); + + print_syscall_prologue(name); + print_sockfd(arg0, 0); + print_buf_len(arg1, arg2, 0); + print_flags(msg_flags, arg3, 0); + print_sockaddr(arg4, addrlen, 1); + print_syscall_epilogue(name); +} +#endif + #ifdef TARGET_NR_sendto static void print_sendto(CPUArchState *cpu_env, const struct syscallname *name, diff --git a/linux-user/strace.list b/linux-user/strace.list index 5a86419e7d..77ca824f9c 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -1135,7 +1135,7 @@ { TARGET_NR_recv, "recv" , "%s(%d,%p,%u,%d)", NULL, NULL }, #endif #ifdef TARGET_NR_recvfrom -{ TARGET_NR_recvfrom, "recvfrom" , NULL, NULL, NULL }, +{ TARGET_NR_recvfrom, "recvfrom" , NULL, print_recvfrom, NULL }, #endif #ifdef TARGET_NR_recvmmsg { TARGET_NR_recvmmsg, "recvmmsg" , NULL, NULL, NULL },