Rust: show stack on stack overflow?

cargo test test_00 -- --nocapture
    Finished test [optimized + debuginfo] target(s) in 0.10s
     Running [redacted]

size: Some(Rect2i64([Rect1i64([-2346, 2345]), Rect1i64([-1250, 1750])]))

thread 'test_00' has overflowed its stack
fatal runtime error: stack overflow
error: test failed, to rerun pass '--lib'

Is there a way to tell cargo/rust to print out the stack? I am trying to figure out what recursive call is causing the overflow.

You can run the code with gdb. It will stop at the stack overflow as if you had a breakpoint there, and you can then run bt to get a backtrace.


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.