This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] record_latest_value: Call release_value_or_incref instead of release_value
- From: Doug Evans <xdje42 at gmail dot com>
- To: Ludovic Courtès <ludo at gnu dot org>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Mon, 3 Mar 2014 08:22:15 -0800
- Subject: Re: [PATCH] record_latest_value: Call release_value_or_incref instead of release_value
- Authentication-results: sourceware.org; auth=none
- References: <m3zjl7u8ik dot fsf at sspiff dot org> <87wqgbsktg dot fsf at gnu dot org>
On Mon, Mar 3, 2014 at 1:17 AM, Ludovic Courtès <ludo@gnu.org> wrote:
> Doug Evans <xdje42@gmail.com> 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 = 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.