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

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: Fix conditional for DCheckDumpWithoutCrashing 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
Index: base/logging.cc
diff --git a/base/logging.cc b/base/logging.cc
index 8ff226082e60b2fbd9999329bd0dccc5ca3b1d60..1c7c82a64b9ced296a312a6dbb14b182cbcc85a8 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -61,6 +61,9 @@ typedef pthread_mutex_t* MutexHandle;
#include "base/command_line.h"
#include "base/debug/alias.h"
#include "base/debug/debugger.h"
+#if defined(OFFICIAL_BUILD)
scottmg 2016/03/21 17:28:12 Remove the #if here.
Wez 2016/03/23 04:18:13 You prefer to include even if it won't be used? D
+#include "base/debug/dump_without_crashing.h"
+#endif
#include "base/debug/stack_trace.h"
#include "base/posix/eintr_wrapper.h"
#include "base/strings/string_piece.h"
@@ -335,6 +338,17 @@ 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.
+ static bool dump_on_dcheck = true;
Nico 2016/03/20 23:10:40 this is racy (doubt it matters though)
Wez 2016/03/23 04:18:13 Extended comment to clarify that yes, that's under
+ if (dump_on_dcheck)
+ dump_on_dcheck = !base::debug::DumpWithoutCrashing();
Nico 2016/03/20 23:10:40 for stacks in renderer processes, this will dump o
Wez 2016/03/23 04:18:13 Yes. Extended comment should make that clearer.
+}
+#endif
+
LoggingSettings::LoggingSettings()
: logging_dest(LOG_DEFAULT),
log_file(nullptr),

Powered by Google App Engine
This is Rietveld 408576698