Commit ab5a66e2 authored by Tudor Bosman's avatar Tudor Bosman Committed by Dave Watson

Leak ELF file cache that the signal handler uses

Summary: so we can still handle signals during global destruction. (d'oh)

Test Plan: unittests

Reviewed By: philipp@fb.com

FB internal diff: D1188159
parent af7e7066
......@@ -193,7 +193,9 @@ constexpr size_t kDefaultCapacity = 500;
// Note: not thread-safe, but that's okay, as we only let one thread
// in our signal handler at a time.
SignalSafeElfCache signalSafeElfCache(kDefaultCapacity);
//
// Leak it so we don't have to worry about destruction order
auto gSignalSafeElfCache = new SignalSafeElfCache(kDefaultCapacity);
} // namespace
void dumpStackTrace(bool symbolize) __attribute__((noinline));
......@@ -208,7 +210,7 @@ void dumpStackTrace(bool symbolize) {
if (!getStackTraceSafe(addresses)) {
print("(error retrieving stack trace)\n");
} else if (symbolize) {
Symbolizer symbolizer(&signalSafeElfCache);
Symbolizer symbolizer(gSignalSafeElfCache);
symbolizer.symbolize(addresses);
FDSymbolizePrinter printer(STDERR_FILENO, SymbolizePrinter::COLOR_IF_TTY);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment