diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2010-10-11 16:40:18 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2010-10-11 16:40:18 -0700 |
| commit | 94cec74096280509083798bfcbd1be169fd43562 (patch) | |
| tree | e10dbce1e72079b4ebddf5a9ad58a92776e92715 /src/rt/rust_task.cpp | |
| parent | 99086292ac50458244722aedbad53c5047214429 (diff) | |
| download | rust-94cec74096280509083798bfcbd1be169fd43562.tar.gz rust-94cec74096280509083798bfcbd1be169fd43562.zip | |
Try to print backtraces on failure
Diffstat (limited to 'src/rt/rust_task.cpp')
| -rw-r--r-- | src/rt/rust_task.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index 97eeb4bff5d..530e5997f55 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -4,6 +4,10 @@ #include "valgrind.h" #include "memcheck.h" +#ifndef __WIN32__ +#include <execinfo.h> +#endif + // Stacks // FIXME (issue #151): This should be 0x300; the change here is for @@ -366,6 +370,7 @@ void rust_task::fail(size_t nargs) { // See note in ::kill() regarding who should call this. dom->log(rust_log::TASK, "task %s @0x%" PRIxPTR " failing", name, this); + backtrace(); // Unblock the task so it can unwind. unblock(); if (this == dom->root_task) @@ -632,6 +637,18 @@ rust_task::log(uint32_t type_bits, char const *fmt, ...) { } } +void +rust_task::backtrace() { + if (!dom->get_log().is_tracing(rust_log::BT)) + return; + +#ifndef __WIN32__ + void *call_stack[256]; + int nframes = ::backtrace(call_stack, 256); + backtrace_symbols_fd(call_stack + 1, nframes - 1, 2); +#endif +} + rust_handle<rust_task> * rust_task::get_handle() { if (handle == NULL) { |
