- (let* ((full-backtrace (sb-debug:backtrace-as-list))
- (backtrace (member (caar frame-specs) full-backtrace
- :key #'car
- :test #'equal)))
-
- (setf result condition)
-
- (unless backtrace
- (format t "~&//~S not in backtrace:~% ~S~%"
- (caar frame-specs)
- full-backtrace)
- (setf result nil))
- ;; check that we have all the frames we wanted
- (mapcar
- (lambda (spec frame)
- (unless (or (not spec)
- (and (equal (car spec) (car frame))
- (args-equal (cdr spec)
- (cdr frame))))
- (print (list :wanted spec :got frame))
- (setf result nil)))
- frame-specs
- backtrace)
-
- ;; Make sure the backtrace isn't stunted in
- ;; any way. (Depends on running in the main
- ;; thread.) FIXME: On Windows we get two
- ;; extra foreign frames below regular frames.
- (unless (find '(sb-impl::toplevel-init) backtrace
- :test #'equal)
- (print (list :backtrace-stunted backtrace))
- (setf result nil))
- (return-from outer-handler)))))
+ (let (full-backtrace)
+ (sb-debug::map-backtrace
+ (lambda (frame)
+ (multiple-value-bind (name args info)
+ (sb-debug::frame-call frame #+nil #+nil
+ :replace-dynamic-extent-objects t)
+ (if details
+ (push (list (cons name args) info) full-backtrace)
+ (push (cons name args) full-backtrace)))))
+
+ (setf full-backtrace (nreverse full-backtrace))
+ (let ((backtrace (if details
+ (member (caaar frame-specs)
+ full-backtrace
+ :key #'caar
+ :test #'equal)
+ (member (caar frame-specs)
+ full-backtrace
+ :key #'car
+ :test #'equal))))
+
+ (setf result condition)
+
+ (unless backtrace
+ (format t "~&//~S not in backtrace:~% ~S~%"
+ (caar frame-specs)
+ full-backtrace)
+ (setf result nil))
+ ;; check that we have all the frames we wanted
+ (mapcar
+ (lambda (spec frame)
+ (unless (or (not spec)
+ (if details
+ (handler-case
+ (and (args-equal (car spec)
+ (car frame))
+ (equal (cdr spec) (cdr frame)))
+ (error (e)
+ (print (list :spec spec :frame frame))
+ (error e)))
+ (and (equal (car spec) (car frame))
+ (args-equal (cdr spec)
+ (cdr frame)))))
+ (print (list :wanted spec :got frame))
+ (setf result nil)))
+ frame-specs
+ backtrace)
+
+ ;; Make sure the backtrace isn't stunted in
+ ;; any way. (Depends on running in the main
+ ;; thread.) FIXME: On Windows we get two
+ ;; extra foreign frames below regular frames.
+ (unless (find (if details
+ '((sb-impl::toplevel-init) ())
+ '(sb-impl::toplevel-init))
+ backtrace
+ :test #'equal)
+ (print (list :backtrace-stunted backtrace))
+ (setf result nil))
+ (return-from outer-handler))))))