1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

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.)
This commit is contained in:
Neil Jerram 2009-09-17 00:05:06 +01:00
parent a29c00447b
commit 931c82f5b0

View file

@ -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);