gecko-dev/toolkit/crashreporter/ThreadAnnotation.h
Gabriele Svelto d3eaf3858d Bug 1622452 - Remove the remote exception handler when a content process shuts down r=froydnj
This works on all platforms with the exception of Linux where we remove the
exception handler only if the sandbox is disabled. With the sandbox enabled we
would have to whitelist sigaltstack() which breakpad uses to remove the
alternate signal stack which is not worth the fuss.

Besides this patch refactors the code that sets and unsets the exception
handler, cutting down on the duplication:

* The XRE_UnsetRemoteExceptionHandler() call is removed from XULAppAPI.h since it
  was no longer used
* The duplicate checks for the special strings used to disable the remote exception
  handler have been removed from CrashReporter::UnsetRemoteExceptionHandler()
  leaving them in the calling code
* The SetRemoteExceptionHandler() function was consolidated into only one
  piece of code with only one non-platform-specific shared prototype
* Some additional code was factored out to improve the readability

These changes pave the way both for bug 1614933 and for the oxidation of the
exception handler code.

Differential Revision: https://phabricator.services.mozilla.com/D67213

--HG--
extra : moz-landing-system : lando
2020-03-19 14:06:31 +00:00

25 lines
648 B
C++

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef ThreadAnnotation_h
#define ThreadAnnotation_h
#include <functional>
#include "nsExceptionHandler.h"
// Thread annotation interfaces for the crash reporter.
namespace CrashReporter {
void InitThreadAnnotation();
void ShutdownThreadAnnotation();
void GetFlatThreadAnnotation(const std::function<void(const char*)>& aCallback,
bool aIsHandlingException = false);
} // namespace CrashReporter
#endif