(use-modules (knots))

(define (do-sort)
  (begin
    (sort '(1 2 3)
          (lambda _
            (+ 1 'a)))         ; LAST BACKTRACE ENTRY HERE
    'unreachable))

;; FIRST BACKTRACE ENTRY: (with-exception-handler
(with-exception-handler
    (lambda (exn)
      (print-backtrace-and-exception/knots exn)
      (primitive-exit 1))
  (lambda ()
    (call-with-temporary-thread
     (lambda ()
       (do-sort)
       'done))))
