unsafe fn init_state() -> *mut backtrace_state {
        static mut STATE: *mut backtrace_state = ptr::null_mut();
        if !STATE.is_null() { return STATE }
        STATE = backtrace_create_state(ptr::null(), 0, error_cb,
                                       ptr::null_mut());
        STATE
    }
// The libbacktrace API supports creating a state, but it does not
// support destroying a state. I personally take this to mean that a
// state is meant to be created and then live forever.
//
// I would love to register an at_exit() handler which cleans up this
// state, but libbacktrace provides no way to do so.
//
// With these constraints, this function has a statically cached state
// that is calculated the first time this is requested. Remember that
// backtracing all happens serially (one global lock).
//
// Things don't work so well on not-Linux since libbacktrace can't track
// down that executable this is. We at one point used env::current_exe but
// it turns out that there are some serious security issues with that
// approach.
//
// Specifically, on certain platforms like BSDs, a malicious actor can cause
// an arbitrary file to be placed at the path returned by current_exe.
// libbacktrace does not behave defensively in the presence of ill-formed
// DWARF information, and has been demonstrated to segfault in at least one
// case. There is no evidence at the moment to suggest that a more carefully
// constructed file can't cause arbitrary code execution. As a result of all
// of this, we don't hint libbacktrace with the path to the current process.
The libbacktrace API supports creating a state, but it does not
support destroying a state. I personally take this to mean that a
state is meant to be created and then live forever.

I would love to register an at_exit() handler which cleans up this
state, but libbacktrace provides no way to do so.

With these constraints, this function has a statically cached state
that is calculated the first time this is requested. Remember that
backtracing all happens serially (one global lock).

Things don't work so well on not-Linux since libbacktrace can't track
down that executable this is. We at one point used env::current_exe but
it turns out that there are some serious security issues with that
approach.

Specifically, on certain platforms like BSDs, a malicious actor can cause
an arbitrary file to be placed at the path returned by current_exe.
libbacktrace does not behave defensively in the presence of ill-formed
DWARF information, and has been demonstrated to segfault in at least one
case. There is no evidence at the moment to suggest that a more carefully
constructed file can't cause arbitrary code execution. As a result of all
of this, we don't hint libbacktrace with the path to the current process.
The libbacktrace API supports creating a state but it does not support destroying a state . I personally take this to mean that a state is meant to be created and then live forever . I would love to register an at_exit () handler which cleans up this state but libbacktrace provides no way to do so . With these constraints this function has a statically cached state that is calculated the first time this is requested . Remember that backtracing all happens serially ( one global lock ) . Things don ' t work so well on not - Linux since libbacktrace can ' t track down that executable this is . We at one point used env :: current_exe but it turns out that there are some serious security issues with that approach . Specifically on certain platforms like BSDs a malicious actor can cause an arbitrary file to be placed at the path returned by current_exe . libbacktrace does not behave defensively in the presence of ill - formed DWARF information and has been demonstrated to segfault in at least one case . There is no evidence at the moment to suggest that a more carefully constructed file can ' t cause arbitrary code execution . As a result of all of this we don ' t hint libbacktrace with the path to the current process .
unsafe fn init_state() -> *mut backtrace_state {
        static mut STATE: *mut backtrace_state = ptr::null_mut();
        if !STATE.is_null() { return STATE }
        STATE = backtrace_create_state(ptr::null(), 0, error_cb,
                                       ptr::null_mut());
        STATE
    }
unsafe fn init_state ( ) -> * mut backtrace_state { static mut STATE : * mut backtrace_state = ptr :: null_mut ( ) ; if ! STATE . is_null ( ) { return STATE } STATE = backtrace_create_state ( ptr :: null ( ) , 0 , error_cb , ptr :: null_mut ( ) ) ; STATE }
The libbacktrace API supports creating a state, but it does not
support destroying a state.
The libbacktrace API supports creating a state but it does not support destroying a state .