clasp icon indicating copy to clipboard operation
clasp copied to clipboard

Stack Frame Walking / Debug Information Retrieval

Open Shinmera opened this issue 7 years ago • 5 comments

This is a feature request / informational issue in order to get support for Clasp into the debugger implementation support library Dissect. In order to function, Dissect needs:

  • [x] A way to traverse the stack downwards from the current point, frame by frame: clasp-debug:map-backtrace, map-indexed-backtrace, and with-stack, map-stack, map-indexed-stack

For each frame it needs the following information:

  • [x] The frame's function or its name: frame-function and frame-function-name respectively
  • [x] The frame's call arguments: frame-arguments
  • [x] (Optional) The function's source form: frame-function-form (always nil at the moment)
  • [x] (Optional) The function's file source location: frame-function-source-position (always nil at the moment, but I'll fix that soon)
  • [ ] (Optional) How to evaluate an expression in the frame

For each restart it needs the following information:

  • [x] The restart's report function: ext:restart-report-function
  • [x] The restart's body function: ext:restart-function
  • [x] The restart's test function: ext:restart-test-function
  • [x] The restart's interactive function: ext:restart-interactive-function

For more information see the current implementation.

Please edit my post with the appropriate Clasp names for the required features if or when they exist.

Shinmera avatar Aug 22 '18 20:08 Shinmera

Restart information is available via ext:restart-report-function, ext:restart-function, ext:restart-test-function, and ext:restart-interactive-function respectively, as of db7ceacd661283643966d5ca78c3d3298ba88a7e. There's also ext:restart-associated-conditions since Dissect has that for SBCL.

I'll write a Dissect implementation myself once we stabilize a backtrace interface.

Bike avatar Apr 06 '20 15:04 Bike

Thank you very much in advance!

Shinmera avatar Apr 06 '20 15:04 Shinmera

Filed as https://github.com/Shinmera/dissect/pull/10

Bike avatar Apr 14 '20 17:04 Bike

Evaluating in frame... that's kind of weird to me conceptually. Lots of fiddly bits.

For SLDB, what we do right now is just eval (let (...variable bindings...) form). We don't even do that correctly, since the frame variable bindings aren't complete right now. Even if they were complete, we'd have to know which variables are actually in place. I don't think even SBCL knows that, they just dump multiple variables with the same name, according to the manual.

The dynamic environment is weird too. Presumably the form should be evaluated in the dynamic environment of the frame's call, except that afterward we need to restore the dynamic environment of the debugger (or whatever's evaluating-in-frame, anyway).

Bike avatar Apr 14 '20 17:04 Bike

Yeah. That part in the very least is definitely something Dissect would only support doing while sitting on top of the stack. The exact semantics of it are probably pretty different from implementation to implementation, too.

Shinmera avatar Apr 14 '20 17:04 Shinmera