From ebc6474668ec60cc793af0f48143bf33d984deb4 Mon Sep 17 00:00:00 2001 From: Valerii Hiora Date: Fri, 13 Jun 2014 10:18:12 +0300 Subject: Cosmetic fixes & comments --- src/libstd/rt/backtrace.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/rt/backtrace.rs b/src/libstd/rt/backtrace.rs index 16b598b3ae7..0e3e7cc796a 100644 --- a/src/libstd/rt/backtrace.rs +++ b/src/libstd/rt/backtrace.rs @@ -248,6 +248,11 @@ mod imp { /// _Unwind_Backtrace is even not available there. Still, /// backtraces could be extracted using a backtrace function, /// which thanks god is public + /// + /// As mentioned in a huge comment block above, backtrace doesn't + /// play well with green threads, so while it is extremely nice + /// and simple to use it should be used only on iOS devices as the + /// only viable option. #[cfg(target_os = "ios", target_arch = "arm")] #[inline(never)] pub fn write(w: &mut Writer) -> IoResult<()> { @@ -267,9 +272,9 @@ mod imp { try!(writeln!(w, "stack backtrace:")); // 100 lines should be enough - static size: libc::c_int = 100; - let mut buf: [*libc::c_void, ..size] = unsafe {mem::zeroed()}; - let cnt = unsafe { backtrace(buf.as_mut_ptr(), size) as uint}; + static SIZE: libc::c_int = 100; + let mut buf: [*libc::c_void, ..SIZE] = unsafe {mem::zeroed()}; + let cnt = unsafe { backtrace(buf.as_mut_ptr(), SIZE) as uint}; // skipping the first one as it is write itself result::fold_(range(1, cnt).map(|i| { -- cgit 1.4.1-3-g733a5