summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libguile/ChangeLog5
-rw-r--r--libguile/throw.c18
2 files changed, 23 insertions, 0 deletions
diff --git a/libguile/ChangeLog b/libguile/ChangeLog
index 882c8074d..b2244a975 100644
--- a/libguile/ChangeLog
+++ b/libguile/ChangeLog
@@ -1,3 +1,8 @@
+2007-01-10 Han-Wen Nienhuys <hanwen@lilypond.org>
+
+ * throw.c (scm_ithrow): print out key symbol and string arguments
+ when error happens inside a critical section, and document why.
+
2007-01-06 Han-Wen Nienhuys <hanwen@lilypond.org>
* read.c (s_scm_read_hash_extend): document #f argument to
diff --git a/libguile/throw.c b/libguile/throw.c
index 115bb0c03..86e4d1fa7 100644
--- a/libguile/throw.c
+++ b/libguile/throw.c
@@ -37,6 +37,7 @@
#include "libguile/validate.h"
#include "libguile/throw.h"
#include "libguile/init.h"
+#include "libguile/strings.h"
/* the jump buffer data structure */
@@ -695,7 +696,24 @@ scm_ithrow (SCM key, SCM args, int noreturn SCM_UNUSED)
if (scm_i_critical_section_level)
{
+ SCM s = args;
+ int i = 0;
+
+ /*
+ We have much better routines for displaying Scheme, but we're
+ already inside a pernicious error, and it's unlikely that they
+ are available to us. We try to print something useful anyway,
+ so users don't need a debugger to find out what went wrong.
+ */
fprintf (stderr, "throw from within critical section.\n");
+ if (scm_is_symbol (key))
+ fprintf (stderr, "error key: %s\n", scm_i_symbol_chars (key));
+
+
+ for (; scm_is_pair (s); s = scm_cdr (s), i++)
+ if (scm_is_string (scm_car (s)))
+ fprintf (stderr, "argument %d: %s\n", i, scm_i_string_chars (scm_car (s)));
+
abort ();
}