summaryrefslogtreecommitdiff
path: root/libguile/stacks.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2009-02-05 18:13:27 +0100
committerAndy Wingo <wingo@pobox.com>2009-02-05 18:13:27 +0100
commit2f9769b60cec324e6d1cb13d8f5690342ac20152 (patch)
tree256544edb6e6dc6ff7965489fbc963f29f6f6604 /libguile/stacks.c
parent3b9e095b44a618b9e5781adfaa287e14b0f44d03 (diff)
downloadguile-2f9769b60cec324e6d1cb13d8f5690342ac20152.tar.gz
fix the ping-pong between evaluator and vm stacks in make-stack
* libguile/frames.c (vm_frame_print): Add a frame printer. * libguile/stacks.c (stack_depth, read_frames): Only switch the VM stack for boot program dframes. * libguile/vm-engine.c (VM_NAME): Push one debug frame per invocation, unconditionally. (If we push them at all, of course.)
Diffstat (limited to 'libguile/stacks.c')
-rw-r--r--libguile/stacks.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/libguile/stacks.c b/libguile/stacks.c
index 8f4e88611..d020d36b0 100644
--- a/libguile/stacks.c
+++ b/libguile/stacks.c
@@ -156,19 +156,23 @@ stack_depth (scm_t_debug_frame *dframe, scm_t_ptrdiff offset, SCM vmframe,
scm_t_debug_info *vect = RELOC_INFO (dframe->vect, offset);
if (SCM_PROGRAM_P (vect[0].a.proc))
{
+ if (!SCM_PROGRAM_IS_BOOT (vect[0].a.proc))
+ /* Programs can end up in the debug stack via deval; but we just
+ ignore those, because we know that the debugging VM engine
+ pushes one dframe per invocation, with the boot program as
+ the proc, so we only count those. */
+ continue;
/* count vmframe back to previous boot frame */
for (; scm_is_true (vmframe); vmframe = scm_c_vm_frame_prev (vmframe))
{
- if (SCM_PROGRAM_IS_BOOT (scm_vm_frame_program (vmframe)))
+ if (!SCM_PROGRAM_IS_BOOT (scm_vm_frame_program (vmframe)))
+ ++n;
+ else
{ /* skip boot frame, cut out of the vm backtrace */
vmframe = scm_c_vm_frame_prev (vmframe);
break;
}
- else
- ++n;
}
- if (!SCM_PROGRAM_IS_BOOT (vect[0].a.proc))
- ++n; /* increment for apply frame if this isn't a boot frame */
}
else if (scm_is_eq (vect[0].a.proc, scm_f_gsubr_apply))
/* Skip gsubr apply frames. */
@@ -322,7 +326,12 @@ read_frames (scm_t_debug_frame *dframe, scm_t_ptrdiff offset,
continue;
else if (SCM_PROGRAM_P (iframe->proc))
{
- scm_t_info_frame saved = *iframe;
+ if (!SCM_PROGRAM_IS_BOOT (iframe->proc))
+ /* Programs can end up in the debug stack via deval; but we just
+ ignore those, because we know that the debugging VM engine
+ pushes one dframe per invocation, with the boot program as
+ the proc, so we only count those. */
+ continue;
for (; scm_is_true (vmframe);
vmframe = scm_c_vm_frame_prev (vmframe))
{
@@ -343,11 +352,6 @@ read_frames (scm_t_debug_frame *dframe, scm_t_ptrdiff offset,
goto quit;
}
}
- if (!SCM_PROGRAM_IS_BOOT (saved.proc))
- {
- *iframe = saved;
- NEXT_FRAME (iframe, n, quit);
- }
}
else
{