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

Unified Diff: base/logging.cc

Issue 1814423002: Patch to try dump-on-DCHECK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweak comment Created 4 years, 9 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 | « base/logging.h ('k') | base/logging_unittest.cc » ('j') | 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 a5f9e1141817b21e82d6fae32b17e8aa3cc6fca0..4790ca84a9d6d083348ed93797ce87f5084f9a29 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -59,6 +59,7 @@ typedef pthread_mutex_t* MutexHandle;
#include "base/command_line.h"
#include "base/debug/alias.h"
#include "base/debug/debugger.h"
+#include "base/debug/dump_without_crashing.h"
#include "base/debug/stack_trace.h"
#include "base/posix/eintr_wrapper.h"
#include "base/strings/string_piece.h"
@@ -333,6 +334,19 @@ void CloseLogFileUnlocked() {
} // namespace
+#if defined(DCHECK_IS_DUMP_WITHOUT_CRASH)
+// Used to implement dump-on-DCHECK. See crbug.com/596231.
+void DCheckDumpWithoutCrashing() {
+ // To ensure we don't risk spamming Crash with dump-on-DCHECK reports we log
+ // only the first[*] DCHECK to fail once DumpWithoutCrashing() is working.
+ // [*] This is racey, but in the pathological case still only results in one
+ // dump per-racing-thread, rather than our aim of one per-process.
+ static bool dump_on_dcheck = true;
+ if (dump_on_dcheck)
+ dump_on_dcheck = !base::debug::DumpWithoutCrashing();
+}
+#endif
+
LoggingSettings::LoggingSettings()
: logging_dest(LOG_DEFAULT),
log_file(nullptr),
« no previous file with comments | « base/logging.h ('k') | base/logging_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698