From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lndn.lancelotsix.com (vps-42846194.vps.ovh.net [IPv6:2001:41d0:801:2000::2400]) by sourceware.org (Postfix) with ESMTPS id C428C385781D for ; Fri, 23 Jul 2021 22:55:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C428C385781D Received: from ubuntu.lan (unknown [IPv6:2a02:390:9086::635]) by lndn.lancelotsix.com (Postfix) with ESMTPSA id 7423B82EC2; Fri, 23 Jul 2021 22:55:41 +0000 (UTC) Date: Fri, 23 Jul 2021 22:55:36 +0000 From: Lancelot SIX To: Simon Marchi Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 15/16] gdb: make cmd_list_element var an optional union Message-ID: <20210723225536.vldk332x4be7czts@ubuntu.lan> References: <20210714120851.3pfew5pgcdp6ezn6@ubuntu.lan> <20210714171238.vzccwpurh2izbkps@ubuntu.lan> <20210714232112.wsn7pits6uuz3nf5@ubuntu.lan> <20210720230335.dcpfxbol2uwjre3b@Plymouth> <20210723204613.ud6kkhnt46dz4bq3@ubuntu.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.11 (lndn.lancelotsix.com [0.0.0.0]); Fri, 23 Jul 2021 22:55:41 +0000 (UTC) X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Jul 2021 22:55:45 -0000 On Fri, Jul 23, 2021 at 05:15:44PM -0400, Simon Marchi wrote: > On 2021-07-23 4:46 p.m., Lancelot SIX wrote: > > Hi, > > > > I plan on spending some more time on it this week end hopefully. > > > > If you do not mind waiting a bit for my patch to be finalized, and want > > to go with my approach, there is indeed no point merging yours now. The > > main thing I try to avoid is having both of us working at the same time > > on different solutions of the same problem. Your approach has the > > advantage of being almost ready, I can wait for it to be stabilized > > before I adapt my work on top on it. If you are fine waiting for my > > approach, I’ll proceed! > > > > My plan is to: > > > > - Improve slightly > > https://sourceware.org/pipermail/gdb-patches/2021-July/180991.html > > (use gdb::Requires instead of static assert, include the python > > binding I forgot because I did not build it, add some selftests of > > the runtime checks introduced by the getters and getters, and ensure > > the documentation is adequate). > > - Adapt your patch using std::string on top on my architecture > > (https://sourceware.org/pipermail/gdb-patches/2021-July/180921.html). > > - Add a new patch that allows the use of setter / getter (based on what > > was is drafted in > > https://sourceware.org/pipermail/gdb-patches/2021-July/181037.html). > > As a side note, the storage of user provided getter / setter functions > > is done using a unions (void* is not an appropriate for that). It is > > possible to use the same approach to create getters and setters around > > the union of pointers you provide in your patch (but this would require > > some work, obviously). > > > > Does that makes sense? > > Yeah, the only thing I would ask: could you verify whether the approach > of allowing getters / setters that you envision can work with my > work-in-progress patch here? Or if my patch can be changed to work with > your approach. > > https://review.lttng.org/c/binutils-gdb/+/5831 > > The reason for all this churn and refactor is to fix some bugs (as > described in the commit log of the patch), so I want to make sure > there's a way forward. > Yes, the usage seems to be quite close (from the command writer point of view). The major diferences at the momment is: - Your setter returns a bool to let know the caller that the setting has been updated where mine does not. I should change that. Other than that, you should be able to fit your set_inferior_tty_command and get_inferior_tty (among others) in my framework quite easily, in a very similar way. Your add_setshow_*_cmd are changed from something like commands.set->function.set_cmd.set_func.string = set_func; commands.show->function.show_cmd.get_func.string = get_func; to something like commands.set->var.set_accessor (set_func, get_func); commands.show->var.set_accessor (set_func, get_func); (I should probably not set both accessors with one function, only one will ever be used). > Also, could you provide a git branch with your latest patch? It will be > easier than figuring out on what to apply it. I have pushed my current work (still a work in progress) to the following branch on sourceware: users/lsix/refactor-typesafe-var. Lancelot. > > Simon