#lang racket/base
(define (baz foo)
(error 'whoops))
(define (bar ber)
(baz ber))
(define (foo ber)
(let ((a 3))
(if (and
(= a 3)
(= (* a 9) 27)
(bar ber)
(list? (list 1 2 3 4)))
ber
(not ber))))
(foo 42)
And I get an error message like this:
error: whoops
context...:
/extra/user/code/racket-stack.rkt: [running body]
That doesn't show the line number on which the error occurred, or even the location of the expression being evaluated. For a custom error, I could just grep through the code for "whoops", but for say an error like "string-append: contract violation" I may have many uses of string-append, and I might not be able to debug them if I can't tell what context they're being being evaluated in.
How do I enable uh, "working" stack traces? --no-jit just removes stack traces entirely. -W debug says the functions are being inlined, but doesn't debug info for the inlining specify what function was inlined? racket has no debug flag that I can find. Setting --disable-inline in raco and running the bytecode produces no information in the stack trace either.
Sometimes (unpredictably AFAIK) I do get /some/ line information, but it's at most the function that the error happened in, not the error itself which could be anywhere inside it or any inlined function.
$ racket -V
Welcome to Racket v6.2.1.
Please tell me I'm not gonna have to say Guido was right...
> Or if you insist on command line usage, use error trace.
What's wrong with command line usage? Anyway, I was going to say this:
http://docs.racket-lang.org/errortrace/using-errortrace.html
That seems to enable stack traces that work.