Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
17
Task/Stack-traces/Racket/stack-traces.rkt
Normal file
17
Task/Stack-traces/Racket/stack-traces.rkt
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#lang racket
|
||||
|
||||
;; To see these calls we do two things: mutate the binding to prevent
|
||||
;; Racket from inlining the value; use a (void) call at the end so the
|
||||
;; calls are not tail calls (which will otherwise not show on the
|
||||
;; stack).
|
||||
(define foo #f)
|
||||
(set! foo (λ() (bar) (void)))
|
||||
(define bar #f)
|
||||
(set! bar (λ() (show-stacktrace) (void)))
|
||||
|
||||
(define (show-stacktrace)
|
||||
(for ([s (continuation-mark-set->context (current-continuation-marks))]
|
||||
[i (in-naturals)])
|
||||
;; show just the names, not the full source information
|
||||
(when (car s) (printf "~s: ~s\n" i (car s)))))
|
||||
(foo)
|
||||
Loading…
Add table
Add a link
Reference in a new issue