From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id gfIJOF+/PmqThhkAWB0awg (envelope-from ) for ; Fri, 26 Jun 2026 14:05:19 -0400 Received: by simark.ca (Postfix, from userid 112) id E19211E024; Fri, 26 Jun 2026 14:05:19 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 7F92D1E024 for ; Fri, 26 Jun 2026 14:05:19 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8D2F14BA2E3A for ; Fri, 26 Jun 2026 18:05:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8D2F14BA2E3A Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by sourceware.org (Postfix) with ESMTPS id 003F34BA2E16 for ; Fri, 26 Jun 2026 18:04:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 003F34BA2E16 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 003F34BA2E16 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1782497095; cv=none; b=gs/+h6PDGrI6+sAo+4F5516cVyTPQVaV9yKw48I7zrjuvN5qN0F4GL1eiD03vjCvHLeV0O9IPNRRRgImZrQYEN8+EUr983nHYU53D6p1u0PbH7bW461RHDiQg2DQev4BJcgBp81b5sVNBc0lVoPV4e+gINI3K4IddH+ejQEkwR4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1782497095; c=relaxed/simple; bh=jiOxMiHD/sI28VXKJDKrUEwXD+YWLDR/KblSJjRS1/Q=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=owC2cPjkXIJ77iMMVn6e0numiePRCzOoMjQQekDP0bQIVOl2BjtHlo/RAMgn+jnId03GLa6SUB/raMKNDVaFwjc5VsYjgk2yUI6yru7cAyGUixvPlvemL5AhebZfCgs1Lu3XdeJ3NLUwZEFswg/W19i/W6blhOjsAqLCrUAGd28= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 003F34BA2E16 Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-490c0c92cffso10044785e9.2 for ; Fri, 26 Jun 2026 11:04:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782497094; x=1783101894; h=content-transfer-encoding:in-reply-to:content-language:from :references:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=uO4gzkr1lC9Cef5wO2ej08D0tGXFtkrEZ+4JCNy7R18=; b=ijy/RIt7S0yMGC3RaOQLEYpHcVko9q5akHOwldSaUfCroIEPRsYmYbfxw7mUx0TlNa vdHtTuTgaCZjuoDsPGfb1zhnd8Kd7kpyjikB1kZBoM/0EwDGywX2ovYB6MI7Y+VU8ukT UlpjayIHo0BKJU3zNcqSloEXx/UZu4PJ2hfCvNsapBg5b4gRrBpJOHaf46ELj3TPrNyz RMD9DRm3p1LMDMH6y8+r5Kkfevyrimewlll1cYR9/zd2WWA2cvqiRMX2X/CGVHgEX3Q9 BfiPdWHaBMzSRhqYLmWF4OCJ0zdk7Xw9l3yajbNyGWtknwwplh/zUEcerHh9PhIBlji/ SHGg== X-Forwarded-Encrypted: i=1; AFNElJ+BCXxsjWdwIXUx8BmBbOhudiLSveTNs7d73+GW+8U2aTVP+xkA9utz473YSLHbetT9HuQ0CJtuFBxigw==@sourceware.org X-Gm-Message-State: AOJu0YzNNIXND30yMFGK5LtgCYfAxuzP0txr1wEDirwpn1myMHdYe5pi lHJG6oytFbkVtPcQqckcwLOLYdrmysaHWx6HxqoyAG0XzNy0xxJYjvGf X-Gm-Gg: AfdE7cmPyxQ/AFholAPt6H23hHf/tPFt8MXmZggYHJHCOLyRq0F+xrmx3SJb+/BNg7R DOIQ+X/IOkUKnUOYXZRPhRoR6nPp+3fZbZmLSc5G7/XTOkxwF/PIDg8TqSJCMlLJrJ5FcIsduE6 /fOzx4cTNPwkpJfytsdBZvkTgMy/OUOTFhW/FsnIMK6bvTvbpUecGeHjrcNCiRuSlFZMMEtAQ5L +KBdFyz80LkCIeM+KO+xU0c6JHLjKEIl9I3YwWKHKe3xzzzcXv8DO7R4EQt7wLtG0bYv9mzYp3r /3k3wi0tOnd+eNpuhkXfIsm6+ZoCF6tQl8IY4iI0C4wwfgrGmi2bE0AjW7CkS1Sx8X7jHwLmX2U wXk/kGt/EakOQZIK6Va1x8SaUzXOPDCqahzw+OMEiHhrHd5I8tpHqa/RzrAwdhao2p5ermvVMz7 n92VMByrglXt2JT1g/JebJwymDNd8xeUZHiktPtOAki6GSKRTci/f83Rk= X-Received: by 2002:a05:600c:8b83:b0:491:8043:5c4a with SMTP id 5b1f17b1804b1-49266884b89mr122048495e9.31.1782497093514; Fri, 26 Jun 2026 11:04:53 -0700 (PDT) Received: from ?IPV6:2001:8a0:fae3:2600:ad19:f1d5:63d9:ab7d? ([2001:8a0:fae3:2600:ad19:f1d5:63d9:ab7d]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-46f86c34d76sm3726411f8f.3.2026.06.26.11.04.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 26 Jun 2026 11:04:53 -0700 (PDT) Message-ID: Date: Fri, 26 Jun 2026 19:04:52 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] gdbserver/linux-low: carry over stop_expected flag after exec (avoid spurious SIGSTOPs) To: Simon Marchi , gdb-patches@sourceware.org References: <20260626143242.4033142-1-simon.marchi@polymtl.ca> From: Pedro Alves Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 2026-06-26 19:00, Simon Marchi wrote: > On 2026-06-26 13:35, Pedro Alves wrote: >>> + unsigned long execing_tid = event_ptid.lwp (); >>> + if (ptrace (PTRACE_GETEVENTMSG, event_ptid.lwp (), (PTRACE_TYPE_ARG3) 0, >>> + &execing_tid) != 0) >>> + execing_tid = event_ptid.lwp (); >> >> This gave me pause -- this is setting execing_tid to the event lwp if ptrace fails. >> But execing_tid is already initialized to the event lwp. I think it'd be clearer not >> to initialize it, like: >> >> unsigned long execing_tid; >> if (ptrace (PTRACE_GETEVENTMSG, event_ptid.lwp (), (PTRACE_TYPE_ARG3) 0, >> &execing_tid) != 0) >> execing_tid = event_ptid.lwp (); > > Well, the question then is: what if the ptrace call fails? It probably > never fails, but we still have to think about it. execing_tid would be > used uninitialized. I see three options: I'm confused with the question. In the snippet I proposed, if ptrace fails, then we set execing_tid: unsigned long execing_tid; if (ptrace (PTRACE_GETEVENTMSG, event_ptid.lwp (), (PTRACE_TYPE_ARG3) 0, &execing_tid) != 0) execing_tid = event_ptid.lwp (); <<< ptrace failed. So this behaves exactly like your original code, just without the redundant initialization. Am I missing something?