From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by sourceware.org (Postfix) with ESMTPS id 91DDE3858C98 for ; Thu, 4 Apr 2024 16:25:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 91DDE3858C98 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 91DDE3858C98 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::1029 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712247913; cv=none; b=kTvVo39r67/Ta/zSJVjR7rMrxPqn3ANMVG9uNpeAsNBUWXg9yw79IFjU+kQqAeteZn6xTNS/tYZvbHV2sbSaauo7TD2MOqP2OTbtnNoHYoJaLD+gPF0RjkOq3Pd99Ty8P1chBAeJhUW2+rxWK6bMyOMW6TxhPxrpPPxrb42WYMk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712247913; c=relaxed/simple; bh=EB6R+frHRBAYY42d3k2cDoCaHiz7aoL4kHHJrGl0OpA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=xRJDYiapRKbWEJu1FGzaI5pkNBxFhfuEpAAil1dA/jnhh3I6bWAJd3S81+9VmpFcR9jLxLj5EjA9rUFzy0XK+Ll+HBeZpDnuujYCBP2oL8kWy/DVY1dJs/BOQS4zJLev+5mIu9hvgV+S+abhKXMfSIKjXgIJe3wl3Mfaj5iQWNw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-2a20a9df742so854195a91.1 for ; Thu, 04 Apr 2024 09:25:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712247910; x=1712852710; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:user-agent :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6Ra87cd3diS1sGSru20Se7G5wXXPWy8gd0o3h0jB2y8=; b=kDLhJVAyu/iogFfy4WTqlAYJX7XBwObKQkmIdWOepr+pGAI8oXeGdOKAeN2NNPg+Rq YAt2JKcf9K+sbloxj+mXNQ9P5tGlhnevOtBELGurR6DK+drEQ8tvHI3n8KXBfY5saXHm xg38hAKgVyZU7UI2dQ5Mqvm8HC08ssk0ucEdxk53JKfiRxJyasj7lDcSd375hkd/Hrrv fhG7dTBwHbyl0e/IvwQ7l1quhty7DeFckQnrCQx1XgWEcUhChFUTw3p/L2tZ6jKor4go 7oQnaaXkdDQVUF+0OeaLI5cihFiQLapvGn+KGnavi43zHgZzeqiyqOWLvwnHLhvGogU4 zcuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712247910; x=1712852710; h=content-transfer-encoding:mime-version:message-id:date:user-agent :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=6Ra87cd3diS1sGSru20Se7G5wXXPWy8gd0o3h0jB2y8=; b=fLNWBbAsqNu2uvq4W4kA7M+gE6QtR9FlDEf+kddKhHzuWpcbgqirlNtF5k1pfBBIfs s/5YtQXH+bsULD2BOljsHpgRSkgsx2uIk6cwJwUVeWZVDr1Dl1waxiO54ri6KioNJUDW 4ri6PN2cfefMwP5dQ+Bmfl7J1btzTY3nrIhyBAPe+BhimVj2K6uoCFk7tGcegSGcScxw FoADenDFKECM3A+6L3K5plyzDNqBAjU9TOPtPWzZzis6Kfxc+INqL+XlOHuZZuzAzO32 8hCkuweDJgdm/eoyXYvJVRRo4CNevDDoM3LCMs3vWqRwUKLFIwiqv6kxmC7AL1FOCLn2 taug== X-Gm-Message-State: AOJu0YyI+cRYFxvJHCMLzMoTePK6KCodErrXW58Z5rAQVTs+5wAcgoOg l+U1lAUMYU5+HoAEc0C10xbgSOUnNkWigBN6jlqFIalDVDhuffzkiNUl2qAwdd4oJ085J/B2PNh W X-Google-Smtp-Source: AGHT+IFNNmxCILcVwh17AIKyxR+asRXnasEzesvbyFKYgj/xylEVywwif+5O82N3Ld1BC9ySxINLcQ== X-Received: by 2002:a17:90a:b10f:b0:29b:b3fa:b7a5 with SMTP id z15-20020a17090ab10f00b0029bb3fab7a5mr2614832pjq.7.1712247909878; Thu, 04 Apr 2024 09:25:09 -0700 (PDT) Received: from localhost ([2804:14d:7e39:8470:1e9a:8bdb:ed9e:6315]) by smtp.gmail.com with ESMTPSA id js15-20020a17090b148f00b002a1f946c65dsm1720935pjb.39.2024.04.04.09.25.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 09:25:09 -0700 (PDT) From: Thiago Jung Bauermann To: Bernd Edlinger Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Fix sporadic XFAILs in, gdb.threads/attach-many-short-lived-threads.exp In-Reply-To: <87y19toqez.fsf@linaro.org> (Thiago Jung Bauermann's message of "Wed, 03 Apr 2024 22:41:24 -0300") References: <87y19toqez.fsf@linaro.org> User-Agent: mu4e 1.12.2; emacs 29.3 Date: Thu, 04 Apr 2024 13:25:06 -0300 Message-ID: <87sf01nli5.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hello again, Sorry, one more comment that occurred to me today. Thiago Jung Bauermann writes: > Bernd Edlinger writes: > >> diff --git a/gdb/nat/linux-procfs.c b/gdb/nat/linux-procfs.c >> index e2086952ce6..36e0f5bf16a 100644 >> --- a/gdb/nat/linux-procfs.c >> +++ b/gdb/nat/linux-procfs.c >> @@ -165,6 +165,9 @@ linux_proc_pid_is_gone (pid_t pid) >> } >> else if (have_state =3D=3D 0) >> { >> + /* errno is ESRCH "No such process": assume thread has disappeare= d. */ >> + if (errno =3D=3D ESRCH) >> + return 1; >> /* No "State:" line, assume thread is alive. */ >> return 0; >> } > > With this patch applied on top of my patch series fixing attach to > zombie threads=C2=B9, I don't see these XFAILs anymore on an aarch64-linux > machine where previously I saw them on every run of this testcase. Nice! > > I would even suggest removing the XFAIL from the testcase, if other > people can confirm similar results. > > In any case: > > Reviewed-by: Thiago Jung Bauermann Actually, thinking more about it I think it would be better if linux_proc_pid_get_state checked for errno =3D=3D ESRCH itself and returned -1 in that case (and also warn if that parameter is true), instead of making its caller do that check. The function documentation says: /* Fill in STATE, a buffer with BUFFER_SIZE bytes with the 'State' line of /proc/PID/status. Returns -1 on failure to open the /proc file, 1 if the line is found, and 0 if not found. If WARN, warn on failure to open the /proc file. */ I think that getting the ESRCH error while reading is semantically equivalent to failing to open the /proc file. Returning 0 when the line wasn't found because of the ESRCH error adheres to the letter of that comment but not to its spirit. :-) -- Thiago