Commit 6b4082ec authored by Tudor Bosman's avatar Tudor Bosman Committed by Jordan DeLong

Verbosify exception tracer dumps

Test Plan: by hand

Reviewed By: philipp@fb.com

FB internal diff: D570233
parent 78ee2805
...@@ -44,18 +44,27 @@ namespace exception_tracer { ...@@ -44,18 +44,27 @@ namespace exception_tracer {
std::ostream& operator<<(std::ostream& out, const ExceptionInfo& info) { std::ostream& operator<<(std::ostream& out, const ExceptionInfo& info) {
out << "Exception type: "; out << "Exception type: ";
if (info.type) { if (info.type) {
out << folly::demangle(*info.type) << "\n"; out << folly::demangle(*info.type);
} else { } else {
out << "(unknown type)\n"; out << "(unknown type)";
} }
Symbolizer symbolizer; out << " (" << info.frames.size()
folly::StringPiece symbolName; << (info.frames.size() == 1 ? " frame" : " frames")
Dwarf::LocationInfo location; << ")\n";
for (auto ip : info.frames) { try {
// Symbolize the previous address because the IP might be in the Symbolizer symbolizer;
// next function, per glog/src/signalhandler.cc folly::StringPiece symbolName;
symbolizer.symbolize(ip-1, symbolName, location); Dwarf::LocationInfo location;
Symbolizer::write(out, ip, symbolName, location); for (auto ip : info.frames) {
// Symbolize the previous address because the IP might be in the
// next function, per glog/src/signalhandler.cc
symbolizer.symbolize(ip-1, symbolName, location);
Symbolizer::write(out, ip, symbolName, location);
}
} catch (const std::exception& e) {
out << "\n !! caught " << folly::exceptionStr(e) << "\n";
} catch (...) {
out << "\n !!! caught unexpected exception\n";
} }
return out; return out;
} }
...@@ -159,10 +168,11 @@ void dumpExceptionStack(const char* prefix) { ...@@ -159,10 +168,11 @@ void dumpExceptionStack(const char* prefix) {
if (exceptions.empty()) { if (exceptions.empty()) {
return; return;
} }
LOG(ERROR) << prefix << ", exception stack follows\n"; LOG(ERROR) << prefix << ", exception stack follows";
for (auto& exc : exceptions) { for (auto& exc : exceptions) {
LOG(ERROR) << exc << "\n"; LOG(ERROR) << exc << "\n";
} }
LOG(ERROR) << "exception stack complete";
} }
void terminateHandler() { void terminateHandler() {
......
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