From: Eric W. <er...@bo...> - 2012-04-28 16:27:13
|
Hi there, I thought that the issue was surely discussed before, but I was unable to find something via google and I couldn't find a way to do a full text search on sbcl-help. If I try to single step the following function (defun build-batcher-sn (n) (declare (optimize (speed 0) (space 0) (compilation-speed 0) (debug 3))) (break) (let* (network (tee (ceiling (log n 2))) (p (ash 1 (- tee 1)))) ;;marked line (loop while (> p 0) do (let ((q (ash 1 (- tee 1))) (r 0) (d p)) (loop while (> d 0) do (loop for i from 0 to (- n d 1) do (if (= (logand i p) r ) (push (list i (+ i d)) network ))) (setf d (- q p) q (ash q -1) r p))) (setf p (ash p -1))) (nreverse network))) on the expression (- tee 1) in "marked line" the debugger tells me that the symbol tee is an unbound variable and (sb-debug:var "TEE") doesn't find anything. This is described in the manual. The availability of a variable used as argument depends on the debug levels of the called function, to which the variable serves as a argument. But If I load the following file (defpackage :debug-test (:use :common-lisp) (:shadow - log ceiling ash > logand +)) (in-package :debug-test) (defun - (&rest params) (apply #'cl:- params)) (defun log (&rest params) (apply #'cl:log params)) (defun ceiling (&rest params) (apply #'cl:ceiling params)) (defun ash (&rest params) (apply #'cl:ash params)) (defun > (&rest params) (apply #'cl:> params)) (defun logand (&rest params) (apply #'cl:logand params)) (defun + (&rest params) (apply #'cl:+ params)) (defun build-batcher-sn (n) (declare (optimize (speed 0) (space 0) (compilation-speed 0) (debug 3))) (break) (let* (network (tee (ceiling (log n 2))) (p (ash 1 (- tee 1)))) ;; marked line (loop while (> p 0) do (let ((q (ash 1 (- tee 1))) (r 0) (d p)) (loop while (> d 0) do (loop for i from 0 to (- n d 1) do (if (= (logand i p) r ) (push (list i (+ i d)) network ))) (setf d (- q p) q (ash q -1) r p))) (setf p (ash p -1))) (nreverse network))) the variable "tee" on marked line is suddenly available. (sb-debug:var "DEBUG-TEST::TEE") does find it. I assume, this behavior is the result of some standard debug level on the function "-" defined in the package debug-test. Is that the only way to single step a function like that with the comfort I am used to from for example C and gdb? Separating it into a single package and mocking all functions it calls, only to have the variable values available in the single stepper? As I would really like to use sbcl in some production level project I need a way to single step functions with all local variables available. Is there anything available in that direction? Yours sincerely, Eric |
From: Nikodemus S. <nik...@ra...> - 2012-04-28 17:24:54
|
Short answer is that arguments are currently only available to the stepper for full calls. This is not a fundamental limitation, but we don't currently store information that would allow the stepper to figure out the arguments for calls implemented directly using machine instructions. If you want to see value TEE there, add (declaim (notinline -)) to the function, which prohibits it from being open coded. Cheers, -- Nikodemus |