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

Unified Diff: base/logging.cc

Issue 1884023002: Implement Dump-on-DCHECK (via alternate DCHECK and DCHECK_OP macro implementations). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase on cleanups Created 3 years, 10 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 4904f18646f122872cbd02eaff96e58576d32710..f0e077c5784f0802eec8f0af8ba4120cae2f3399 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -57,6 +57,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"
@@ -124,6 +125,7 @@ bool show_error_dialogs = false;
// An assert handler override specified by the client to be called instead of
// the debug message dialog and process termination.
LogAssertHandlerFunction log_assert_handler = nullptr;
+
// A log message handler that gets notified of every log message we process.
LogMessageHandlerFunction log_message_handler = nullptr;
@@ -343,6 +345,20 @@ void CloseLogFileUnlocked() {
} // namespace
+#if defined(DCHECK_IS_DUMP_WITHOUT_CRASH)
+// Used to implement dump-on-DCHECK. See crbug.com/596231.
+void DCheckDumpWithoutCrashingOnce() {
+ // 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 one per-process.
+ static bool dump_on_dcheck = true;
+ if (dump_on_dcheck)
+ dump_on_dcheck = !base::debug::DumpWithoutCrashing();
+}
+#endif // defined(DCHECK_IS_DUMP_WITHOUT_CRASH)
+
// This is never instantiated, it's just used for EAT_STREAM_PARAMETERS to have
// an object of the correct type on the LHS of the unused part of the ternary
// operator.
« 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