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 Subject: Re: saving and restoring the error stack trace Date: Thu, 07 Sep 2006 22:36:05 +0100 Message-ID: <87zmdb4awq.fsf@ossau.uklinux.net> References: <87ejv2gx0x.fsf@ossau.uklinux.net> <87r6z0fqnj.fsf@ossau.uklinux.net> <20060907090226.GB1396@alamut> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1157665570 3624 80.91.229.2 (7 Sep 2006 21:46:10 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 7 Sep 2006 21:46:10 +0000 (UTC) Cc: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Sep 07 23:46:08 2006 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GLRgw-0004NQ-Ew for guile-user@m.gmane.org; Thu, 07 Sep 2006 23:45:46 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GLRgv-0003ik-Ue for guile-user@m.gmane.org; Thu, 07 Sep 2006 17:45:45 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GLRgr-0003cg-6v for guile-user@gnu.org; Thu, 07 Sep 2006 17:45:41 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GLRgp-0003YJ-TJ for guile-user@gnu.org; Thu, 07 Sep 2006 17:45:40 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GLRgp-0003Xq-N4 for guile-user@gnu.org; Thu, 07 Sep 2006 17:45:39 -0400 Original-Received: from [80.84.72.33] (helo=mail3.uklinux.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GLRhH-0001c4-N7 for guile-user@gnu.org; Thu, 07 Sep 2006 17:46:07 -0400 Original-Received: from laruns (host86-129-125-104.range86-129.btcentralplus.com [86.129.125.104]) by mail3.uklinux.net (Postfix) with ESMTP id 587C540A521; Thu, 7 Sep 2006 21:37:35 +0000 (UTC) Original-Received: from laruns (laruns [127.0.0.1]) by laruns (Postfix) with ESMTP id 06EAC6F71C; Thu, 7 Sep 2006 22:36:05 +0100 (BST) Original-To: Volkan YAZICI In-Reply-To: <20060907090226.GB1396@alamut> (Volkan YAZICI's message of "Thu, 7 Sep 2006 12:02:26 +0300") User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) 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:5496 Archived-At: Volkan YAZICI writes: > I've another situation that doesn't get executed inside a `catch' block. > For instance, I need to make some variable definitions just before > executing related code via scm_c_with_throw_handler(). The problem is, > in these definitions when an error occurs (e.g. not enough memory in > case of a scm_from_locale_string() call) I'm not able to handle it and > program exists without my permission. > > In such a situation, should I try to place my whole definition related > code into a SCM function and execute in a catch scope Yes, I think that's what you need to do. It's not too hard to do this, is it? > or is there any other way to fix this? Not unless you want to change the libguile code. The behaviour in the case where there is no enclosing catch scope is hardcoded in scm_ithrow (throw.c line 730): /* If we didn't find anything, print a message and abort the process right here. If you don't want this, establish a catch-all around any code that might throw up. */ if (scm_is_null (winds)) { scm_handle_by_message (NULL, key, args); abort (); } > [If you want to take a look at the related code, see > place_scheme_args(), guile_eval_str() and handle_scm_res() functions > called inside plscheme_func_handler() function in > http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/~checkout~/plscheme/plscheme/plscheme.c?rev=1.4 > URL.] It's interesting that you use separate catches for place_scheme_args, init_spi and guile_eval_str. Does it really make sense to go ahead with the guile_eval_str even if one (or both) of (place_scheme_args init_spi) failed? My inclination would be to try to put everything inside a single catch, if that is possible. > P.S. Thanks for this paper. It's quite helpful. Now I'm planning to > power up my buggy scm_c_with_throw_handler() code with that > make-stack stuff. I forgot to mention when I wrote it that you also need to be using the debugging evaluator (otherwise make-stack doesn't do anything), but I see that you've already got that sorted in your code. Regards, Neil _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user