From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 4/cQBmCkyWhP6QYAWB0awg (envelope-from ) for ; Tue, 16 Sep 2025 13:54:40 -0400 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=n2v7hhkb; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 0617D1E0BA; Tue, 16 Sep 2025 13:54:40 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_SBL,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=no autolearn_force=no version=4.0.1 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 603AF1E04C for ; Tue, 16 Sep 2025 13:54:39 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EB3703857400 for ; Tue, 16 Sep 2025 17:54:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EB3703857400 Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=n2v7hhkb Received: from omta38.uswest2.a.cloudfilter.net (omta38.uswest2.a.cloudfilter.net [35.89.44.37]) by sourceware.org (Postfix) with ESMTPS id 79BB13858D39 for ; Tue, 16 Sep 2025 17:54:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 79BB13858D39 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 79BB13858D39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1758045245; cv=none; b=h6qksWgZYkdpXUZZu5cNyi9/NQQZgF6+HdxAXmnrHs0I4Q3MRy6WqvcuJLUQEvR/CtRCGVqlnrG9ibo077lIw3A6BgCuUdUvy3CmHPM+lU2d3fdHVn8LKhFmjvxdfKrBizxrpwRlj/ywr61nQK+hM7P7B1ZNByq//ctIc6RAgxk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1758045245; c=relaxed/simple; bh=iMfYy/11ouT7X5a8RCWRopE6YNqDDLVxAm6d4dX2jiU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=h1+WSyJ47lyW1zU4BLlOkqzGXS2ZeGOIuZ395hnLoxCj//gJEDrD30RfF+8o20zsJcQtMmVv5D+siK7/go+ZZ5qOtBBKxKdZccRGT/mmQusZnaqh0uOfPMzcq5J1FkMNxIf82moiN452O2TGdqLFYGtIauWbEcld5LL110n0XJE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 79BB13858D39 Received: from eig-obgw-6002b.ext.cloudfilter.net ([10.0.30.203]) by cmsmtp with ESMTPS id yX71usHTweNqiyZsSuQxxa; Tue, 16 Sep 2025 17:54:04 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id yZsRusb7BgltQyZsRutgNp; Tue, 16 Sep 2025 17:54:03 +0000 X-Authority-Analysis: v=2.4 cv=ZYMdNtVA c=1 sm=1 tr=0 ts=68c9a43c a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=yJojWOMRYYMA:10 a=ItBw4LHWJt0A:10 a=20KFwNOVAAAA:8 a=d95c3rk2nu0u7ik-548A:9 a=VS4QxaUSPT0UtbFnIvSC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=5RCF0HjrXRdGVEHQ5kLdH6xaGeW/aFPYEe/w7Iga8ig=; b=n2v7hhkbD33wZeVWVkjyZNJ25b ghYP2FwIBuNTDGt5P5Ow22wISJDpsU62fq49hXlovh1JqZhtQKwVNE9SwGcYJrb3C5GvKOKZdudQj DE0xU1iPmrmE/xk5gMeVcvBsC; Received: from 97-122-110-68.hlrn.qwest.net ([97.122.110.68]:48922 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.1) (envelope-from ) id 1uyZsQ-000000021sT-4B7W; Tue, 16 Sep 2025 11:54:03 -0600 From: Tom Tromey To: Andrew Burgess Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 3/3] gdb/python: add Corefile.mapped_files method In-Reply-To: <5b014e8b969d0661adf41c803fdaf8e83a55a880.1756828929.git.aburgess@redhat.com> (Andrew Burgess's message of "Tue, 2 Sep 2025 17:03:51 +0100") References: <5b014e8b969d0661adf41c803fdaf8e83a55a880.1756828929.git.aburgess@redhat.com> X-Attribution: Tom Date: Tue, 16 Sep 2025 11:54:02 -0600 Message-ID: <875xdil1vp.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.110.68 X-Source-L: No X-Exim-ID: 1uyZsQ-000000021sT-4B7W X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-110-68.hlrn.qwest.net (bapiya) [97.122.110.68]:48922 X-Source-Auth: tom+tromey.com X-Email-Count: 6 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfHntIqy91dbW1WQqmR0WEKDY5TF+zeQj5Qit/idNdcbRQGdFbewQ3t8Hs1M5OQbvHL0CsMkFuI4UhcFhX6P/uI03YQ+51kI+p3z27Ww5CRvVt3wAAhfi OLhtfqd3cR2hporAgcYRYfdfuOgaU7Xu6scukdEVvqqbk82EUjlVzeYSGxI0xD1NMwmrJRF7HQeQDCcd4miVh2QM2T2lSiA2gQQ= 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 >>>>> "Andrew" == Andrew Burgess writes: Andrew> Add a new Corefile.mapped_files method which returns a list of Andrew> gdb.CorefileMappedFile objects. Andrew> Each gdb.CorefileMappedFile object represents a file that was mapped Andrew> into the process when the core file was created. Thanks. Andrew> + /* A List of gdb.CorefileMappedFile objects. This list is only created Andrew> + the first time the user calls gdb.Corefile.mapped_files(), the result Andrew> + is cached here. If this pointer is not NULL then this is an owning Andrew> + pointer (i.e. this owns a reference to the List). */ Andrew> + PyObject *mapped_files; A Python list is a mutable object, so I think user code could mess around with this data. IMO it would be better to make this a tuple instead. Andrew> + /* A List of gdb.CorefileMappedFileRegion objects. */ Andrew> + PyObject *regions; Same here. Though I wonder if that's overly paranoid of me. Andrew> + object->mapped_files = nullptr; Perhaps this has to be hoisted if the initialization of object->inferior does (see earlier review). Andrew> + gdbpy_ref region_obj Andrew> + ((corefile_mapped_file_region_object *) PyObject_New I think the cast of the return value of PyObject_New shouldn't be needed. PyObject_New is a macro that supplies the cast. There were a few cases of this. Andrew> + gdbpy_ref<> start (gdb_py_object_from_ulongest (obj->start)); Andrew> + if (start == nullptr) Andrew> + return nullptr; Andrew> + Andrew> + return start.release (); The null check isn't really needed since the release does the same. I think it's normal to just write return gdb_py_object_from_ulongest (obj->start).release (); There are a few of these. Though if you prefer the wordier approach that is fine too I suppose. Tom