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: ludo at gnu dot org (Ludovic CourtÃs)
- To: Doug Evans <xdje42 at gmail dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 03 Mar 2014 10:17:15 +0100
- 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>
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?
Thanks,
Ludoâ.