Skip to content

Instantly share code, notes, and snippets.

@jimblandy
Created June 27, 2018 20:13
Show Gist options
  • Save jimblandy/599a575f28c93db297e8912e7912cb05 to your computer and use it in GitHub Desktop.
Save jimblandy/599a575f28c93db297e8912e7912cb05 to your computer and use it in GitHub Desktop.
Patch to make Firefox pause and wait to be debugged when it crashes
MOZ_PAUSE_ON_CRASH(6W ago) changes to: Bug 1421062: Enable production nightly balrog update on comm-c...
diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -3426,6 +3426,13 @@
mAppData->flags |= NS_XRE_ENABLE_CRASH_REPORTER;
}
+ if (EnvHasValue("MOZ_PAUSE_ON_CRASH")) {
+ if (mAppData->flags & NS_XRE_ENABLE_CRASH_REPORTER) {
+ Output(false, "MOZ_PAUSE_ON_CRASH is set, overriding MOZ_CRASHREPORTER.");
+ }
+ mAppData->flags &= ~NS_XRE_ENABLE_CRASH_REPORTER;
+ }
+
nsCOMPtr<nsIFile> xreBinDirectory;
xreBinDirectory = mDirProvider.GetGREBinDir();
diff --git a/toolkit/xre/nsSigHandlers.cpp b/toolkit/xre/nsSigHandlers.cpp
--- a/toolkit/xre/nsSigHandlers.cpp
+++ b/toolkit/xre/nsSigHandlers.cpp
@@ -245,7 +245,10 @@
}
#if defined(CRAWL_STACK_ON_SIGSEGV)
- if (!getenv("XRE_NO_WINDOWS_CRASH_DIALOG")) {
+ fprintf(stderr, "JIMB: XRE_NO_WINDOWS_CRASH_DIALOG = %s\n", getenv("XRE_NO_WINDOWS_CRASH_DIALOG"));
+ fprintf(stderr, "JIMB: MOZ_PAUSE_ON_CRASH = %s\n", getenv("MOZ_PAUSE_ON_CRASH"));
+ if (getenv("MOZ_PAUSE_ON_CRASH") ||
+ !getenv("XRE_NO_WINDOWS_CRASH_DIALOG")) {
void (*crap_handler)(int) =
GeckoProcessType_Default != XRE_GetProcessType() ?
child_ah_crap_handler :
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment