From 6d342dbab95e68dd10974e5b71767dfefb0df906 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Tue, 14 Jan 2020 13:23:39 +0100 Subject: Issue #1319 - Remove stderr_to_file. This local-debug function is only useful for Android to work around issues with logspewing and should never be in production builds anyway. --- xpcom/glue/nsCRTGlue.cpp | 24 ------------------------ xpcom/glue/nsDebug.h | 27 --------------------------- 2 files changed, 51 deletions(-) diff --git a/xpcom/glue/nsCRTGlue.cpp b/xpcom/glue/nsCRTGlue.cpp index 7a9f6db03..03c77da2b 100644 --- a/xpcom/glue/nsCRTGlue.cpp +++ b/xpcom/glue/nsCRTGlue.cpp @@ -321,30 +321,6 @@ set_stderr_callback(StderrCallback aCallback) sStderrCallback = aCallback; } -#if defined(ANDROID) && !defined(RELEASE_OR_BETA) -static FILE* sStderrCopy = nullptr; - -void -stderr_to_file(const char* aFmt, va_list aArgs) -{ - vfprintf(sStderrCopy, aFmt, aArgs); -} - -void -copy_stderr_to_file(const char* aFile) -{ - if (sStderrCopy) { - return; - } - size_t buflen = strlen(aFile) + 16; - char* buf = (char*)malloc(buflen); - snprintf(buf, buflen, "%s.%u", aFile, (uint32_t)getpid()); - sStderrCopy = fopen(buf, "w"); - free(buf); - set_stderr_callback(stderr_to_file); -} -#endif - #ifdef HAVE_VA_COPY #define VARARGS_ASSIGN(foo, bar) VA_COPY(foo,bar) #elif defined(HAVE_VA_LIST_AS_ARRAY) diff --git a/xpcom/glue/nsDebug.h b/xpcom/glue/nsDebug.h index 7365f9ce3..0cc7f0a03 100644 --- a/xpcom/glue/nsDebug.h +++ b/xpcom/glue/nsDebug.h @@ -426,33 +426,6 @@ void fprintf_stderr(FILE* aFile, const char* aFmt, ...) MOZ_FORMAT_PRINTF(2, 3); // advanced performance debugging and display/layers visualization. void set_stderr_callback(StderrCallback aCallback); -#if defined(ANDROID) && !defined(RELEASE_OR_BETA) -// Call this if you want a copy of stderr logging sent to a file. This is -// useful to get around logcat overflow problems on android devices, which use -// a circular logcat buffer and can intermittently drop messages if there's too -// much spew. -// -// This is intended for local debugging only, DO NOT USE IN PRODUCTION CODE. -// (This is ifndef RELEASE_OR_BETA to catch uses of it that accidentally get -// checked in). Using this will also prevent the profiler from getting a copy of -// the stderr messages which it uses for various visualization features. -// -// This function can be called from any thread, but if it is called multiple -// times all invocations must be on the same thread. Invocations after the -// first one are ignored, so you can safely put it inside a loop, for example. -// Once this is called there is no way to turn it off; all stderr output from -// that point forward will go to the file. Note that the output is subject to -// buffering so make sure you have enough output to flush the messages you care -// about before you terminate the process. -// -// The file passed in should be writable, so on Android devices a path like -// "/data/local/tmp/blah" is a good one to use as it is world-writable and will -// work even in B2G child processes which have reduced privileges. Note that the -// actual file created will have the PID appended to the path you pass in, so -// that on B2G the output from each process goes to a separate file. -void copy_stderr_to_file(const char* aFile); -#endif - #ifdef __cplusplus } #endif -- cgit v1.2.3