From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.user,gmane.comp.cad.geda.devel Subject: Re: Help needed debugging segfault with Guile 1.8.7 Date: Sun, 28 Nov 2010 11:38:33 +0000 Message-ID: <8739ql38pe.fsf@ossau.uklinux.net> References: <871v6sqbny.fsf@ambire.localdomain> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1290949222 14748 80.91.229.12 (28 Nov 2010 13:00:22 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 28 Nov 2010 13:00:22 +0000 (UTC) Cc: guile-user@gnu.org, geda-dev@seul.org To: Peter Brett Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sun Nov 28 14:00:18 2010 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PMgra-0001lO-8v for guile-user@m.gmane.org; Sun, 28 Nov 2010 14:00:18 +0100 Original-Received: from localhost ([127.0.0.1]:36687 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PMgrZ-0006JT-Ov for guile-user@m.gmane.org; Sun, 28 Nov 2010 08:00:17 -0500 Original-Received: from [140.186.70.92] (port=43860 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PMgrS-0006Ir-HE for guile-user@gnu.org; Sun, 28 Nov 2010 08:00:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PMgrR-0003fB-7l for guile-user@gnu.org; Sun, 28 Nov 2010 08:00:10 -0500 Original-Received: from mail3.uklinux.net ([80.84.72.33]:34564) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PMgrR-0003Xh-3A for guile-user@gnu.org; Sun, 28 Nov 2010 08:00:09 -0500 Original-Received: from arudy (unknown [78.149.126.128]) by mail3.uklinux.net (Postfix) with ESMTP id 4223D1F66A9; Sun, 28 Nov 2010 12:59:31 +0000 (GMT) Original-Received: from neil-laptop (unknown [192.168.11.7]) by arudy (Postfix) with ESMTP id 52C443800B; Sun, 28 Nov 2010 12:59:27 +0000 (GMT) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:8241 gmane.comp.cad.geda.devel:9047 Archived-At: Hi Peter, Thanks for providing such a clear explanation of the problem. Here are a few comments. Peter Brett writes: > Sure. libgeda uses direct management of memory, and the structures used > in its document object model need to be explicitly deleted when finished > with. I decided to use a Guile smob to represent these structures for > access from Scheme code, with the pointer to the actual structure in > SCM_SMOB_DATA and with the low nibble of SCM_SMOB_FLAGS indicating which > type of DOM structure the smob references. > > This would have been sufficient if Scheme code had only been working > with libgeda DOMs created and managed entirely via Scheme code. [...] I think your design is similar to what is outlined in the `Extending Dia' node of the Guile manual. Were you aware of that doc before working out your design? If not, I guess we need to make it more prominent. If yes, I'd appreciate any suggestions you have for how it may be improved. > So, where was the bug? When a smob is GC'd, and if the pointer it > contains hasn't already been cleared, [...] Now that you've successfully debugged this, is there any general advice that you would offer for "how to investigate a free list corruption?" I would guess not, as corruption is fundamentally a general thing and has infinite possible causes - but perhaps I'm missing something. > I hope that explained things reasonably precisely! Thank you, it certainly did. To conclude, I'll just note that in the Guile 2.0 future we won't have such difficult problems, because of using libgc - which will automatically find active references anywhere in the whole application. (And of course I understand that your code still needs to work with Guile 1.8.x now.) Regards, Neil