From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id TckzD+G/p2ZjpjUAWB0awg (envelope-from ) for ; Mon, 29 Jul 2024 12:14:25 -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=0LKIIPRQ; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=bFlYgbRW; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=0LKIIPRQ; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=bFlYgbRW; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 33CE21E0D0; Mon, 29 Jul 2024 12:14:25 -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 214AB1E097 for ; Mon, 29 Jul 2024 12:14:23 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4A54E385DDC2 for ; Mon, 29 Jul 2024 16:14:21 +0000 (GMT) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) by sourceware.org (Postfix) with ESMTPS id 3F84A3858410 for ; Mon, 29 Jul 2024 16:13:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3F84A3858410 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 3F84A3858410 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722269596; cv=none; b=QcxvvYa0D5/88Yczh0g/Ghko+ul/8qGftiw+pajiEkgGs54DAgXgPim6srNVCk8Kv3TjlsbHNpUyMaUpX6dC9Y3xyNgyG6lQ6mq9g3RL8/f4y8TeaGnrKjIynxxEUBaGZBTZxYW2HFuk+t5cUVEojkpUTzj4ud/PVB0lFLMzxw4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722269596; c=relaxed/simple; bh=9EwwMyhuyTP+3sLuYNcd3gZLxJT0dQnIxJGRbBqsdxQ=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature: Message-ID:Date:MIME-Version:Subject:From:To; b=aFSXIrmw5U4Dg3ETxFFYzMaHaqkwiW2t4cp6omuJW52SoXMTAO6aBFrMBK/EK7EnAj3Y1UGOAP6BRQIB0rUCSfeSnq9kVAofg37HU+iwm/mBm8QF8CRvCCSCp/mn7RyWBmncP/OZSq+lfUJIBbk1tGfQ8spnciIMNYewQ4RuqsY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104: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 08B7E21B1A; Mon, 29 Jul 2024 16:13:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1722269593; 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=/EV+s0yC2rtvElf6/J65gmhaioAzfis/FRoW0uxxpmc=; b=0LKIIPRQMb1hsrLsZjUGdmBkhilV+WZz6+6DedxG90SqjJgyaSOgnaxltaZ5ZdIVK65PeQ gi7lMjfcgPZNBEDqFYrQDakxk02fZT9+dYNERMygD0D6une8ADbL/syjMOeoNBEYAIqSg0 EgeUCu73nYuS/U7IHUrwznFocwRkd80= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1722269593; 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=/EV+s0yC2rtvElf6/J65gmhaioAzfis/FRoW0uxxpmc=; b=bFlYgbRWe3/7m21TIbbtJHbtcZWU4AOUKeDemI96FLqcoulzlvo158Y7CpWlvSQWh4j20C jFlwNG9ASDcHuoDg== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=0LKIIPRQ; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=bFlYgbRW DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1722269593; 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=/EV+s0yC2rtvElf6/J65gmhaioAzfis/FRoW0uxxpmc=; b=0LKIIPRQMb1hsrLsZjUGdmBkhilV+WZz6+6DedxG90SqjJgyaSOgnaxltaZ5ZdIVK65PeQ gi7lMjfcgPZNBEDqFYrQDakxk02fZT9+dYNERMygD0D6une8ADbL/syjMOeoNBEYAIqSg0 EgeUCu73nYuS/U7IHUrwznFocwRkd80= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1722269593; 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=/EV+s0yC2rtvElf6/J65gmhaioAzfis/FRoW0uxxpmc=; b=bFlYgbRWe3/7m21TIbbtJHbtcZWU4AOUKeDemI96FLqcoulzlvo158Y7CpWlvSQWh4j20C jFlwNG9ASDcHuoDg== 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 DED02138A7; Mon, 29 Jul 2024 16:13:12 +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 xqJKNJi/p2ZRCQAAD6G6ig (envelope-from ); Mon, 29 Jul 2024 16:13:12 +0000 Message-ID: <78ab9c10-a0f4-4b23-8486-c9655f2194b8@suse.de> Date: Mon, 29 Jul 2024 18:13:05 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] [gdb/symtab] Simplify memory management in parse_macro_definition From: Tom de Vries To: Simon Marchi , 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> Content-Language: en-US In-Reply-To: <6619062a-4841-4e24-95d8-5ff7ec949088@suse.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Level: X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-1.30 / 50.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MIME_GOOD(-0.10)[text/plain]; XM_UA_NO_VERSION(0.01)[]; MX_GOOD(-0.01)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_TWO(0.00)[2]; FUZZY_BLOCKED(0.00)[rspamd.com]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; TO_DN_SOME(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim, imap1.dmz-prg2.suse.org:rdns, imap1.dmz-prg2.suse.org:helo] X-Rspamd-Action: no action X-Spam-Score: -1.30 X-Rspamd-Queue-Id: 08B7E21B1A 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: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. Anyway, patch LGTM. Tested on x86_64-linux, no issues found. Thanks, - Tom > Thanks, > - Tom > >> Here is it if you want to take a peek: >> https://review.lttng.org/c/binutils-gdb/+/13009 >> >> Simon >