From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id qphkIPjwH2YYpjIAWB0awg (envelope-from ) for ; Wed, 17 Apr 2024 11:55:36 -0400 Received: by simark.ca (Postfix, from userid 112) id 7102E1E0C0; Wed, 17 Apr 2024 11:55:36 -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 5E9F51E092 for ; Wed, 17 Apr 2024 11:55:34 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 98475385841D for ; Wed, 17 Apr 2024 15:55:33 +0000 (GMT) Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) by sourceware.org (Postfix) with ESMTPS id ABB7B3858D20 for ; Wed, 17 Apr 2024 15:55:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ABB7B3858D20 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 ABB7B3858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713369318; cv=none; b=mW7WsijXp7f5pGLV/wBsNm1/xp1dUgHEDUAHl23wWH3x19Itgf5kyiB4rrJr47Cv9dK/Tfb3OO9U0nDxjGKLGpPf8tnqC2udhdKbWXi9RPaN2upFY5RezWHSiT/B49v5b3ziJQ8mcOEkj8eOYB2vdOf9311R/LwkKR7LLIDp98Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713369318; c=relaxed/simple; bh=Li0ZwsrDrDb6+L8aMUnvZ9o7ZmMkbCt1Uv0xMOuLnJ8=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=EI8hkpn6APO06CPCmef1+wLt58R4ixmO92NxvTpMlqmPfLWs42WDp0++MQ3EUrdBCauEJ3IsZpcS3nJiF22n5GG2tYcnZzauIaaxwXB3leNDWtErfVqtEIXFaJ7aP5FI3bEgDqQiPbzmHY59nXFf7Q6a7bxLA39oNR0gKFCwSIY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-418d1edcd4cso1892735e9.1 for ; Wed, 17 Apr 2024 08:55:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713369314; x=1713974114; h=content-transfer-encoding:in-reply-to:content-language:from :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=rccvnqwXh3PrACOCmv3bCIT99LoDR9ovWglaQ5M7gM0=; b=l88LBsxbXQiPvOgQCeHqV/CPY4tOQRkbpr3+A1/9WVsH9OLLCarAv4QpMv9T23jisl oryBoKqI/p+1FeJTHCB4SlY3UUD94jN/ARmgZuh1/Vf3WBT9+ZEE9sE5cpftjQBACuy/ j8oioXl+ViSA5vLdkuUopx4Eb2MQ5XXEfrUm7aFNW1SoAoHzEYqVcNqW8+PISG1Whafw gJwJAEhzoCmrY3N3z0XfXuwSj9wXB7Q6X27T9epIG/p6Tpjglh8g76oBchdtAdjEs1Gl kXiVsixyq7EVksvJuSskpeulzzfkOnAChUAQvLsWMu/qFKCDLpbMWMb5ImFxmyPVu12T WXVA== X-Forwarded-Encrypted: i=1; AJvYcCX2FASYVuV5Xwo0zGjQnz1L1TWgH91a8oJehWB4GBJ93YaiDkUgg+V/b8i5OM2is6unEA+pCB5ZlC8WVibhnWhmj+rVH2lh++IKTA== X-Gm-Message-State: AOJu0YxNzaacBgP7wk+aq/0GodRT/2DPNu02LScOuxcDx9P6ZyUT7vzg zsYwcx0Tz6JBZDcmtaUTvM7hsalt1YGOrFDxKVPiHV55vyG3zte/ X-Google-Smtp-Source: AGHT+IEGQK573GRPeoLIyN56Gku5782mkrDbKD9lWAiHJQlFzHU1ZvSXwMMyYs66DB0sncU9QMHQNQ== X-Received: by 2002:a05:600c:4e86:b0:417:f7ad:7066 with SMTP id f6-20020a05600c4e8600b00417f7ad7066mr7767wmq.38.1713369314214; Wed, 17 Apr 2024 08:55:14 -0700 (PDT) Received: from ?IPV6:2001:8a0:f93d:b900:e643:3adf:640c:b3ad? ([2001:8a0:f93d:b900:e643:3adf:640c:b3ad]) by smtp.gmail.com with ESMTPSA id g18-20020a05600c4ed200b00417d624cffbsm3337477wmq.6.2024.04.17.08.55.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 17 Apr 2024 08:55:13 -0700 (PDT) Message-ID: Date: Wed, 17 Apr 2024 16:55:09 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH 1/3] gdb/nat: Use procfs(5) indexes in linux_common_core_of_thread To: Luis Machado , Thiago Jung Bauermann , gdb-patches@sourceware.org References: <20240321231149.519549-1-thiago.bauermann@linaro.org> <20240321231149.519549-2-thiago.bauermann@linaro.org> <188824c6-ac5b-47fc-b137-1555432b6313@arm.com> From: Pedro Alves Content-Language: en-US In-Reply-To: <188824c6-ac5b-47fc-b137-1555432b6313@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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 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.