Bug 1898180 - Use proper process ID for all the crash reporter functions r=KrisWright

Differential Revision: https://phabricator.services.mozilla.com/D211166
This commit is contained in:
Gabriele Svelto 2024-05-27 09:32:11 +00:00
parent 10d3567120
commit 1cf3b81e8d
3 changed files with 29 additions and 29 deletions

View file

@ -118,7 +118,7 @@ nsresult AppendAppNotesToCrashReport(const nsACString& data) {
bool GetAnnotation(const nsACString& key, nsACString& data) { return false; }
void GetAnnotation(uint32_t childPid, Annotation annotation,
void GetAnnotation(ProcessId childPid, Annotation annotation,
nsACString& outStr) {
return;
}
@ -221,12 +221,12 @@ bool CreateNotificationPipeForChild(int* childCrashFd, int* childCrashRemapFd) {
bool SetRemoteExceptionHandler(const char* aCrashPipe) { return false; }
bool TakeMinidumpForChild(uint32_t childPid, nsIFile** dump,
bool TakeMinidumpForChild(ProcessId childPid, nsIFile** dump,
AnnotationTable& aAnnotations) {
return false;
}
bool FinalizeOrphanedMinidump(uint32_t aChildPid, GeckoProcessType aType,
bool FinalizeOrphanedMinidump(ProcessId aChildPid, GeckoProcessType aType,
nsString* aDumpId) {
return false;
}

View file

@ -3560,7 +3560,7 @@ bool SetRemoteExceptionHandler(const char* aCrashPipe) {
return gExceptionHandler->IsOutOfProcess();
}
void GetAnnotation(uint32_t childPid, Annotation annotation,
void GetAnnotation(ProcessId childPid, Annotation annotation,
nsACString& outStr) {
if (!GetEnabled()) {
return;
@ -3576,7 +3576,7 @@ void GetAnnotation(uint32_t childPid, Annotation annotation,
outStr = (*pd->annotations)[annotation];
}
bool TakeMinidumpForChild(uint32_t childPid, nsIFile** dump,
bool TakeMinidumpForChild(ProcessId childPid, nsIFile** dump,
AnnotationTable& aAnnotations) {
if (!GetEnabled()) return false;
@ -3593,7 +3593,7 @@ bool TakeMinidumpForChild(uint32_t childPid, nsIFile** dump,
return !!*dump;
}
bool FinalizeOrphanedMinidump(uint32_t aChildPid, GeckoProcessType aType,
bool FinalizeOrphanedMinidump(ProcessId aChildPid, GeckoProcessType aType,
nsString* aDumpId) {
AnnotationTable annotations;
nsCOMPtr<nsIFile> minidump;

View file

@ -47,6 +47,26 @@ namespace CrashReporter {
using mozilla::Maybe;
using mozilla::Nothing;
#if defined(XP_WIN)
typedef HANDLE ProcessHandle;
typedef DWORD ProcessId;
typedef DWORD ThreadId;
typedef HANDLE FileHandle;
const FileHandle kInvalidFileHandle = INVALID_HANDLE_VALUE;
#elif defined(XP_MACOSX)
typedef task_t ProcessHandle;
typedef pid_t ProcessId;
typedef mach_port_t ThreadId;
typedef int FileHandle;
const FileHandle kInvalidFileHandle = -1;
#else
typedef int ProcessHandle;
typedef pid_t ProcessId;
typedef int ThreadId;
typedef int FileHandle;
const FileHandle kInvalidFileHandle = -1;
#endif
/**
* Returns true if the crash reporter is using the dummy implementation.
*/
@ -151,7 +171,7 @@ nsresult UnregisterAppMemory(void* ptr);
// Include heap regions of the crash context.
void SetIncludeContextHeap(bool aValue);
void GetAnnotation(uint32_t childPid, Annotation annotation,
void GetAnnotation(ProcessId childPid, Annotation annotation,
nsACString& outStr);
// Functions for working with minidumps and .extras
@ -210,7 +230,7 @@ void OOPInit();
// 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|.
bool TakeMinidumpForChild(uint32_t childPid, nsIFile** dump,
bool TakeMinidumpForChild(ProcessId childPid, nsIFile** dump,
AnnotationTable& aAnnotations);
/**
@ -224,30 +244,10 @@ bool TakeMinidumpForChild(uint32_t childPid, nsIFile** dump,
* @param aType The type of the crashed process
* @param aDumpId A string that will be filled with the dump ID
*/
[[nodiscard]] bool FinalizeOrphanedMinidump(uint32_t aChildPid,
[[nodiscard]] bool FinalizeOrphanedMinidump(ProcessId aChildPid,
GeckoProcessType aType,
nsString* aDumpId = nullptr);
#if defined(XP_WIN)
typedef HANDLE ProcessHandle;
typedef DWORD ProcessId;
typedef DWORD ThreadId;
typedef HANDLE FileHandle;
const FileHandle kInvalidFileHandle = INVALID_HANDLE_VALUE;
#elif defined(XP_MACOSX)
typedef task_t ProcessHandle;
typedef pid_t ProcessId;
typedef mach_port_t ThreadId;
typedef int FileHandle;
const FileHandle kInvalidFileHandle = -1;
#else
typedef int ProcessHandle;
typedef pid_t ProcessId;
typedef int ThreadId;
typedef int FileHandle;
const FileHandle kInvalidFileHandle = -1;
#endif
// Return the current thread's ID.
//
// XXX: this is a somewhat out-of-place interface to expose through