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

Unified Diff: content/renderer/render_view_impl.cc

Issue 9380026: Add a stackframe named 'CrashIntentionally' to crashes from about:crash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_view_impl.cc
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 8240f49de3b66596a0ec355c47159fbed7828e8f..2db9ad1a3170225c077f40150ebf6de748cbe367 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -325,18 +325,35 @@ static WebReferrerPolicy getReferrerPolicyFromRequest(
WebKit::WebReferrerPolicyDefault;
}
+// Disable optimizations so the symbol "CrashIntentionally()" does not get
+// optimized away. We want this name to appear in the crashed callstack to
+// make it clear what these crashes are about.
+#if defined(COMPILER_MSVC)
+#pragma optimize("", off)
+MSVC_PUSH_DISABLE_WARNING(4748)
+#endif
+
+#if defined(COMPILER_GCC)
+__attribute__((noinline))
Nico 2012/02/10 22:20:39 Does this work? I thought attributes go behind the
+#endif
+
+static void CrashIntentionally() {
+ // NOTE(shess): Crash directly rather than using NOTREACHED() so
+ // that the signature is easier to triage in crash reports.
+ volatile int* zero = NULL;
+ *zero = 0;
+}
+
+#if defined(COMPILER_MSVC)
+MSVC_POP_WARNING()
+#pragma optimize("", on)
+#endif
+
static void MaybeHandleDebugURL(const GURL& url) {
if (!url.SchemeIs(chrome::kChromeUIScheme))
return;
if (url == GURL(chrome::kChromeUICrashURL)) {
- // NOTE(shess): Crash directly rather than using NOTREACHED() so
- // that the signature is easier to triage in crash reports.
- volatile int* zero = NULL;
- *zero = 0;
-
- // Just in case the compiler decides the above is undefined and
- // optimizes it away.
- NOTREACHED();
+ CrashIntentionally();
} else if (url == GURL(chrome::kChromeUIKillURL)) {
base::KillProcess(base::GetCurrentProcessHandle(), 1, false);
} else if (url == GURL(chrome::kChromeUIHangURL)) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698