Logo

Programming-Idioms

Print the stack frames of the current execution thread of the program.
New implementation

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating material.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
import "runtime/debug"
debug.PrintStack()
import GHC.Stack
msgStacktraced :: HasCallStack => String -> IO ()
msgStacktraced msg = putStrLn (msg ++ "\n" ++ prettyCallStack callStack)
console.trace()
for(StackTraceElement stackTraceElement : Thread.currentThread().getStackTrace()) {
	System.out.println(stackTraceElement.toString());
}
dump_stack(stdout,0);
import Carp 'cluck';
cluck 'print this message and a full stack track';
import inspect
for frame in inspect.stack():
    print(frame)
puts caller
use backtrace::Backtrace;
let bt = Backtrace::new();
println!("{:?}", bt);