Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
Select your favorite languages :
  • Or search :

Idiom #253 Print stack trace

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

import inspect
for frame in inspect.stack():
    print(frame)
import "runtime/debug"
debug.PrintStack()
import GHC.Stack
msgStacktraced :: HasCallStack => String -> IO ()
msgStacktraced msg = putStrLn (msg ++ "\n" ++ prettyCallStack callStack)
console.trace()
dump_stack(stdout,0);
puts caller
use backtrace::Backtrace;
let bt = Backtrace::new();
println!("{:?}", bt);

New implementation...
< >
programming-idioms.org