Bug 1896650 - Remove sequence numbers from crash reports r=KrisWright

Differential Revision: https://phabricator.services.mozilla.com/D210309
This commit is contained in:
Gabriele Svelto 2024-05-21 19:58:18 +00:00
parent 91d0d2bc81
commit 80f0c61cf5
5 changed files with 10 additions and 23 deletions

View file

@ -25,7 +25,7 @@ CrashReporterHost::CrashReporterHost(GeckoProcessType aProcessType,
mFinalized(false) {}
bool CrashReporterHost::GenerateCrashReport(base::ProcessId aPid) {
if (!TakeCrashedChildMinidump(aPid, nullptr)) {
if (!TakeCrashedChildMinidump(aPid)) {
return false;
}
@ -35,13 +35,13 @@ bool CrashReporterHost::GenerateCrashReport(base::ProcessId aPid) {
}
RefPtr<nsIFile> CrashReporterHost::TakeCrashedChildMinidump(
base::ProcessId aPid, uint32_t* aOutSequence) {
base::ProcessId aPid) {
CrashReporter::AnnotationTable annotations;
MOZ_ASSERT(!HasMinidump());
RefPtr<nsIFile> crashDump;
if (!CrashReporter::TakeMinidumpForChild(aPid, getter_AddRefs(crashDump),
annotations, aOutSequence)) {
annotations)) {
return nullptr;
}
if (!AdoptMinidump(crashDump, annotations)) {

View file

@ -38,8 +38,7 @@ class CrashReporterHost {
// Given an existing minidump for a crashed child process, take ownership of
// it from IPDL. After this, FinalizeCrashReport may be called.
RefPtr<nsIFile> TakeCrashedChildMinidump(base::ProcessId aPid,
uint32_t* aOutSequence);
RefPtr<nsIFile> TakeCrashedChildMinidump(base::ProcessId aPid);
// Replace the stored minidump with a new one. After this,
// FinalizeCrashReport may be called.

View file

@ -222,7 +222,7 @@ bool CreateNotificationPipeForChild(int* childCrashFd, int* childCrashRemapFd) {
bool SetRemoteExceptionHandler(const char* aCrashPipe) { return false; }
bool TakeMinidumpForChild(uint32_t childPid, nsIFile** dump,
AnnotationTable& aAnnotations, uint32_t* aSequence) {
AnnotationTable& aAnnotations) {
return false;
}

View file

@ -288,18 +288,14 @@ static FileHandle gMagicChildCrashReportFd =
static Mutex* dumpMapLock;
struct ChildProcessData : public nsUint32HashKey {
explicit ChildProcessData(KeyTypePointer aKey)
: nsUint32HashKey(aKey), sequence(0), annotations(nullptr) {}
: nsUint32HashKey(aKey), annotations(nullptr) {}
nsCOMPtr<nsIFile> minidump;
// Each crashing process is assigned an increasing sequence number to
// indicate which process crashed first.
uint32_t sequence;
UniquePtr<AnnotationTable> annotations;
};
typedef nsTHashtable<ChildProcessData> ChildMinidumpMap;
static ChildMinidumpMap* pidToMinidump;
static uint32_t crashSequence;
static bool OOPInitialized();
void RecordMainThreadId() {
@ -3364,7 +3360,6 @@ static void OnChildProcessDumpRequested(
ChildProcessData* pd = pidToMinidump->PutEntry(pid);
MOZ_ASSERT(!pd->minidump);
pd->minidump = minidump;
pd->sequence = ++crashSequence;
pd->annotations = MakeUnique<AnnotationTable>();
AnnotationTable& annotations = *(pd->annotations);
AddSharedAnnotations(annotations);
@ -3582,7 +3577,7 @@ void GetAnnotation(uint32_t childPid, Annotation annotation,
}
bool TakeMinidumpForChild(uint32_t childPid, nsIFile** dump,
AnnotationTable& aAnnotations, uint32_t* aSequence) {
AnnotationTable& aAnnotations) {
if (!GetEnabled()) return false;
MutexAutoLock lock(*dumpMapLock);
@ -3593,10 +3588,6 @@ bool TakeMinidumpForChild(uint32_t childPid, nsIFile** dump,
NS_IF_ADDREF(*dump = pd->minidump);
aAnnotations = *(pd->annotations);
if (aSequence) {
*aSequence = pd->sequence;
}
pidToMinidump->RemoveEntry(pd);
return !!*dump;
@ -3637,7 +3628,7 @@ bool FinalizeOrphanedMinidump(uint32_t aChildPid, GeckoProcessType aType,
# pragma section("mozwerpt", read, executable, shared)
__declspec(allocate("mozwerpt")) MOZ_EXPORT DWORD WINAPI
WerNotifyProc(LPVOID aParameter) {
WerNotifyProc(LPVOID aParameter) {
const WindowsErrorReportingData* werData =
static_cast<const WindowsErrorReportingData*>(aParameter);
@ -3668,7 +3659,6 @@ __declspec(allocate("mozwerpt")) MOZ_EXPORT DWORD WINAPI
ChildProcessData* pd = pidToMinidump->PutEntry(pid);
MOZ_ASSERT(!pd->minidump);
pd->minidump = minidump;
pd->sequence = ++crashSequence;
pd->annotations = MakeUnique<AnnotationTable>();
(*pd->annotations)[Annotation::WindowsErrorReporting] = "1"_ns;
AddSharedAnnotations(*(pd->annotations));

View file

@ -209,11 +209,9 @@ void OOPInit();
// Return true if a dump was found for |childPid|, and return the
// path in |dump|. The caller owns the last reference to |dump| if it
// is non-nullptr. The annotations for the crash will be stored in
// |aAnnotations|. The sequence parameter will be filled with an ordinal
// indicating which remote process crashed first.
// |aAnnotations|.
bool TakeMinidumpForChild(uint32_t childPid, nsIFile** dump,
AnnotationTable& aAnnotations,
uint32_t* aSequence = nullptr);
AnnotationTable& aAnnotations);
/**
* If a dump was found for |childPid| then write a minimal .extra file to