diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-03-30 08:50:58 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-03-30 08:50:58 +0200 |
commit | 4e368f8199a61c6319621ad1b9d6c352f0319f41 (patch) | |
tree | 69c6e2296c4e183ecbe6cfd1e856619e3715ae01 /ipc/glue | |
parent | 59bf4204a84f7638d3f89a29bc7c04e5dc401369 (diff) | |
download | uxp-4e368f8199a61c6319621ad1b9d6c352f0319f41.tar.gz |
Remove base conditional code for crash reporter and injector.
Diffstat (limited to 'ipc/glue')
-rw-r--r-- | ipc/glue/CrashReporterHost.cpp | 103 | ||||
-rw-r--r-- | ipc/glue/CrashReporterHost.h | 20 | ||||
-rw-r--r-- | ipc/glue/CrashReporterMetadataShmem.cpp | 23 | ||||
-rw-r--r-- | ipc/glue/CrashReporterMetadataShmem.h | 4 | ||||
-rw-r--r-- | ipc/glue/GeckoChildProcessHost.cpp | 31 | ||||
-rw-r--r-- | ipc/glue/IPCMessageUtils.h | 11 | ||||
-rw-r--r-- | ipc/glue/MessageChannel.h | 4 | ||||
-rw-r--r-- | ipc/glue/MessageLink.cpp | 7 | ||||
-rw-r--r-- | ipc/glue/ProtocolUtils.cpp | 67 | ||||
-rw-r--r-- | ipc/glue/ProtocolUtils.h | 12 |
10 files changed, 3 insertions, 279 deletions
diff --git a/ipc/glue/CrashReporterHost.cpp b/ipc/glue/CrashReporterHost.cpp index 76052ae663..85552cba5d 100644 --- a/ipc/glue/CrashReporterHost.cpp +++ b/ipc/glue/CrashReporterHost.cpp @@ -9,9 +9,6 @@ #include "mozilla/Sprintf.h" #include "mozilla/SyncRunnable.h" #include "mozilla/Telemetry.h" -#ifdef MOZ_CRASHREPORTER -# include "nsICrashService.h" -#endif namespace mozilla { namespace ipc { @@ -24,105 +21,5 @@ CrashReporterHost::CrashReporterHost(GeckoProcessType aProcessType, { } -#ifdef MOZ_CRASHREPORTER -void -CrashReporterHost::GenerateCrashReport(RefPtr<nsIFile> aCrashDump) -{ - nsString dumpID; - if (!CrashReporter::GetIDFromMinidump(aCrashDump, dumpID)) { - return; - } - - CrashReporter::AnnotationTable notes; - - nsAutoCString type; - switch (mProcessType) { - case GeckoProcessType_Content: - type = NS_LITERAL_CSTRING("content"); - break; - case GeckoProcessType_Plugin: - case GeckoProcessType_GMPlugin: - type = NS_LITERAL_CSTRING("plugin"); - break; - case GeckoProcessType_GPU: - type = NS_LITERAL_CSTRING("gpu"); - break; - default: - NS_ERROR("unknown process type"); - break; - } - notes.Put(NS_LITERAL_CSTRING("ProcessType"), type); - - char startTime[32]; - SprintfLiteral(startTime, "%lld", static_cast<long long>(mStartTime)); - notes.Put(NS_LITERAL_CSTRING("StartupTime"), nsDependentCString(startTime)); - - CrashReporterMetadataShmem::ReadAppNotes(mShmem, ¬es); - - CrashReporter::AppendExtraData(dumpID, notes); - NotifyCrashService(mProcessType, dumpID, ¬es); -} - -/* static */ void -CrashReporterHost::NotifyCrashService(GeckoProcessType aProcessType, - const nsString& aChildDumpID, - const AnnotationTable* aNotes) -{ - if (!NS_IsMainThread()) { - RefPtr<Runnable> runnable = NS_NewRunnableFunction([=] () -> void { - CrashReporterHost::NotifyCrashService(aProcessType, aChildDumpID, aNotes); - }); - RefPtr<nsIThread> mainThread = do_GetMainThread(); - SyncRunnable::DispatchToThread(mainThread, runnable); - return; - } - - MOZ_ASSERT(!aChildDumpID.IsEmpty()); - - nsCOMPtr<nsICrashService> crashService = - do_GetService("@mozilla.org/crashservice;1"); - if (!crashService) { - return; - } - - int32_t processType; - int32_t crashType = nsICrashService::CRASH_TYPE_CRASH; - - nsCString telemetryKey; - - switch (aProcessType) { - case GeckoProcessType_Content: - processType = nsICrashService::PROCESS_TYPE_CONTENT; - telemetryKey.AssignLiteral("content"); - break; - case GeckoProcessType_Plugin: { - processType = nsICrashService::PROCESS_TYPE_PLUGIN; - telemetryKey.AssignLiteral("plugin"); - nsAutoCString val; - if (aNotes->Get(NS_LITERAL_CSTRING("PluginHang"), &val) && - val.Equals(NS_LITERAL_CSTRING("1"))) { - crashType = nsICrashService::CRASH_TYPE_HANG; - telemetryKey.AssignLiteral("pluginhang"); - } - break; - } - case GeckoProcessType_GMPlugin: - processType = nsICrashService::PROCESS_TYPE_GMPLUGIN; - telemetryKey.AssignLiteral("gmplugin"); - break; - case GeckoProcessType_GPU: - processType = nsICrashService::PROCESS_TYPE_GPU; - telemetryKey.AssignLiteral("gpu"); - break; - default: - NS_ERROR("unknown process type"); - return; - } - - crashService->AddCrash(processType, crashType, aChildDumpID); - Telemetry::Accumulate(Telemetry::SUBPROCESS_CRASHES_WITH_DUMP, telemetryKey, 1); -} -#endif - } // namespace ipc } // namespace mozilla diff --git a/ipc/glue/CrashReporterHost.h b/ipc/glue/CrashReporterHost.h index 36c5923c27..1089781c56 100644 --- a/ipc/glue/CrashReporterHost.h +++ b/ipc/glue/CrashReporterHost.h @@ -28,26 +28,6 @@ class CrashReporterHost public: CrashReporterHost(GeckoProcessType aProcessType, const Shmem& aShmem); -#ifdef MOZ_CRASHREPORTER - void GenerateCrashReport(base::ProcessId aPid) { - RefPtr<nsIFile> crashDump; - if (!XRE_TakeMinidumpForChild(aPid, getter_AddRefs(crashDump), nullptr)) { - return; - } - GenerateCrashReport(crashDump); - } - - // This is a static helper function to notify the crash service that a - // crash has occurred. When PCrashReporter is removed, we can make this - // a member function. This can be called from any thread, and if not - // called from the main thread, will post a synchronous message to the - // main thread. - static void NotifyCrashService( - GeckoProcessType aProcessType, - const nsString& aChildDumpID, - const AnnotationTable* aNotes); -#endif - private: void GenerateCrashReport(RefPtr<nsIFile> aCrashDump); diff --git a/ipc/glue/CrashReporterMetadataShmem.cpp b/ipc/glue/CrashReporterMetadataShmem.cpp index f579d5bb0e..5b889948bc 100644 --- a/ipc/glue/CrashReporterMetadataShmem.cpp +++ b/ipc/glue/CrashReporterMetadataShmem.cpp @@ -208,28 +208,5 @@ private: EntryType mEntryType; }; -#ifdef MOZ_CRASHREPORTER -void -CrashReporterMetadataShmem::ReadAppNotes(const Shmem& aShmem, CrashReporter::AnnotationTable* aNotes) -{ - for (MetadataShmemReader reader(aShmem); !reader.Done(); reader.Next()) { - switch (reader.Type()) { - case EntryType::Annotation: { - nsCString key, value; - if (!reader.Read(key) || !reader.Read(value)) { - return; - } - - aNotes->Put(key, value); - break; - } - default: - NS_ASSERTION(false, "Unknown metadata entry type"); - break; - } - } -} -#endif - } // namespace ipc } // namespace mozilla diff --git a/ipc/glue/CrashReporterMetadataShmem.h b/ipc/glue/CrashReporterMetadataShmem.h index d2d8670a22..ad67c6d750 100644 --- a/ipc/glue/CrashReporterMetadataShmem.h +++ b/ipc/glue/CrashReporterMetadataShmem.h @@ -28,10 +28,6 @@ public: void AnnotateCrashReport(const nsCString& aKey, const nsCString& aData); void AppendAppNotes(const nsCString& aData); -#ifdef MOZ_CRASHREPORTER - static void ReadAppNotes(const Shmem& aShmem, CrashReporter::AnnotationTable* aNotes); -#endif - private: void SyncNotesToShmem(); diff --git a/ipc/glue/GeckoChildProcessHost.cpp b/ipc/glue/GeckoChildProcessHost.cpp index 48051472aa..db8ab3d0a7 100644 --- a/ipc/glue/GeckoChildProcessHost.cpp +++ b/ipc/glue/GeckoChildProcessHost.cpp @@ -307,12 +307,6 @@ GeckoChildProcessHost::GetUniqueID() void GeckoChildProcessHost::PrepareLaunch() { -#ifdef MOZ_CRASHREPORTER - if (CrashReporter::GetEnabled()) { - CrashReporter::OOPInit(); - } -#endif - #ifdef XP_WIN if (mProcessType == GeckoProcessType_Plugin) { InitWindowsGroupID(); @@ -902,26 +896,6 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt childArgv.push_back(pidstring); -#if defined(MOZ_CRASHREPORTER) -# if defined(OS_LINUX) || defined(OS_BSD) - int childCrashFd, childCrashRemapFd; - if (!CrashReporter::CreateNotificationPipeForChild( - &childCrashFd, &childCrashRemapFd)) - return false; - if (0 <= childCrashFd) { - mFileMap.push_back(std::pair<int,int>(childCrashFd, childCrashRemapFd)); - // "true" == crash reporting enabled - childArgv.push_back("true"); - } - else { - // "false" == crash reporting disabled - childArgv.push_back("false"); - } -# elif defined(MOZ_WIDGET_COCOA) - childArgv.push_back(CrashReporter::GetChildNotificationPipe()); -# endif // OS_LINUX -#endif - #ifdef MOZ_WIDGET_COCOA // Add a mach port to the command line so the child can communicate its // 'task_t' back to the parent. @@ -1139,11 +1113,6 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt // Process id cmdLine.AppendLooseValue(UTF8ToWide(pidstring)); -#if defined(MOZ_CRASHREPORTER) - cmdLine.AppendLooseValue( - UTF8ToWide(CrashReporter::GetChildNotificationPipe())); -#endif - // Process type cmdLine.AppendLooseValue(UTF8ToWide(childProcessType)); diff --git a/ipc/glue/IPCMessageUtils.h b/ipc/glue/IPCMessageUtils.h index 094aa978a8..15834a8548 100644 --- a/ipc/glue/IPCMessageUtils.h +++ b/ipc/glue/IPCMessageUtils.h @@ -25,9 +25,6 @@ #include <stdint.h> -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#endif #include "nsID.h" #include "nsIWidget.h" #include "nsMemory.h" @@ -127,16 +124,8 @@ struct EnumSerializer { static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) { uintParamType value; if (!ReadParam(aMsg, aIter, &value)) { -#ifdef MOZ_CRASHREPORTER - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCReadErrorReason"), - NS_LITERAL_CSTRING("Bad iter")); -#endif return false; } else if (!EnumValidator::IsLegalValue(paramType(value))) { -#ifdef MOZ_CRASHREPORTER - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCReadErrorReason"), - NS_LITERAL_CSTRING("Illegal value")); -#endif return false; } *aResult = paramType(value); diff --git a/ipc/glue/MessageChannel.h b/ipc/glue/MessageChannel.h index df70899dff..4c9edf9dd7 100644 --- a/ipc/glue/MessageChannel.h +++ b/ipc/glue/MessageChannel.h @@ -19,10 +19,6 @@ #include "mozilla/ipc/Neutering.h" #endif // defined(OS_WIN) #include "mozilla/ipc/Transport.h" -#if defined(MOZ_CRASHREPORTER) && defined(OS_WIN) -#include "mozilla/mozalloc_oom.h" -#include "nsExceptionHandler.h" -#endif #include "MessageLink.h" #include <deque> diff --git a/ipc/glue/MessageLink.cpp b/ipc/glue/MessageLink.cpp index 6a1bda02df..a66fbbb326 100644 --- a/ipc/glue/MessageLink.cpp +++ b/ipc/glue/MessageLink.cpp @@ -14,9 +14,6 @@ #include "mozilla/Assertions.h" #include "mozilla/DebugOnly.h" #include "nsDebug.h" -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#endif #include "nsISupportsImpl.h" #include "nsXULAppAPI.h" @@ -135,10 +132,6 @@ void ProcessLink::SendMessage(Message *msg) { if (msg->size() > IPC::Channel::kMaximumMessageSize) { -#ifdef MOZ_CRASHREPORTER - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCMessageName"), nsDependentCString(msg->name())); - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCMessageSize"), nsPrintfCString("%d", msg->size())); -#endif MOZ_CRASH("IPC message size is too large"); } diff --git a/ipc/glue/ProtocolUtils.cpp b/ipc/glue/ProtocolUtils.cpp index 1a022048fc..4de1314692 100644 --- a/ipc/glue/ProtocolUtils.cpp +++ b/ipc/glue/ProtocolUtils.cpp @@ -25,13 +25,6 @@ #include "mozilla/sandboxTarget.h" #endif -#if defined(MOZ_CRASHREPORTER) && defined(XP_WIN) -#include "aclapi.h" -#include "sddl.h" - -#include "mozilla/TypeTraits.h" -#endif - #include "nsAutoPtr.h" using namespace IPC; @@ -42,16 +35,6 @@ using base::ProcessId; namespace mozilla { -#if defined(MOZ_CRASHREPORTER) && defined(XP_WIN) -// Generate RAII classes for LPTSTR and PSECURITY_DESCRIPTOR. -MOZ_TYPE_SPECIFIC_SCOPED_POINTER_TEMPLATE(ScopedLPTStr, \ - RemovePointer<LPTSTR>::Type, \ - ::LocalFree) -MOZ_TYPE_SPECIFIC_SCOPED_POINTER_TEMPLATE(ScopedPSecurityDescriptor, \ - RemovePointer<PSECURITY_DESCRIPTOR>::Type, \ - ::LocalFree) -#endif - namespace ipc { class ChannelOpened : public IPC::Message @@ -195,11 +178,6 @@ bool DuplicateHandle(HANDLE aSourceHandle, FALSE, aTargetProcessId)); if (!targetProcess) { -#ifdef MOZ_CRASHREPORTER - CrashReporter::AnnotateCrashReport( - NS_LITERAL_CSTRING("IPCTransportFailureReason"), - NS_LITERAL_CSTRING("Failed to open target process.")); -#endif return false; } @@ -209,34 +187,6 @@ bool DuplicateHandle(HANDLE aSourceHandle, } #endif -#ifdef MOZ_CRASHREPORTER -void -AnnotateSystemError() -{ - int64_t error = 0; -#if defined(XP_WIN) - error = ::GetLastError(); -#elif defined(OS_POSIX) - error = errno; -#endif - if (error) { - CrashReporter::AnnotateCrashReport( - NS_LITERAL_CSTRING("IPCSystemError"), - nsPrintfCString("%lld", error)); - } -} -#endif - -#if defined(MOZ_CRASHREPORTER) && defined(XP_MACOSX) -void -AnnotateCrashReportWithErrno(const char* tag, int error) -{ - CrashReporter::AnnotateCrashReport( - nsCString(tag), - nsPrintfCString("%d", error)); -} -#endif - void LogMessageForProtocol(const char* aTopLevelProtocol, base::ProcessId aOtherPid, const char* aContextDescription, @@ -274,18 +224,6 @@ FatalError(const char* aProtocolName, const char* aMsg, bool aIsParent) formattedMessage.AppendLiteral("]: \""); formattedMessage.AppendASCII(aMsg); if (aIsParent) { -#ifdef MOZ_CRASHREPORTER - // We're going to crash the parent process because at this time - // there's no other really nice way of getting a minidump out of - // this process if we're off the main thread. - formattedMessage.AppendLiteral("\". Intentionally crashing."); - NS_ERROR(formattedMessage.get()); - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCFatalErrorProtocol"), - nsDependentCString(aProtocolName)); - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCFatalErrorMsg"), - nsDependentCString(aMsg)); - AnnotateSystemError(); -#endif MOZ_CRASH("IPC FatalError in the parent process!"); } else { formattedMessage.AppendLiteral("\". abort()ing as a result."); @@ -540,12 +478,9 @@ IToplevelProtocol::SetOtherProcessId(base::ProcessId aOtherPid) bool IToplevelProtocol::TakeMinidump(nsIFile** aDump, uint32_t* aSequence) { + /*** STUB ***/ MOZ_RELEASE_ASSERT(GetSide() == ParentSide); -#ifdef MOZ_CRASHREPORTER - return XRE_TakeMinidumpForChild(OtherPid(), aDump, aSequence); -#else return false; -#endif } bool diff --git a/ipc/glue/ProtocolUtils.h b/ipc/glue/ProtocolUtils.h index 9184aae547..83860d93a4 100644 --- a/ipc/glue/ProtocolUtils.h +++ b/ipc/glue/ProtocolUtils.h @@ -472,14 +472,10 @@ DuplicateHandle(HANDLE aSourceHandle, #endif /** - * Annotate the crash reporter with the error code from the most recent system - * call. Returns the system error. + * Hist: Annotated the crash reporter with the error code from the most + * recent system call. Returned the system error. */ -#ifdef MOZ_CRASHREPORTER -void AnnotateSystemError(); -#else #define AnnotateSystemError() do { } while (0) -#endif /** * An endpoint represents one end of a partially initialized IPDL channel. To @@ -599,12 +595,8 @@ private: ProtocolId mProtocolId; }; -#if defined(MOZ_CRASHREPORTER) && defined(XP_MACOSX) -void AnnotateCrashReportWithErrno(const char* tag, int error); -#else static inline void AnnotateCrashReportWithErrno(const char* tag, int error) {} -#endif // This function is used internally to create a pair of Endpoints. See the // comment above Endpoint for a description of how it might be used. |