Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(671)

Unified Diff: base/logging.cc

Issue 1310083004: Avoid dialogs and generating call stacks under a debugger (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merging adjacent 'if' statements. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/logging.cc
diff --git a/base/logging.cc b/base/logging.cc
index ea731610dd59fe1006f9a11d89a10589b3ffe08a..2dec987c6003387d7a4a3bee08d7fa73090be22e 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -544,8 +544,8 @@ 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.
+ if (severity_ == LOG_FATAL && !base::debug::BeingDebugged()) {
+ // 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_);
@@ -639,7 +639,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();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698