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 void MergeCrashAnnotations(AnnotationTable
& aDst
, const AnnotationTable
& aSrc
) {
65 nsresult
SetGarbageCollecting(bool collecting
) {
66 return NS_ERROR_NOT_IMPLEMENTED
;
69 void SetEventloopNestingLevel(uint32_t level
) {}
71 void SetMinidumpAnalysisAllThreads() {}
73 nsresult
AppendAppNotesToCrashReport(const nsACString
& data
) {
74 return NS_ERROR_NOT_IMPLEMENTED
;
77 bool GetAnnotation(const nsACString
& key
, nsACString
& data
) { return false; }
79 void GetAnnotation(uint32_t childPid
, Annotation annotation
,
84 nsresult
RegisterAppMemory(void* ptr
, size_t length
) {
85 return NS_ERROR_NOT_IMPLEMENTED
;
88 nsresult
UnregisterAppMemory(void* ptr
) { return NS_ERROR_NOT_IMPLEMENTED
; }
90 void SetIncludeContextHeap(bool aValue
) {}
92 bool GetServerURL(nsACString
& aServerURL
) { return false; }
94 nsresult
SetServerURL(const nsACString
& aServerURL
) {
95 return NS_ERROR_NOT_IMPLEMENTED
;
98 nsresult
SetRestartArgs(int argc
, char** argv
) {
99 return NS_ERROR_NOT_IMPLEMENTED
;
103 int GetAnnotationTimeCrashFd() { return 7; }
106 void RegisterChildCrashAnnotationFileDescriptor(ProcessId aProcess
,
108 // The real implementation of this function takes ownership of aFd
109 // and closes it when the process exits; if we don't close it, it
110 // causes a leak. With no crash reporter we'll never write to the
111 // pipe, so it's safe to close the read end immediately.
115 void DeregisterChildCrashAnnotationFileDescriptor(ProcessId aProcess
) {}
118 nsresult
WriteMinidumpForException(EXCEPTION_POINTERS
* aExceptionInfo
) {
119 return NS_ERROR_NOT_IMPLEMENTED
;
124 bool WriteMinidumpForSigInfo(int signo
, siginfo_t
* info
, void* uc
) {
130 nsresult
AppendObjCExceptionInfoToAppNotes(void* inException
) {
131 return NS_ERROR_NOT_IMPLEMENTED
;
135 nsresult
GetSubmitReports(bool* aSubmitReports
) {
136 return NS_ERROR_NOT_IMPLEMENTED
;
139 nsresult
SetSubmitReports(bool aSubmitReports
) {
140 return NS_ERROR_NOT_IMPLEMENTED
;
143 void SetProfileDirectory(nsIFile
* aDir
) {}
145 void SetUserAppDataDirectory(nsIFile
* aDir
) {}
147 void UpdateCrashEventsDir() {}
149 bool GetCrashEventsDir(nsAString
& aPath
) { return false; }
151 void SetMemoryReportFile(nsIFile
* aFile
) {}
153 nsresult
GetDefaultMemoryReportFile(nsIFile
** aFile
) {
154 return NS_ERROR_NOT_IMPLEMENTED
;
157 void DeleteMinidumpFilesForID(const nsAString
& id
) {}
159 bool GetMinidumpForID(const nsAString
& id
, nsIFile
** minidump
) { return false; }
161 bool GetIDFromMinidump(nsIFile
* minidump
, nsAString
& id
) { return false; }
163 bool GetExtraFileForID(const nsAString
& id
, nsIFile
** extraFile
) {
167 bool GetExtraFileForMinidump(nsIFile
* minidump
, nsIFile
** extraFile
) {
171 bool WriteExtraFile(const nsAString
& id
, const AnnotationTable
& annotations
) {
177 #if defined(XP_WIN) || defined(XP_MACOSX)
178 const char* GetChildNotificationPipe() { return nullptr; }
181 #ifdef MOZ_CRASHREPORTER_INJECTOR
182 void InjectCrashReporterIntoProcess(DWORD processID
,
183 InjectorCrashCallback
* cb
) {}
185 void UnregisterInjectorCallback(DWORD processID
) {}
187 #endif // MOZ_CRASHREPORTER_INJECTOR
189 bool GetLastRunCrashID(nsAString
& id
) { return false; }
191 #if !defined(XP_WIN) && !defined(XP_MACOSX)
193 bool CreateNotificationPipeForChild(int* childCrashFd
, int* childCrashRemapFd
) {
197 #endif // !defined(XP_WIN) && !defined(XP_MACOSX)
199 bool SetRemoteExceptionHandler(const char* aCrashPipe
,
200 uintptr_t aCrashTimeAnnotationFile
) {
204 bool TakeMinidumpForChild(uint32_t childPid
, nsIFile
** dump
,
205 AnnotationTable
& aAnnotations
, uint32_t* aSequence
) {
209 bool FinalizeOrphanedMinidump(uint32_t aChildPid
, GeckoProcessType aType
,
214 ThreadId
CurrentThreadId() { return -1; }
216 bool TakeMinidump(nsIFile
** aResult
, bool aMoveToPending
) { return false; }
218 bool CreateMinidumpsAndPair(ProcessHandle aTargetPid
,
219 ThreadId aTargetBlamedThread
,
220 const nsACString
& aIncomingPairName
,
221 nsIFile
* aIncomingDumpToPair
,
222 AnnotationTable
& aTargetAnnotations
,
223 nsIFile
** aTargetDumpOut
) {
227 bool CreateAdditionalChildMinidump(ProcessHandle childPid
,
228 ThreadId childBlamedThread
,
229 nsIFile
* parentMinidump
,
230 const nsACString
& name
) {
234 bool UnsetRemoteExceptionHandler() { return false; }
236 #if defined(MOZ_WIDGET_ANDROID)
237 void SetNotificationPipeForChild(int childCrashFd
) {}
239 void SetCrashAnnotationPipeForChild(int childCrashAnnotationFd
) {}
241 void AddLibraryMapping(const char* library_name
, uintptr_t start_address
,
242 size_t mapping_length
, size_t file_offset
) {}
245 // From ThreadAnnotation.cpp
247 void InitThreadAnnotation() {}
249 void SetCurrentThreadName(const char* aName
) {}
251 void GetFlatThreadAnnotation(
252 const std::function
<void(const char*)>& aCallback
) {}
254 void ShutdownThreadAnnotation() {}
256 } // namespace CrashReporter