Title: [293688] trunk/Source
- Revision
- 293688
- Author
- justin_mich...@apple.com
- Date
- 2022-05-02 15:33:52 -0700 (Mon, 02 May 2022)
Log Message
Add option to JSC shell to wait for a USR2 signal before exiting to aid in collection of vmmaps
https://bugs.webkit.org/show_bug.cgi?id=239919
Reviewed by Yusuke Suzuki.
Source/_javascript_Core:
* jsc.cpp:
(main):
Source/WTF:
* wtf/threads/Signals.h:
(WTF::toSystemSignal):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (293687 => 293688)
--- trunk/Source/_javascript_Core/ChangeLog 2022-05-02 22:22:40 UTC (rev 293687)
+++ trunk/Source/_javascript_Core/ChangeLog 2022-05-02 22:33:52 UTC (rev 293688)
@@ -1,3 +1,13 @@
+2022-05-02 Justin Michaud <justin_mich...@apple.com>
+
+ Add option to JSC shell to wait for a USR2 signal before exiting to aid in collection of vmmaps
+ https://bugs.webkit.org/show_bug.cgi?id=239919
+
+ Reviewed by Yusuke Suzuki.
+
+ * jsc.cpp:
+ (main):
+
2022-05-02 Commit Queue <commit-qu...@webkit.org>
Unreviewed, reverting r293680.
Modified: trunk/Source/_javascript_Core/jsc.cpp (293687 => 293688)
--- trunk/Source/_javascript_Core/jsc.cpp 2022-05-02 22:22:40 UTC (rev 293687)
+++ trunk/Source/_javascript_Core/jsc.cpp 2022-05-02 22:33:52 UTC (rev 293688)
@@ -95,6 +95,7 @@
#include <wtf/URL.h>
#include <wtf/WallTime.h>
#include <wtf/text/StringBuilder.h>
+#include <wtf/threads/BinarySemaphore.h>
#include <wtf/threads/Signals.h>
#if OS(WINDOWS)
@@ -3035,6 +3036,19 @@
WTF::disableForwardingVPrintfStdErrToOSLog();
#endif
+#if OS(UNIX)
+ BinarySemaphore waitToExit;
+
+ if (getenv("JS_SHELL_WAIT_FOR_SIGUSR2_TO_EXIT")) {
+ addSignalHandler(Signal::Usr, SignalHandler([&] (Signal, SigInfo&, PlatformRegisters&) {
+ dataLogLn("Signal handler hit, we can exit now.");
+ waitToExit.signal();
+ return SignalAction::Handled;
+ }));
+ activateSignalHandlersFor(Signal::Usr);
+ }
+#endif
+
// We can't use destructors in the following code because it uses Windows
// Structured Exception Handling
int res = EXIT_SUCCESS;
@@ -3049,6 +3063,19 @@
getc(stdin);
}
+#if OS(UNIX)
+ if (getenv("JS_SHELL_WAIT_FOR_SIGUSR2_TO_EXIT")) {
+ WTF::fastDisableScavenger();
+ fprintf(stdout, "\njs shell waiting for `kill -USR2 [pid]` to exit\n");
+ fflush(stdout);
+
+ waitToExit.wait();
+
+ fprintf(stdout, "\njs shell exiting\n");
+ fflush(stdout);
+ }
+#endif
+
jscExit(res);
}
Modified: trunk/Source/WTF/ChangeLog (293687 => 293688)
--- trunk/Source/WTF/ChangeLog 2022-05-02 22:22:40 UTC (rev 293687)
+++ trunk/Source/WTF/ChangeLog 2022-05-02 22:33:52 UTC (rev 293688)
@@ -1,3 +1,13 @@
+2022-05-02 Justin Michaud <justin_mich...@apple.com>
+
+ Add option to JSC shell to wait for a USR2 signal before exiting to aid in collection of vmmaps
+ https://bugs.webkit.org/show_bug.cgi?id=239919
+
+ Reviewed by Yusuke Suzuki.
+
+ * wtf/threads/Signals.h:
+ (WTF::toSystemSignal):
+
2022-05-02 Eric Carlson <eric.carl...@apple.com>
[Cocoa] Allow more mime types in captive portal mode
Modified: trunk/Source/WTF/wtf/threads/Signals.h (293687 => 293688)
--- trunk/Source/WTF/wtf/threads/Signals.h 2022-05-02 22:22:40 UTC (rev 293687)
+++ trunk/Source/WTF/wtf/threads/Signals.h 2022-05-02 22:33:52 UTC (rev 293688)
@@ -63,7 +63,7 @@
switch (signal) {
case Signal::AccessFault: return std::make_tuple(SIGSEGV, SIGBUS);
case Signal::IllegalInstruction: return std::make_tuple(SIGILL, std::nullopt);
- case Signal::Usr: return std::make_tuple(SIGILL, std::nullopt);
+ case Signal::Usr: return std::make_tuple(SIGUSR2, std::nullopt);
case Signal::FloatingPoint: return std::make_tuple(SIGFPE, std::nullopt);
case Signal::Breakpoint: return std::make_tuple(SIGTRAP, std::nullopt);
#if !OS(DARWIN)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes