From 1ffe08c10b4ade6acf92d4a1c2f604200facd410 Mon Sep 17 00:00:00 2001 From: "deanm@google.com" Date: Wed, 13 Aug 2008 11:15:11 +0000 Subject: Make debug_util cross platform, adding BeingDebugged and BreakDebugger. Linux supported added, and Mac OSX left as a todo for the mac team. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@785 0039d316-1c4b-4281-b951-d872f2087c98 --- base/logging.cc | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) (limited to 'base/logging.cc') diff --git a/base/logging.cc b/base/logging.cc index 2648346..1e20dd0 100644 --- a/base/logging.cc +++ b/base/logging.cc @@ -59,6 +59,7 @@ typedef pthread_mutex_t* MutexHandle; #include #include "base/base_switches.h" #include "base/command_line.h" +#include "base/debug_util.h" #include "base/lock_impl.h" #include "base/logging.h" #include "base/string_util.h" @@ -473,13 +474,9 @@ LogMessage::~LogMessage() { if (severity_ == LOG_FATAL) { // display a message or break into the debugger on a fatal error -#if defined(OS_WIN) - if (::IsDebuggerPresent()) { - __debugbreak(); - } - else -#endif - { + if (DebugUtil::BeingDebugged()) { + DebugUtil::BreakDebugger(); + } else { if (log_assert_handler) { // make a copy of the string for the handler out of paranoia log_assert_handler(std::string(stream_.str())); @@ -488,16 +485,9 @@ LogMessage::~LogMessage() { // the debug message process DisplayDebugMessage(stream_.str()); // Crash the process to generate a dump. -#if defined(OS_WIN) - __debugbreak(); -#elif defined(OS_POSIX) -#if defined(OS_MACOSX) - // TODO: when we have breakpad support, generate a breakpad dump, but - // until then, do not invoke the Apple crash reporter. - Debugger(); -#endif - exit(-1); -#endif + DebugUtil::BreakDebugger(); + // TODO(mmentovai): when we have breakpad support, generate a breakpad + // dump, but until then, do not invoke the Apple crash reporter. } } } -- cgit v1.1