Bug 1395524 - Add profiler log messages for invalid startup profiling env vars. r?njn draft
authorMarkus Stange <mstange@themasta.com>
Thu, 31 Aug 2017 13:34:51 +0200
changeset 656539 0c2267312d354c23141616ff1b04a296e1900fd9
parent 656538 88d7c33425478e59c414ac79af0c6adb102c6960
child 656540 03789073b69e5a55713b2a3f3ef57a7d5f3e1c01
push id77269
push userbmo:mstange@themasta.com
push dateThu, 31 Aug 2017 11:42:46 +0000
reviewersnjn
bugs1395524
milestone57.0a1
Bug 1395524 - Add profiler log messages for invalid startup profiling env vars. r?njn MozReview-Commit-ID: ipWVT6Jh3j
tools/profiler/core/platform.cpp
--- a/tools/profiler/core/platform.cpp
+++ b/tools/profiler/core/platform.cpp
@@ -2323,39 +2323,45 @@ profiler_init(void* aStackTop)
 
     const char* startupEntries = getenv("MOZ_PROFILER_STARTUP_ENTRIES");
     if (startupEntries && startupEntries[0] != '\0') {
       errno = 0;
       entries = strtol(startupEntries, nullptr, 10);
       if (errno == 0 && entries > 0) {
         LOG("- MOZ_PROFILER_STARTUP_ENTRIES = %d", entries);
       } else {
+        LOG("- MOZ_PROFILER_STARTUP_ENTRIES not a valid integer: %s",
+            startupEntries);
         PrintUsageThenExit(1);
       }
     }
 
     const char* startupInterval = getenv("MOZ_PROFILER_STARTUP_INTERVAL");
     if (startupInterval && startupInterval[0] != '\0') {
       errno = 0;
       interval = PR_strtod(startupInterval, nullptr);
       if (errno == 0 && interval > 0.0 && interval <= 1000.0) {
         LOG("- MOZ_PROFILER_STARTUP_INTERVAL = %f", interval);
       } else {
+        LOG("- MOZ_PROFILER_STARTUP_INTERVAL not a valid float: %s",
+            startupInterval);
         PrintUsageThenExit(1);
       }
     }
 
     const char* startupFeaturesBitfield =
       getenv("MOZ_PROFILER_STARTUP_FEATURES_BITFIELD");
     if (startupFeaturesBitfield && startupFeaturesBitfield[0] != '\0') {
       errno = 0;
       features = strtol(startupFeaturesBitfield, nullptr, 10);
       if (errno == 0 && features != 0) {
         LOG("- MOZ_PROFILER_STARTUP_FEATURES_BITFIELD = %d", features);
       } else {
+        LOG("- MOZ_PROFILER_STARTUP_FEATURES_BITFIELD not a valid integer: %s",
+            startupFeaturesBitfield);
         PrintUsageThenExit(1);
       }
     } else {
       const char* startupFeatures = getenv("MOZ_PROFILER_STARTUP_FEATURES");
       if (startupFeatures && startupFeatures[0] != '\0') {
         // Interpret startupFeatures as a list of feature strings, separated by
         // commas.
         UniquePtr<char[]> featureStringStorage;