Make jsc dump the command line if JSC_dumpOption environment variable is set with...
authormark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Sep 2017 21:24:48 +0000 (21:24 +0000)
committermark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Sep 2017 21:24:48 +0000 (21:24 +0000)
https://bugs.webkit.org/show_bug.cgi?id=176722

Reviewed by Saam Barati.

For PLATFORM(COCOA), I also dumped the JSC_* environmental variables that are
in effect when jsc is invoked.

* jsc.cpp:
(CommandLine::parseArguments):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221878 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/jsc.cpp

index 61fcc1a..6e3c550 100644 (file)
@@ -1,3 +1,16 @@
+2017-09-11  Mark Lam  <mark.lam@apple.com>
+
+        Make jsc dump the command line if JSC_dumpOption environment variable is set with a non-zero value.
+        https://bugs.webkit.org/show_bug.cgi?id=176722
+
+        Reviewed by Saam Barati.
+
+        For PLATFORM(COCOA), I also dumped the JSC_* environmental variables that are
+        in effect when jsc is invoked.
+
+        * jsc.cpp:
+        (CommandLine::parseArguments):
+
 2017-09-11  Ryan Haddad  <ryanhaddad@apple.com>
 
         Unreviewed, rolling out r221854.
index 757f408..9db03f4 100644 (file)
 #include <unistd.h>
 #endif
 
+#if PLATFORM(COCOA)
+#include <crt_externs.h>
+#endif
+
 #if HAVE(READLINE)
 // readline/history.h has a Function typedef which conflicts with the WTF::Function template from WTF/Forward.h
 // We #define it to something else to avoid this conflict.
@@ -3595,6 +3599,20 @@ void CommandLine::parseArguments(int argc, char** argv)
 {
     Options::initialize();
     
+    if (Options::dumpOptions()) {
+        printf("Command line:");
+#if PLATFORM(COCOA)
+        for (char** envp = *_NSGetEnviron(); *envp; envp++) {
+            const char* env = *envp;
+            if (!strncmp("JSC_", env, 4))
+                printf(" %s", env);
+        }
+#endif // PLATFORM(COCOA)
+        for (int i = 0; i < argc; ++i)
+            printf(" %s", argv[i]);
+        printf("\n");
+    }
+
     int i = 1;
     JSC::Options::DumpLevel dumpOptionsLevel = JSC::Options::DumpLevel::None;
     bool needToExit = false;