Title: [264051] trunk/Source/_javascript_Core
Revision
264051
Author
[email protected]
Date
2020-07-07 17:59:10 -0700 (Tue, 07 Jul 2020)

Log Message

[JSC] Fix btjs by recovering CallFrame::describeFrame
https://bugs.webkit.org/show_bug.cgi?id=214055

Reviewed by Mark Lam.

While CallFrame::describeFrame is not used in WebKit tree, it is used in LLDB btjs which is invoked from python.
So we need to keep it. We also use std::call_once based buffer allocation instead of `static char buffer[...]`
to avoid spreading debug-use-only buffer in BSS segment.

* interpreter/CallFrame.cpp:
(JSC::CallFrame::describeFrame):
* interpreter/CallFrame.h:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (264050 => 264051)


--- trunk/Source/_javascript_Core/ChangeLog	2020-07-08 00:53:09 UTC (rev 264050)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-07-08 00:59:10 UTC (rev 264051)
@@ -1,3 +1,18 @@
+2020-07-07  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Fix btjs by recovering CallFrame::describeFrame
+        https://bugs.webkit.org/show_bug.cgi?id=214055
+
+        Reviewed by Mark Lam.
+
+        While CallFrame::describeFrame is not used in WebKit tree, it is used in LLDB btjs which is invoked from python.
+        So we need to keep it. We also use std::call_once based buffer allocation instead of `static char buffer[...]`
+        to avoid spreading debug-use-only buffer in BSS segment.
+
+        * interpreter/CallFrame.cpp:
+        (JSC::CallFrame::describeFrame):
+        * interpreter/CallFrame.h:
+
 2020-07-07  Keith Miller  <[email protected]>
 
         Bytecode UseDef should be aware of checkpoints

Modified: trunk/Source/_javascript_Core/interpreter/CallFrame.cpp (264050 => 264051)


--- trunk/Source/_javascript_Core/interpreter/CallFrame.cpp	2020-07-08 00:53:09 UTC (rev 264050)
+++ trunk/Source/_javascript_Core/interpreter/CallFrame.cpp	2020-07-08 00:59:10 UTC (rev 264051)
@@ -288,6 +288,25 @@
     out.print(returnPC());
 }
 
+const char* CallFrame::describeFrame()
+{
+    constexpr size_t bufferSize = 200;
+    static char* buffer = nullptr;
+    static std::once_flag onceKey;
+    std::call_once(onceKey, [&] {
+        buffer = static_cast<char*>(fastZeroedMalloc(bufferSize + 1));
+    });
+
+    WTF::StringPrintStream stringStream;
+
+    dump(stringStream);
+
+    strncpy(buffer, stringStream.toCString().data(), bufferSize);
+    buffer[bufferSize] = '\0';
+
+    return buffer;
+}
+
 void CallFrame::convertToStackOverflowFrame(VM& vm, CodeBlock* codeBlockToKeepAliveUntilFrameIsUnwound)
 {
     ASSERT(!isDeprecatedCallFrameForDebugger());

Modified: trunk/Source/_javascript_Core/interpreter/CallFrame.h (264050 => 264051)


--- trunk/Source/_javascript_Core/interpreter/CallFrame.h	2020-07-08 00:53:09 UTC (rev 264050)
+++ trunk/Source/_javascript_Core/interpreter/CallFrame.h	2020-07-08 00:59:10 UTC (rev 264051)
@@ -281,6 +281,9 @@
 
         void dump(PrintStream&);
 
+        // This function is used in LLDB btjs.
+        JS_EXPORT_PRIVATE const char* describeFrame();
+
     private:
 
         CallFrame();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to