[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: saving and restoring the error stack trace

From: Neil Jerram
Subject: Re: saving and restoring the error stack trace
Date: Thu, 07 Sep 2006 22:36:05 +0100
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Volkan YAZICI <address@hidden> 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
> 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]