From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Bruce Korb Newsgroups: gmane.lisp.guile.user,gmane.lisp.guile.devel Subject: Re: PLEASE: debugging embedded guile code Date: Sat, 26 Apr 2003 09:40:49 -0700 Organization: Home Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Message-ID: <3EAAB691.6AD935B5@veritas.com> References: <20030225093608.6a8935f8.dsmith@altustech.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1051374950 24802 80.91.224.249 (26 Apr 2003 16:35:50 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 26 Apr 2003 16:35:50 +0000 (UTC) Cc: Joris van der Hoeven Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sat Apr 26 18:35:48 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 199SeS-0006Rt-00 for ; Sat, 26 Apr 2003 18:35:48 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 199SdT-0002es-02 for guile-user@m.gmane.org; Sat, 26 Apr 2003 12:34:47 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 199ScX-00025w-00 for guile-user@gnu.org; Sat, 26 Apr 2003 12:33:49 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 199ScA-0000zM-00 for guile-user@gnu.org; Sat, 26 Apr 2003 12:33:27 -0400 Original-Received: from bay-bridge.veritas.com ([143.127.3.10] helo=mtvmime02.veritas.com) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 199Sc8-0000qW-00; Sat, 26 Apr 2003 12:33:24 -0400 Original-Received: from megami (unverified) by mtvmime02.veritas.com (Content Technologies SMTPRS 4.3.6) with SMTP id ; Sat, 26 Apr 2003 09:35:02 -0700 Original-Received: from veritas.com ([172.22.12.211]) (3290 bytes) by megami via sendmail with P:esmtp/R:smart_host/T:smtp (sender: ) id for ; Sat, 26 Apr 2003 09:33:21 -0700 (PDT) (Smail-3.2.0.101 1997-Dec-17 #15 built 2001-Aug-30) X-Mailer: Mozilla 4.8 [en] (X11; U; Linux 2.4.19-4GB i686) X-Accept-Language: en Original-To: Neil Jerram Original-cc: guile-devel@gnu.org Original-cc: "Dale P. Smith" Original-cc: guile-user@gnu.org X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: General Guile related discussions List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.user:1836 gmane.lisp.guile.devel:2217 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:1836 Neil Jerram wrote: > >> So: what should I do in order to enable debugging support > >> for embedded Guile code? How can I retrieve the location of > >> a possible error when calling guile code from the main program? > Dale> Here is how I did it in mod-guile: > > Dale> SCM > Dale> mg_lazy_handler(void *data, SCM tag, SCM throw_args) > Dale> { > Dale> SCM eport = scm_current_error_port(); [...] > > I'm curious about this because the question of error handling keeps > popping up and I'm wondering whether our current solution is good > enough. (With a strong suspicion that it isn't.) > > One thing I'm not sure I understand is why you want (or perhaps need) > to do this lazy-catch in C rather than in Scheme, since it would be > much easier in Scheme. Can you explain? The need is to be able to point our clients to problems in the Scheme code. We (or, at least, I) know where in our client's input we are when we hand a string off to Guile for evaluation. I'd like to be able to tell Guile what the current file name and line number so that when it emits an error message, Guile can refer to our client's source file. As it is, I have to set an atexit routine. All it is able to tell is that Guile called exit(3C) and it must now emit a generic "this is where we were when Guile called exit" message: switch (procState) { case PROC_STATE_EMITTING: case PROC_STATE_INCLUDING: /* * A library (viz., Guile) procedure has called exit(3C). * The AutoGen abort paths all set procState to PROC_STATE_ABORTING. */ if (*pzOopsPrefix != NUL) { /* * Emit the CGI page header for an error message. */ fputs( pzOopsPrefix, stderr ); pzOopsPrefix = ""; } fprintf( stderr, zErr, pCurTemplate->pzFileName, pCurMacro->lineNo ); Of course, I have to do a bunch of magic anyway because if there is an error exit, I may or may not have to emit a CGI-style preamble: > static const char zOops[] = > "Content-type: text/plain\n\n" > "AutoGen form processing error:\n"; but it would still be nice to have the above file/line woven into the native Guile message as it is for the interactive guile program. _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://mail.gnu.org/mailman/listinfo/guile-user