From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Volkan YAZICI Newsgroups: gmane.lisp.guile.user Subject: Re: Enabling Debugging Date: Tue, 1 Aug 2006 13:46:31 +0300 Message-ID: <20060801104631.GC1323@alamut.tdm.local> References: <20060729113034.GA1340@alamut.tdm.local> <873bck9qkv.fsf@unknownlamer.org> <20060731071301.GA1600@alamut.tdm.local> <1154339628.9074.8.camel@localhost.localdomain> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1154429333 22045 80.91.229.2 (1 Aug 2006 10:48:53 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 1 Aug 2006 10:48:53 +0000 (UTC) Cc: Clinton Ebadi , guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Aug 01 12:48:50 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 1G7rnm-0006bV-M4 for guile-user@m.gmane.org; Tue, 01 Aug 2006 12:48:42 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G7rnm-0008RA-7P for guile-user@m.gmane.org; Tue, 01 Aug 2006 06:48:42 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1G7rni-0008Qf-MJ for guile-user@gnu.org; Tue, 01 Aug 2006 06:48:38 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1G7rnd-0008L8-Ab for guile-user@gnu.org; Tue, 01 Aug 2006 06:48:38 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G7rnd-0008L3-4K for guile-user@gnu.org; Tue, 01 Aug 2006 06:48:33 -0400 Original-Received: from [212.175.13.129] (helo=fep05.ttnet.net.tr) by monty-python.gnu.org with esmtp (Exim 4.52) id 1G7rqU-0001g9-Jv for guile-user@gnu.org; Tue, 01 Aug 2006 06:51:31 -0400 Original-Received: from alamut ([212.174.26.173]) by fep05.ttnet.net.tr with ESMTP id <20060801104829.NYAL10864.fep05.ttnet.net.tr@alamut>; Tue, 1 Aug 2006 13:48:29 +0300 Original-To: dave Content-Disposition: inline In-Reply-To: <1154339628.9074.8.camel@localhost.localdomain> User-Agent: Mutt/1.4.2.1i 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:5437 Archived-At: On Jul 31 10:53, dave wrote: > I had to work through this a while back, and the problem I had was that > there are two types of error handler callback - one is called before the > stack is unwound, the other after. If you only set the error callback > for after the unwind there is no stack to do the debugging... Can you send an example working code snippet please? > I think you can call gh_eval_str_with_stack_saving_handler() or using > the scm interface you can call scm_c_catch() which allows you to specify > both handlers. AFAIK, gh_eval_str_with_stack_saving_handler() isn't present in the 1.6 release and it'd be better if my code would be able to run with 1.6 too. Therefore, I'll try to have same effect with scm_c_catch(). I've considered your "before the stack is unwound and the other after" explanation and concluded with such a scm_c_catch() call: scm_c_catch(SCM_BOOL_T, /* tag */ (scm_t_catch_body) eval_code, /* body */ (void *) code, /* body data */ (scm_t_catch_handler) catch_err, /* handler */ (void *) code, /* handler data */ (scm_t_catch_handler) unwind_catch, (void *) code); But scm_backtrace(), that's placed in both catch_err() and unwind_catch(), still complains that "No backtrace available". (Placing that SCM_DEVAL_P = 1; ... SCM_RESET_DEBUG_MODE; stuff doesn't affect anything too.) Doesn't anybody have a working example code snippet? How did ppl achieve to write so much programs using guile? Furthermore, I've another problem: How do we receive information from tag and args variables passed to exception handlers? I was using buf = SCM_STRING_CHARS(tag); len = SCM_STRING_LENGTH(tag); while (len-- > 0) putchar(*buf++); method but, in the new 1.8 release it says that I'm using deprecated functions. So how can get the pointer pointing to the related text buffer? I cannot use gh_scm2newstr() in this situation, because it allocates required buffer itself and just dumps an error to stderr in case of a failure. Actually, I'm working on a shared memory segment thus I don't want guile to make any memory allocations on its own. Can I achieve such a functionality? (I want it to use palloc/pfree instead of recent malloc/free calls.) Can a macro hack like #define malloc palloc #define free pfree solve that problem? Moreover, as far as SCM_CONSP(args) says so, the third param (args) passed to exception handlers is a cons. Despite I've tried some gh_car(), gh_cdr() tricks, I couldn't manage to figure out how to use that information too. I'd be very very appreciated if anybody can help me to solve above problems. (Pointers to existing projects that use guile are welcome too.) Regards. _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user