From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21926 invoked by alias); 3 Mar 2014 16:22:19 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 21908 invoked by uid 89); 3 Mar 2014 16:22:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-yk0-f171.google.com Received: from mail-yk0-f171.google.com (HELO mail-yk0-f171.google.com) (209.85.160.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 03 Mar 2014 16:22:17 +0000 Received: by mail-yk0-f171.google.com with SMTP id q9so11039789ykb.2 for ; Mon, 03 Mar 2014 08:22:15 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.236.199.82 with SMTP id w58mr21608162yhn.57.1393863735764; Mon, 03 Mar 2014 08:22:15 -0800 (PST) Received: by 10.170.99.85 with HTTP; Mon, 3 Mar 2014 08:22:15 -0800 (PST) In-Reply-To: <87wqgbsktg.fsf@gnu.org> References: <87wqgbsktg.fsf@gnu.org> Date: Mon, 03 Mar 2014 16:22:00 -0000 Message-ID: Subject: Re: [PATCH] record_latest_value: Call release_value_or_incref instead of release_value From: Doug Evans To: =?ISO-8859-1?Q?Ludovic_Court=E8s?= Cc: "gdb-patches@sourceware.org" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2014-03/txt/msg00043.txt.bz2 On Mon, Mar 3, 2014 at 1:17 AM, Ludovic Court=E8s wrote: > Doug Evans skribis: > >> I think this is because its reference counting is wrong. >> Upon return from record_latest_value, its reference count is still one. >> However it was one upon entry. It should be two, right? >> One for the Scheme wrapper and one for the history entry. >> >> (gdb) guile (define histnum (history-append! (make-value 42))) > > Indeed, good catch. Here's how I reproduced it: > > --8<---------------cut here---------------start------------->8--- > (gdb) guile (use-modules (gdb)) > (gdb) guile (history-append! (make-value 42)) > 1 > (gdb) p $1 > $2 =3D 42 > (gdb) guile (gc) > (gdb) p $1 > Segmentation fault > --8<---------------cut here---------------end--------------->8--- > > What about adding this to the patch as a test case? Shall do. Thanks.