From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 0B6C53856DD6 for ; Wed, 27 Sep 2023 15:17:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0B6C53856DD6 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695827877; 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=zpMGW/zYxMHLKX4QP9dqGrGZRWwULt9h6c75rv9ua8g=; b=RfGq/lElQC94owPsU/rCu+WaAV9sIuGQOsyFTLRk6xzSt8NMhG/F2SwiqFNWUYnNxj9/NN RpkzSczyDZMzPqKlysaa9PegjCovL1mJdXBd1x5KSBLou4VQdY01oPkSU+GXKqNKnRm1XE 41IeZ6xpKY+qLU24DkQJvWBUVgRjxgQ= Received: from mail-ua1-f70.google.com (mail-ua1-f70.google.com [209.85.222.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-299-_bbcpgTFMBmRoJG3vrw50A-1; Wed, 27 Sep 2023 11:17:56 -0400 X-MC-Unique: _bbcpgTFMBmRoJG3vrw50A-1 Received: by mail-ua1-f70.google.com with SMTP id a1e0cc1a2514c-7ae19d17416so1823331241.3 for ; Wed, 27 Sep 2023 08:17:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695827875; x=1696432675; 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=zpMGW/zYxMHLKX4QP9dqGrGZRWwULt9h6c75rv9ua8g=; b=b60N6iCHP89Nk/QLWeSI4ZJT6x9WvIZ5qWEuhmTZ7Zwrpk8hDmRXjVw8za6+afwvID SxeRQdHNb3CkJVr8+9QSR8XNtJGtpnRGIsgJ/2Az5Tn25XHoNOxtmjye57m4pGT8PRIC 9cSoRUMQvrOfY81r7k6jIhY1P5bYxCSO/j1a/p3/2XVdsKDMicC4itHjJcWpYvIzLTPF rQ4mTvhA/ESMfPpiCI7iLGQwVrmeyLKYilhPabiXrXsMx9mdJ/8rDM13IJH+cy16SNC0 N+nrgabJPnPAS0rV8kVHXe8Xr5d4MNH+1JICDIoFOD7hs7aTNaPbRhQF6cgAx/p1lCVm v9Nw== X-Gm-Message-State: AOJu0YwBOabbKiEOHVPN3bCK5jGur3SiwARx/zfPMjWxA4wsmGdpilpd MsGt9VazQo+7pdhW3xNLaDSbILasML2LJu8bVEIrdePtxltsNXDSb3FuOI6KUBtWIUMdOC6Yo2F zkewVOQwf4gx6Q9ey907ngXkp63wtDg== X-Received: by 2002:a67:fc87:0:b0:452:871e:bd04 with SMTP id x7-20020a67fc87000000b00452871ebd04mr1716835vsp.17.1695827875591; Wed, 27 Sep 2023 08:17:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGjUQt2fbfQMBhoMubYl+wMBw+Y0gDce1Vpyc2XagNOW6Vw+aohaxYulWb8y+W3nApvujcuUA== X-Received: by 2002:a67:fc87:0:b0:452:871e:bd04 with SMTP id x7-20020a67fc87000000b00452871ebd04mr1716820vsp.17.1695827875244; Wed, 27 Sep 2023 08:17:55 -0700 (PDT) Received: from localhost ([31.111.84.209]) by smtp.gmail.com with ESMTPSA id s19-20020ac87593000000b0041953e41482sm1134562qtq.82.2023.09.27.08.17.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 08:17:54 -0700 (PDT) From: Andrew Burgess To: Tom Tromey , Andrew Burgess via Gdb-patches Cc: Tom Tromey Subject: Re: [PATCH] gdb: add Python events for program space addition and removal In-Reply-To: <87h6nf4s17.fsf@tromey.com> References: <634d50951c6a4d50b0aa8dc91758c025738e8c68.1695300249.git.aburgess@redhat.com> <87cyyb72pj.fsf@tromey.com> <87r0mjx514.fsf@redhat.com> <87h6nf4s17.fsf@tromey.com> Date: Wed, 27 Sep 2023 16:17:53 +0100 Message-ID: <87o7hnwspq.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,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 List-Id: Tom Tromey writes: >>>>>> "Andrew" == Andrew Burgess via Gdb-patches writes: > >>> This approach seems totally fine to me, but it's worth noting that you >>> could attach data directly to a Progspace if the tp_hash field were >>> filled in. Some other Python classes in gdb do this. This makes caches >>> easier because the cleanup is automatic. > > Andrew> I'm not sure I understand how tp_hash helps here? > > Yeah, I meant tp_dictoffset ... > > Andrew> gdb.Progspace does have a __dict__ attribute, so things like: > > ... which is already set. Sorry about that. > > Andrew> works just fine, and I did consider this. But I wasn't sure if this was > Andrew> "good practice". My concern was mostly that this might lead to clashes > Andrew> between different extensions if good names are not chosen for > Andrew> 'my_random_var', or even clashes between extensions and future GDB > Andrew> enhancements -- my understanding is that if we later added > Andrew> 'my_random_var' as a builtin attribute this would take precedence over > Andrew> the user defined attribute, breaking their extension. > > Yeah. gdb should promise not to use "_" names here & in other spots > using tp_dictoffset. That's a good idea. I'll add this to my todo list, as having this documented would make this more useful I think. Thanks, Andrew