From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id QPzXGOUnoWYcijAAWB0awg (envelope-from ) for ; Wed, 24 Jul 2024 12:12:21 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=NcTdZkcC; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=OLpCpjx7; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=yRl3xlLr; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=0+aW7hnU; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 5FBF21E0C3; Wed, 24 Jul 2024 12:12:21 -0400 (EDT) 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 4BE891E097 for ; Wed, 24 Jul 2024 12:12:19 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C50DB385841D for ; Wed, 24 Jul 2024 16:12:18 +0000 (GMT) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by sourceware.org (Postfix) with ESMTPS id 11A203858C56 for ; Wed, 24 Jul 2024 16:11:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 11A203858C56 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 11A203858C56 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721837516; cv=none; b=DU7juClV8qQJxuZXmZxFY+fIUHWcohnoOQsEcVuwXdbFJ0WFC7YRVOMYO4vDKCoGMxM/qSDdHdqUb/42Zas3EVuetjT4ge2A0l1IfFZzQ9HZ14C+eb0bYCJsA0TapsM0tChBPg4DTsLVfzaZpa/Az5VnqGr+hQITgHQK1ifxtYE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721837516; c=relaxed/simple; bh=3U1xY21fxfFtDQ6+NLzs4nZLKtKTXfPkRyQ89vKKEuc=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature: Message-ID:Date:MIME-Version:Subject:To:From; b=epkLNQ113WO8bnXnSKnBY3k4ZkRfshwVwLppTE/WAXZnjJrYFThPHVcv1ozWmtNDJ/9sLSb3sC45A5+84FSoOk1+b0rbFOlWFwhe19vpcGPKjP3DsAnr3TgzOwjoQ2sjypMbbDULy5rcBoOh5E5prGA4SPjWMask+Mfja8YB+6s= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id F0B5B21B45; Wed, 24 Jul 2024 16:11:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1721837514; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sJ6ap2tFoX8vr5ULPol25RbRyXtWn9GKhIskKnfkF14=; b=NcTdZkcC7HPgkwFkrhcEdqeuO31V9T4HeL9pbuB4mOyI0/j6WiXqec4C2u72Xt7zwfq3T/ KxeJKTDXRV/hfw9mf4ODod+iinA8B+Fu4fFW6UjcwmAc5w5ocWqrVsa0FoefnO2sXXrhDn /wSiNCLeI9w53E0zIDPL7er+hBnezNE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1721837514; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sJ6ap2tFoX8vr5ULPol25RbRyXtWn9GKhIskKnfkF14=; b=OLpCpjx7bMRW3WUwMBaKhPX6AW+lFFhGxMHiIM1678O0gOx5AcTFaJjTjqd5JMRI3xqKyy RYfWmPprTkFj4WDA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1721837512; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sJ6ap2tFoX8vr5ULPol25RbRyXtWn9GKhIskKnfkF14=; b=yRl3xlLrX3qYs+HpsIr6rG80lD/1zqyZpBVWsD41LK6WKze/e4ejI+nPtcZsIV1+4Iq+Ep McrqBc1q9EK+bBcWtAKCidDPS3S3xJkV/uk1KjP0NpITgE8qNbu0YUq8WrzCUhkMcLXVyN W190WEZ02akYCaRIa+ywKfOEVV+Hrfc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1721837512; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sJ6ap2tFoX8vr5ULPol25RbRyXtWn9GKhIskKnfkF14=; b=0+aW7hnUg+j4RBaSg+xEqYYNK9uUHtBbkdEPlCrRLP6wRCf1AvJh+47NQqbLINfwHxx0xJ GaWeEQa5pfEZZMBQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id D589B13411; Wed, 24 Jul 2024 16:11:52 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id cMOUMsgnoWa3RwAAD6G6ig (envelope-from ); Wed, 24 Jul 2024 16:11:52 +0000 Message-ID: <6619062a-4841-4e24-95d8-5ff7ec949088@suse.de> Date: Wed, 24 Jul 2024 18:12:18 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] [gdb/symtab] Simplify memory management in parse_macro_definition To: Simon Marchi , gdb-patches@sourceware.org References: <20240626063233.19408-1-tdevries@suse.de> <91690c44-2946-4413-be8d-9f94b8435641@simark.ca> Content-Language: en-US From: Tom de Vries In-Reply-To: <91690c44-2946-4413-be8d-9f94b8435641@simark.ca> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Level: X-Spamd-Result: default: False [-1.09 / 50.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; XM_UA_NO_VERSION(0.01)[]; MID_RHS_MATCH_FROM(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo] X-Spam-Score: -1.09 X-Spam-Status: No, score=-6.4 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.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/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. Thanks, - Tom > Here is it if you want to take a peek: https://review.lttng.org/c/binutils-gdb/+/13009 > > Simon