Bug 790589 - Add env variable to define the cc/gc log directory, r=mccr8
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Thu, 13 Sep 2012 09:24:12 +0200
changeset 107005 f36b93c70d054c848c29273b048df41b16c32c7a
parent 107004 e80ec1d9b1b1299bb2739042eb3811733e936cb4
child 107019 f39786e8364db741d3db3908ad4ec4d2cd44f73d
push id14815
push useremorley@mozilla.com
push dateThu, 13 Sep 2012 20:03:32 +0000
treeherdermozilla-inbound@6dc63bb388e4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs790589
milestone18.0a1
first release with
nightly linux32
f36b93c70d05 / 18.0a1 / 20120913030547 / files
nightly linux64
f36b93c70d05 / 18.0a1 / 20120913030547 / files
nightly mac
f36b93c70d05 / 18.0a1 / 20120913030547 / files
nightly win32
f36b93c70d05 / 18.0a1 / 20120913030547 / files
nightly win64
f36b93c70d05 / 18.0a1 / 20120913030547 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 790589 - Add env variable to define the cc/gc log directory, r=mccr8
xpcom/base/nsCycleCollector.cpp
--- a/xpcom/base/nsCycleCollector.cpp
+++ b/xpcom/base/nsCycleCollector.cpp
@@ -1298,27 +1298,32 @@ public:
         mCurrentAddress.AssignLiteral("0x");
         mDescribers.Clear();
         mNextIndex = 0;
         if (mDisableLog) {
             return NS_OK;
         }
         char basename[MAXPATHLEN] = {'\0'};
         char ccname[MAXPATHLEN] = {'\0'};
+        char* env;
+        if ((env = PR_GetEnv("MOZ_CC_LOG_DIRECTORY"))) {
+            strcpy(basename, env);
+        } else {
 #ifdef XP_WIN
-        // On Windows, tmpnam returns useless stuff, such as "\\s164.".
-        // Therefore we need to call the APIs directly.
-        GetTempPathA(mozilla::ArrayLength(basename), basename);
+            // On Windows, tmpnam returns useless stuff, such as "\\s164.".
+            // Therefore we need to call the APIs directly.
+            GetTempPathA(mozilla::ArrayLength(basename), basename);
 #else
-        tmpnam(basename);
-        char *lastSlash = strrchr(basename, XPCOM_FILE_PATH_SEPARATOR[0]);
-        if (lastSlash) {
-            *lastSlash = '\0';
+            tmpnam(basename);
+            char *lastSlash = strrchr(basename, XPCOM_FILE_PATH_SEPARATOR[0]);
+            if (lastSlash) {
+                *lastSlash = '\0';
+            }
+#endif
         }
-#endif
 
         ++gLogCounter;
 
         // Dump the JS heap.
         char gcname[MAXPATHLEN] = {'\0'};
         sprintf(gcname, "%s%sgc-edges-%d.%d.log", basename,
                 XPCOM_FILE_PATH_SEPARATOR,
                 gLogCounter, base::GetCurrentProcId());