Rust linux x86: dump stack, continue executing

Unlike many of my previous questions, this is Linux/x86, not wasm.

  1. When I use todo!(), panic!(), unimplemented!(), Rust dumps a very helpful stack trace (that I can click on in IntelliJ and jump to the right filename / line number), and kills the execution.

  2. When I use return Err(...) in a function returning a Result<...>, execution continues but I lose the "info at time of error."

Question: Is there some builtin macro that will dump a stacktrace in the same way as todo! / panic! / unimplemented! ... but then continue execution?

My goal here is that the program continues executing, returning the Result<...>, as I would want in production -- but during dev time, I'd like all the stack traces dumped out to stdout so I can click on stuff.

You can create a Backtrace at will. Some error crates will also capture backtraces for you, like error-chain and failure.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.