narrowing stacks to prompts; backtrace shows frames from start-stack
authorAndy Wingo <wingo@pobox.com>
Sat, 13 Mar 2010 20:03:06 +0000 (21:03 +0100)
committerAndy Wingo <wingo@pobox.com>
Sat, 13 Mar 2010 20:03:06 +0000 (21:03 +0100)
commit06dcb9dfb663169ce612bca241e5438c73bfa5c6
treee49821653abc4c9e5919116f028c9aa50970950d
parent01c0082fae4ce3b0c09f003a2141c38cfc062d74
narrowing stacks to prompts; backtrace shows frames from start-stack

* libguile/stacks.c (scm_sys_stacks): New global variable, moved here
  from boot-9.scm.
  (scm_init_stacks): Define scm_sys_stacks to %stacks.
  (stack_depth): Remove narrowing by frame pointer.
  (find_prompt): New helper.
  (narrow_stack): Clean up a bit, and allow narrowing by prompt tag.
  (scm_make_stack): Update docs, and use scm_stack_id to get the stack
  id.
  (scm_stack_id): The current stack id may be fetched as the cdar of
  %stacks.
  (stack_id_with_fp): Remove helper.

* module/ice-9/boot-9.scm (%start-stack): Fix indentation.
  (%stacks): Remove definition, it's in stacks.c now.
  (default-pre-unwind-handler): Narrow by another frame.
  (save-stack): Remove special handling for certain stack ids, as it is
  often possible that the function isn't on the stack -- in the
  interpreter, or after a tail call. Better to narrow by prompt ids.

* module/system/vm/debug.scm (print-frames): Change to operate on a
  vector of frames.
  (run-debugger): Change to receive a vector of frames. The debugger
  also has the full stack, so it can re-narrow (or widen) to get the
  whole stack, if the user wants.
  (stack->vector): New helper.
  (debug-pre-unwind-handler): Narrow by more frames, and to the most
  recent start-stack invocation. Adapt to run-debugger change.
libguile/stacks.c
module/ice-9/boot-9.scm
module/system/vm/debug.scm