Author: Adrian Prantl Date: 2024-08-23T11:06:01-07:00 New Revision: 9e9e8238df63b9f10c6635d3f16d8a0fbc7f00c4
URL: https://github.com/llvm/llvm-project/commit/9e9e8238df63b9f10c6635d3f16d8a0fbc7f00c4 DIFF: https://github.com/llvm/llvm-project/commit/9e9e8238df63b9f10c6635d3f16d8a0fbc7f00c4.diff LOG: Revert "Revert "[lldb-dap] Mark hidden frames as "subtle" (#105457)"" This reverts commit aa70f83e660453c006193aab7ba67c94db236948. Added: lldb/test/API/tools/lldb-dap/stackTrace/subtleFrames/Makefile lldb/test/API/tools/lldb-dap/stackTrace/subtleFrames/TestDAP_subtleFrames.py lldb/test/API/tools/lldb-dap/stackTrace/subtleFrames/main.cpp Modified: lldb/tools/lldb-dap/JSONUtils.cpp Removed: ################################################################################ diff --git a/lldb/test/API/tools/lldb-dap/stackTrace/subtleFrames/Makefile b/lldb/test/API/tools/lldb-dap/stackTrace/subtleFrames/Makefile new file mode 100644 index 00000000000000..99998b20bcb050 --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/stackTrace/subtleFrames/Makefile @@ -0,0 +1,3 @@ +CXX_SOURCES := main.cpp + +include Makefile.rules diff --git a/lldb/test/API/tools/lldb-dap/stackTrace/subtleFrames/TestDAP_subtleFrames.py b/lldb/test/API/tools/lldb-dap/stackTrace/subtleFrames/TestDAP_subtleFrames.py new file mode 100644 index 00000000000000..1e41e841e39bc8 --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/stackTrace/subtleFrames/TestDAP_subtleFrames.py @@ -0,0 +1,29 @@ +""" +Test lldb-dap stack trace response +""" + + +import dap_server +from lldbsuite.test.decorators import * + +import lldbdap_testcase +from lldbsuite.test.lldbtest import * + + +class TestDAP_subtleFrames(lldbdap_testcase.DAPTestCaseBase): + @add_test_categories(["libc++"]) + def test_subtleFrames(self): + """ + Internal stack frames (such as the ones used by `std::function`) are marked as "subtle". + """ + program = self.getBuildArtifact("a.out") + self.build_and_launch(program) + source = "main.cpp" + self.set_source_breakpoints(source, [line_number(source, "BREAK HERE")]) + self.continue_to_next_stop() + + frames = self.get_stackFrames() + for f in frames: + if "__function" in f["name"]: + self.assertEqual(f["presentationHint"], "subtle") + self.assertTrue(any(f.get("presentationHint") == "subtle" for f in frames)) diff --git a/lldb/test/API/tools/lldb-dap/stackTrace/subtleFrames/main.cpp b/lldb/test/API/tools/lldb-dap/stackTrace/subtleFrames/main.cpp new file mode 100644 index 00000000000000..71944528441e38 --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/stackTrace/subtleFrames/main.cpp @@ -0,0 +1,13 @@ +#include <functional> +#include <iostream> + +void greet() { + // BREAK HERE + std::cout << "Hello\n"; +} + +int main() { + std::function<void()> func{greet}; + func(); + return 0; +} diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp index a8b85f55939e17..c080fd395b7288 100644 --- a/lldb/tools/lldb-dap/JSONUtils.cpp +++ b/lldb/tools/lldb-dap/JSONUtils.cpp @@ -763,6 +763,9 @@ llvm::json::Value CreateStackFrame(lldb::SBFrame &frame) { object.try_emplace("instructionPointerReference", formatted_addr); } + if (frame.IsArtificial() || frame.IsHidden()) + object.try_emplace("presentationHint", "subtle"); + return llvm::json::Value(std::move(object)); } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits