summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authoryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-16 04:43:05 +0000
committeryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-16 04:43:05 +0000
commit2c402eda1477ac7feae71c9a8c7b8ae2bf064b37 (patch)
tree5a8de9641afb4bf179023fb24106b11a09351fc6 /base
parent0d820ec6e811269cc8dfac645f30f53f58d6abc3 (diff)
downloadchromium_src-2c402eda1477ac7feae71c9a8c7b8ae2bf064b37.zip
chromium_src-2c402eda1477ac7feae71c9a8c7b8ae2bf064b37.tar.gz
chromium_src-2c402eda1477ac7feae71c9a8c7b8ae2bf064b37.tar.bz2
- crash when calling abort() in all ppapi processes;
- crash when calling exit(), _exit() and ExitProcess() in Pepper Flash process. BUG=None TEST=None Review URL: https://chromiumcodereview.appspot.com/11565026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173362 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/win/win_util.cc19
-rw-r--r--base/win/win_util.h4
2 files changed, 23 insertions, 0 deletions
diff --git a/base/win/win_util.cc b/base/win/win_util.cc
index 3b6b1761..b885d6e 100644
--- a/base/win/win_util.cc
+++ b/base/win/win_util.cc
@@ -11,6 +11,8 @@
#include <propvarutil.h>
#include <sddl.h>
#include <shlobj.h>
+#include <signal.h>
+#include <stdlib.h>
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
@@ -39,6 +41,10 @@ bool SetPropVariantValueForPropertyStore(
return SUCCEEDED(result);
}
+void __cdecl ForceCrashOnSigAbort(int) {
+ *((int*)0) = 0x1337;
+}
+
} // namespace
namespace base {
@@ -186,6 +192,19 @@ bool ShouldCrashOnProcessDetach() {
return g_crash_on_process_detach;
}
+void SetAbortBehaviorForCrashReporting() {
+ // Prevent CRT's abort code from prompting a dialog or trying to "report" it.
+ // Disabling the _CALL_REPORTFAULT behavior is important since otherwise it
+ // has the sideffect of clearing our exception filter, which means we
+ // don't get any crash.
+ _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
+
+ // Set a SIGABRT handler for good measure. We will crash even if the default
+ // is left in place, however this allows us to crash earlier. And it also
+ // lets us crash in response to code which might directly call raise(SIGABRT)
+ signal(SIGABRT, ForceCrashOnSigAbort);
+}
+
bool IsMachineATablet() {
if (base::win::GetVersion() < base::win::VERSION_WIN7)
return false;
diff --git a/base/win/win_util.h b/base/win/win_util.h
index 7db98e9..d5bcd7a 100644
--- a/base/win/win_util.h
+++ b/base/win/win_util.h
@@ -106,6 +106,10 @@ BASE_EXPORT bool ReadCommandFromAutoRun(HKEY root_key,
BASE_EXPORT void SetShouldCrashOnProcessDetach(bool crash);
BASE_EXPORT bool ShouldCrashOnProcessDetach();
+// Adjusts the abort behavior so that crash reports can be generated when the
+// process is aborted.
+BASE_EXPORT void SetAbortBehaviorForCrashReporting();
+
// A tablet by this definition is something that has integrated multi-touch
// ready to use and also has screen resolution not greater than 1366x768.
BASE_EXPORT bool IsMachineATablet();