unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Neil Jerram <neil@ossau.uklinux.net>
Cc: guile-devel@gnu.org
Subject: Re: No way out.
Date: Mon, 02 Jan 2006 18:54:27 +0000	[thread overview]
Message-ID: <877j9i31gc.fsf@ossau.uklinux.net> (raw)
In-Reply-To: <87lkxy3abo.fsf@ossau.uklinux.net> (Neil Jerram's message of "Mon, 02 Jan 2006 15:42:51 +0000")

Neil Jerram <neil@ossau.uklinux.net> writes:

> In 1.7.x, we don't call scm_handle_by_message, because there is a
> matching catch which was set up as part of scm_with_guile.  The C
> backtrace after jumping back out to this catch is:
>
> #0  scm_internal_catch (tag=0x1, body=0x40044850 <c_body>, 
>     body_data=0xbffffbe0, handler=0x40044880 <c_handler>, 
>     handler_data=0xbffffbe0) at throw.c:158
> #1  0x4004482c in scm_i_with_continuation_barrier (body=0x1, body_data=0x1, 
>     handler=0x1, handler_data=0x1) at continuations.c:336
> #2  0x40044913 in scm_c_with_continuation_barrier (func=0x1, data=0x1)
>     at continuations.c:378
> #3  0x400b53a0 in scm_i_with_guile_and_parent (func=0x1, data=0x1, parent=0x1)
>     at threads.c:645
> #4  0x400b5350 in scm_with_guile (func=0x1, data=0x1) at threads.c:633
> #5  0x400732a1 in scm_boot_guile (argc=1, argv=0x1, main_func=0x1, closure=0x1)
>     at init.c:350
> #6  0x080489c6 in main (argc=1, argv=0x1) at guile.c:74

The problem is that the use of scm_internal_catch here means that the
stack is unwound before the code in c_handler can get at it.
c_handler has code in it that would print a backtrace if the stack was
still available, but it isn't; to be precise, the "else if
(SCM_JMPBUFP (jmpbuf))" code in scm_ithrow sets
scm_i_last_debug_frame() back to NULL before the catch handler is called.

I think the only really good fix for this would be to implement an
exception handling mechanism that doesn't rely on lazy catch, along
the lines of SRFI-34.  Then the exception handler could display the
backtrace.

Alternatively we could make a shorter term fix by adding a lazy catch
inside the scm_internal_catch, and using the lazy catch handler either
to display the backtrace directly, or to save off the stack so it can
be displayed later.  scm_internal_stack_catch does the latter, by
setting the value of the-last-stack, so we could use that, but would
it be correct for uses of with-continuation-barrier to overwrite
the-last-stack?  I'm not sure.

One other query/possibility...  Does with-continuation-barrier _have_
to include a (catch #t ...)?  If it didn't, there wouldn't be a catch
on the wind list, and so the exception would be caught and handled by
the fallback code in scm_ithrow(), as is the case for 1.6.

Thoughts?
        Neil



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


  reply	other threads:[~2006-01-02 18:54 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-01  0:16 gh_inexact_p error in 1.7.x Bruce Korb
2005-12-01  0:44 ` Kevin Ryde
2005-12-05  4:08   ` No way out Bruce Korb
2005-12-05  4:35     ` Bruce Korb
2005-12-07  1:31       ` Marius Vollmer
2005-12-05 22:20     ` Kevin Ryde
2005-12-06 10:58       ` Han-Wen Nienhuys
2005-12-28 15:59         ` Neil Jerram
2005-12-31 15:09           ` Han-Wen Nienhuys
2005-12-31 15:14             ` Neil Jerram
2006-01-01 19:58               ` Han-Wen Nienhuys
2006-01-02 15:42                 ` Neil Jerram
2006-01-02 18:54                   ` Neil Jerram [this message]
2006-01-04 21:13                     ` Backtrace and enhanced catch Neil Jerram
2006-01-14 12:41                       ` Neil Jerram
2006-01-22 13:47                         ` Marius Vollmer
2006-01-23 20:11                           ` Neil Jerram
2006-01-24 21:34                             ` Marius Vollmer
2006-01-16  8:38                       ` Ludovic Courtès
2006-01-18 23:08                         ` Neil Jerram
2006-01-19  9:38                           ` Ludovic Courtès
2006-01-21 11:26                             ` Neil Jerram
2006-01-26 23:29                       ` Kevin Ryde
2006-01-27 19:30                         ` Neil Jerram
2006-01-31 20:07                           ` Kevin Ryde
2006-02-01 23:04                             ` Neil Jerram
2006-02-04  0:46                               ` Kevin Ryde
2006-02-04 15:41                                 ` Neil Jerram
2005-12-07  1:07     ` No way out Marius Vollmer
2005-12-07  1:55       ` Rob Browning
2005-12-13 20:32         ` Marius Vollmer
2005-12-28 16:09       ` Neil Jerram

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877j9i31gc.fsf@ossau.uklinux.net \
    --to=neil@ossau.uklinux.net \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).