Many programming languages, including Java[3] and C#,[4] have built-in support for retrieving the current stack trace via system calls.
In Java, stack traces can be dumped manually with Thread.dumpStack()[5] Take the following input: The exception lists functions in descending order, so the most-inner call is first.
Both C and C++ (pre-C++23) do not have native support for obtaining stack traces, but libraries such as glibc and boost provide this functionality.
As of C++23, stack traces can be dumped manually by printing the value returned by static member function std::stacktrace::current():[8] Rust has two types of errors.
Functions that use the panic macro are "unrecoverable" and the current thread will become poisoned experiencing stack unwinding.
Rust supports printing to stderr when a thread panics, but it must be enabled by setting the RUST_BACKTRACE environment variable.