From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ZIsnBQmE42j+WSEAWB0awg (envelope-from ) for ; Mon, 06 Oct 2025 04:55:37 -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=RRkfmhmE; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id F05821E047; Mon, 06 Oct 2025 04:55:36 -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 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 44D931E047 for ; Mon, 06 Oct 2025 04:55:36 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B9BF33858D3C for ; Mon, 6 Oct 2025 08:55:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B9BF33858D3C 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=RRkfmhmE 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 6BB0E3858D38 for ; Mon, 6 Oct 2025 08:54:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6BB0E3858D38 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 6BB0E3858D38 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=1759740887; cv=none; b=shFsExWVTPkz+oLl4+tnn/5VNBPKWhGrzvchRq0srkmBFBHaC1GwMUZYShi+PJuur3eGexknEn2DSj6MPyP43FSCb93MU3AQYk5XzQU0scVlWWdKfz31e58lwfPSc65tW6qiNdBFIZuUYCXg3hOy8etCiXLlH2KAvVEX91SUxPw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1759740887; c=relaxed/simple; bh=bhY5q8XaR+rz+ZphowctLF8UxHxjfNFUqYTn5A37/EU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=HvO4WS30HahpFmexlckYrX+gr9MNtb2YkCknBNTqvCXHfXrKXAvsmFRNaOhvufcAiSFmf1Gx4p5pXskgelFpurrc+5O7PX+vdtlJ5Rhv5vNOnmFCiMuyugF8G4HN2gI5V3Kyf0RifvQGywjexzHcsz8OwJi2XBgMJd3wHyHM8Lw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6BB0E3858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1759740886; 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=YbDrsIZ9riEbb1ZcagF/Q5i6SJB3QbvxIysqK+syRLM=; b=RRkfmhmEnPg6zIyMWTfu8rS5Xj7Fb3yTLtWB00KHR4nBIuwzatnpb/GZaWt3CPL65BKh1w V9p14wh+QOnPYWmqq2+/xTaPkE7XX2w2UHeuUxzNtpncOtMl9lVYi5jP8NZG8MfYJLicwm HPXyi65mnkow/17OpIy8s3YT8jw2i9A= 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-218-FKMHh2gANhKH1QPzOtrp_w-1; Mon, 06 Oct 2025 04:54:45 -0400 X-MC-Unique: FKMHh2gANhKH1QPzOtrp_w-1 X-Mimecast-MFC-AGG-ID: FKMHh2gANhKH1QPzOtrp_w_1759740884 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-3f384f10762so2311240f8f.3 for ; Mon, 06 Oct 2025 01:54:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759740884; x=1760345684; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=YbDrsIZ9riEbb1ZcagF/Q5i6SJB3QbvxIysqK+syRLM=; b=hOhkN0/DhhR54p5FjB5YtwyEigWvqQdZQf+Nf4bAUwWZ5K74m4r91+GllVOogDDKwH Et7cQ5zkDEM1BOhMtZr24u0LqD4OFNJTReTTkeg4b20QReo9s9/4kqQ3tntBljW8npb+ QJawkf2qywx0qi5fQ1psJv0dlV4pQWBi7SsD9zYeU6Hg81I2oMttA1vKWfJyM1xYEEMv R6clEkTKh8/KfDdJpZYCKA8Z9KvL7pySjptKlH8yO42mRzxQlKOBovjsN1Cp5eq65Ezn wU139K1LmFjklJDZo7ISq7qir6kW+54Ax0qRTpFP9aChMTsKmlp+QrOVFcnue6LWXBAW ORvw== X-Gm-Message-State: AOJu0YwkugZmLuOUxgDlQpKqZUNUFkRTUVbc+qxhp//sakIJWPRaag9z jScIEj52hUZJ2q5e4jesHjPYpkh9yUjvfTFaZAqiQ2Ls0yIaDTGmSBWwK0UN3ySUzMKEY/Mqtef 7AVU/aUp3VEp3/m6czuhn8CFVt062mB4lF+4wGTrYWHq7V21h1lW466KcBZnlays= X-Gm-Gg: ASbGncvS5MFUrnoQH7flk+xlNWOemKpw+hu9DeAI6p4ZZeECDuWb/DRLDgFN1x3dIqx Rzb2Aql/ihyNgVZwQgvLvIW12ySNtQZrzjURrrKCIIyjDzTNIHZlx59Uy/Uq9PmXQibpNnyT0KD 8KOv4slOs0fCW+YH6zgdKZBNyN+0PYMSnApzkffS9PQbYe6d381Tqt6ggDZkr+ZVxYN6UtCrc/6 QWCgrZj4doy5n1DVZTUAlFlN1hMwNkSrJqQwSOJuZJKxMcJiDRmhNd19SoGFBs4dMuMXby52dy0 Dujnn8BABpCyJqI7vswdwhKuIzQ8r/+6rj9FfcdQ X-Received: by 2002:a05:6000:40cc:b0:3e7:5f26:f1e8 with SMTP id ffacd0b85a97d-4256713a0f1mr7700665f8f.5.1759740884341; Mon, 06 Oct 2025 01:54:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHLpu6yGy+URtGi5Y45dxNgZPXFarKA/gT3b22v+kjaU4Pf3VyZ6AnE0c9aeNS7dFdCkkvpmA== X-Received: by 2002:a05:6000:40cc:b0:3e7:5f26:f1e8 with SMTP id ffacd0b85a97d-4256713a0f1mr7700645f8f.5.1759740883858; Mon, 06 Oct 2025 01:54:43 -0700 (PDT) Received: from localhost ([31.111.84.207]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4255d8f01absm19737517f8f.44.2025.10.06.01.54.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Oct 2025 01:54:43 -0700 (PDT) From: Andrew Burgess To: Tom Tromey Cc: gdb-patches@sourceware.org, Eli Zaretskii Subject: Re: [PATCHv2 1/3] gdb/python: introduce gdb.Corefile API In-Reply-To: <87h5wf7r1q.fsf@tromey.com> References: <87h5wf7r1q.fsf@tromey.com> Date: Mon, 06 Oct 2025 09:54:42 +0100 Message-ID: <87sefw76lp.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: wevxietNWS11SFrPEkKilPoCWP0Zzh-itCDdx39Nd0Y_1759740884 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 Tom Tromey writes: >>>>>> "Andrew" == Andrew Burgess writes: > > Andrew> This commit starts adding some core file related features to the > Andrew> Python API. > > Thanks. > > Andrew> +/* Store a gdb.Corefile object in an inferior's registry. */ > Andrew> + > Andrew> +static const registry::key Andrew> + inferior_corefile_deleter> > Andrew> + cfpy_inferior_corefile_data_key; > > I suspect this should now use the new python-specific registry > approaches, see gdbpy_registry. I took a look at this, and I don't think gdbpy_registry is the right solution. 1. It is designed to hold objects which are stored on either an objfile or a gdbarch, e.g. types. The use of templates allows us to avoid the duplication needed to deal with accessing the same type of "thing" either from the objfile or the gdbarch. In my case I need to store on the inferior. 2. It is designed for cases where each objfile or gdbarch can hold many "things" of a given type. E.g. types, as such within each registry entry the "things" are stored in some container, like a map or set. In my case each inferior has 0 or 1 associated core files, so adding a set or map would be unnecessary. I'm sure with a little additional effort we _could_ generalise gdbpy_registry more to make it apply in my case, but I don't think that would actually add any value. The existing code, for the cases in which it applies, serves to remove some duplication. But for cases like mine, I don't think gdbpy_registry would remove any code. The only benefit of extending gdbpy_registry would be that _every_ use of a registry in Python code could, potentially, be made to use the same interface. But at a cost of making that interface more complex (to handle the different cases). Let me know your thoughts. > > Andrew> + bfd *abfd= obj->inferior->pspace->core_bfd (); > > Nit: missing space before '='. Fixed. Thanks, Andrew