|
40 | 40 | //! }
|
41 | 41 | //! # }
|
42 | 42 | //! ```
|
| 43 | +//! |
| 44 | +//! # Backtrace accuracy |
| 45 | +//! |
| 46 | +//! This crate implements best-effort attempts to get the native backtrace. This |
| 47 | +//! is not always guaranteed to work, and some platforms don't return any |
| 48 | +//! backtrace at all. If your application requires accurate backtraces then it's |
| 49 | +//! recommended to closely evaluate this crate to see whether it's suitable |
| 50 | +//! for your use case on your target platforms. |
| 51 | +//! |
| 52 | +//! Even on supported platforms, there's a number of reasons that backtraces may |
| 53 | +//! be less-than-accurate, including but not limited to: |
| 54 | +//! |
| 55 | +//! * Unwind information may not be available. This crate primarily implements |
| 56 | +//! backtraces by unwinding the stack, but not all functions may have |
| 57 | +//! unwinding information (e.g. DWARF unwinding information). |
| 58 | +//! |
| 59 | +//! * Rust code may be compiled without unwinding information for some |
| 60 | +//! functions. This can also happen for Rust code compiled with |
| 61 | +//! `-Cpanic=abort`. You can remedy this, however, with |
| 62 | +//! `-Cforce-unwind-tables` as a compiler option. |
| 63 | +//! |
| 64 | +//! * Unwind information may be inaccurate or corrupt. In the worst case |
| 65 | +//! inaccurate unwind information can lead this library to segfault. In the |
| 66 | +//! best case inaccurate information will result in a truncated stack trace. |
| 67 | +//! |
| 68 | +//! * Backtraces may not report filenames/line numbers correctly due to missing |
| 69 | +//! or corrupt debug information. This won't lead to segfaults unlike corrupt |
| 70 | +//! unwinding information, but missing or malformed debug information will |
| 71 | +//! mean that filenames and line numbers will not be available. This may be |
| 72 | +//! because debug information wasn't generated by the compiler, or it's just |
| 73 | +//! missing on the filesystem. |
| 74 | +//! |
| 75 | +//! * Not all platforms are supported. For example there's no way to get a |
| 76 | +//! backtrace on WebAssembly at the moment. |
| 77 | +//! |
| 78 | +//! * Crate features may be disabled. Currently this crate supports using Gimli |
| 79 | +//! libbacktrace on non-Windows platforms for reading debuginfo for |
| 80 | +//! backtraces. If both crate features are disabled, however, then these |
| 81 | +//! platforms will generate a backtrace but be unable to generate symbols for |
| 82 | +//! it. |
| 83 | +//! |
| 84 | +//! In most standard workflows for most standard platforms you generally don't |
| 85 | +//! need to worry about these caveats. We'll try to fix ones where we can over |
| 86 | +//! time, but otherwise it's important to be aware of the limitations of |
| 87 | +//! unwinding-based backtraces! |
43 | 88 |
|
44 | 89 | #![doc(html_root_url = "https://docs.rs/backtrace")]
|
45 | 90 | #![deny(missing_docs)]
|
|
0 commit comments