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

Unified Diff: base/logging.cc

Issue 62140: Print backtraces on FATAL log messages in debug mode. (Closed)
Patch Set: Add todo for stackwalk64 Created 11 years, 8 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/debug_util_win.cc ('k') | build/common.gypi » ('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 961ea6c6b32fa0ee8b792ea10258d6afde4ba77a..7b890203280b2077bb1b5c85ad12ef65a59a4f71 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -520,6 +520,13 @@ LogMessage::~LogMessage() {
if (DebugUtil::BeingDebugged()) {
DebugUtil::BreakDebugger();
} else {
+#ifndef NDEBUG
+ // Dump a stack trace on a fatal.
+ StackTrace trace;
+ stream_ << "\n"; // Newline to separate from log message.
+ trace.OutputToStream(&stream_);
+#endif
+
if (log_assert_handler) {
// make a copy of the string for the handler out of paranoia
log_assert_handler(std::string(stream_.str()));
@@ -554,7 +561,7 @@ void CloseLogFile() {
log_file = NULL;
}
-} // namespace logging
+} // namespace logging
std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) {
return out << base::SysWideToUTF8(std::wstring(wstr));
« no previous file with comments | « base/debug_util_win.cc ('k') | build/common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698