From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id EVshAN6+o2r2Rz8AWB0awg (envelope-from ) for ; Fri, 11 Sep 2026 04:42:06 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=JWWGNKvr; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id EE3FC1E09E; Fri, 11 Sep 2026 04:42:05 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.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 F16F91E091 for ; Fri, 11 Sep 2026 04:42:04 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BEEE64A9E045 for ; Fri, 11 Sep 2026 08:42:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BEEE64A9E045 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=JWWGNKvr Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 8D6C14BB1C1C for ; Fri, 11 Sep 2026 08:41:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8D6C14BB1C1C Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8D6C14BB1C1C Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1789116098; cv=none; b=ibB/IJ+VK9OcPZ6+X+jsMeGi9SLyS6dQ7P5JGVpgw9/ow685sWexF9o42nQOKLZQ8umaj66cTswmOWCBU19SyXAw6Qo/26HbBl/5bDZa5ZbwfnT4c4klGsKK907XBKz2k+6EXCfqegy3YvukB+0y93fG2/0oiwbFZBG1RxNw6zI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1789116098; c=relaxed/simple; bh=iNpe+mPQDSC9kkVX2K9af5izeifVXdm4XWenQ2lgp5U=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=iOeJc5IfPDK6+eNlgbCdg+YG3oqm+GOy6RQ3fOYCPibYN8x5+4Gwwymg37t1sh9GqVIdfRmjz1lQMBoFJo18WmppByUAc+Awl2PGC+SaXn4J3YzGKYIkRVDJSrCJKdywN17sCu5tJFUHmwHgvl4g2ibH8yhO0GVbtJ1M1IJ44mE= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=JWWGNKvr DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8D6C14BB1C1C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789116098; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=abFOx5LSjmW3ok+YvqXbqsUajoEJuFeAPOLendwlghg=; b=JWWGNKvrMi32PEYEWfFxg3N2Ei0th8ofMnfhLatZ51sOxrclSYTr2FcZC+ad+6XudIgWXj Q4+NR4GCaXB+fFbnVz0t9mbQ6PrT/9ngeMB/Lmlh0jRX8QnKgpFgEx/rQ4HpRR21jJQ/01 2BJ6mtYI0X6oUk4ZEYcHT5KSru7eDs4= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-397-hFd6LojKPTO_l4P3XukYzw-1; Fri, 11 Sep 2026 04:41:36 -0400 X-MC-Unique: hFd6LojKPTO_l4P3XukYzw-1 X-Mimecast-MFC-AGG-ID: hFd6LojKPTO_l4P3XukYzw_1789116095 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-486f2848319so61096f8f.0 for ; Fri, 11 Sep 2026 01:41:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789116095; x=1789720895; h=content-type:mime-version:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to:content-type; bh=abFOx5LSjmW3ok+YvqXbqsUajoEJuFeAPOLendwlghg=; b=nnxk9jMp+7l+QffDVb8Hr9FXR0Z73d5zYqvmZEtg2wMr3gRIl1vRi4l74JMJxCjdPq emVGZ1kahuT7uFv8PadzrtsE1clDbiQEkznYkeP1QERVPoRDHxSTkeRaEj0QOTV28QJN ASDJP6L8rKtOTuEuP0JDQJj3tGWcvYvWgX1rr4IYXtgzOwUVhuneivDwVUhnHl7Vxfbj mPxd+UBNN33u2CZOiu7cP9aauV1fbJT4SJIbx4C/wREfYAEKMU+JQ6uy2fXAH6YQ6TtL n3CBejytntZxwkTqYMrqDc9ybZSbab4xnQhJ+/F0gwIMEQfAY+lpefN98CSW+ZUmoIM2 wddw== X-Forwarded-Encrypted: i=1; AKwUvBzJjbnKiihApkgEddKvArwHgIzBgLf4cEBJYzl/ejVqxaD8fL+ZhOtj0PbIgFssvg3C9grfnCu3gPeBxQ==@sourceware.org X-Gm-Message-State: AFuF++nJAl5oW9yI5iCSxQFZnsk0JvxFk4+wwI53uMelxTiQeeXEPvO4 Wv07zF4USyK3dtR9PUfCpQEzQ/3LBgfMzPDsyIaN0/Icx2PoK1Oh6wtn3dMZu1a9Ry+is2GXIhx PPCur/Lvfv1WiBTRci0gnLGqKslw1md0t8XcPq7rqz49xOY49gV24KZeCnEYVEKA= X-Gm-Gg: AYBFou3yBa9ra0AtiV2gjXXUxmfjVw1owBwSNxV02hJ0lbbK3/YDFO/6vnkogn9VktD 6Ejz5HjyBdzV+fV77B/POdWXYmuzR4uZsFdnxqxXAjIj9xatBk8XGBquJNzgwrBZgxFsmRMg0ei ntfAkzClKWXRV5dBF/cLzCwB3WfANqJQDYwIPzQNpwyn1Z9WlsPGZZbAbUokjAGQPXi/0jfVgqi GbpWW5BEW9PdQIXHOLdWRk/0k18h7xGFdqByznBXa0XCSid/GjcPCqCVwLZineSAy+bAvA97fq4 BX0T9i5AmLn7K2IF6hKxakwru/166QXu5hP0F9+9vBKpisMjdYYlu+qFXHV9yVxbbzCYcaKyBR8 KCgtOc360ZzHfb9CH X-Received: by 2002:a05:6000:2888:b0:486:e60f:a4e7 with SMTP id ffacd0b85a97d-486eb2e3e4amr3330150f8f.11.1789116095321; Fri, 11 Sep 2026 01:41:35 -0700 (PDT) X-Received: by 2002:a05:6000:2888:b0:486:e60f:a4e7 with SMTP id ffacd0b85a97d-486eb2e3e4amr3330114f8f.11.1789116094901; Fri, 11 Sep 2026 01:41:34 -0700 (PDT) Received: from localhost (59.6.93.209.dyn.plus.net. [209.93.6.59]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-486eb32e8d1sm4306735f8f.11.2026.09.11.01.41.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Sep 2026 01:41:34 -0700 (PDT) From: Andrew Burgess To: Matthieu Longo , gdb-patches@sourceware.org Cc: Simon Marchi , Thiago Jung Bauermann , Luis Machado , Luis Machado , Christina Joos , Kevin Buettner , Matthieu Longo Subject: Re: [PATCH v2 6/6] gdb/linux-tdep: remove legacy parse_smaps_data overload In-Reply-To: <20260825100912.514232-7-matthieu.longo@arm.com> References: <20260825100912.514232-1-matthieu.longo@arm.com> <20260825100912.514232-7-matthieu.longo@arm.com> Date: Fri, 11 Sep 2026 09:41:34 +0100 Message-ID: <8733vgdvsx.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: lalEh0yZIRXa2QFigVCUIo3mixJPZWBccXOZf5Ga-7U_1789116095 X-Mimecast-Originator: redhat.com Content-Type: text/plain 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 Matthieu Longo writes: > Now that all callers use the file_reader_t overload of parse_smaps_data, > the legacy interface taking a raw buffer and filename separately is no > longer needed. > > Fold its implementation into the file_reader_t version and remove the > obsolete wrapper. This also simplifies the implementation by using the > file_reader_t accessors directly. > > Reviewed-By: Thiago Jung Bauermann > Reviewed-By: Luis Machado > --- > gdb/linux-tdep.c | 30 ++++++++++++------------------ > 1 file changed, 12 insertions(+), 18 deletions(-) > > diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c > index 2833d8a4bb6..4cdb02b9c09 100644 > --- a/gdb/linux-tdep.c > +++ b/gdb/linux-tdep.c > @@ -1581,18 +1581,17 @@ parse_smaps_key_value (const char *keyword, const char *line, > /* Helper function to parse the contents of /proc//smaps into a data > structure, for easy access. > > - DATA is the contents of the smaps file. The parsed contents are stored > - into the SMAPS vector. */ > + FREADER is a wrapper around the contents of the smaps file. > + The parsed contents are stored into the SMAPS vector. */ As you are editing this comment anyway, could you fix it too please. The parsed contents are not "stored into the SMAPS vector", but are returned as a vector. > > static std::vector > -parse_smaps_data (const char *data, > - const std::string &maps_filename) > +parse_smaps_data (const file_reader_t &freader) > { > char *line, *t; > > - gdb_assert (data != nullptr); > + gdb_assert (freader); > > - line = strtok_r ((char *) data, "\n", &t); > + line = strtok_r (freader.data (), "\n", &t); > > std::vector smaps; > > @@ -1648,8 +1647,8 @@ parse_smaps_data (const char *data, > > if (sscanf (line, "%64s", keyword) != 1) > { > - warning (_("Error parsing {s,}maps file '%s'"), > - maps_filename.c_str ()); > + warning (_("Error parsing keyword in {s,}maps file '%s'"), > + freader.c_filepath ()); Also, while you're passing, warning message should start with a lower case letter (as they are printed "warning: ..."), could you fix this please. And could you add filename styling too: warning (_("error parsing keyword in {s,}maps file '%ps'"), styled_string (file_name_style.style (), freader.c_filepath ())); There's another place that would benefit from this cleanup below. Thanks, Andrew > break; > } > > @@ -1663,12 +1662,12 @@ parse_smaps_data (const char *data, > decode_vmflags (line, &v); > > if (parse_smaps_key_value (keyword, line, "Rss:", > - maps_filename, > + freader.filepath (), > &rss)) > continue; > > if (parse_smaps_key_value (keyword, line, "Swap:", > - maps_filename, > + freader.filepath (), > &swap)) > continue; > > @@ -1679,8 +1678,9 @@ parse_smaps_data (const char *data, > > if (sscanf (line, "%*s%lu", &number) != 1) > { > - warning (_("Error parsing {s,}maps file '%s' number"), > - maps_filename.c_str ()); > + warning (_("Error parsing numeric value associated with " > + "key '%s' in {s,}maps file '%s'"), > + keyword, freader.c_filepath ()); > break; > } > if (number > 0) > @@ -1730,12 +1730,6 @@ parse_smaps_data (const char *data, > return smaps; > } > > -static std::vector > -parse_smaps_data (const file_reader_t &freader) > -{ > - return parse_smaps_data (freader.data (), freader.filepath ()); > -} > - > /* Helper that checks if an address is in a memory tag page for a live > process. */ > > -- > 2.55.0