2017-11-14 13:49:33 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* 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/. */
|
|
|
|
|
2018-09-17 20:51:45 +00:00
|
|
|
#include <functional>
|
|
|
|
|
2017-11-14 13:49:33 +00:00
|
|
|
#include "nsExceptionHandler.h"
|
|
|
|
#include "nsExceptionHandlerUtils.h"
|
2019-07-23 16:04:05 +00:00
|
|
|
#include "prio.h"
|
2017-11-14 13:49:33 +00:00
|
|
|
|
|
|
|
namespace CrashReporter {
|
|
|
|
|
|
|
|
void AnnotateOOMAllocationSize(size_t size) {}
|
|
|
|
|
|
|
|
void AnnotateTexturesSize(size_t size) {}
|
|
|
|
|
|
|
|
void AnnotatePendingIPC(size_t aNumOfPendingIPC, uint32_t aTopPendingIPCCount,
|
|
|
|
const char* aTopPendingIPCName,
|
|
|
|
uint32_t aTopPendingIPCType) {}
|
|
|
|
|
|
|
|
nsresult SetExceptionHandler(nsIFile* aXREDirectory, bool force /*=false*/) {
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GetEnabled() { return false; }
|
|
|
|
|
|
|
|
bool GetMinidumpPath(nsAString& aPath) { return false; }
|
|
|
|
|
|
|
|
nsresult SetMinidumpPath(const nsAString& aPath) {
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult SetupExtraData(nsIFile* aAppDataDirectory,
|
|
|
|
const nsACString& aBuildID) {
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult UnsetExceptionHandler() { return NS_ERROR_NOT_IMPLEMENTED; }
|
|
|
|
|
Bug 1348273 - Convert crash annotations into a machine-readable list of constants; r=ted.mielczarek,njn,dholbert,mak,cpearce,mcmanus,froydnj,Dexter,jrmuizel,jchen,jimm,bz,surkov
This introduces the machinery needed to generate crash annotations from a YAML
file. The relevant C++ functions are updated to take a typed enum. JavaScript
calls are unaffected but they will throw if the string argument does not
correspond to one of the known entries in the C++ enum. The existing whitelists
and blacklists of annotations are also generated from the YAML file and all
duplicate code related to them has been consolidated. Once written out to the
.extra file the annotations are converted in string form and are no different
than the existing ones.
All existing annotations have been included in the list (and some obsolete ones
have been removed) and all call sites have been updated including tests where
appropriate.
--HG--
extra : source : 4f6c43f2830701ec5552e08e3f1b06fe6d045860
2018-07-05 13:42:11 +00:00
|
|
|
nsresult AnnotateCrashReport(Annotation key, bool data) {
|
2017-11-14 13:49:33 +00:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
Bug 1348273 - Convert crash annotations into a machine-readable list of constants; r=ted.mielczarek,njn,dholbert,mak,cpearce,mcmanus,froydnj,Dexter,jrmuizel,jchen,jimm,bz,surkov
This introduces the machinery needed to generate crash annotations from a YAML
file. The relevant C++ functions are updated to take a typed enum. JavaScript
calls are unaffected but they will throw if the string argument does not
correspond to one of the known entries in the C++ enum. The existing whitelists
and blacklists of annotations are also generated from the YAML file and all
duplicate code related to them has been consolidated. Once written out to the
.extra file the annotations are converted in string form and are no different
than the existing ones.
All existing annotations have been included in the list (and some obsolete ones
have been removed) and all call sites have been updated including tests where
appropriate.
--HG--
extra : source : 4f6c43f2830701ec5552e08e3f1b06fe6d045860
2018-07-05 13:42:11 +00:00
|
|
|
nsresult AnnotateCrashReport(Annotation key, int data) {
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult AnnotateCrashReport(Annotation key, unsigned int data) {
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult AnnotateCrashReport(Annotation key, const nsACString& data) {
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult RemoveCrashReportAnnotation(Annotation key) {
|
2017-11-14 13:49:33 +00:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2020-07-08 16:32:41 +00:00
|
|
|
AutoAnnotateCrashReport::AutoAnnotateCrashReport(Annotation key, bool data) {}
|
|
|
|
|
|
|
|
AutoAnnotateCrashReport::AutoAnnotateCrashReport(Annotation key, int data) {}
|
|
|
|
|
|
|
|
AutoAnnotateCrashReport::AutoAnnotateCrashReport(Annotation key,
|
|
|
|
unsigned data) {}
|
|
|
|
|
|
|
|
AutoAnnotateCrashReport::AutoAnnotateCrashReport(Annotation key,
|
|
|
|
const nsACString& data) {}
|
|
|
|
|
|
|
|
AutoAnnotateCrashReport::~AutoAnnotateCrashReport() {}
|
|
|
|
|
2019-05-18 16:19:55 +00:00
|
|
|
void MergeCrashAnnotations(AnnotationTable& aDst, const AnnotationTable& aSrc) {
|
|
|
|
}
|
|
|
|
|
2017-11-14 13:49:33 +00:00
|
|
|
nsresult SetGarbageCollecting(bool collecting) {
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetEventloopNestingLevel(uint32_t level) {}
|
|
|
|
|
|
|
|
void SetMinidumpAnalysisAllThreads() {}
|
|
|
|
|
|
|
|
nsresult AppendAppNotesToCrashReport(const nsACString& data) {
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GetAnnotation(const nsACString& key, nsACString& data) { return false; }
|
|
|
|
|
2020-02-21 17:40:30 +00:00
|
|
|
void GetAnnotation(uint32_t childPid, Annotation annotation,
|
|
|
|
nsACString& outStr) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-11-14 13:49:33 +00:00
|
|
|
nsresult RegisterAppMemory(void* ptr, size_t length) {
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult UnregisterAppMemory(void* ptr) { return NS_ERROR_NOT_IMPLEMENTED; }
|
|
|
|
|
|
|
|
void SetIncludeContextHeap(bool aValue) {}
|
|
|
|
|
|
|
|
bool GetServerURL(nsACString& aServerURL) { return false; }
|
|
|
|
|
|
|
|
nsresult SetServerURL(const nsACString& aServerURL) {
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult SetRestartArgs(int argc, char** argv) {
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2017-11-27 20:37:34 +00:00
|
|
|
#if !defined(XP_WIN)
|
|
|
|
int GetAnnotationTimeCrashFd() { return 7; }
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void RegisterChildCrashAnnotationFileDescriptor(ProcessId aProcess,
|
2019-07-23 16:04:05 +00:00
|
|
|
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);
|
|
|
|
}
|
2017-11-27 20:37:34 +00:00
|
|
|
|
|
|
|
void DeregisterChildCrashAnnotationFileDescriptor(ProcessId aProcess) {}
|
|
|
|
|
2019-03-21 01:28:50 +00:00
|
|
|
#ifdef XP_WIN
|
2017-11-14 13:49:33 +00:00
|
|
|
nsresult WriteMinidumpForException(EXCEPTION_POINTERS* aExceptionInfo) {
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XP_LINUX
|
|
|
|
bool WriteMinidumpForSigInfo(int signo, siginfo_t* info, void* uc) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XP_MACOSX
|
|
|
|
nsresult AppendObjCExceptionInfoToAppNotes(void* inException) {
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
nsresult GetSubmitReports(bool* aSubmitReports) {
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult SetSubmitReports(bool aSubmitReports) {
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetProfileDirectory(nsIFile* aDir) {}
|
|
|
|
|
|
|
|
void SetUserAppDataDirectory(nsIFile* aDir) {}
|
|
|
|
|
|
|
|
void UpdateCrashEventsDir() {}
|
|
|
|
|
|
|
|
bool GetCrashEventsDir(nsAString& aPath) { return false; }
|
|
|
|
|
|
|
|
void SetMemoryReportFile(nsIFile* aFile) {}
|
|
|
|
|
|
|
|
nsresult GetDefaultMemoryReportFile(nsIFile** aFile) {
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DeleteMinidumpFilesForID(const nsAString& id) {}
|
|
|
|
|
|
|
|
bool GetMinidumpForID(const nsAString& id, nsIFile** minidump) { return false; }
|
|
|
|
|
|
|
|
bool GetIDFromMinidump(nsIFile* minidump, nsAString& id) { return false; }
|
|
|
|
|
|
|
|
bool GetExtraFileForID(const nsAString& id, nsIFile** extraFile) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GetExtraFileForMinidump(nsIFile* minidump, nsIFile** extraFile) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-05-18 16:19:55 +00:00
|
|
|
bool WriteExtraFile(const nsAString& id, const AnnotationTable& annotations) {
|
2017-11-14 13:49:33 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OOPInit() {}
|
|
|
|
|
|
|
|
#if defined(XP_WIN) || defined(XP_MACOSX)
|
|
|
|
const char* GetChildNotificationPipe() { return nullptr; }
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef MOZ_CRASHREPORTER_INJECTOR
|
|
|
|
void InjectCrashReporterIntoProcess(DWORD processID,
|
|
|
|
InjectorCrashCallback* cb) {}
|
|
|
|
|
|
|
|
void UnregisterInjectorCallback(DWORD processID) {}
|
|
|
|
|
|
|
|
#endif // MOZ_CRASHREPORTER_INJECTOR
|
|
|
|
|
|
|
|
bool GetLastRunCrashID(nsAString& id) { return false; }
|
|
|
|
|
2020-04-13 21:38:51 +00:00
|
|
|
#if !defined(XP_WIN) && !defined(XP_MACOSX)
|
2020-03-20 20:56:41 +00:00
|
|
|
|
|
|
|
bool CreateNotificationPipeForChild(int* childCrashFd, int* childCrashRemapFd) {
|
2017-11-14 13:49:33 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-04-13 21:38:51 +00:00
|
|
|
#endif // !defined(XP_WIN) && !defined(XP_MACOSX)
|
2017-11-14 13:49:33 +00:00
|
|
|
|
2020-03-20 20:56:41 +00:00
|
|
|
bool SetRemoteExceptionHandler(const char* aCrashPipe,
|
2021-06-11 09:59:49 +00:00
|
|
|
FileHandle aCrashTimeAnnotationFile) {
|
2017-11-14 13:49:33 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TakeMinidumpForChild(uint32_t childPid, nsIFile** dump,
|
2019-05-18 16:19:55 +00:00
|
|
|
AnnotationTable& aAnnotations, uint32_t* aSequence) {
|
2017-11-14 13:49:33 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-12-20 17:50:45 +00:00
|
|
|
bool FinalizeOrphanedMinidump(uint32_t aChildPid, GeckoProcessType aType,
|
|
|
|
nsString* aDumpId) {
|
2019-08-09 14:23:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-06-11 09:59:49 +00:00
|
|
|
#if defined(XP_WIN)
|
|
|
|
|
|
|
|
DWORD WINAPI WerNotifyProc(LPVOID aParameter) { return 0; }
|
|
|
|
|
|
|
|
#endif // defined(XP_WIN)
|
|
|
|
|
2017-11-14 13:49:33 +00:00
|
|
|
ThreadId CurrentThreadId() { return -1; }
|
|
|
|
|
|
|
|
bool TakeMinidump(nsIFile** aResult, bool aMoveToPending) { return false; }
|
|
|
|
|
|
|
|
bool CreateMinidumpsAndPair(ProcessHandle aTargetPid,
|
|
|
|
ThreadId aTargetBlamedThread,
|
|
|
|
const nsACString& aIncomingPairName,
|
|
|
|
nsIFile* aIncomingDumpToPair,
|
2019-05-18 16:19:55 +00:00
|
|
|
AnnotationTable& aTargetAnnotations,
|
2018-09-17 20:51:45 +00:00
|
|
|
nsIFile** aTargetDumpOut) {
|
|
|
|
return false;
|
2017-11-14 13:49:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CreateAdditionalChildMinidump(ProcessHandle childPid,
|
|
|
|
ThreadId childBlamedThread,
|
|
|
|
nsIFile* parentMinidump,
|
|
|
|
const nsACString& name) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool UnsetRemoteExceptionHandler() { return false; }
|
|
|
|
|
|
|
|
#if defined(MOZ_WIDGET_ANDROID)
|
2021-06-11 09:59:49 +00:00
|
|
|
void SetNotificationPipeForChild(FileHandle childCrashFd) {}
|
2017-11-14 13:49:33 +00:00
|
|
|
|
2021-06-11 09:59:49 +00:00
|
|
|
void SetCrashAnnotationPipeForChild(FileHandle childCrashAnnotationFd) {}
|
2017-11-27 20:37:34 +00:00
|
|
|
|
2017-11-14 13:49:33 +00:00
|
|
|
void AddLibraryMapping(const char* library_name, uintptr_t start_address,
|
|
|
|
size_t mapping_length, size_t file_offset) {}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// From ThreadAnnotation.cpp
|
|
|
|
|
|
|
|
void InitThreadAnnotation() {}
|
|
|
|
|
|
|
|
void SetCurrentThreadName(const char* aName) {}
|
|
|
|
|
|
|
|
void GetFlatThreadAnnotation(
|
|
|
|
const std::function<void(const char*)>& aCallback) {}
|
|
|
|
|
|
|
|
void ShutdownThreadAnnotation() {}
|
|
|
|
|
|
|
|
} // namespace CrashReporter
|