diff --git a/SConstruct b/SConstruct index 4c8f52889b7..b349f4e4166 100644 --- a/SConstruct +++ b/SConstruct @@ -789,10 +789,7 @@ def doConfigure(myenv): if solaris or conf.CheckDeclaration('clock_gettime', includes='#include '): conf.CheckLib('rt') - if freebsd and conf.CheckCXXHeader( "unwind.h" ): - myenv.Append( CPPDEFINES=[ "MONGO_HAVE_UNWIND_BACKTRACE" ] ) - - elif (conf.CheckCXXHeader( "execinfo.h" ) and + if (conf.CheckCXXHeader( "execinfo.h" ) and conf.CheckDeclaration('backtrace', includes='#include ') and conf.CheckDeclaration('backtrace_symbols', includes='#include ')): @@ -811,11 +808,9 @@ def doConfigure(myenv): if not conf.CheckLib( v8_lib_choices ): Exit(1) - # requires ports devel/libexecinfo or devel/libunwind to be installed + # requires ports devel/libexecinfo to be installed if freebsd or openbsd: - # CheckLib actually sets the -l argument, so check in the - # order of precedence. - if not (conf.CheckLib("unwind") or conf.CheckLib("execinfo")): + if not conf.CheckLib("execinfo"): Exit(1) # 'tcmalloc' needs to be the last library linked. Please, add new libraries before this 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 - -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 {