mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1160142 - Updates for content crash reporter apis to allow the pairing of a passed in minidump. r=ted
This commit is contained in:
parent
bb45c43a43
commit
60d6414da3
@ -139,15 +139,13 @@ CrashReporterParent::GenerateChildData(const AnnotationTable* processNotes)
|
||||
mNotes.Put(NS_LITERAL_CSTRING("Notes"), mAppNotes);
|
||||
}
|
||||
|
||||
bool ret = true;
|
||||
|
||||
// Append these notes to the end of the extra file based on the current
|
||||
// dump id we obtained from CreatePairedMinidumps.
|
||||
ret = CrashReporter::AppendExtraData(mChildDumpID, mNotes);
|
||||
bool ret = CrashReporter::AppendExtraData(mChildDumpID, mNotes);
|
||||
if (ret && processNotes) {
|
||||
ret = CrashReporter::AppendExtraData(mChildDumpID, *processNotes);
|
||||
if (!ret)
|
||||
}
|
||||
|
||||
if (!ret) {
|
||||
NS_WARNING("problem appending child data to .extra");
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
|
||||
/*
|
||||
* Attempt to generate a parent/child pair of minidumps from the given
|
||||
* toplevel actor. This calls CrashReporter::CreatePairedMinidumps to
|
||||
* toplevel actor. This calls CrashReporter::CreateMinidumpsAndPair to
|
||||
* generate the minidumps. Crash reporter annotations set prior to this
|
||||
* call will be saved via PairedDumpCallbackExtra into an .extra file
|
||||
* under the proper crash id. AnnotateCrashReport annotations are not
|
||||
@ -54,6 +54,20 @@ public:
|
||||
bool
|
||||
GeneratePairedMinidump(Toplevel* t);
|
||||
|
||||
/*
|
||||
* Attempts to take a minidump of the current process and pair that with
|
||||
* a named minidump handed in by the caller.
|
||||
*
|
||||
* @param aTopLevel - top level actor this reporter is associated with.
|
||||
* @param aMinidump - the minidump to associate with.
|
||||
* @param aPairName - the name of the additional minidump.
|
||||
* @returns true if successful, false otherwise.
|
||||
*/
|
||||
template<class Toplevel>
|
||||
bool
|
||||
GenerateMinidumpAndPair(Toplevel* aTopLevel, nsIFile* aMinidump,
|
||||
const nsACString& aPairName);
|
||||
|
||||
/**
|
||||
* Apply child process annotations to an existing paired mindump generated
|
||||
* with GeneratePairedMinidump.
|
||||
@ -158,8 +172,10 @@ public:
|
||||
#endif
|
||||
nsCString mAppNotes;
|
||||
nsString mChildDumpID;
|
||||
// stores the child main thread id
|
||||
NativeThreadId mMainThread;
|
||||
time_t mStartTime;
|
||||
// stores the child process type
|
||||
uint32_t mProcessType;
|
||||
bool mInitialized;
|
||||
};
|
||||
@ -179,15 +195,44 @@ CrashReporterParent::GeneratePairedMinidump(Toplevel* t)
|
||||
}
|
||||
#endif
|
||||
nsCOMPtr<nsIFile> childDump;
|
||||
if (CrashReporter::CreatePairedMinidumps(child,
|
||||
mMainThread,
|
||||
getter_AddRefs(childDump)) &&
|
||||
if (CrashReporter::CreateMinidumpsAndPair(child,
|
||||
mMainThread,
|
||||
NS_LITERAL_CSTRING("browser"),
|
||||
nullptr, // pair with a dump of this process and thread
|
||||
getter_AddRefs(childDump)) &&
|
||||
CrashReporter::GetIDFromMinidump(childDump, mChildDumpID)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template<class Toplevel>
|
||||
inline bool
|
||||
CrashReporterParent::GenerateMinidumpAndPair(Toplevel* aTopLevel,
|
||||
nsIFile* aMinidumpToPair,
|
||||
const nsACString& aPairName)
|
||||
{
|
||||
mozilla::ipc::ScopedProcessHandle childHandle;
|
||||
#ifdef XP_MACOSX
|
||||
childHandle = aTopLevel->Process()->GetChildTask();
|
||||
#else
|
||||
if (!base::OpenPrivilegedProcessHandle(aTopLevel->OtherPid(), &childHandle.rwget())) {
|
||||
NS_WARNING("Failed to open child process handle.");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
nsCOMPtr<nsIFile> targetDump;
|
||||
if (CrashReporter::CreateMinidumpsAndPair(childHandle,
|
||||
mMainThread, // child thread id
|
||||
aPairName,
|
||||
aMinidumpToPair,
|
||||
getter_AddRefs(targetDump)) &&
|
||||
CrashReporter::GetIDFromMinidump(targetDump, mChildDumpID)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template<class Toplevel>
|
||||
inline bool
|
||||
CrashReporterParent::GenerateCrashReport(Toplevel* t,
|
||||
@ -220,9 +265,11 @@ CrashReporterParent::GenerateCompleteMinidump(Toplevel* t)
|
||||
}
|
||||
#endif
|
||||
nsCOMPtr<nsIFile> childDump;
|
||||
if (CrashReporter::CreatePairedMinidumps(child,
|
||||
mMainThread,
|
||||
getter_AddRefs(childDump)) &&
|
||||
if (CrashReporter::CreateMinidumpsAndPair(child,
|
||||
mMainThread,
|
||||
NS_LITERAL_CSTRING("browser"),
|
||||
nullptr, // pair with a dump of this process and thread
|
||||
getter_AddRefs(childDump)) &&
|
||||
CrashReporter::GetIDFromMinidump(childDump, mChildDumpID)) {
|
||||
GenerateChildData(nullptr);
|
||||
FinalizeChildData();
|
||||
|
Loading…
Reference in New Issue
Block a user