From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 1DXxIXrim2CJXAAAWB0awg (envelope-from ) for ; Wed, 12 May 2021 10:13:14 -0400 Received: by simark.ca (Postfix, from userid 112) id 7CCEB1F11C; Wed, 12 May 2021 10:13:14 -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 CEE8B1E783 for ; Wed, 12 May 2021 10:13:13 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 22028389440E; Wed, 12 May 2021 14:13:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 22028389440E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1620828793; bh=Wg5KCmIxPGwqAhxouXLZtSU28cU6VwkUMX+ejvtETB0=; h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=r0uo5Yy7C/RuRM/ef6OGpNhMNAQ3TTQ4kcEFJl2kvaqXzakzJZd2WoErjeTJLL8se 9XN6H2dbKF3yuMtWfJ8f7JX/IwK+AFpd/9p5Lg2gSs5yl02bzghd2v7gO+xYyxHrF2 1b+F84eaiExwOIDIwEKjiBTo+GTIeSBwNTwIESn8= Received: from mail-ot1-x331.google.com (mail-ot1-x331.google.com [IPv6:2607:f8b0:4864:20::331]) by sourceware.org (Postfix) with ESMTPS id 33D68393A40A for ; Wed, 12 May 2021 14:13:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 33D68393A40A Received: by mail-ot1-x331.google.com with SMTP id i23-20020a9d68d70000b02902dc19ed4c15so16672854oto.0 for ; Wed, 12 May 2021 07:13:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Wg5KCmIxPGwqAhxouXLZtSU28cU6VwkUMX+ejvtETB0=; b=Gfxa6bVifIsi5d1IZGCBgN31cQCNGjfqNYFu8WLHbhVFcllJSlcjtwwVh7ilwr19iA S4Ff548k2ArfcOp4Vk6Cl7mgydyGAt9vB9/+S6n8YeTV4/QTfhpcqmhsM/slA7RP3Qbs IjzI/DMW0pA0xi3jWxmKTkqxVIf/ErTSKA1BD3SvKqf/lwXOobgfE+6H7RcgGmjch/Oh 3GHdQ5UoxhR4oN4B5cpy1MJZK5D8g//u3ageNmKOKvm2zDOhY+NTeuBCElOehec80Fam 9OXjJ3dAbilqxQQ5EhbfmYo6mL1PmWYbt4HPxhylKpj3Am99SZjmAD7uUUgx02K+m6pl nXHg== X-Gm-Message-State: AOAM532A/pYwnr4DHoZcHXGn2FLAIP5kjeapJFQWJvR9OofzGIEZtnNp kIKrGqDrGIDWEZv9YfgFAk9luS3+/HZi3ANk4N96sVcEwGjBsAVJ X-Google-Smtp-Source: ABdhPJw8YxjFidl3lH4EqnpUGf5ZU13xav3YdIAygDgxZx72cb/T9O5L11kp+PeBU/CaX+KFK/C7+aFKrtu8wU0mlx8= X-Received: by 2002:a9d:5a7:: with SMTP id 36mr31229276otd.321.1620828790423; Wed, 12 May 2021 07:13:10 -0700 (PDT) MIME-Version: 1.0 References: <20210323175546.3836508-1-simon.marchi@polymtl.ca> <20210323183846.3886585-1-simon.marchi@polymtl.ca> In-Reply-To: <20210323183846.3886585-1-simon.marchi@polymtl.ca> Date: Wed, 12 May 2021 15:12:34 +0100 Message-ID: Subject: Re: [PATCH v2] gdb: make gdbpy_parse_command_name return a unique_xmalloc_ptr To: Simon Marchi Content-Type: text/plain; charset="UTF-8" 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: Marco Barisione via Gdb-patches Reply-To: Marco Barisione Cc: GDB patches mailing list Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" 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