These are chat archives for rust-lang/rust

13th
Sep 2016
James Lucas
@AtheMathmo
Sep 13 2016 15:04
Excuse me while I talk about things I hardly understand - how easy would it be to access the function call stack for Rust?
Can I do this directly in Rust even?
Sergey Noskov
@Albibek
Sep 13 2016 15:06
in case of panic it's RUST_BACKTRACE=1 environment vairable
James Lucas
@AtheMathmo
Sep 13 2016 15:07
well I'm looking at doing some profiling stuff
I've been using a google profiler in the last few days and it's worked really well. I'm just wondering how easy it would be to do something similar in Rust
so I'd need to jump into the function call stack many times a second and record where the program is
Remi Rampin
@remram44
Sep 13 2016 15:34
The call stack looks like any call stack and whatever tool you use to do that should work for Rust programs as well
if you mean language support for it, I don't think there is that
(something like Java's Thread::getStackTrace())
James Lucas
@AtheMathmo
Sep 13 2016 15:36
@remram44 ok cool! I guess I can just directly port the tool if I ever want to then. Thanks
Remi Rampin
@remram44
Sep 13 2016 15:40
On the other hand Rust programs can get backtraces, which is how they print it when RUST_BACKTRACE=1 and an error occur. So there is support for that, it's just might not be super exposed
you might want to look in to libbacktrace: https://github.com/rust-lang/rust/tree/master/src/libbacktrace
but I read "As of September 2012, libbacktrace only supports ELF executables with DWARF debugging information. The library is written to make it straightforward to add support for other object file and debugging formats."
James Lucas
@AtheMathmo
Sep 13 2016 15:47
Thanks! That does look promising, hopefully I'll get some time to toy with it soon.
Peter Atashian
@retep998
Sep 13 2016 21:50