From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id cPzgEMzjm2CzXAAAWB0awg (envelope-from ) for ; Wed, 12 May 2021 10:18:52 -0400 Received: by simark.ca (Postfix, from userid 112) id 3659F1F11C; Wed, 12 May 2021 10:18:52 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from 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 RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 3F9E11E783 for ; Wed, 12 May 2021 10:18:51 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 936F93938C10; Wed, 12 May 2021 14:18:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 936F93938C10 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1620829130; bh=MIzYO3aNA+cblG+sVBqo2xlkqz9lGd3PP5/GC7wq+LI=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=H3ZXWUWIfLBCB7oCAkrFJlfNva1xkTmRxovbdI8pK4Zh12Ns8ge99ofeHBZ0IcCz1 +VEJFV+E1wa+MeLfm1ZFqyjU/5A/4TSfh5OMoJsEthE5oh8zZ2pxVzdYX7GmDZxjYA I/q84u5j7+vIgMMdIpu/a6FG0w75H9uV5x8InV5U= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 61C97389367A for ; Wed, 12 May 2021 14:18:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 61C97389367A Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 14CEIglu010311 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 May 2021 10:18:47 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 14CEIglu010311 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 466AC1E783; Wed, 12 May 2021 10:18:42 -0400 (EDT) Subject: Re: [PATCH v2] gdb: make gdbpy_parse_command_name return a unique_xmalloc_ptr To: Marco Barisione References: <20210323175546.3836508-1-simon.marchi@polymtl.ca> <20210323183846.3886585-1-simon.marchi@polymtl.ca> Message-ID: <56ed3c1f-60b8-3b6d-a6dd-f612fbd8116f@polymtl.ca> Date: Wed, 12 May 2021 10:18:41 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 12 May 2021 14:18:42 +0000 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: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Cc: GDB patches mailing list Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" On 2021-05-12 10:12 a.m., Marco Barisione wrote:> On Tue, 23 Mar 2021 at 18:38, Simon Marchi via Gdb-patches > wrote: >> >> This avoids some manual memory management. >> >> cmdpy_init correctly transfers ownership of the name to the >> cmd_list_element, as it sets the name_allocated flag. However, >> cmdpy_init (and add_setshow_generic) doesn't, it looks like the name is >> just leaked. This is a bit tricky, because it actually creates two >> commands (one set and one show), it would take a bit of refactoring of >> the command code to give each their own allocated copy. For now, just >> keep doing what the current code does but in a more explicit fashion, >> with an explicit release. >> >> gdb/ChangeLog: >> >> * python/python-internal.h (gdbpy_parse_command_name): Return >> gdb::unique_xmalloc_ptr. >> * python/py-cmd.c (gdbpy_parse_command_name): Likewise. >> (cmdpy_init): Adjust. >> * python/py-param.c (parmpy_init): Adjust. >> (add_setshow_generic): Take gdb::unique_xmalloc_ptr, release it >> when done. > > Any news on this patch (which looks good to me)? > You wrote this in response to my command renaming work[1]. Sorry for > only looking at it now. > It would be helpful to merge it, so I can rebase my command renaming > patches on this. If it's not ready and needs more work, I'm happy to help. > > [1] https://sourceware.org/pipermail/gdb-patches/2021-March/177165.html > I had forgotten about it! I see that Tom sent some comments. I'll check that and merge or send a new version accordingly. Simon