backtrace_execinfo: correct newlines for ostream

if addr2line wasn't found newlines weren't consistent
This commit is contained in:
Danny Robson 2016-05-12 17:47:47 +10:00
parent 12f154d0cb
commit 539188ffde

View File

@ -66,7 +66,7 @@ addr2line (const void *addr)
return std::string (data.cbegin (), data.cend ()); return std::string (data.cbegin (), data.cend ());
#else #else
return "\n"; return "";
#endif #endif
} }
@ -81,7 +81,7 @@ debug::operator <<(std::ostream &os, const debug::backtrace &rhs) {
str_t names (backtrace_symbols (frames.data (), trunc_cast<int> (frames.size ())), ::free); str_t names (backtrace_symbols (frames.data (), trunc_cast<int> (frames.size ())), ::free);
for (unsigned int i = 0; i < frames.size (); ++i) for (unsigned int i = 0; i < frames.size (); ++i)
os << frames[i] << '\t' << names.get()[i] << '\t' << addr2line (frames[i]); os << frames[i] << '\t' << names.get()[i] << '\t' << addr2line (frames[i]) << '\n';
return os; return os;
} }