File tree 4 files changed +48
-0
lines changed
test/API/tools/lldb-dap/stackTrace/subtleFrames 4 files changed +48
-0
lines changed Original file line number Diff line number Diff line change
1
+ CXX_SOURCES := main.cpp
2
+
3
+ include Makefile.rules
Original file line number Diff line number Diff line change
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 ))
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change @@ -763,6 +763,9 @@ llvm::json::Value CreateStackFrame(lldb::SBFrame &frame) {
763
763
object.try_emplace (" instructionPointerReference" , formatted_addr);
764
764
}
765
765
766
+ if (frame.IsArtificial () || frame.IsHidden ())
767
+ object.try_emplace (" presentationHint" , " subtle" );
768
+
766
769
return llvm::json::Value (std::move (object));
767
770
}
768
771
You can’t perform that action at this time.
0 commit comments