From patchwork Sat Nov 23 15:07:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 845114 Delivered-To: patch@linaro.org Received: by 2002:a5d:688e:0:b0:382:43a8:7b94 with SMTP id h14csp352891wru; Sat, 23 Nov 2024 07:08:15 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU71L936Tqb7mpzm6QsTcGx0ZtfdUG8H8ziSDmAij7yyUdckKlcCHPvgoN+tfqgWa3hehop+w==@linaro.org X-Google-Smtp-Source: AGHT+IHlJPXcZTQ6eduaUW6Pw7nL5CbUcoClq95UreJ9m5wuCRDd+EkhwIG1o6YGefdZAicZkHot X-Received: by 2002:a05:620a:2493:b0:7b1:43e2:712e with SMTP id af79cd13be357-7b5144ad15emr811479085a.17.1732374495481; Sat, 23 Nov 2024 07:08:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732374495; cv=none; d=google.com; s=arc-20240605; b=dqX3ppPd4juzcw4osr0f+cRZp6WV0Se+vsNvy2Y6kXGx+iABVRWYJw6WKm+6bO38RF nfuVAJkYd5zClLdLgHffMV1VrGxK90f29dGvfyOvcUkFRWz1SPM7PvZofNiMNVKW3+9j 91Q66gHazXbDsod48y3h3yRzgq7chr05LTMCo9/sZrKVITUG0/uBhElC7R1Fmq/noU5J PfJACh+N30ptuUmjAcnbGRwXMXjfQVpQSI1dt+Fi5efae7vZqC4v41gWbStiA/kRK3Fs zL6y+b2N7vOB3su1Gs8bLT3qLHrsl5NPlkR8XCEIIh4sSjwWqukPwf55xEv6RPD3/GIL oB9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=3+soXgIGzU1qx/4reP56HeUhKrWsVcJ3S0viKluo4FI=; fh=Z5cQS2SDpzotHfcDUrj0/G4dYdihu+anMiGjmeCrPQU=; b=LdOZp4PqbgJdy6u9KPNMhBAax6zuYuM7+YpQ4B2ft9GMoQLrgKdkUQ8mZrjA4t2guY 5lIc0ezuR50N8BKWkLY+7C8OYJqWKg9006z3ZgoH47claGb1G7i52D1SO3xPenKqK/MJ hUfCHJRZB+aOHDJK8WwrnsWY8tlcxQLtEbM52ZWpOY9a1Z3Ks/CfNZeTQ0Cl1CtGW3qu Wh5UZS92x4UKosanv9qre9gmogcu/cEmS/dZh5IDoKE7MOx1yxuIHnq4XjFMuxhoMBXV 0DKXFjsZcbfMffYY6KyV7vCmbvCPWke/XXJbbfAeR6Wjmb8CINzwmjFhwEuiYjrDe987 WfWg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LnjDoSuk; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a1e0cc1a2514c-85b118a7320si1478419241.174.2024.11.23.07.08.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 23 Nov 2024 07:08: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=pass header.i=@linaro.org header.s=google header.b=LnjDoSuk; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tErj8-00024R-QZ; Sat, 23 Nov 2024 10:07:15 -0500 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 1tErj6-000244-TH for qemu-devel@nongnu.org; Sat, 23 Nov 2024 10:07:13 -0500 Received: from mail-oa1-x34.google.com ([2001:4860:4864:20::34]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tErj5-0004q1-9Q for qemu-devel@nongnu.org; Sat, 23 Nov 2024 10:07:12 -0500 Received: by mail-oa1-x34.google.com with SMTP id 586e51a60fabf-295d27f9fc9so2411515fac.0 for ; Sat, 23 Nov 2024 07:07:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732374430; x=1732979230; 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=3+soXgIGzU1qx/4reP56HeUhKrWsVcJ3S0viKluo4FI=; b=LnjDoSukwJc5iaaDwxp++G8QEerDLJVQ6BpG1+3pqrbyfnqixPkGreH3mraC+pO74K CAaXPY6+wlAs86BKDfsUU+xqjnEjYVISHjXeVwyvfdZ3Vkv6OHqLwLtYbV6iP4rgC6Wv uQ74m6Bmd14Q+LotquJQytXIYM4u6Hz6wr2b0UBmbucfQlDYiEGEHck6NUnpaEL214YO Xjg90WdS0jx+bonnGdWOiFMJ0oZZ4mcY7tiLjOAIPUZl1w97jNLc2EbTtL3jH+OVLEH+ oVi1rXxGHEPXglwAbZwm5kLhqT4AlgRrQ7/aAhXld5Ub7HsTzPBeeZEthQb4UzFjWdml TDJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732374430; x=1732979230; 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=3+soXgIGzU1qx/4reP56HeUhKrWsVcJ3S0viKluo4FI=; b=eXSWcPCMKxqKHLRQnJ2wU6apS/bsfLCSBESbvP8PurEQzJO6TjZhE/Wf9M2RcRBkKd SbsbqzeoaSLP5bDAOJeYRp2VZIoqDXz60sZLWpq2yUPC8xUX4SVWeg6fj1EME68WUHvA dPDxiSXZzbMuOV1UTS58QYnWMGbJFGRdlkI0YaEfpR9NuxyK0J5F/Cc6Wosy+UpyyJPW 8O0Lmd2WlTNyvTDUDMhMdCJ/OjOnlkBGmrP6HngDDcKdM3Z38okGVlF/tUH7OGXVzbhx 1n2E777PFGX2PxIZhFsqSExmEg0GR2rtzJskszbWDbfa8LH0+QKTwczJBr4tXhqTOjtt 2tdw== X-Gm-Message-State: AOJu0Yyesry7hidJO0NsefolUXxUHqpkaYE1mkzXiLYSDJmakM3TrJPk gU/X70raCPjuDmnU7FCWi7EqrmmJC2cteay4lLvCOrnfzud1EEJYU9FWbhJ+7LL9O3JgZsLjWOA iAHY= X-Gm-Gg: ASbGncsIHeT+n11mrgzebsCEthoKL6b8k8G9Aq3E15E31SbSVxeEpYPi9mVWfFLe2SY 2w584KdHSG0HQtLxPeZSm41i7ruPr77iSKuFHJtKoCcSjpnfvtiKnk0vBnZvg3w1MaLyJ6DVvmJ 8bD46QxJQsIxarv+dsObZPcnXKzhITC5wcGmETn+SFj7tx7xLwJy0zumi04GGsHc5rZyhUX1zA8 3ZfaR+QzJPgEUpQvOv5q07Hoz0j/6UMcQlYg7pY6h0eXrgeGY8CeaB5MQ== X-Received: by 2002:a05:6870:2188:b0:297:949:4406 with SMTP id 586e51a60fabf-29720ede21bmr6827393fac.31.1732374430178; Sat, 23 Nov 2024 07:07:10 -0800 (PST) Received: from stoup.. ([187.210.107.185]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2971d82291fsm1396390fac.33.2024.11.23.07.07.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Nov 2024 07:07:09 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?J=2E_Neusch=C3=A4fer?= Subject: [PULL 1/2] linux-user: Print tid not pid with strace Date: Sat, 23 Nov 2024 09:07:05 -0600 Message-ID: <20241123150706.19740-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241123150706.19740-1-richard.henderson@linaro.org> References: <20241123150706.19740-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::34; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x34.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: J. Neuschäfer This aligns with strace, and is very useful when tracing multi-threaded programs. The result is the same in single-threaded programs. Signed-off-by: J. Neuschäfer Message-Id: 20241024-strace-v1-1-56c4161431cd@gmx.net [rth: Use TaskState.ts_tid via get_task_state()] Signed-off-by: Richard Henderson --- 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 b70eadc19e..f68c5cdc44 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -4401,7 +4401,7 @@ print_syscall(CPUArchState *cpu_env, int num, if (!f) { return; } - fprintf(f, "%d ", getpid()); + fprintf(f, "%d ", get_task_state(env_cpu(cpu_env))->ts_tid); for (i = 0; i < nsyscalls; i++) { if (scnames[i].nr == num) {