Bug 1776197 - Remove the old IPC channel used for retrieving annotations and all related machinery r=geckoview-reviewers,afranchuk,owlish

Depends on D173699

Differential Revision: https://phabricator.services.mozilla.com/D173700
This commit is contained in:
Gabriele Svelto 2023-06-07 12:34:31 +00:00
parent d40b19f8c6
commit 4b039f20f2
15 changed files with 30 additions and 283 deletions

16
Cargo.lock generated
View File

@ -2108,6 +2108,7 @@ dependencies = [
"mio 0.8.0",
"moz_asserts",
"mozannotation_client",
"mozannotation_server",
"mozglue-static",
"mozurl",
"mp4parse_capi",
@ -3337,6 +3338,21 @@ dependencies = [
"nsstring",
]
[[package]]
name = "mozannotation_server"
version = "0.1.0"
dependencies = [
"goblin",
"libc",
"mach2",
"memoffset",
"mozannotation_client",
"nsstring",
"thin-vec",
"thiserror",
"winapi",
]
[[package]]
name = "mozbuild"
version = "0.1.0"

View File

@ -6047,7 +6047,6 @@ _ZN5style7sharing17SHARING_CACHE_KEY7__getit17he592e433f2be153cE
?DoResolveOrReject@ThenValueBase@?$MozPromise@PAXULaunchError@ipc@mozilla@@$0A@@mozilla@@IAEXAAVResolveOrRejectValue@23@@Z
?IsOnCurrentThreadInfallible@AbstractThread@mozilla@@UAG_NXZ
?AddTargetPeer@SandboxBroker@mozilla@@SA_NPAX@Z
?RegisterChildCrashAnnotationFileDescriptor@CrashReporter@@YAXKPAUPRFileDesc@@@Z
?CreateAdditionalChildMinidump@CrashReporter@@YA_NPAXKPAVnsIFile@@ABV?$nsTSubstring@D@@@Z
?_Tidy@?$deque@VMessage@IPC@@V?$allocator@VMessage@IPC@@@std@@@std@@IAEXXZ
?_Tidy@?$vector@V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@V?$allocator@V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@2@@std@@AAEXXZ

View File

@ -4242,7 +4242,6 @@ ZN5style7stylist7Stylist17append_stylesheet17he70cadcba5340a98E
?DoResolveOrReject@ThenValueBase@?$MozPromise@PEAXULaunchError@ipc@mozilla@@$0A@@mozilla@@IEAAXAEAVResolveOrRejectValue@23@@Z
?IsOnCurrentThreadInfallible@AbstractThread@mozilla@@UEAA_NXZ
?AddTargetPeer@SandboxBroker@mozilla@@SA_NPEAX@Z
?RegisterChildCrashAnnotationFileDescriptor@CrashReporter@@YAXKPEAUPRFileDesc@@@Z
?CreateAdditionalChildMinidump@CrashReporter@@YA_NPEAXKPEAVnsIFile@@AEBV?$nsTSubstring@D@@@Z
?AccumulateTimeDelta@Telemetry@mozilla@@YAXW4HistogramID@12@VTimeStamp@2@1@Z
?ThenInternal@?$MozPromise@V?$RefPtr@VBrowserParent@dom@mozilla@@@@W4nsresult@@$0A@@mozilla@@QEAAXU?$already_AddRefed@VThenValueBase@?$MozPromise@V?$RefPtr@VBrowserParent@dom@mozilla@@@@W4nsresult@@$0A@@mozilla@@@@PEBD@Z

View File

@ -45,7 +45,6 @@
#include "mozilla/GeckoArgs.h"
#include "mozilla/Omnijar.h"
#include "mozilla/RDDProcessHost.h"
#include "mozilla/Scoped.h"
#include "mozilla/Services.h"
#include "mozilla/SharedThreadPool.h"
#include "mozilla/StaticMutex.h"
@ -98,20 +97,12 @@
#include "nsNativeCharsetUtils.h"
#include "nsTArray.h"
#include "nscore.h" // for NS_FREE_PERMANENT_DATA
#include "private/pprio.h"
#include "nsIThread.h"
using mozilla::MonitorAutoLock;
using mozilla::Preferences;
using mozilla::StaticMutexAutoLock;
namespace mozilla {
MOZ_TYPE_SPECIFIC_SCOPED_POINTER_TEMPLATE(ScopedPRFileDesc, PRFileDesc,
PR_Close)
}
using mozilla::ScopedPRFileDesc;
#ifdef MOZ_WIDGET_ANDROID
# include "AndroidBridge.h"
# include "mozilla/java/GeckoProcessManagerWrappers.h"
@ -253,8 +244,6 @@ class BaseProcessLauncher {
// Set during launch.
IPC::Channel::ChannelId mChannelId;
ScopedPRFileDesc mCrashAnnotationReadPipe;
ScopedPRFileDesc mCrashAnnotationWritePipe;
nsCOMPtr<nsIFile> mAppDir;
};
@ -470,14 +459,6 @@ GeckoChildProcessHost::~GeckoChildProcessHost()
#endif
if (mChildProcessHandle != 0) {
#if defined(XP_WIN)
CrashReporter::DeregisterChildCrashAnnotationFileDescriptor(
base::GetProcId(mChildProcessHandle));
#else
CrashReporter::DeregisterChildCrashAnnotationFileDescriptor(
mChildProcessHandle);
#endif
ProcessWatcher::EnsureProcessTerminated(
mChildProcessHandle
#ifdef NS_FREE_PERMANENT_DATA
@ -1124,11 +1105,6 @@ Result<Ok, LaunchError> BaseProcessLauncher::DoSetup() {
MapChildLogging();
PRStatus status = PR_CreatePipe(&mCrashAnnotationReadPipe.rwget(),
&mCrashAnnotationWritePipe.rwget());
if (status != PR_SUCCESS) {
return Err(LaunchError("PR_CreatePipe", PR_GetError()));
}
return Ok();
}
@ -1324,10 +1300,6 @@ Result<Ok, LaunchError> PosixProcessLauncher::DoSetup() {
# endif
}
int fd = PR_FileDesc2NativeHandle(mCrashAnnotationWritePipe);
mLaunchOptions->fds_to_remap.push_back(
std::make_pair(fd, CrashReporter::GetAnnotationTimeCrashFd()));
# ifdef MOZ_WIDGET_COCOA
{
auto* thisMac = static_cast<MacProcessLauncher*>(this);
@ -1602,11 +1574,6 @@ Result<Ok, LaunchError> WindowsProcessLauncher::DoSetup() {
UTF8ToWide(CrashReporter::GetChildNotificationPipe()));
if (!CrashReporter::IsDummy()) {
PROsfd h = PR_FileDesc2NativeHandle(mCrashAnnotationWritePipe);
mLaunchOptions->handles_to_inherit.push_back(reinterpret_cast<HANDLE>(h));
std::string hStr = std::to_string(h);
mCmdLine->AppendLooseValue(UTF8ToWide(hStr));
char werDataAddress[17] = {};
SprintfLiteral(werDataAddress, "%p", mWerDataPointer);
mCmdLine->AppendLooseValue(UTF8ToWide(werDataAddress));
@ -1694,9 +1661,6 @@ RefPtr<ProcessLaunchPromise> BaseProcessLauncher::FinishLaunch() {
MOZ_DIAGNOSTIC_ASSERT(mResults.mHandle);
CrashReporter::RegisterChildCrashAnnotationFileDescriptor(
base::GetProcId(mResults.mHandle), mCrashAnnotationReadPipe.forget());
Telemetry::AccumulateTimeDelta(Telemetry::CHILD_PROCESS_LAUNCH_MS,
mStartTimeStamp);
@ -1780,18 +1744,13 @@ RefPtr<ProcessHandlePromise> AndroidProcessLauncher::LaunchAndroidService(
int32_t prefMapFd = fds_to_remap[1].first;
int32_t ipcFd = fds_to_remap[2].first;
int32_t crashFd = -1;
int32_t crashAnnotationFd = -1;
if (fds_to_remap.size() == 4) {
crashAnnotationFd = fds_to_remap[3].first;
}
if (fds_to_remap.size() == 5) {
crashFd = fds_to_remap[3].first;
crashAnnotationFd = fds_to_remap[4].first;
}
auto type = java::GeckoProcessType::FromInt(aType);
auto genericResult = java::GeckoProcessManager::Start(
type, jargs, prefsFd, prefMapFd, ipcFd, crashFd, crashAnnotationFd);
type, jargs, prefsFd, prefMapFd, ipcFd, crashFd);
auto typedResult = java::GeckoResult::LocalRef(std::move(genericResult));
return ProcessHandlePromise::FromGeckoResult(typedResult);
}

View File

@ -30,8 +30,7 @@ interface IChildProcess {
in ParcelFileDescriptor prefsPfd,
in ParcelFileDescriptor prefMapPfd,
in ParcelFileDescriptor ipcPfd,
in ParcelFileDescriptor crashReporterPfd,
in ParcelFileDescriptor crashAnnotationPfd);
in ParcelFileDescriptor crashReporterPfd);
void crash();

View File

@ -157,14 +157,12 @@ public class GeckoThread extends Thread {
public final @Nullable ParcelFileDescriptor prefMap;
public final @NonNull ParcelFileDescriptor ipc;
public final @Nullable ParcelFileDescriptor crashReporter;
public final @Nullable ParcelFileDescriptor crashAnnotation;
private ParcelFileDescriptors(final Builder builder) {
prefs = builder.prefs;
prefMap = builder.prefMap;
ipc = builder.ipc;
crashReporter = builder.crashReporter;
crashAnnotation = builder.crashAnnotation;
}
public FileDescriptors detach() {
@ -173,7 +171,6 @@ public class GeckoThread extends Thread {
.prefMap(detach(prefMap))
.ipc(detach(ipc))
.crashReporter(detach(crashReporter))
.crashAnnotation(detach(crashAnnotation))
.build();
}
@ -185,7 +182,7 @@ public class GeckoThread extends Thread {
}
public void close() {
close(prefs, prefMap, ipc, crashReporter, crashAnnotation);
close(prefs, prefMap, ipc, crashReporter);
}
private static void close(final ParcelFileDescriptor... pfds) {
@ -207,7 +204,6 @@ public class GeckoThread extends Thread {
.prefMap(from(fds.prefMap))
.ipc(from(fds.ipc))
.crashReporter(from(fds.crashReporter))
.crashAnnotation(from(fds.crashAnnotation))
.build();
}
@ -231,7 +227,6 @@ public class GeckoThread extends Thread {
ParcelFileDescriptor prefMap;
ParcelFileDescriptor ipc;
ParcelFileDescriptor crashReporter;
ParcelFileDescriptor crashAnnotation;
private Builder() {}
@ -258,11 +253,6 @@ public class GeckoThread extends Thread {
this.crashReporter = crashReporter;
return this;
}
public Builder crashAnnotation(final ParcelFileDescriptor crashAnnotation) {
this.crashAnnotation = crashAnnotation;
return this;
}
}
}
@ -271,14 +261,12 @@ public class GeckoThread extends Thread {
final int prefMap;
final int ipc;
final int crashReporter;
final int crashAnnotation;
private FileDescriptors(final Builder builder) {
prefs = builder.prefs;
prefMap = builder.prefMap;
ipc = builder.ipc;
crashReporter = builder.crashReporter;
crashAnnotation = builder.crashAnnotation;
}
public static Builder builder() {
@ -290,7 +278,6 @@ public class GeckoThread extends Thread {
int prefMap = INVALID_FD;
int ipc = INVALID_FD;
int crashReporter = INVALID_FD;
int crashAnnotation = INVALID_FD;
private Builder() {}
@ -317,11 +304,6 @@ public class GeckoThread extends Thread {
this.crashReporter = crashReporter;
return this;
}
public Builder crashAnnotation(final int crashAnnotation) {
this.crashAnnotation = crashAnnotation;
return this;
}
}
}
@ -680,7 +662,6 @@ public class GeckoThread extends Thread {
mInitInfo.fds.prefMap,
mInitInfo.fds.ipc,
mInitInfo.fds.crashReporter,
mInitInfo.fds.crashAnnotation,
isChildProcess ? false : mInitInfo.xpcshell,
isChildProcess ? null : mInitInfo.outFilePath);

View File

@ -426,7 +426,6 @@ public final class GeckoLoader {
int prefMapFd,
int ipcFd,
int crashFd,
int crashAnnotationFd,
boolean xpcshell,
String outFilePath);

View File

@ -753,8 +753,7 @@ public final class GeckoProcessManager extends IProcessManager.Stub {
final int prefsFd,
final int prefMapFd,
final int ipcFd,
final int crashFd,
final int crashAnnotationFd) {
final int crashFd) {
final GeckoResult<Integer> result = new GeckoResult<>();
final StartInfo info =
new StartInfo(
@ -770,7 +769,6 @@ public final class GeckoProcessManager extends IProcessManager.Stub {
.prefMap(prefMapFd)
.ipc(ipcFd)
.crashReporter(crashFd)
.crashAnnotation(crashAnnotationFd)
.build())
.build());
@ -899,8 +897,7 @@ public final class GeckoProcessManager extends IProcessManager.Stub {
info.pfds.prefs,
info.pfds.prefMap,
info.pfds.ipc,
info.pfds.crashReporter,
info.pfds.crashAnnotation);
info.pfds.crashReporter);
if (result == IChildProcess.STARTED_OK) {
return connection.getPid();
} else {

View File

@ -78,8 +78,7 @@ public class GeckoServiceChildProcess extends Service {
final ParcelFileDescriptor prefsPfd,
final ParcelFileDescriptor prefMapPfd,
final ParcelFileDescriptor ipcPfd,
final ParcelFileDescriptor crashReporterPfd,
final ParcelFileDescriptor crashAnnotationPfd) {
final ParcelFileDescriptor crashReporterPfd) {
final ParcelFileDescriptors pfds =
ParcelFileDescriptors.builder()
@ -87,7 +86,6 @@ public class GeckoServiceChildProcess extends Service {
.prefMap(prefMapPfd)
.ipc(ipcPfd)
.crashReporter(crashReporterPfd)
.crashAnnotation(crashAnnotationPfd)
.build();
synchronized (GeckoServiceChildProcess.class) {

View File

@ -362,8 +362,7 @@ static void FreeArgv(char** argv, int argc) {
extern "C" APKOPEN_EXPORT void MOZ_JNICALL
Java_org_mozilla_gecko_mozglue_GeckoLoader_nativeRun(
JNIEnv* jenv, jclass jc, jobjectArray jargs, int prefsFd, int prefMapFd,
int ipcFd, int crashFd, int crashAnnotationFd, bool xpcshell,
jstring outFilePath) {
int ipcFd, int crashFd, bool xpcshell, jstring outFilePath) {
EnsureBaseProfilerInitialized();
int argc = 0;
@ -392,8 +391,8 @@ Java_org_mozilla_gecko_mozglue_GeckoLoader_nativeRun(
ElfLoader::Singleton.ExpectShutdown(true);
#endif
} else {
gBootstrap->XRE_SetAndroidChildFds(
jenv, {prefsFd, prefMapFd, ipcFd, crashFd, crashAnnotationFd});
gBootstrap->XRE_SetAndroidChildFds(jenv,
{prefsFd, prefMapFd, ipcFd, crashFd});
gBootstrap->XRE_SetProcessType(argv[argc - 1]);
XREChildData childData;

View File

@ -8,7 +8,6 @@
#include "nsExceptionHandler.h"
#include "nsExceptionHandlerUtils.h"
#include "prio.h"
namespace CrashReporter {
@ -115,21 +114,6 @@ nsresult SetRestartArgs(int argc, char** argv) {
return NS_ERROR_NOT_IMPLEMENTED;
}
#if !defined(XP_WIN)
int GetAnnotationTimeCrashFd() { return 7; }
#endif
void RegisterChildCrashAnnotationFileDescriptor(ProcessId aProcess,
PRFileDesc* aFd) {
// The real implementation of this function takes ownership of aFd
// and closes it when the process exits; if we don't close it, it
// causes a leak. With no crash reporter we'll never write to the
// pipe, so it's safe to close the read end immediately.
PR_Close(aFd);
}
void DeregisterChildCrashAnnotationFileDescriptor(ProcessId aProcess) {}
#ifdef XP_WIN
nsresult WriteMinidumpForException(EXCEPTION_POINTERS* aExceptionInfo) {
return NS_ERROR_NOT_IMPLEMENTED;
@ -216,10 +200,7 @@ bool CreateNotificationPipeForChild(int* childCrashFd, int* childCrashRemapFd) {
#endif // !defined(XP_WIN) && !defined(XP_MACOSX)
bool SetRemoteExceptionHandler(const char* aCrashPipe,
FileHandle aCrashTimeAnnotationFile) {
return false;
}
bool SetRemoteExceptionHandler(const char* aCrashPipe) { return false; }
bool TakeMinidumpForChild(uint32_t childPid, nsIFile** dump,
AnnotationTable& aAnnotations, uint32_t* aSequence) {
@ -254,8 +235,6 @@ bool UnsetRemoteExceptionHandler(bool wasSet) { return false; }
#if defined(MOZ_WIDGET_ANDROID)
void SetNotificationPipeForChild(FileHandle childCrashFd) {}
void SetCrashAnnotationPipeForChild(FileHandle childCrashAnnotationFd) {}
void AddLibraryMapping(const char* library_name, uintptr_t start_address,
size_t mapping_length, size_t file_offset) {}
#endif

View File

@ -104,8 +104,6 @@ using mozilla::InjectCrashRunnable;
#include "nsDebug.h"
#include "nsCRT.h"
#include "nsIFile.h"
#include <map>
#include <vector>
#include "mozilla/IOInterposer.h"
#include "mozilla/mozalloc_oom.h"
@ -260,8 +258,6 @@ static bool sIncludeContextHeap = false;
// OOP crash reporting
static CrashGenerationServer* crashServer; // chrome process has this
static StaticMutex processMapLock MOZ_UNANNOTATED;
static std::map<ProcessId, PRFileDesc*> processToCrashFd;
static std::terminate_handler oldTerminateHandler = nullptr;
@ -288,14 +284,6 @@ static FileHandle gMagicChildCrashReportFd =
;
#endif
static FileHandle gChildCrashAnnotationReportFd =
#if (defined(XP_LINUX) || defined(XP_MACOSX)) && !defined(MOZ_WIDGET_ANDROID)
7
#else
kInvalidFileHandle
#endif
;
// |dumpMapLock| must protect all access to |pidToMinidump|.
static Mutex* dumpMapLock;
struct ChildProcessData : public nsUint32HashKey {
@ -1719,27 +1707,6 @@ static bool BuildTempPath(PathStringT& aResult) {
return true;
}
FileHandle GetAnnotationTimeCrashFd() { return gChildCrashAnnotationReportFd; }
static void PrepareChildExceptionTimeAnnotations(
const phc::AddrInfo* addrInfo) {
MOZ_ASSERT(!XRE_IsParentProcess());
PlatformWriter apiData;
apiData.OpenHandle(GetAnnotationTimeCrashFd());
BinaryAnnotationWriter writer(apiData);
WriteMozCrashReason(writer);
WriteMainThreadRunnableName(writer);
WriteOOMAllocationSize(writer);
#ifdef MOZ_PHC
WritePHCAddrInfo(writer, addrInfo);
#endif
}
#ifdef XP_WIN
static void ReserveBreakpadVM() {
@ -1884,7 +1851,6 @@ static bool ChildMinidumpCallback(
EXCEPTION_POINTERS* exinfo, MDRawAssertionInfo* assertion,
#endif // defined(XP_WIN)
const mozilla::phc::AddrInfo* addr_info, bool succeeded) {
return succeeded;
}
@ -1930,57 +1896,10 @@ static nsresult LocateExecutable(nsIFile* aXREDirectory, const nsAString& aName,
#endif // !defined(MOZ_WIDGET_ANDROID)
#if defined(XP_WIN)
DWORD WINAPI FlushContentProcessAnnotationsThreadFunc(LPVOID aContext) {
PrepareChildExceptionTimeAnnotations(nullptr);
return 0;
}
#else
static const int kAnnotationSignal = SIGUSR2;
static void AnnotationSignalHandler(int aSignal, siginfo_t* aInfo,
void* aContext) {
PrepareChildExceptionTimeAnnotations(nullptr);
}
#endif // defined(XP_WIN)
static void InitChildAnnotationsFlusher() {
#if !defined(XP_WIN)
struct sigaction oldSigAction = {};
struct sigaction sigAction = {};
sigAction.sa_sigaction = AnnotationSignalHandler;
sigAction.sa_flags = SA_RESTART | SA_SIGINFO;
sigemptyset(&sigAction.sa_mask);
mozilla::DebugOnly<int> rv =
sigaction(kAnnotationSignal, &sigAction, &oldSigAction);
MOZ_ASSERT(rv == 0, "Failed to install the crash reporter's SIGUSR2 handler");
MOZ_ASSERT(oldSigAction.sa_sigaction == nullptr,
"A SIGUSR2 handler was already present");
#endif // !defined(XP_WIN)
}
static bool FlushContentProcessAnnotations(ProcessHandle aTargetPid) {
#if defined(XP_WIN)
nsAutoHandle hThread(CreateRemoteThread(
aTargetPid, nullptr, 0, FlushContentProcessAnnotationsThreadFunc, nullptr,
0, nullptr));
return !!hThread;
#else // POSIX platforms
return kill(aTargetPid, kAnnotationSignal) == 0;
#endif
}
static void InitializeAnnotationFacilities() {
crashReporterAPILock = new Mutex("crashReporterAPILock");
notesFieldLock = new Mutex("notesFieldLock");
notesField = new nsCString();
if (!XRE_IsParentProcess()) {
InitChildAnnotationsFlusher();
}
}
static void TeardownAnnotationFacilities() {
@ -3170,40 +3089,6 @@ bool GetExtraFileForMinidump(nsIFile* minidump, nsIFile** extraFile) {
return true;
}
static void ReadAndValidateExceptionTimeAnnotations(
PRFileDesc* aFd, AnnotationTable& aAnnotations) {
PRInt32 res;
do {
uint32_t rawAnnotation;
res = PR_Read(aFd, &rawAnnotation, sizeof(rawAnnotation));
if ((res != sizeof(rawAnnotation)) ||
(rawAnnotation >= static_cast<uint32_t>(Annotation::Count))) {
return;
}
uint64_t len;
res = PR_Read(aFd, &len, sizeof(len));
if (res != sizeof(len) || (len == 0)) {
return;
}
char c;
nsAutoCString value;
do {
res = PR_Read(aFd, &c, 1);
if (res != 1) {
return;
}
len--;
value.Append(c);
} while (len > 0);
// Looks good, save the (annotation, value) pair
aAnnotations[static_cast<Annotation>(rawAnnotation)] = value;
} while (res > 0);
}
static bool WriteExtraFile(PlatformWriter& pw,
const AnnotationTable& aAnnotations) {
if (!pw.Valid()) {
@ -3235,18 +3120,6 @@ bool WriteExtraFile(const nsAString& id, const AnnotationTable& annotations) {
return WriteExtraFile(pw, annotations);
}
static void ReadExceptionTimeAnnotations(AnnotationTable& aAnnotations,
ProcessId aPid) {
// Read exception-time annotations
StaticMutexAutoLock pidMapLock(processMapLock);
if (aPid && processToCrashFd.count(aPid)) {
PRFileDesc* prFd = processToCrashFd[aPid];
processToCrashFd.erase(aPid);
ReadAndValidateExceptionTimeAnnotations(prFd, aAnnotations);
PR_Close(prFd);
}
}
// This adds annotations that were populated in the main process but are not
// present among the ones that were passed in. Additionally common annotations
// which are present in every crash report are added, including crash time,
@ -3421,18 +3294,6 @@ static void OnChildProcessDumpRequested(
}
}
static void OnChildProcessDumpWritten(void* aContext,
const ClientInfo& aClientInfo)
MOZ_NO_THREAD_SAFETY_ANALYSIS {
ProcessId pid = aClientInfo.pid();
ChildProcessData* pd = pidToMinidump->GetEntry(pid);
MOZ_ASSERT(pd);
if (!pd->minidumpOnly) {
// ReadExceptionTimeAnnotations(*(pd->annotations), pid);
}
dumpMapLock->Unlock();
}
static bool OOPInitialized() { return pidToMinidump != nullptr; }
void OOPInit() {
@ -3607,21 +3468,6 @@ void UnregisterInjectorCallback(DWORD processID) {
#endif // MOZ_CRASHREPORTER_INJECTOR
void RegisterChildCrashAnnotationFileDescriptor(ProcessId aProcess,
PRFileDesc* aFd) {
StaticMutexAutoLock pidMapLock(processMapLock);
processToCrashFd[aProcess] = aFd;
}
void DeregisterChildCrashAnnotationFileDescriptor(ProcessId aProcess) {
StaticMutexAutoLock pidMapLock(processMapLock);
auto it = processToCrashFd.find(aProcess);
if (it != processToCrashFd.end()) {
PR_Close(it->second);
processToCrashFd.erase(it);
}
}
#if defined(XP_LINUX)
// Parent-side API for children
@ -3642,8 +3488,7 @@ bool CreateNotificationPipeForChild(int* childCrashFd, int* childCrashRemapFd) {
#endif // defined(XP_LINUX)
bool SetRemoteExceptionHandler(const char* aCrashPipe,
FileHandle aCrashTimeAnnotationFile) {
bool SetRemoteExceptionHandler(const char* aCrashPipe) {
MOZ_ASSERT(!gExceptionHandler, "crash client already init'd");
RegisterRuntimeExceptionModule();
InitializeAnnotationFacilities();
@ -3690,7 +3535,6 @@ bool SetRemoteExceptionHandler(const char* aCrashPipe,
#endif
#if defined(XP_WIN)
gChildCrashAnnotationReportFd = aCrashTimeAnnotationFile;
gExceptionHandler = new google_breakpad::ExceptionHandler(
L"", ChildFilter, ChildMinidumpCallback,
nullptr, // no callback context
@ -4045,10 +3889,6 @@ bool UnsetRemoteExceptionHandler(bool wasSet) {
void SetNotificationPipeForChild(int childCrashFd) {
gMagicChildCrashReportFd = childCrashFd;
}
void SetCrashAnnotationPipeForChild(int childCrashAnnotationFd) {
gChildCrashAnnotationReportFd = childCrashAnnotationFd;
}
#endif
} // namespace CrashReporter

View File

@ -241,13 +241,6 @@ typedef int FileHandle;
const FileHandle kInvalidFileHandle = -1;
#endif
#if !defined(XP_WIN)
FileHandle GetAnnotationTimeCrashFd();
#endif
void RegisterChildCrashAnnotationFileDescriptor(ProcessId aProcess,
PRFileDesc* aFd);
void DeregisterChildCrashAnnotationFileDescriptor(ProcessId aProcess);
// Return the current thread's ID.
//
// XXX: this is a somewhat out-of-place interface to expose through
@ -325,16 +318,13 @@ DWORD WINAPI WerNotifyProc(LPVOID aParameter);
#endif
// Child-side API
bool SetRemoteExceptionHandler(
const char* aCrashPipe = nullptr,
FileHandle aCrashTimeAnnotationFile = kInvalidFileHandle);
bool SetRemoteExceptionHandler(const char* aCrashPipe = nullptr);
bool UnsetRemoteExceptionHandler(bool wasSet = true);
#if defined(MOZ_WIDGET_ANDROID)
// Android creates child process as services so we must explicitly set
// the handle for the pipe since it can't get remapped to a default value.
void SetNotificationPipeForChild(FileHandle childCrashFd);
void SetCrashAnnotationPipeForChild(FileHandle childCrashAnnotationFd);
#endif
} // namespace CrashReporter

View File

@ -188,7 +188,6 @@ void XRE_SetAndroidChildFds(JNIEnv* env, const XRE_AndroidChildFds& fds) {
mozilla::ipc::SetPrefMapFd(fds.mPrefMapFd);
IPC::Channel::SetClientChannelFd(fds.mIpcFd);
CrashReporter::SetNotificationPipeForChild(fds.mCrashFd);
CrashReporter::SetCrashAnnotationPipeForChild(fds.mCrashAnnotationFd);
}
#endif // defined(MOZ_WIDGET_ANDROID)
@ -384,8 +383,6 @@ nsresult XRE_InitChildProcess(int aArgc, char* aArgv[],
bool exceptionHandlerIsSet = false;
if (!CrashReporter::IsDummy()) {
CrashReporter::FileHandle crashTimeAnnotationFile =
CrashReporter::kInvalidFileHandle;
#if defined(XP_WIN)
if (aArgc < 1) {
return NS_ERROR_FAILURE;
@ -393,18 +390,14 @@ nsresult XRE_InitChildProcess(int aArgc, char* aArgv[],
// Pop the first argument, this is used by the WER runtime exception module
// which reads it from the command-line so we can just discard it here.
--aArgc;
const char* const crashTimeAnnotationArg = aArgv[--aArgc];
crashTimeAnnotationFile = reinterpret_cast<CrashReporter::FileHandle>(
std::stoul(std::string(crashTimeAnnotationArg)));
#endif
if (aArgc < 1) return NS_ERROR_FAILURE;
const char* const crashReporterArg = aArgv[--aArgc];
if (IsCrashReporterEnabled(crashReporterArg)) {
exceptionHandlerIsSet = CrashReporter::SetRemoteExceptionHandler(
crashReporterArg, crashTimeAnnotationFile);
exceptionHandlerIsSet =
CrashReporter::SetRemoteExceptionHandler(crashReporterArg);
MOZ_ASSERT(exceptionHandlerIsSet,
"Should have been able to set remote exception handler");

View File

@ -283,7 +283,6 @@ struct XRE_AndroidChildFds {
int mPrefMapFd;
int mIpcFd;
int mCrashFd;
int mCrashAnnotationFd;
};
void XRE_SetAndroidChildFds(JNIEnv* env, const XRE_AndroidChildFds& fds);