unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Neil Jerram <neil@ossau.uklinux.net>
Cc: guile-user@gnu.org
Subject: Re: saving and restoring the error stack trace
Date: Thu, 07 Sep 2006 22:36:05 +0100	[thread overview]
Message-ID: <87zmdb4awq.fsf@ossau.uklinux.net> (raw)
In-Reply-To: <20060907090226.GB1396@alamut> (Volkan YAZICI's message of "Thu, 7 Sep 2006 12:02:26 +0300")

Volkan YAZICI <yazicivo@ttnet.net.tr> writes:

> I've another situation that doesn't get executed inside a `catch' block.
> For instance, I need to make some variable definitions just before
> executing related code via scm_c_with_throw_handler(). The problem is,
> in these definitions when an error occurs (e.g. not enough memory in
> case of a scm_from_locale_string() call) I'm not able to handle it and
> program exists without my permission.
>
> In such a situation, should I try to place my whole definition related
> code into a SCM function and execute in a catch scope

Yes, I think that's what you need to do.  It's not too hard to do
this, is it?

> or is there any other way to fix this?

Not unless you want to change the libguile code.  The behaviour in the
case where there is no enclosing catch scope is hardcoded in
scm_ithrow (throw.c line 730):

  /* If we didn't find anything, print a message and abort the process
     right here.  If you don't want this, establish a catch-all around
     any code that might throw up. */
  if (scm_is_null (winds))
    {
      scm_handle_by_message (NULL, key, args);
      abort ();
    }


> [If you want to take a look at the related code, see
> place_scheme_args(), guile_eval_str() and handle_scm_res() functions
> called inside plscheme_func_handler() function in
> http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/~checkout~/plscheme/plscheme/plscheme.c?rev=1.4
> URL.]

It's interesting that you use separate catches for place_scheme_args,
init_spi and guile_eval_str.  Does it really make sense to go ahead
with the guile_eval_str even if one (or both) of (place_scheme_args
init_spi) failed?

My inclination would be to try to put everything inside a single
catch, if that is possible.

> P.S. Thanks for this paper. It's quite helpful. Now I'm planning to
>      power up my buggy scm_c_with_throw_handler() code with that
>      make-stack stuff.

I forgot to mention when I wrote it that you also need to be using the
debugging evaluator (otherwise make-stack doesn't do anything), but I
see that you've already got that sorted in your code.

Regards,
     Neil



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


  reply	other threads:[~2006-09-07 21:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-25  9:39 saving and restoring the error stack trace Marco Maggi
2006-08-27 12:53 ` Neil Jerram
2006-08-28 22:21   ` Neil Jerram
2006-09-07  9:02     ` Volkan YAZICI
2006-09-07 21:36       ` Neil Jerram [this message]
2006-09-08  6:09         ` Volkan YAZICI
  -- strict thread matches above, loose matches on Subject: below --
2006-09-01 20:10 Marco Maggi
2006-08-31  6:04 Marco Maggi
2006-09-01  7:47 ` Neil Jerram
2006-09-01  9:39   ` Ludovic Courtès
2006-09-07 22:11     ` Neil Jerram
2006-08-29  3:08 dsmich
2006-09-01  7:34 ` Neil Jerram
2006-08-24 19:34 Marco Maggi
2006-08-24 21:53 ` 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=87zmdb4awq.fsf@ossau.uklinux.net \
    --to=neil@ossau.uklinux.net \
    --cc=guile-user@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).