From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id yLCSNDsglWlAjz8AWB0awg (envelope-from ) for ; Tue, 17 Feb 2026 21:13:15 -0500 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=Q9wlGSI7; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id B9ADA1E08D; Tue, 17 Feb 2026 21:13:15 -0500 (EST) 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 D37421E08D for ; Tue, 17 Feb 2026 21:13:14 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id D7EE44BA23FD for ; Wed, 18 Feb 2026 02:13:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D7EE44BA23FD 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=Q9wlGSI7 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 83A564BA2E16 for ; Wed, 18 Feb 2026 02:12:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 83A564BA2E16 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 83A564BA2E16 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1771380768; cv=none; b=SOLPHgroTkdLqxZu7YsBU9Pzmn7J5UU+Qgi3eSeIYdeBmJGU6yqnFHtIagsI5S251uumbDcgK/bRWikz4d5004uW55UzjsAgNqUGweWxwKig1xFtF9ZENfH+2gD/q59OwylH330kdlaU6cTjufLy79WG8QeYgGxReJjVdt+a1qI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1771380768; c=relaxed/simple; bh=fWpybGjSssIQ8pYvx5RygmubxpOO7HhUweT3L38KqSE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=j7cBFCjQNiue5bReRmR5ODGAPoToNKclp3wLmrPgCpuw9Z7I17p8kVmHlD+qBELLURMc/32rQUggYS17XeKRh48/9+wWWHxUTQg8icSK4E9qtr8wz7uBgzhvvJB1G8x+o+79gMyT8TbWuEe2/YramNkPae9ufkpg3i2RtgBnY2k= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 83A564BA2E16 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771380768; 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: content-transfer-encoding:content-transfer-encoding; bh=mX+5PZ6PNh71wXh2/Dft+IxZ+QF2VQOn7tK+1522cUw=; b=Q9wlGSI7Iv7KIHNuVaLAiNvRgXcavUZEufmjWsqaI5MZVsXKBzW+ZZD3u14VV4Ex+Z7q2M TOdN4hGKbtgNUALr1p4k+5FAEeWSuTRwgkyuUNIuflvKpq2N2T8YHA2Bz1mi/raR8TmF5P RTg3c07LN6g+keQixf94k48IRRdP4Lo= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-646-GgUu6u5zNcmPdESzwf5KmQ-1; Tue, 17 Feb 2026 21:12:44 -0500 X-MC-Unique: GgUu6u5zNcmPdESzwf5KmQ-1 X-Mimecast-MFC-AGG-ID: GgUu6u5zNcmPdESzwf5KmQ_1771380764 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8925A19560B2; Wed, 18 Feb 2026 02:12:43 +0000 (UTC) Received: from f43-1.lan (unknown [10.22.80.38]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 89F0930001A5; Wed, 18 Feb 2026 02:12:41 +0000 (UTC) From: Kevin Buettner To: gdb-patches@sourceware.org Cc: Tom de Vries , Kevin Buettner Subject: [PATCH] gcore: Query auxv for AT_PAGESZ in gcore_copy_callback Date: Tue, 17 Feb 2026 19:09:48 -0700 Message-ID: <20260218021217.1821113-1-kevinb@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 0sPqD0v1x8d1gz66BZSA5Bjs92Co62zVhrAqg5PcQ0k_1771380764 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true 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 This is a followup patch to commit c1da013915e, titled "gcore: Handle unreadable pages within readable memory regions". In his review of that earlier patch, Tom de Vries recommended using target_auxv_search with AT_PAGESZ to find the page size if it's available; this patch implements that suggestion. As before, a 4k fallback size is used should the search for an AT_PAGESZ value not succeed. --- gdb/gcore.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gdb/gcore.c b/gdb/gcore.c index 7bf2f00e866..66a9f6c4153 100644 --- a/gdb/gcore.c +++ b/gdb/gcore.c @@ -36,6 +36,7 @@ #include "gdbsupport/gdb_unlinker.h" #include "gdbsupport/byte-vector.h" #include "gdbsupport/scope-exit.h" +#include "auxv.h" /* To generate sparse cores, we look at the data to write in chunks of this size when considering whether to skip the write. Only if we @@ -766,6 +767,11 @@ gcore_copy_callback (bfd *obfd, asection *osec) size = std::min (total_size, (bfd_size_type) MAX_COPY_BYTES); gdb::byte_vector memhunk (size); + bfd_size_type page_size = FALLBACK_PAGE_SIZE; + CORE_ADDR at_pagesz; + if (target_auxv_search (AT_PAGESZ, &at_pagesz) > 0) + page_size = (bfd_size_type) at_pagesz; + while (total_size > 0) { if (size > total_size) @@ -786,8 +792,7 @@ gcore_copy_callback (bfd *obfd, asection *osec) while (remaining > 0) { - bfd_size_type chunk_size - = std::min (remaining, (bfd_size_type) FALLBACK_PAGE_SIZE); + bfd_size_type chunk_size = std::min (remaining, page_size); if (target_read_memory (addr, p, chunk_size) != 0) { -- 2.52.0