Skip to content

Commit 6dd8e7f

Browse files
adrian-prantlJDevlieghere
authored andcommitted
Revert "Revert "[lldb-dap] Mark hidden frames as "subtle" (llvm#105457)""
This reverts commit aa70f83. (cherry picked from commit 9e9e823)
1 parent 9a5aae3 commit 6dd8e7f

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CXX_SOURCES := main.cpp
2+
3+
include Makefile.rules
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"""
2+
Test lldb-dap stack trace response
3+
"""
4+
5+
6+
import dap_server
7+
from lldbsuite.test.decorators import *
8+
9+
import lldbdap_testcase
10+
from lldbsuite.test.lldbtest import *
11+
12+
13+
class TestDAP_subtleFrames(lldbdap_testcase.DAPTestCaseBase):
14+
@add_test_categories(["libc++"])
15+
def test_subtleFrames(self):
16+
"""
17+
Internal stack frames (such as the ones used by `std::function`) are marked as "subtle".
18+
"""
19+
program = self.getBuildArtifact("a.out")
20+
self.build_and_launch(program)
21+
source = "main.cpp"
22+
self.set_source_breakpoints(source, [line_number(source, "BREAK HERE")])
23+
self.continue_to_next_stop()
24+
25+
frames = self.get_stackFrames()
26+
for f in frames:
27+
if "__function" in f["name"]:
28+
self.assertEqual(f["presentationHint"], "subtle")
29+
self.assertTrue(any(f.get("presentationHint") == "subtle" for f in frames))
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include <functional>
2+
#include <iostream>
3+
4+
void greet() {
5+
// BREAK HERE
6+
std::cout << "Hello\n";
7+
}
8+
9+
int main() {
10+
std::function<void()> func{greet};
11+
func();
12+
return 0;
13+
}

lldb/tools/lldb-dap/JSONUtils.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,9 @@ llvm::json::Value CreateStackFrame(lldb::SBFrame &frame) {
763763
object.try_emplace("instructionPointerReference", formatted_addr);
764764
}
765765

766+
if (frame.IsArtificial() || frame.IsHidden())
767+
object.try_emplace("presentationHint", "subtle");
768+
766769
return llvm::json::Value(std::move(object));
767770
}
768771

0 commit comments

Comments
 (0)