From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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> From: Marco Barisione 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 Cc: GDB patches mailing list Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Wed, 12 May 2021 14:13:12 -0000 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