1 ;;;; This file is for testing backtraces, using test machinery which
2 ;;;; might have side effects (e.g. executing DEFUN).
4 ;;;; This software is part of the SBCL system. See the README file for
7 ;;;; While most of SBCL is derived from the CMU CL system, the test
8 ;;;; files (like this one) were written from scratch after the fork
11 ;;;; This software is in the public domain and is provided with
12 ;;;; absolutely no warranty. See the COPYING and CREDITS files for
13 ;;;; more information.
15 (cl:in-package
:cl-user
)
17 ;;; The following objects should be EQUALP to the respective markers
18 ;;; produced by the backtrace machinery.
20 (defvar *unused-argument
*
21 (sb-debug::make-unprintable-object
"unused argument"))
23 (defvar *unavailable-argument
*
24 (sb-debug::make-unprintable-object
"unavailable argument"))
26 (defvar *unavailable-more
*
27 (sb-debug::make-unprintable-object
"more unavailable arguments"))
29 (defvar *unavailable-lambda-list
*
30 (sb-debug::make-unprintable-object
"unavailable lambda list"))
32 ;;; TEST-FUNCTION is called and has to signal an error at which point
33 ;;; the backtrace will be captured.
35 ;;; If DETAILS is true, the returned backtrace description is of the
38 ;;; (((NAME1 . ARGS1) INFO1)
39 ;;; ((NAME2 . ARGS2) INFO2)
42 ;;; Otherwise it is of the form
48 (defun call-with-backtrace (cont test-function
&key details
)
49 (flet ((capture-it (condition)
51 (sb-debug:map-backtrace
53 (multiple-value-bind (name args info
)
54 (sb-debug::frame-call frame
)
56 (list (cons name args
) info
)
59 (funcall cont
(nreverse backtrace
) condition
))))
60 (handler-bind ((error #'capture-it
))
61 (funcall test-function
))))
63 ;;; Check the backtrace FRAMES against the list of frame
64 ;;; specifications EXPECTED signaling an error if they do not match.
66 ;;; If DETAILS is true, EXPECTED is a list with elements of the form
68 ;;; ((FUNCTION ARGS) INFO)
70 ;;; Otherwise elements are of the form
74 ;;; ARGS is a list of expected argument values, but can also contain
75 ;;; the following symbols
77 ;;; &REST The corresponding frame in FRAMES can contain an arbitrary
78 ;;; number of arguments starting at the corresponding
81 ;;; ? The corresponding frame in FRAMES can have an arbitrary
82 ;;; argument at the corresponding position.
83 (defun check-backtrace (frames expected
&key details
)
84 (labels ((args-equal (want actual
)
85 (cond ((eq want
*unavailable-lambda-list
*)
87 ((eq '&rest
(car want
))
91 ((or (eq '?
(car want
)) (equal (car want
) (car actual
)))
92 (args-equal (cdr want
) (cdr actual
)))
93 ((typep (car want
) 'sb-debug
::unprintable-object
)
94 (equalp (car want
) (car actual
)))
97 (fail (datum &rest arguments
)
98 (return-from check-backtrace
99 (values nil
(apply #'sb-kernel
:coerce-to-condition
100 datum
'simple-error
'error arguments
)))))
101 (mapc (lambda (frame spec
)
106 (and (args-equal (car spec
)
108 (equal (cdr spec
) (cdr frame
))))
110 (and (equal (car spec
) (car frame
))
111 (args-equal (cdr spec
) (cdr frame
)))))
112 (fail "~@<Unexpected frame during ~
113 ~:[non-detailed~:;detailed~] check: wanted ~S, got ~
115 details spec frame
)))
119 ;;; Check for backtraces generally being correct. Ensure that the
120 ;;; actual backtrace finishes (doesn't signal any errors on its own),
121 ;;; and that it contains the frames we expect, doesn't contain any
122 ;;; "bogus stack frame"s, and contains the appropriate toplevel call
123 ;;; and hasn't been cut off anywhere.
125 ;;; See CHECK-BACKTRACE for an explanation of the structure
127 (defun verify-backtrace (test-function expected-frames
&key details
129 (labels ((find-frame (function-name frames
)
130 (member function-name frames
131 :key
(if details
#'caar
#'car
)
133 (fail (datum &rest arguments
)
134 (return-from verify-backtrace
135 (let ((c (apply #'sb-kernel
:coerce-to-condition datum
'simple-error
'error arguments
)))
140 (lambda (backtrace condition
)
141 (declare (ignore condition
))
142 (let* ((test-function-name (if details
143 (caaar expected-frames
)
144 (caar expected-frames
)))
145 (frames (or (find-frame test-function-name backtrace
)
146 (fail "~@<~S (expected name ~S) not found in ~
147 backtrace:~@:_~a~@:>"
148 test-function test-function-name
149 (princ-to-string backtrace
)))))
150 ;; Check that we have all the frames we wanted.
151 (multiple-value-bind (successp condition
)
152 (check-backtrace frames expected-frames
:details details
)
153 (unless successp
(fail condition
)))
154 ;; Make sure the backtrace isn't stunted in any way.
155 ;; (Depends on running in the main thread.) FIXME: On Windows
156 ;; we get two extra foreign frames below regular frames.
157 (unless (find-frame 'sb-impl
::toplevel-init frames
)
158 (fail "~@<Backtrace stunted:~@:_~a~@:>" (princ-to-string backtrace
))))
159 (return-from verify-backtrace t
))
160 test-function
:details details
)))
162 (defun assert-backtrace (test-function expected-frames
&key details
)
163 (verify-backtrace test-function expected-frames
:details details
166 (defvar *p
* (namestring (if sb-c
::*merge-pathnames
* *load-truename
* *load-pathname
*)))
168 (defvar *undefined-function-frame
*
169 '("undefined function"))
174 ;;; Test for "undefined function" (undefined_tramp) working properly.
175 ;;; Try it with and without tail call elimination, since they can have
176 ;;; different effects. (Specifically, if undefined_tramp is incorrect
177 ;;; a stunted stack can result from the tail call variant.)
179 (declare (optimize (speed 2) (debug 1))) ; tail call elimination
180 (declare (muffle-conditions style-warning
))
181 (#:undefined-function
42))
183 (declare (optimize (speed 1) (debug 3))) ; no tail call elimination
184 (declare (muffle-conditions style-warning
))
185 (#:undefined-function
42))
187 (declare (optimize (speed 1) (debug 3))) ; no tail call elimination
190 (with-test (:name
(:backtrace
:undefined-function
:bug-346
)
191 :skipped-on
:interpreter
192 ;; Failures on SPARC are due to
193 ;; not having a full and valid stack frame for the
194 ;; undefined function frame. See PPC
195 ;; undefined_tramp for details.
198 (lambda () (test #'optimized
))
199 (list (append *undefined-function-frame
* '(42))
200 (list `(flet test
:in
,*p
*) #'optimized
))))
202 ;; bug 353: This test fails at least most of the time for x86/linux
203 ;; ca. 0.8.20.16. -- WHN
204 (with-test (:name
(:backtrace
:undefined-function
:bug-353
)
205 :skipped-on
:interpreter
)
207 (lambda () (test #'not-optimized
))
208 (list (append *undefined-function-frame
* '(42))
209 (list `(flet not-optimized
:in
,*p
*))
210 (list `(flet test
:in
,*p
*) #'not-optimized
)))))
212 (with-test (:name
(:backtrace
:interrupted-condition-wait
)
213 :skipped-on
(not :sb-thread
)
214 :broken-on
:sb-safepoint
) ;; unreliable
215 (let ((m (sb-thread:make-mutex
))
216 (q (sb-thread:make-waitqueue
)))
219 (sb-thread:with-mutex
(m)
220 (handler-bind ((timeout (lambda (condition)
221 (declare (ignore condition
))
224 (sb-thread:condition-wait q m
)))))
225 `((sb-thread::%condition-wait
,q
,m t nil nil nil nil nil nil
)))))
227 ;;; Division by zero was a common error on PPC. It depended on the
228 ;;; return function either being before INTEGER-/-INTEGER in memory,
229 ;;; or more than MOST-POSITIVE-FIXNUM bytes ahead. It also depends on
230 ;;; INTEGER-/-INTEGER calling SIGNED-TRUNCATE. I believe Raymond Toy
231 ;;; says that the Sparc backend (at least for CMUCL) inlines this, so
232 ;;; if SBCL does the same this test is probably not good for the
235 ;;; Disabling tail call elimination on this will probably ensure that
236 ;;; the return value (to the flet or the enclosing top level form) is
237 ;;; more than MOST-POSITIVE-FIXNUM with the current spaces on OS X.
238 ;;; Enabling it might catch other problems, so do it anyway.
240 (declare (optimize (speed 2) (debug 1))) ; tail call elimination
241 (declare (muffle-conditions style-warning
))
244 (declare (optimize (speed 1) (debug 3))) ; no tail call elimination
245 (declare (muffle-conditions style-warning
))
248 (declare (optimize (speed 1) (debug 3))) ; no tail call elimination
251 (with-test (:name
(:backtrace
:divide-by-zero
:bug-346
)
252 :skipped-on
:interpreter
)
253 (assert-backtrace (lambda () (test #'optimized
))
254 `((sb-kernel::integer-
/-integer
42 &rest
)
255 ((flet test
:in
,*p
*) ,#'optimized
))))
257 (with-test (:name
(:backtrace
:divide-by-zero
:bug-356
)
258 :skipped-on
:interpreter
)
259 (assert-backtrace (lambda () (test #'not-optimized
))
260 `((sb-kernel::integer-
/-integer
42 &rest
)
261 ((flet not-optimized
:in
,*p
*))
262 ((flet test
:in
,*p
*) ,#'not-optimized
)))))
265 (throw 'no-such-tag t
))
266 (with-test (:name
(:backtrace
:throw
:no-such-tag
)
267 :fails-on
(or :mips
(and :sparc
:linux
)))
268 (assert-backtrace #'throw-test
'((throw-test))))
270 (funcall (checked-compile
272 (defun bug-308926 (x)
279 :allow-style-warnings t
))
280 (with-test (:name
(:backtrace
:bug-308926
) :skipped-on
:interpreter
)
281 (assert-backtrace (lambda () (bug-308926 13))
282 '(((flet bar
:in bug-308926
) 13)
283 (bug-308926 &rest t
))))
285 ;;; Test backtrace through assembly routines
287 (macrolet ((test (predicate fun
289 (find-symbol (format nil
"TWO-ARG-~A" fun
)
291 (let ((test-name (make-symbol (format nil
"TEST-~A" fun
))))
292 `(flet ((,test-name
(x y
)
293 ;; make sure it's not in tail position
295 (with-test (:name
(:backtrace
:bug-800343
,fun
)
296 :skipped-on
:interpreter
)
299 (eval `(funcall ,#',test-name
42 t
)))
303 `((,(find-symbol (format nil
"GENERIC-~A" fun
) "SB-VM"))))
304 ((flet ,(string test-name
) :in
,*p
*) 42 t
)))))))
305 (test-predicates (&rest functions
)
306 `(progn ,@(mapcar (lambda (function)
307 `(test t
,@(sb-int:ensure-list function
)))
309 (test-functions (&rest functions
)
310 `(progn ,@(mapcar (lambda (function)
311 `(test nil
,@(sb-int:ensure-list function
)))
313 (test-predicates = < >)
314 (test-functions + -
* /
316 (logand sb-kernel
:two-arg-and
)
317 (logior sb-kernel
:two-arg-ior
)
318 (logxor sb-kernel
:two-arg-xor
)))
320 ;;; test entry point handling in backtraces
322 (with-test (:name
(:backtrace
:xep-too-many-arguments
)
323 :skipped-on
:interpreter
)
324 ;; CHECKED-COMPILE avoids STYLE-WARNING noise.
325 (assert-backtrace (checked-compile '(lambda () (oops 1 2 3 4 5 6))
326 :allow-style-warnings t
)
327 '((oops ? ? ? ? ? ?
))))
329 (defmacro defbt
(n ll
&body body
)
330 ;; WTF is this? This is a way to make these tests not depend so much on the
331 ;; details of LOAD/EVAL. Around 1.0.57 we changed %SIMPLE-EVAL to be
332 ;; slightly smarter, which meant that things which used to have xeps
333 ;; suddenly had tl-xeps, etc. This takes care of that.
339 (defun ,(intern (format nil
"BT.~A.1" n
)) ,ll
341 ;; no arguments saved
342 (defun ,(intern (format nil
"BT.~A.2" n
)) ,ll
343 (declare (optimize (debug 1) (speed 3)))
345 ;; no lambda-list saved
346 (defun ,(intern (format nil
"BT.~A.3" n
)) ,ll
347 (declare (optimize (debug 0)))
348 (let (*) ;; disable tail calls enabled by debug-0
350 :allow-style-warnings t
)))
358 (defbt 3 (&key
(key (oops)))
361 ;;; ERROR instead of OOPS so that tail call elimination doesn't happen
362 (defbt 4 (&optional opt
)
363 (list (error "error")))
365 (defbt 5 (&optional
(opt (oops)))
368 (defbt 6 (&optional
(opt nil opt-p
))
369 (declare (ignore opt
))
370 (list (error "error ~A" opt-p
))) ; use OPT-P
372 (defbt 7 (&key
(key nil key-p
))
373 (declare (ignore key
))
374 (list (error "error ~A" key-p
))) ; use KEY-P
377 (error "XEPs in backtraces: ~S" x
))
379 (with-test (:name
(:backtrace
:bug-354
))
380 (assert (not (verify-backtrace (lambda () (bug-354 354))
382 (((bug-354 &rest
) (:tl
:external
)) 354)))))
383 (assert-backtrace (lambda () (bug-354 354)) '((bug-354 354))))
385 ;;; FIXME: This test really should be broken into smaller pieces
386 (with-test (:name
(:backtrace
:tl-xep
))
387 (assert-backtrace #'namestring
'(((namestring) (:external
))) :details t
)
388 (assert-backtrace #'namestring
'((namestring))))
390 (with-test (:name
(:backtrace
:more-processor
))
391 ;; CHECKED-COMPILE avoids STYLE-WARNING noise.
392 (assert-backtrace (checked-compile '(lambda () (bt.1.1 :key
))
393 :allow-style-warnings t
)
394 '(((bt.1.1 :key
) (:more
)))
396 (assert-backtrace (checked-compile '(lambda () (bt.1.2 :key
))
397 :allow-style-warnings t
)
398 '(((bt.1.2 ?
) (:more
)))
400 (assert-backtrace (lambda () (bt.1.3 :key
))
401 `(((bt.1.3 ,*unavailable-more
*) (:more
)))
403 (assert-backtrace (checked-compile '(lambda () (bt.1.1 :key
))
404 :allow-style-warnings t
)
406 (assert-backtrace (checked-compile '(lambda () (bt.1.2 :key
))
407 :allow-style-warnings t
)
409 (assert-backtrace (lambda () (bt.1.3 :key
))
412 (with-test (:name
(:backtrace
:xep
))
413 (assert-backtrace #'bt
.2.1 '(((bt.2.1) (:external
))) :details t
)
414 (assert-backtrace #'bt
.2.2 '(((bt.2.2) (:external
))) :details t
)
415 (assert-backtrace #'bt
.2.3 `(((bt.2.3) (:external
))) :details t
)
416 (assert-backtrace #'bt
.2.1 '((bt.2.1)))
417 (assert-backtrace #'bt
.2.2 '((bt.2.2)))
418 (assert-backtrace #'bt
.2.3 `((bt.2.3))))
420 ;;; This test is somewhat deceptively named. Due to confusion in debug
421 ;;; naming these functions used to have sb-c::varargs-entry debug
422 ;;; names for their main lambda.
423 (with-test (:name
(:backtrace
:varargs-entry
))
424 (assert-backtrace #'bt
.3.1 '((bt.3.1 :key nil
)))
425 (assert-backtrace #'bt
.3.2 '((bt.3.2 :key ?
)))
426 (assert-backtrace #'bt
.3.3 `((bt.3.3 :key
,*unavailable-argument
*)))
427 (assert-backtrace #'bt
.3.1 '((bt.3.1 :key nil
)))
428 (assert-backtrace #'bt
.3.2 '((bt.3.2 :key ?
)))
429 (assert-backtrace #'bt
.3.3 `((bt.3.3 :key
,*unavailable-argument
*))))
431 ;;; This test is somewhat deceptively named. Due to confusion in debug naming
432 ;;; these functions used to have sb-c::hairy-args-processor debug names for
433 ;;; their main lambda.
434 (with-test (:name
(:backtrace
:hairy-args-processor
))
435 (assert-backtrace #'bt
.4.1 '((bt.4.1 ?
)))
436 (assert-backtrace #'bt
.4.2 '((bt.4.2 ?
)))
437 (assert-backtrace #'bt
.4.3 `((bt.4.3 ,*unused-argument
*)))
438 (assert-backtrace #'bt
.4.1 '((bt.4.1 ?
)))
439 (assert-backtrace #'bt
.4.2 '((bt.4.2 ?
)))
440 (assert-backtrace #'bt
.4.3 `((bt.4.3 ,*unused-argument
*))))
442 (with-test (:name
(:backtrace
:optional-processor
))
443 (assert-backtrace #'bt
.5.1 '(((bt.5.1) (:optional
))) :details t
)
444 (assert-backtrace #'bt
.5.2 '(((bt.5.2) (:optional
))) :details t
)
445 (assert-backtrace #'bt
.5.3 `(((bt.5.3) (:optional
)))
447 (assert-backtrace #'bt
.5.1 '((bt.5.1)))
448 (assert-backtrace #'bt
.5.2 '((bt.5.2)))
449 (assert-backtrace #'bt
.5.3 `((bt.5.3))))
451 (with-test (:name
(:backtrace
:unused-optional-with-supplied-p
:bug-1498644
))
452 (assert-backtrace (lambda () (bt.6.1 :opt
))
453 `(((bt.6.1 ,*unused-argument
*) ()))
455 (assert-backtrace (lambda () (bt.6.2 :opt
))
456 `(((bt.6.2 ,*unused-argument
*) ()))
458 (assert-backtrace (lambda () (bt.6.3 :opt
))
459 `(((bt.6.3 ,*unused-argument
*) ()))
461 (assert-backtrace (lambda () (bt.6.1 :opt
))
462 `((bt.6.1 ,*unused-argument
*)))
463 (assert-backtrace (lambda () (bt.6.2 :opt
))
464 `((bt.6.2 ,*unused-argument
*)))
465 (assert-backtrace (lambda () (bt.6.3 :opt
))
466 `((bt.6.3 ,*unused-argument
*))))
468 (with-test (:name
(:backtrace
:unused-key-with-supplied-p
))
469 (assert-backtrace (lambda () (bt.7.1 :key
:value
))
470 `(((bt.7.1 :key
,*unused-argument
*) ()))
472 (assert-backtrace (lambda () (bt.7.2 :key
:value
))
473 `(((bt.7.2 :key
,*unused-argument
*) ()))
475 (assert-backtrace (lambda () (bt.7.3 :key
:value
))
476 `(((bt.7.3 :key
,*unused-argument
*) ()))
478 (assert-backtrace (lambda () (bt.7.1 :key
:value
))
479 `((bt.7.1 :key
,*unused-argument
*)))
480 (assert-backtrace (lambda () (bt.7.2 :key
:value
))
481 `((bt.7.2 :key
,*unused-argument
*)))
482 (assert-backtrace (lambda () (bt.7.3 :key
:value
))
483 `((bt.7.3 :key
,*unused-argument
*))))
485 (defvar *compile-nil-error
*
486 (checked-compile '(lambda (x)
487 (cons (when x
(error "oops")) nil
))))
488 (defvar *compile-nil-non-tc
*
489 (checked-compile '(lambda (y)
490 (cons (funcall *compile-nil-error
* y
) nil
))))
491 (with-test (:name
(:backtrace compile nil
))
492 (assert-backtrace (lambda () (funcall *compile-nil-non-tc
* 13))
493 `(((lambda (x) :in
,*p
*) 13)
494 ((lambda (y) :in
,*p
*) 13))))
496 (with-test (:name
(:backtrace
:clos-slot-typecheckfun-named
))
500 (locally (declare (optimize safety
))
501 (defclass clos-typecheck-test
()
502 ((slot :type fixnum
)))
503 (setf (slot-value (make-instance 'clos-typecheck-test
) 'slot
) t
))))
504 '(((sb-pcl::slot-typecheck fixnum
) t
))))
506 (with-test (:name
(:backtrace
:clos-emf-named
))
511 (defgeneric clos-emf-named-test
(x)
512 (:method
((x symbol
)) x
)
513 (:method
:before
(x) (assert x
)))
514 (clos-emf-named-test nil
)))
515 :allow-style-warnings t
)
516 '(((sb-pcl::emf clos-emf-named-test
) ? ? nil
))))
518 (with-test (:name
(:backtrace
:bug-310173
))
520 (let* ((names '(a b
))
521 (req (loop repeat n collect
(pop names
))))
523 `(lambda (,@req
&rest rest
)
524 (let ((* *)) ; no tail-call
525 (apply '/ ,@req rest
)))))))
526 (assert-backtrace (lambda ()
527 (funcall (make-fun 0) 10 11 0))
528 `((sb-kernel:two-arg-
/ 10/11 0)
530 ((lambda (&rest rest
) :in
,*p
*) 10 11 0)))
531 (assert-backtrace (lambda ()
532 (funcall (make-fun 1) 10 11 0))
533 `((sb-kernel:two-arg-
/ 10/11 0)
535 ((lambda (a &rest rest
) :in
,*p
*) 10 11 0)))
536 (assert-backtrace (lambda ()
537 (funcall (make-fun 2) 10 11 0))
538 `((sb-kernel:two-arg-
/ 10/11 0)
540 ((lambda (a b
&rest rest
) :in
,*p
*) 10 11 0)))))
542 (defgeneric gf-dispatch-test
/gf
(x y
)
543 (:method
((x integer
) (y integer
))
545 (defun gf-dispatch-test/f
(z)
546 (declare (muffle-conditions style-warning
))
547 (gf-dispatch-test/gf z
))
548 (with-test (:name
(:backtrace
:gf-dispatch
))
550 (gf-dispatch-test/gf
1 1)
551 ;; Wrong argument count
552 (assert-backtrace (lambda () (gf-dispatch-test/f
42))
553 '((gf-dispatch-test/gf
42))))
555 (defgeneric gf-default-only-test
/gf
(x y
)
556 (:method
(x y
) (+ x y
)))
557 (defun gf-default-only-test/f
(z)
558 (declare (muffle-conditions style-warning
))
559 (gf-default-only-test/gf z
))
560 (with-test (:name
(:backtrace
:default-only
))
561 (gf-default-only-test/gf
1 1)
562 (assert-backtrace (lambda () (gf-default-only-test/f
42))
563 '(((sb-pcl::default-only gf-default-only-test
/gf
) 42))))
565 (with-test (:name
(:backtrace
:local-tail-call
))
567 (lambda () (funcall (compile nil
`(sb-int:named-lambda test
()
570 (declare (notinline tail
))
574 (defun fact (n) (if (zerop n
) (error "nope") (* n
(fact (1- n
)))))
577 (with-test (:name
(:backtrace
:interpreted-factorial
)
578 :skipped-on
(not :interpreter
))
582 (sb-interpreter::2-arg-
* &rest
)
584 (sb-interpreter::2-arg-
* &rest
)
586 (sb-interpreter::2-arg-
* &rest
)
588 (sb-interpreter::2-arg-
* &rest
)
590 (sb-interpreter::2-arg-
* &rest
)
593 (with-test (:name
:deleted-args
)
594 (let ((fun (checked-compile `(lambda (&rest ignore
)
595 (declare (ignore ignore
))
597 (assert (typep (block nil
598 (handler-bind ((error
601 (sb-debug:list-backtrace
))))))
605 (defun mega-string-replace-fail (x)
606 (let ((string (make-string 10000 :initial-element
#\z
))
607 (stream (make-string-output-stream)))
610 ((condition (lambda (c)
612 (sb-debug:print-backtrace
:stream stream
)
615 (get-output-stream-string stream
)))
617 (with-test (:name
:long-string-abbreviation
)
618 (let ((backtrace (mega-string-replace-fail '(#\-
1))))
619 (assert (search (concatenate 'string
621 (make-string 199 :initial-element
#\z
)
625 (defclass cannot-print-this
() ())
626 (defmethod print-object ((object cannot-print-this
) stream
)
629 (with-test (:name
(sb-debug:print-backtrace
:no-error print-object
))
630 ;; Errors during printing objects used to be suppressed in a way
631 ;; that required outer condition handlers to behave in a specific
633 (handler-bind ((error (lambda (condition)
634 (error "~@<~S signaled ~A.~@:>"
635 'sb-debug
:print-backtrace condition
))))
636 (with-output-to-string (stream)
641 (sb-debug:print-backtrace
:count
100 :stream stream
642 :emergency-best-effort t
))))
643 (foo 100 (make-instance 'cannot-print-this
))))))
645 (with-test (:name
(sb-debug:print-backtrace
:no-error
:circles
))
646 ;; Errors during printing objects used to be suppressed in a way
647 ;; that required outer condition handlers to behave in a specific
649 (handler-bind ((error (lambda (condition)
650 (error "~@<~S signaled ~A.~@:>"
651 'sb-debug
:print-backtrace condition
))))
652 (with-output-to-string (stream)
657 (sb-debug:print-backtrace
:count
100 :stream stream
))))
658 (foo 100 (let ((list (list t
)))
659 (nconc list list
)))))))
661 (with-test (:name
:uninitialized-optionals
)
662 (let ((fun (checked-compile
663 `(lambda (l &optional m n
)
666 (checked-compile-and-assert
668 `(lambda (fun &rest args
)
670 (handler-bind ((error
673 (return (cdar (sb-debug:list-backtrace
:count
1))))))
675 ((fun t
) (list t
*unavailable-argument
* *unavailable-argument
*) :test
#'equalp
)
676 ((fun t
1) (list t
1 *unavailable-argument
*) :test
#'equalp
)
677 ((fun t
1 2) (list t
1 2) :test
#'equalp
)
678 ((fun 1 2 3) (values 1 2 3)))))