@@ -143,8 +143,43 @@ If the arguments are not available, returns NIL NIL."
143
143
(bind-var (first auxs) (second auxs)))
144
144
(nreverse bindings))))
145
145
146
- (defun frame-locals (frame &key eval
147
- &aux (fname (frame-function-name frame)))
146
+ (defun locals-from-arguments (frame eval &aux (fname (frame-function-name frame)))
147
+ (multiple-value-bind (args args-available) (frame-arguments frame)
148
+ (multiple-value-bind (lambda-list lambda-list-available)
149
+ (frame-function-lambda-list frame)
150
+ (cond
151
+ ((not args-available) nil )
152
+ (lambda-list-available
153
+ (lambda-list-alist lambda-list args eval ))
154
+ ; ; The frame is missing a lambda list so fallback to just naming the arguments sequentially.
155
+ ((and (consp fname)
156
+ (eq (first fname) ' cl:method)
157
+ (= (length args) 2 )
158
+ (core :vaslistp (first args)))
159
+ ; ; This is non-fast method. The real arguments are a vaslist in
160
+ ; ; the first element and the method list is in the second element.
161
+ (let ((method-args (core :list-from-vaslist (first args)))
162
+ (next-methods (second args)))
163
+ (append
164
+ (let ((result ()))
165
+ (do ((args method-args (cdr method-args))
166
+ (i 0 (1+ i)))
167
+ ((null args) (nreverse result))
168
+ (push (cons (intern (format nil " ARG~d " i) :cl-user )
169
+ (first args))
170
+ result)))
171
+ (list (cons ' cl-user::next-methods next-methods)))))
172
+ (t
173
+ ; ; This is a fast method. Just treat it normally.
174
+ (let ((result ()))
175
+ (do ((args args (cdr args))
176
+ (i 0 (1+ i)))
177
+ ((null args) (nreverse result))
178
+ (push (cons (intern (format nil " ARG~d " i) :cl-user )
179
+ (first args))
180
+ result))))))))
181
+
182
+ (defun frame-locals (frame &key eval )
148
183
" Return an alist of local lexical/special variables and their values at the continuation the frame
149
184
represents. The CARs are variable names and CDRs their values. Multiple bindings with the same
150
185
name may be returned, as there is no notion of lexical scope in this interface. By default
@@ -154,40 +189,10 @@ If the arguments are not available, returns NIL NIL."
154
189
(append
155
190
; ; This only gives anything for bytecode functions right now.
156
191
(core :debugger-frame-locals frame)
157
- (multiple-value-bind (args args-available) (frame-arguments frame)
158
- (multiple-value-bind (lambda-list lambda-list-available)
159
- (frame-function-lambda-list frame)
160
- (cond
161
- ((not args-available) nil )
162
- (lambda-list-available
163
- (lambda-list-alist lambda-list args eval ))
164
- ; ; The frame is missing a lambda list so fallback to just naming the arguments sequentially.
165
- ((and (consp fname)
166
- (eq (first fname) ' cl:method)
167
- (= (length args) 2 )
168
- (core :vaslistp (first args)))
169
- ; ; This is non-fast method. The real arguments are a vaslist in
170
- ; ; the first element and the method list is in the second element.
171
- (let ((method-args (core :list-from-vaslist (first args)))
172
- (next-methods (second args)))
173
- (append
174
- (let ((result ()))
175
- (do ((args method-args (cdr method-args))
176
- (i 0 (1+ i)))
177
- ((null args) (nreverse result))
178
- (push (cons (intern (format nil " ARG~d " i) :cl-user )
179
- (first args))
180
- result)))
181
- (list (cons ' cl-user::next-methods next-methods)))))
182
- (t
183
- ; ; This is a fast method. Just treat it normally.
184
- (let ((result ()))
185
- (do ((args args (cdr args))
186
- (i 0 (1+ i)))
187
- ((null args) (nreverse result))
188
- (push (cons (intern (format nil " ARG~d " i) :cl-user )
189
- (first args))
190
- result)))))))))
192
+ (if (eq (core :debugger-frame-lang frame) :bytecode )
193
+ ; ; bytecode frames already have good locals, so don't bother w/arguments
194
+ nil
195
+ (locals-from-arguments frame eval ))))
191
196
192
197
(defun frame-function-lambda-list (frame)
193
198
" Return the lambda list of the function being called in this frame, and a second value indicating success. This function may fail, in which case the first value is undefined and the second is NIL. In success the first value is the lambda list and the second value is true."
0 commit comments