1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
9 #include "nsExceptionHandler.h"
10 #include "nsExceptionHandlerUtils.h"
13 namespace CrashReporter
{
15 void AnnotateOOMAllocationSize(size_t size
) {}
17 void AnnotateTexturesSize(size_t size
) {}
19 void AnnotatePendingIPC(size_t aNumOfPendingIPC
, uint32_t aTopPendingIPCCount
,
20 const char* aTopPendingIPCName
,
21 uint32_t aTopPendingIPCType
) {}
23 nsresult
SetExceptionHandler(nsIFile
* aXREDirectory
, bool force
/*=false*/) {
24 return NS_ERROR_NOT_IMPLEMENTED
;
27 bool GetEnabled() { return false; }
29 bool GetMinidumpPath(nsAString
& aPath
) { return false; }
31 nsresult
SetMinidumpPath(const nsAString
& aPath
) {
32 return NS_ERROR_NOT_IMPLEMENTED
;
35 nsresult
SetupExtraData(nsIFile
* aAppDataDirectory
,
36 const nsACString
& aBuildID
) {
37 return NS_ERROR_NOT_IMPLEMENTED
;
40 nsresult
UnsetExceptionHandler() { return NS_ERROR_NOT_IMPLEMENTED
; }
42 nsresult
AnnotateCrashReport(Annotation key
, bool data
) {
43 return NS_ERROR_NOT_IMPLEMENTED
;
46 nsresult
AnnotateCrashReport(Annotation key
, int data
) {
47 return NS_ERROR_NOT_IMPLEMENTED
;
50 nsresult
AnnotateCrashReport(Annotation key
, unsigned int data
) {
51 return NS_ERROR_NOT_IMPLEMENTED
;
54 nsresult
AnnotateCrashReport(Annotation key
, const nsACString
& data
) {
55 return NS_ERROR_NOT_IMPLEMENTED
;
58 nsresult
RemoveCrashReportAnnotation(Annotation key
) {
59 return NS_ERROR_NOT_IMPLEMENTED
;
62 AutoAnnotateCrashReport::AutoAnnotateCrashReport(Annotation key
, bool data
) {}
64 AutoAnnotateCrashReport::AutoAnnotateCrashReport(Annotation key
, int data
) {}
66 AutoAnnotateCrashReport::AutoAnnotateCrashReport(Annotation key
,
69 AutoAnnotateCrashReport::AutoAnnotateCrashReport(Annotation key
,
70 const nsACString
& data
) {}
72 AutoAnnotateCrashReport::~AutoAnnotateCrashReport() {}
74 void MergeCrashAnnotations(AnnotationTable
& aDst
, const AnnotationTable
& aSrc
) {
77 nsresult
SetGarbageCollecting(bool collecting
) {
78 return NS_ERROR_NOT_IMPLEMENTED
;
81 void SetEventloopNestingLevel(uint32_t level
) {}
83 void SetMinidumpAnalysisAllThreads() {}
85 nsresult
AppendAppNotesToCrashReport(const nsACString
& data
) {
86 return NS_ERROR_NOT_IMPLEMENTED
;
89 bool GetAnnotation(const nsACString
& key
, nsACString
& data
) { return false; }
91 void GetAnnotation(uint32_t childPid
, Annotation annotation
,
96 nsresult
RegisterAppMemory(void* ptr
, size_t length
) {
97 return NS_ERROR_NOT_IMPLEMENTED
;
100 nsresult
UnregisterAppMemory(void* ptr
) { return NS_ERROR_NOT_IMPLEMENTED
; }
102 void SetIncludeContextHeap(bool aValue
) {}
104 bool GetServerURL(nsACString
& aServerURL
) { return false; }
106 nsresult
SetServerURL(const nsACString
& aServerURL
) {
107 return NS_ERROR_NOT_IMPLEMENTED
;
110 nsresult
SetRestartArgs(int argc
, char** argv
) {
111 return NS_ERROR_NOT_IMPLEMENTED
;
115 int GetAnnotationTimeCrashFd() { return 7; }
118 void RegisterChildCrashAnnotationFileDescriptor(ProcessId aProcess
,
120 // The real implementation of this function takes ownership of aFd
121 // and closes it when the process exits; if we don't close it, it
122 // causes a leak. With no crash reporter we'll never write to the
123 // pipe, so it's safe to close the read end immediately.
127 void DeregisterChildCrashAnnotationFileDescriptor(ProcessId aProcess
) {}
130 nsresult
WriteMinidumpForException(EXCEPTION_POINTERS
* aExceptionInfo
) {
131 return NS_ERROR_NOT_IMPLEMENTED
;
136 bool WriteMinidumpForSigInfo(int signo
, siginfo_t
* info
, void* uc
) {
142 nsresult
AppendObjCExceptionInfoToAppNotes(void* inException
) {
143 return NS_ERROR_NOT_IMPLEMENTED
;
147 nsresult
GetSubmitReports(bool* aSubmitReports
) {
148 return NS_ERROR_NOT_IMPLEMENTED
;
151 nsresult
SetSubmitReports(bool aSubmitReports
) {
152 return NS_ERROR_NOT_IMPLEMENTED
;
155 void SetProfileDirectory(nsIFile
* aDir
) {}
157 void SetUserAppDataDirectory(nsIFile
* aDir
) {}
159 void UpdateCrashEventsDir() {}
161 bool GetCrashEventsDir(nsAString
& aPath
) { return false; }
163 void SetMemoryReportFile(nsIFile
* aFile
) {}
165 nsresult
GetDefaultMemoryReportFile(nsIFile
** aFile
) {
166 return NS_ERROR_NOT_IMPLEMENTED
;
169 void DeleteMinidumpFilesForID(const nsAString
& id
) {}
171 bool GetMinidumpForID(const nsAString
& id
, nsIFile
** minidump
) { return false; }
173 bool GetIDFromMinidump(nsIFile
* minidump
, nsAString
& id
) { return false; }
175 bool GetExtraFileForID(const nsAString
& id
, nsIFile
** extraFile
) {
179 bool GetExtraFileForMinidump(nsIFile
* minidump
, nsIFile
** extraFile
) {
183 bool WriteExtraFile(const nsAString
& id
, const AnnotationTable
& annotations
) {
189 #if defined(XP_WIN) || defined(XP_MACOSX)
190 const char* GetChildNotificationPipe() { return nullptr; }
193 #ifdef MOZ_CRASHREPORTER_INJECTOR
194 void InjectCrashReporterIntoProcess(DWORD processID
,
195 InjectorCrashCallback
* cb
) {}
197 void UnregisterInjectorCallback(DWORD processID
) {}
199 #endif // MOZ_CRASHREPORTER_INJECTOR
201 bool GetLastRunCrashID(nsAString
& id
) { return false; }
203 #if !defined(XP_WIN) && !defined(XP_MACOSX)
205 bool CreateNotificationPipeForChild(int* childCrashFd
, int* childCrashRemapFd
) {
209 #endif // !defined(XP_WIN) && !defined(XP_MACOSX)
211 bool SetRemoteExceptionHandler(const char* aCrashPipe
,
212 FileHandle aCrashTimeAnnotationFile
) {
216 bool TakeMinidumpForChild(uint32_t childPid
, nsIFile
** dump
,
217 AnnotationTable
& aAnnotations
, uint32_t* aSequence
) {
221 bool FinalizeOrphanedMinidump(uint32_t aChildPid
, GeckoProcessType aType
,
228 DWORD WINAPI
WerNotifyProc(LPVOID aParameter
) { return 0; }
230 #endif // defined(XP_WIN)
232 ThreadId
CurrentThreadId() { return -1; }
234 bool TakeMinidump(nsIFile
** aResult
, bool aMoveToPending
) { return false; }
236 bool CreateMinidumpsAndPair(ProcessHandle aTargetPid
,
237 ThreadId aTargetBlamedThread
,
238 const nsACString
& aIncomingPairName
,
239 nsIFile
* aIncomingDumpToPair
,
240 AnnotationTable
& aTargetAnnotations
,
241 nsIFile
** aTargetDumpOut
) {
245 bool CreateAdditionalChildMinidump(ProcessHandle childPid
,
246 ThreadId childBlamedThread
,
247 nsIFile
* parentMinidump
,
248 const nsACString
& name
) {
252 bool UnsetRemoteExceptionHandler() { return false; }
254 #if defined(MOZ_WIDGET_ANDROID)
255 void SetNotificationPipeForChild(FileHandle childCrashFd
) {}
257 void SetCrashAnnotationPipeForChild(FileHandle childCrashAnnotationFd
) {}
259 void AddLibraryMapping(const char* library_name
, uintptr_t start_address
,
260 size_t mapping_length
, size_t file_offset
) {}
263 // From ThreadAnnotation.cpp
265 void InitThreadAnnotation() {}
267 void SetCurrentThreadName(const char* aName
) {}
269 void GetFlatThreadAnnotation(
270 const std::function
<void(const char*)>& aCallback
) {}
272 void ShutdownThreadAnnotation() {}
274 } // namespace CrashReporter