From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id lxeZLoFPI2Y8vjUAWB0awg (envelope-from ) for ; Sat, 20 Apr 2024 01:15:45 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=mQfrVSZK; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id AB1DC1E0C0; Sat, 20 Apr 2024 01:15:45 -0400 (EDT) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (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 8C99F1E030 for ; Sat, 20 Apr 2024 01:15:43 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0290F3858C52 for ; Sat, 20 Apr 2024 05:15:43 +0000 (GMT) Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by sourceware.org (Postfix) with ESMTPS id CC41A3858D33 for ; Sat, 20 Apr 2024 05:15:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CC41A3858D33 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 CC41A3858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713590122; cv=none; b=fh/PV+a3+gRUbsnKK1neI6x8V+9g8CtGDimtMTXHo7f/a4rROs2wspZw7+4WDLJsLQLjPLr5froMAgdqGnCP2rRYbz5s7CXdLALypGG72pwZuAQ/PydaX0fqD2TPtTjCnUBAA3XjnYT4ZpEL4I6lLNoOmScDJf26tan1rWRS81Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713590122; c=relaxed/simple; bh=Aiv80VIefiwl+MX/ArtQ7CuBZPfyMUCPG6eC2AlJL3M=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=u2vRsSvgoQzQZCCuC+8UYyo3HFRgYr9Xjs3o8P7b1fyq1djxsficNoker9OBUc9hWpaxQBXV9Q4Dk5HtcyhqSpcbsJJCXYKbATC44+1PN85M236tFeZ7HmEYzygnb1/gFCsCrXYfavtrRM09ZrWXNsIGO4+5eMY43NEnyNn4Mf4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1e4bf0b3e06so26174475ad.1 for ; Fri, 19 Apr 2024 22:15:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713590119; x=1714194919; darn=sourceware.org; h=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=9bBSDFCIB+ts/NKMoKThliKLSbnCmqkUKanABdU9EGc=; b=mQfrVSZKvwXyT8AgShxNzWzq4W64ICqu1plVeJ60maDpCyh9xJlsPvDhP3FDMidXj0 m7rBl5E2ki2ggxJKyaU5mPH41V8oAOcpfsSyNs8/b+Fugf7Gnm1kQuQ/utibw4FidN5j DXz67kgEXhGcugsP52epIDb+remZzE73WZNJwTQNInzb39urS7hTTpjsEQ+Hlg7/cw75 aLGZ6uhqUWWe4RxCaVTwfUTMKGjrYz/vC7T4xHrf5drVSvWlLvsvpJUdp/PTLwccQOTF fqjzlszoBUHMepgrIKfxemfFnOKJkf0SUDg5p1ynQKQhGC5Jut33uw1sGk2U6rS14iT+ 2YVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713590119; x=1714194919; h=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=9bBSDFCIB+ts/NKMoKThliKLSbnCmqkUKanABdU9EGc=; b=BbSyHwlCMWUdz/fcD0UIgxNbjFOO5cKeJAJUftMTfjKYt/BhtOUb01m1yKLNcOpKjj fKwVK3WPYzqIwDUN0SKUew/OW0GAj+4W7IIwUSk9VvMbHBT6kNCC2nJEphKdDvLpRmLs zxd4bXdFdoPDmxflnRLXR4m3Pdh2lmozUfo5lW9MXKTJTZX8bahcMZCtK5toIaF67gFe Eb6Od3OYfxYbZ5mB/QdwrXkLU6YUAyvTYFJlOh3WB+50BWl/rp8VGO8Tj/NmFOVOkXiN B2QrlhBN1oAqSRz0lE6DQpC+yr1uHRz8PHeCSHH2hMnDhMOWpPS+fZnGDv/xaPt4sV6c LRKw== X-Forwarded-Encrypted: i=1; AJvYcCXXEjhf3aYNC6S5EhfB5TMkx3+L3Zy9m2wHqSNc7H/QQK/Sta1AExqKhtdzppW6PZyj0JkWFgA9QL549vM7idca+ioyZ0Hp36BfoQ== X-Gm-Message-State: AOJu0YxHnkmUYvePnt7lnGzEwwmgaejuklF7rpjfQzEABcy6gncQoEfa RTdZo91NB+PSSmSEFTqw6ds4KCqWx6xf2g1RWaC+JmBMzhGtd5KeD7oYBY3qAN9jACL5oc7MHVC O X-Google-Smtp-Source: AGHT+IHbwtxOo10BNMbqyaM9WxMwYgXL+bZOC8gSd+7CJ0Pk6sTi0tOh+vOD8aEwf5JYHv1nwm8XIQ== X-Received: by 2002:a17:902:e74a:b0:1e8:4ad9:cbdf with SMTP id p10-20020a170902e74a00b001e84ad9cbdfmr5580376plf.13.1713590119503; Fri, 19 Apr 2024 22:15:19 -0700 (PDT) Received: from localhost ([2804:14d:7e39:8470:1348:72c4:7c65:61e7]) by smtp.gmail.com with ESMTPSA id u7-20020a17090341c700b001e2a7fb6e01sm4246861ple.44.2024.04.19.22.15.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 22:15:19 -0700 (PDT) From: Thiago Jung Bauermann To: Pedro Alves Cc: Luis Machado , gdb-patches@sourceware.org Subject: Re: [RFC PATCH 1/3] gdb/nat: Use procfs(5) indexes in linux_common_core_of_thread In-Reply-To: (Pedro Alves's message of "Wed, 17 Apr 2024 16:55:09 +0100") References: <20240321231149.519549-1-thiago.bauermann@linaro.org> <20240321231149.519549-2-thiago.bauermann@linaro.org> <188824c6-ac5b-47fc-b137-1555432b6313@arm.com> User-Agent: mu4e 1.12.4; emacs 29.3 Date: Sat, 20 Apr 2024 02:15:16 -0300 Message-ID: <87edb0k42j.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-10.9 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 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 Pedro Alves writes: > On 2024-03-22 17:33, Luis Machado wrote: > >>> --- >>> gdb/nat/linux-osdata.c | 8 ++++---- >>> 1 file changed, 4 insertions(+), 4 deletions(-) >>> >>> diff --git a/gdb/nat/linux-osdata.c b/gdb/nat/linux-osdata.c >>> index c9192940f236..172fea5cea85 100644 >>> --- a/gdb/nat/linux-osdata.c >>> +++ b/gdb/nat/linux-osdata.c >>> @@ -75,10 +75,10 @@ linux_common_core_of_thread (ptid_t ptid) >>> if (pos == std::string::npos) >>> return -1; >>> >>> - /* If the first field after program name has index 0, then core number is >>> - the field with index 36 (so, the 37th). There's no constant for that >>> - anywhere. */ >>> - for (int i = 0; i < 37; ++i) >>> + /* If the first field after program name has index 3, then core number is >>> + the field with index 39. These are the indexes shown in the procfs(5) >>> + man page. */ >>> + for (int i = 3; i <= 39; ++i) >>> { >>> /* Find separator. */ >>> pos = content->find_first_of (' ', pos); >> >> Looks ok to me. >> >> See the comment about turning the numeric constants into named constants. > > IMHO, macros here would obfuscate more than help. In v2, I'm sending with the macros so that it's easy to compare and decide. I can send a v3 without macros again if needed. -- Thiago