julia
4fe309ae - Integrate interpreter frames into backtraces (#23973)

Commit
8 years ago
Integrate interpreter frames into backtraces (#23973) Before: ``` julia> let error() end ERROR: Stacktrace: [1] error() at ./error.jl:44 ``` After: ``` julia> let error() end ERROR: Stacktrace: [1] error() at ./error.jl:44 [2] macro expansion at REPL[0]:2 [inlined] [3] In toplevel scope ``` The extra `macro expansion` frame is a pre-existing julia bug (#23971) that this PR doesn't address. The mechanism used here is to add a no-inline enter_interpreter stack frame that has a known stack layout (since it only has one local variable) and can thus be used to retrieve the interpreter state. I do not believe that this is guaranteed by the C standard, so depending on the whims of the compiler we may have to eventually write this function in assembly, but it seems to work well enough for now. One significant complication is that the backtrace buffer may now contain pointers to gc-managed data, so we need to make the gc aware that and can't be as non-chalant about copying the buffer around anymore.
Author
Committer
Parents
Loading