diff options
author | Martin Bligh <mbligh@mongodb.com> | 2015-06-24 15:46:39 -0400 |
---|---|---|
committer | Martin Bligh <mbligh@mongodb.com> | 2015-06-24 15:47:22 -0400 |
commit | 2fe33e6040c5fdc998e369b33a6b2de8a8b01f15 (patch) | |
tree | 0624db29e74d9f9665243e40daa475a6c0692b78 /src/mongo/util | |
parent | 6a33aa91723ee25351d658abcbbf6f15435820ee (diff) | |
download | mongo-2fe33e6040c5fdc998e369b33a6b2de8a8b01f15.tar.gz |
SERVER-18699 dump /proc/self/maps on a sigbus to make it easier to diagnose
Diffstat (limited to 'src/mongo/util')
-rw-r--r-- | src/mongo/util/signal_handlers_synchronous.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mongo/util/signal_handlers_synchronous.cpp b/src/mongo/util/signal_handlers_synchronous.cpp index 65531c51fcc..ac2d2bc7140 100644 --- a/src/mongo/util/signal_handlers_synchronous.cpp +++ b/src/mongo/util/signal_handlers_synchronous.cpp @@ -37,6 +37,7 @@ #include <csignal> #include <exception> #include <iostream> +#include <fstream> #include <memory> #include <streambuf> #include <typeinfo> @@ -265,6 +266,18 @@ void abruptQuitWithAddrSignal(int signalNum, siginfo_t* siginfo, void*) { printSignalAndBacktrace(signalNum); breakpoint(); + +#if defined(__linux__) + // Dump /proc/self/maps if possible to see where the bad address relates to our layout. + // We do this last just in case it goes wrong. + mallocFreeOStream << "/proc/self/maps:\n"; + std::ifstream is("/proc/self/maps"); + std::string str; + while(getline(is, str)) { + mallocFreeOStream << str; + writeMallocFreeStreamToLog(); + } +#endif quickExit(EXIT_ABRUPT); } |