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: Fri, 01 Sep 2006 08:47:13 +0100 Message-ID: <87veo8av0e.fsf@ossau.uklinux.net> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1157096928 30352 80.91.229.2 (1 Sep 2006 07:48:48 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 1 Sep 2006 07:48:48 +0000 (UTC) Cc: guile-user Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Fri Sep 01 09:48:45 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 1GJ3lY-0004X9-I1 for guile-user@m.gmane.org; Fri, 01 Sep 2006 09:48:40 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GJ3lY-0000Aa-2a for guile-user@m.gmane.org; Fri, 01 Sep 2006 03:48:40 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GJ3lT-0000AV-Jm for guile-user@gnu.org; Fri, 01 Sep 2006 03:48:35 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GJ3lS-0000AJ-2N for guile-user@gnu.org; Fri, 01 Sep 2006 03:48:35 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GJ3lR-0000AG-V3 for guile-user@gnu.org; Fri, 01 Sep 2006 03:48:34 -0400 Original-Received: from [80.84.72.33] (helo=mail3.uklinux.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GJ3vF-0005ga-CU for guile-user@gnu.org; Fri, 01 Sep 2006 03:58:41 -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 F335340A664; Fri, 1 Sep 2006 07:48:32 +0000 (UTC) Original-Received: from laruns (laruns [127.0.0.1]) by laruns (Postfix) with ESMTP id 2927B6FF90; Fri, 1 Sep 2006 08:47:14 +0100 (BST) Original-To: "Marco Maggi" In-Reply-To: (Marco Maggi's message of "Thu, 31 Aug 2006 08:04:56 +0200") 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:5486 Archived-At: "Marco Maggi" writes: > Making the stack with this: > > s_error_stack = scm_make_stack(SCM_BOOL_T, SCM_EOL); > > and using the function (scm_t = SCM): [...] > > I have error messages like: > > Backtrace: > In unknown file: > ?: 0* [dotest "gsl-ode-error-2.4" # ...] > ?: 1 (let* () (let* (# #) (let* # #))) > ... > ?: 2 (begin (display name) (if (thunk? setup) (setup)) ...) > ?: 3* (let (# # # ...) (set-current-input-port saved-in) ...) > ?: 4* (if catch-error (catch #t thunk (lambda (key . > args) key)) (thunk)) > ?: 5 [#] > ... > ?: 6 (let* ((result (quote ()))) (if debugging > (newline)) ...) > ?: 7* [gsl-ode-evolve # > #:initial-indep-value ...] > ?: 8 (let-keywords args #f ...) > ... > ?: 9 [gsl-p-ode-evolve # > 0.0 ...] > > : In procedure gsl-ode-evolve in expression > (gsl-p-ode-evolve ode initial-indep-value ...): > : my error message 1 and 2 > In unknown file: > ?: 10* [# 0.0 #,(gsl-vector-real 1 2.0)] > ?: 11* [gsl-ode-invoke-fun 0.0 #,(gsl-vector-real 1 2.0) ...] > ?: 12 (let* ((o (func t #))) (if (gsl? o) (slot-ref o > (quote v)) ...)) > ?: 13* [# 0.0 #,(gvr 1 2.0)] > ?: 14 [throwing-error] > ... > ?: 15 [scm-error my-own-error "sub-throwing-error" ...] > > which is not perfect but seems good enough for me. OK. Out of interest, though, what changes would you like to the presentation? (And, to ask a leading question, do you think that the way my Emacs interface displays the stack is better or worse than this? http://www.ossau.uklinux.net/guile/debugging-demo/shot2.html) > I am a little annoyed that I have to use a port to > build the backtrace string, That just needs getting used to; I'd say that ports are a fantastic abstraction. And the C API for a string port is very easy to use, isn't it? > and that the args content > is not explicitly documented (that is, I was not > able to find it) even if its content is well defined > in 'scm_error_scm()': > > scm_ithrow (key, > scm_list_4 (subr, message, args, data), 1); Yes, here I completely agree with you. I've been wondering what to do about this for ages. Do you think it can be solved adequately by precise documentation, or do we need some way of describing the expected throw args in code; perhaps even construct some kind of object model around the args with methods for getting the useful bits of information out? (Use of which would be optional.) Regards, Neil _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user