From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Bruce Korb Newsgroups: gmane.lisp.guile.devel,gmane.lisp.guile.user Subject: Re: PLEASE: debugging embedded guile code Date: Sun, 27 Apr 2003 14:57:58 -0700 Organization: Home Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <3EAC5266.23DEEB7F@veritas.com> References: <20030225093608.6a8935f8.dsmith@altustech.com> <3EAAB691.6AD935B5@veritas.com> <3EAAE877.7140ECB6@veritas.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 1051481786 8249 80.91.224.249 (27 Apr 2003 22:16:26 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 27 Apr 2003 22:16:26 +0000 (UTC) Cc: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Apr 28 00:16:24 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 199uRc-00028v-00 for ; Mon, 28 Apr 2003 00:16:24 +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 199uPt-0006FG-02 for guile-devel@m.gmane.org; Sun, 27 Apr 2003 18:14:37 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 199uOJ-0005uP-00 for guile-devel@gnu.org; Sun, 27 Apr 2003 18:12:59 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 199u87-0002Uh-00 for guile-devel@gnu.org; Sun, 27 Apr 2003 17:56:15 -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 199u2k-0001TU-00; Sun, 27 Apr 2003 17:50:42 -0400 Original-Received: from megami (unverified) by mtvmime02.veritas.com (Content Technologies SMTPRS 4.3.6) with SMTP id ; Sun, 27 Apr 2003 14:52:16 -0700 Original-Received: from veritas.com ([172.22.12.211]) (3441 bytes) by megami via sendmail with P:esmtp/R:smart_host/T:smtp (sender: ) id for ; Sun, 27 Apr 2003 14:50:35 -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-user@gnu.org X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Developers list for Guile, the GNU extensibility library List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:2225 gmane.lisp.guile.user:1844 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:2225 Neil Jerram wrote: > So, given this description, can you be more precise about which (if > any) parts of it are causing you trouble? I guess I'm really lazy. I'm interested in playing with my project and I'm completely _un_interested in figuring out the inner workings of Guile error handling. But I have a problem. Sometimes my clients provide my project with a scheme script that is many lines long. I merrily hand the whole string off to gh_eval_str() to deal with. Somewhere in that string, Guile becomes confused and says, "this is confusing" and calls exit(3C). My client emails me and says, "Your program said it was confused but won't tell me where or why." Well, I do print out where the Scheme script starts, but not where in the script the confusion was. It's adequate for me because I generally keep my Scheme scripts to under a half dozen lines. It's a problem. So, what I would really like: Explicit, unambiguous directions on exactly how to get the Guile library to print out the same error messages it does when running as part of the "guile" independent program. That message has sufficient contextual information to help the user debug the problem. e.g.: > guile> (define foo bar) > standard input:1:1: In expression (define foo bar): > standard input:1:1: Unbound variable: bar > ABORT: (unbound-variable) as opposed to: > $ autogen --no-def -Txx.tpl --base=x > ERROR: Unbound variable: bar > AutoGen ABENDED in template xx.tpl line 2 the library message here consists of ``ERROR: Unbound variable: bar'' and leaves out ``In expression (define foo bar):'' and also the line and column numbers. (This is a trivial case and obviously easy to diagnose.) Example solutions: * gh_eval_file_line_str( pz_text, state->file_name, state->line_no ) * a detailed example of gh_eval_str_with_catch that shows how to print the broken expression and how to describe where in the input string that expression was encountered. Perhaps this can be accomplished by adding a file name and incrementing the line number passed along in the error description list, then forwarding to the normal handler? Frankly, I'd prefer the first, but I'd need to understand the latter anyway just to be compatible with Guile libraries without this new gh_* function. :-) Heck, with a proper implementation of gh_eval_file_line_str I could just tack it into my program and configure it if not present. :) _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel