Base: Explicitly set abort message on FATAL
Currently bionic only stores the first invocation of android_set_abort_message, libbase splits the logging invocations into discrete lines, and liblog automatically calls bionic when fatal severity is used. This leads to only the first line of LOG(FATAL) being stored for tombstoned. Eagerly set the abort message directly before logging when the severity is FATAL. This ensures the complete message will be available. Bug: 120506942 Test: m Test: manual Change-Id: I104d6960a2b1f66f21f5ada383fb4ab0f35e96a9
This commit is contained in:
parent
5ae47e10c8
commit
2819c0b831
1 changed files with 8 additions and 0 deletions
|
@ -417,6 +417,14 @@ LogMessage::~LogMessage() {
|
|||
}
|
||||
std::string msg(data_->ToString());
|
||||
|
||||
if (data_->GetSeverity() == FATAL) {
|
||||
#ifdef __ANDROID__
|
||||
// Set the bionic abort message early to avoid liblog doing it
|
||||
// with the individual lines, so that we get the whole message.
|
||||
android_set_abort_message(msg.c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
{
|
||||
// Do the actual logging with the lock held.
|
||||
std::lock_guard<std::mutex> lock(LoggingLock());
|
||||
|
|
Loading…
Reference in a new issue