Chromium Code Reviews| Index: base/logging.cc |
| diff --git a/base/logging.cc b/base/logging.cc |
| index ea731610dd59fe1006f9a11d89a10589b3ffe08a..57c332640443644878601865e0d10499307b6b3b 100644 |
| --- a/base/logging.cc |
| +++ b/base/logging.cc |
| @@ -545,10 +545,12 @@ LogMessage::LogMessage(const char* file, int line, LogSeverity severity, |
| LogMessage::~LogMessage() { |
| #if !defined(OFFICIAL_BUILD) && !defined(OS_NACL) && !defined(__UCLIBC__) |
| if (severity_ == LOG_FATAL) { |
| - // Include a stack trace on a fatal. |
| - base::debug::StackTrace trace; |
| - stream_ << std::endl; // Newline to separate from log message. |
| - trace.OutputToStream(&stream_); |
| + if (!base::debug::BeingDebugged()) { |
|
Lei Zhang
2015/09/04 22:11:31
nit: combine with the if on the line above?
|
| + // Include a stack trace on a fatal, unless a debugger is attached. |
| + base::debug::StackTrace trace; |
| + stream_ << std::endl; // Newline to separate from log message. |
| + trace.OutputToStream(&stream_); |
| + } |
| } |
| #endif |
| stream_ << std::endl; |
| @@ -639,7 +641,11 @@ LogMessage::~LogMessage() { |
| // information, and displaying message boxes when the application is |
| // hosed can cause additional problems. |
| #ifndef NDEBUG |
| - DisplayDebugMessageInDialog(stream_.str()); |
| + if (!base::debug::BeingDebugged()) { |
| + // Displaying a dialog is unnecessary when debugging and can complicate |
| + // debugging. |
| + DisplayDebugMessageInDialog(stream_.str()); |
| + } |
| #endif |
| // Crash the process to generate a dump. |
| base::debug::BreakDebugger(); |