From 829df69f9f7a0dd0adbf072a47fd7c7600e75211 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 5 Feb 2014 15:19:40 -0800 Subject: Add basic backtrace functionality Whenever a failure happens, if a program is run with `RUST_LOG=std::rt::backtrace` a backtrace will be printed to the task's stderr handle. Stack traces are uncondtionally printed on double-failure and rtabort!(). This ended up having a nontrivial implementation, and here's some highlights of it: * We're bundling libbacktrace for everything but OSX and Windows * We use libgcc_s and its libunwind apis to get a backtrace of instruction pointers * On OSX we use dladdr() to go from an instruction pointer to a symbol * On unix that isn't OSX, we use libbacktrace to get symbols * Windows, as usual, has an entirely separate implementation Lots more fun details and comments can be found in the source itself. Closes #10128 --- src/libstd/rt/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/libstd/rt/mod.rs') diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs index 459bc061c56..a58826daa49 100644 --- a/src/libstd/rt/mod.rs +++ b/src/libstd/rt/mod.rs @@ -119,6 +119,12 @@ mod thread_local_storage; /// Stack unwinding pub mod unwind; +/// The interface to libunwind that rust is using. +mod libunwind; + +/// Simple backtrace functionality (to print on failure) +pub mod backtrace; + /// Just stuff mod util; -- cgit 1.4.1-3-g733a5