summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Jerram <neil@ossau.uklinux.net>2009-09-17 00:05:06 +0100
committerNeil Jerram <neil@ossau.uklinux.net>2009-09-17 00:19:47 +0100
commit931c82f5b02213c8e9e1cca2b21672b809970e18 (patch)
tree3d97b32c49ba6be083836ad1c1488b2431911ecf
parenta29c00447ba91458e35f81c7715c333ff1641018 (diff)
downloadguile-931c82f5b02213c8e9e1cca2b21672b809970e18.tar.gz
Fix incorrect stack count warnings
* libguile/stacks.c (stack_depth): Decrement depth count for a macro-expansion frame. (Missing this decrement will cause a "stack count incorrect" warning but is actually benign, as it only means that scm_make_stack allocates a bit more space for the stack than it really needs.) (read_frames): Increment count of remaining unused frames, when cutting out a macro transformer application frame. (Missing this increment could cause the "stack count incorrect" warning, and could make read_frames think it's filled up all the available stack frames when there's actually still one frame unused; this wasn't benign, because it could cause information to be missing from a stack trace.)
-rw-r--r--libguile/stacks.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libguile/stacks.c b/libguile/stacks.c
index 5c8d1a5d7..a70186371 100644
--- a/libguile/stacks.c
+++ b/libguile/stacks.c
@@ -143,6 +143,11 @@ stack_depth (scm_t_debug_frame *dframe, scm_t_ptrdiff offset, SCM vmframe,
{
scm_t_debug_info *info = RELOC_INFO (dframe->info, offset);
scm_t_debug_info *vect = RELOC_INFO (dframe->vect, offset);
+ /* If current frame is a macro during expansion, we should
+ skip the previously recorded macro transformer
+ application frame. */
+ if (SCM_MACROEXPP (*dframe) && n > 0)
+ --n;
n += (info - vect) / 2 + 1;
/* Data in the apply part of an eval info frame comes from previous
stack frame if the scm_t_debug_info vector is overflowed. */
@@ -280,6 +285,7 @@ read_frames (scm_t_debug_frame *dframe, scm_t_ptrdiff offset,
{
*(iframe - 1) = *iframe;
--iframe;
+ ++n;
}
info = RELOC_INFO (dframe->info, offset);
vect = RELOC_INFO (dframe->vect, offset);