summaryrefslogtreecommitdiff
path: root/src/mongo/util/stacktrace.cpp
diff options
context:
space:
mode:
authorEric Milkie <milkie@10gen.com>2012-05-24 13:47:48 -0400
committerEric Milkie <milkie@10gen.com>2012-05-24 13:48:36 -0400
commita7be5e92b29cf21ccee24ab26fbdb8c76082eb2c (patch)
treecf2868347666eb3a64a37e22f9d7dbc5b56f9514 /src/mongo/util/stacktrace.cpp
parent229931979ff59c9092bc39de9f5e72a35207a74e (diff)
downloadmongo-a7be5e92b29cf21ccee24ab26fbdb8c76082eb2c.tar.gz
Revert "SERVER-5852 use libunwind routines for backtrace on freebsd"
This reverts commit e6f9efc3c372f5bc8871df838c6e891117655a88. This may be resubmitted as a generic replacement for backtrace() on all platforms, rather than just FreeBSD.
Diffstat (limited to 'src/mongo/util/stacktrace.cpp')
-rw-r--r--src/mongo/util/stacktrace.cpp47
1 files changed, 0 insertions, 47 deletions
diff --git a/src/mongo/util/stacktrace.cpp b/src/mongo/util/stacktrace.cpp
index 37aececd958..4e4687217d5 100644
--- a/src/mongo/util/stacktrace.cpp
+++ b/src/mongo/util/stacktrace.cpp
@@ -34,53 +34,6 @@ namespace mongo {
}
}
-#elif MONGO_HAVE_UNWIND_BACKTRACE
-
-// This makes libunwind only work for within the
-// current process, but that's what we want anyway.
-#define UNW_LOCAL_ONLY
-
-#include <libunwind.h>
-
-namespace mongo {
- static const int maxBackTraceFrames = 20;
-
- void printStackTrace( std::ostream &os ) {
- unw_context_t stack;
- unw_cursor_t cursor;
-
- int status = unw_getcontext(&stack);
- if (status != 0) {
- os << "unw_getcontext failed: " << status << std::endl;
- return;
- }
- status = unw_init_local(&cursor, &stack);
- if (status != 0) {
- os << "unw_init_local failed: " << status << std::endl;
- return;
- }
- for ( int depth = 0; (depth < maxBackTraceFrames && unw_step(&cursor) != 0); ++depth ) {
- unw_word_t offset;
- unw_word_t pc;
- char fname[128];
-
- status = unw_get_reg(&cursor, UNW_REG_IP, &pc);
- if (status != 0) {
- os << "unw_get_reg failed: " << status << std::endl;
- return;
- }
-
- fname[0] = '\0';
- status = unw_get_proc_name(&cursor, fname, sizeof(fname), &offset);
- if (status != 0) {
- os << "unw_get_proc_name failed: " << status << std::endl;
- return;
- }
- os << fname << "+0x" << offset << " [0x" << std::hex << pc << std::dec << "]" << std::endl;
- }
- }
-}
-
#else
namespace mongo {