From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ZTZBDD/Dp2Z/qDUAWB0awg (envelope-from ) for ; Mon, 29 Jul 2024 12:28:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1722270527; bh=GBPeCQ88Ar/bFW7JVQX6aBL3YW7sulLbd562mbH5n7E=; h=Date:Subject:To:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=W4KthTAZamuK0/SmL0Go2TA0PhZJGn5ghuOxzFZ0nMk8m0/67LQX38wmrg6dEkzgh UkZDzV8m4LzjN/8F4BFi8s+LWwVgQaj2tjcCNL6KSJ85BWhaj2nNcvvXCaUisSgXXT k35VvhYb+270VURKBbxQ7+TPEeqoDIKiqWO8fX5s= Received: by simark.ca (Postfix, from userid 112) id 1DEB71E0D0; Mon, 29 Jul 2024 12:28:47 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=wj5lG5IY; dkim-atps=neutral Received: from server2.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 ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 061571E097 for ; Mon, 29 Jul 2024 12:28:45 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8CE623858424 for ; Mon, 29 Jul 2024 16:28:43 +0000 (GMT) Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id F16B53858410 for ; Mon, 29 Jul 2024 16:28:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F16B53858410 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org F16B53858410 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722270503; cv=none; b=HaxKfuVRLAIt9n/7u1ujIFcyi7Z/Ib4ZCdJ3arVaZ9G7iyYhjf3LTu8THeB8WdRC+wFb59aA0FN74mVaj9u11qn+nywbGiEyy4PAoelnNqQgykVi9iMyDOjgpBTT5t3gbqHAiNBVTbvPgcxbpz7ev5nR9TwM3UClTLgWukp7VB4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722270503; c=relaxed/simple; bh=GBPeCQ88Ar/bFW7JVQX6aBL3YW7sulLbd562mbH5n7E=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=R6A8d/xWg6hP+Tacc631rUWcEpA2cMAeFP712bEIozdTq3A+SZhF+DqBcc+QyzbokrK0TMFSlIfxKKmVnvinIZTtdZsCQR+IEz8tM6yjUSDW0ne4VOXJngoX3HBLjfaMyOAFcm+D6VCICgDgG36AxxfG6GWpa7fYVmAyRMfawAw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1722270500; bh=GBPeCQ88Ar/bFW7JVQX6aBL3YW7sulLbd562mbH5n7E=; h=Date:Subject:To:References:From:In-Reply-To:From; b=wj5lG5IYyTiLjPQA5gT38F7eNH481MHR22zsqzP7NRJ/HeSfOV1KO8ctdlEjufSuY 4ONBytUvvnkRAy1H4M3d6jGG4nBRJXdTwk8JBnY2LTSzQhp66FqzF+02bNLONK1Ov4 RnswlvoNUPJkHzVoxkIeWWRAn5e0tNQthGz1EvA4= Received: from [10.0.0.170] (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id A7C6E1E097; Mon, 29 Jul 2024 12:28:20 -0400 (EDT) Message-ID: Date: Mon, 29 Jul 2024 12:28:20 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] [gdb/symtab] Simplify memory management in parse_macro_definition To: Tom de Vries , gdb-patches@sourceware.org References: <20240626063233.19408-1-tdevries@suse.de> <91690c44-2946-4413-be8d-9f94b8435641@simark.ca> <6619062a-4841-4e24-95d8-5ff7ec949088@suse.de> <78ab9c10-a0f4-4b23-8486-c9655f2194b8@suse.de> Content-Language: fr From: Simon Marchi In-Reply-To: <78ab9c10-a0f4-4b23-8486-c9655f2194b8@suse.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_PASS, SPF_PASS, 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 7/29/24 12:13 PM, Tom de Vries wrote: > On 7/24/24 18:12, Tom de Vries wrote: >> On 7/24/24 18:07, Simon Marchi wrote: >>> On 6/26/24 2:32 AM, Tom de Vries wrote: >>>> I noticed that parse_macro_definition does malloc and free, both for the >>>> argv array and its elements. >>>> >>>> Make memory management simpler by introducing a new class >>>> vector_c_string (copied from temporary_macro_definition here [1]) that uses an >>>> std::vector for the argv array. >>> >>> Is there a reason to keep using C strings here, instead of a let's say, >>> a vector of std::string? I gave it a quick try, I have something that >>> builds, just need to test and polish it. >>> >> >> Hi Simon, >> >> thanks for the review. >> >> No, not really, my main goal here is the ability to do a return in parse_macro_definition without introducing a memory leak. >> >> So that sounds fine to me. >> > > I've looked at the patch. > > I've was thrown astray a bit about the macro_special_kind business, until I realized it was a pre-existing notion. Yeah, I think it's a bit clearer with my change, we don't use that int parameter for multiple purposes, including passing an enum. > Anyway, patch LGTM. > > Tested on x86_64-linux, no issues found. For clarity, can you give your approval on the version I posted here? Sorry, it wasn't clear that I posted it on the list. https://inbox.sourceware.org/gdb-patches/20240724190833.69587-1-simon.marchi@efficios.com/#r Simon