From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 7953E3858C50 for ; Thu, 9 Feb 2023 02:08:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7953E3858C50 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [10.0.0.11] (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 17F461E110; Wed, 8 Feb 2023 21:08:54 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1675908535; bh=SW2ZbWyhUCn2Vcq9nxTY70d4bcbcnEDYtHUMlmBi8/4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=XDUSV4W41HyyXdV2A03s3Cl3lwxpmG5zu88TRxdPvq5gL+UpjRzJy/HIkH6X+Zgr2 ThafjirqHwv3TutEyFCmtvFT8RwdsGDO+0mrYleZ2byau96e/bEApDUkP3neOMLvgd GR6jNxcTuiqUFXjH2pLz3cJZ7i9c+GOu6qIWNnVU= Message-ID: Date: Wed, 8 Feb 2023 21:08:54 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH] Always create a new value object in valpy_do_cast Content-Language: en-US To: Tom Tromey , Hannes Domani Cc: Hannes Domani via Gdb-patches References: <20230118172740.2171-1-ssbssa.ref@yahoo.de> <20230118172740.2171-1-ssbssa@yahoo.de> <87tu0ijw76.fsf@tromey.com> <861084923.719650.1674411768974@mail.yahoo.com> <87lelujntp.fsf@tromey.com> From: Simon Marchi In-Reply-To: <87lelujntp.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,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 List-Id: On 1/22/23 15:50, Tom Tromey wrote: >>>>>> "Hannes" == Hannes Domani writes: > > Hannes> The problem isn't the value that's reference by gdb.Value, instead > Hannes> one of the other values in all_values before it. > > Hannes> But release_value removes it from all_values, and it was the exact value > Hannes> that the scoped_value_mark free_values instance was using as the mark point, > Hannes> and since it was then missing, all_values was cleared completely. > Hannes> And one of those earlier values is still used by the printing later on. > > OMG. I think this is a latent bug in the value-mark API that's been > there since... well I don't know exactly when, maybe forever. So, nice > find! > > I think what we probably need is to change how the value_mark API works, > so that it isn't relying on a value pointer being in all_values, but > rather return some other type/object that isn't invalidated in the same > way. Is there an advantage of that value chain thing vs using value_ref_ptr throughout? Not replace all `value *` with value_ref_ptr, but have functions return and accept value_ref_ptr where that makes sense. Simon