@@ -114,6 +114,39 @@ def test_class_with_only_const_static(self):
114114
115115        self .expect_expr ("ClassWithOnlyConstStatic::member" , result_value = "3" )
116116
117+     def  check_global_var (self , name : str , expect_type , expect_val ):
118+         var_list  =  self .target ().FindGlobalVariables (name , lldb .UINT32_MAX )
119+         self .assertEqual (len (var_list ), 1 )
120+         varobj  =  var_list [0 ]
121+         self .assertEqual (varobj .type .name , expect_type )
122+         self .assertEqual (varobj .value , expect_val )
123+ 
124+     # For debug-info produced by older versions of clang, inline static data members 
125+     # wouldn't get indexed into the Names accelerator table preventing LLDB from finding 
126+     # them. 
127+     @expectedFailureAll (compiler = ["clang" ], compiler_version = ["<" , "18.0" ]) 
128+     @expectedFailureAll (debug_info = no_match (["dsym" ])) 
129+     def  test_inline_static_members (self ):
130+         self .build ()
131+         lldbutil .run_to_source_breakpoint (
132+             self , "// break here" , lldb .SBFileSpec ("main.cpp" )
133+         )
134+ 
135+         self .check_global_var ("A::int_val" , "const int" , "1" )
136+         self .check_global_var ("A::int_val_with_address" , "const int" , "2" )
137+         self .check_global_var ("A::bool_val" , "const bool" , "true" )
138+         self .check_global_var ("A::enum_val" , "Enum" , "enum_case2" )
139+         self .check_global_var ("A::enum_bool_val" , "EnumBool" , "enum_bool_case1" )
140+         self .check_global_var ("A::scoped_enum_val" , "ScopedEnum" , "scoped_enum_case2" )
141+ 
142+         self .check_global_var ("ClassWithOnlyConstStatic::member" , "const int" , "3" )
143+ 
144+         self .check_global_var ("ClassWithConstexprs::member" , "const int" , "2" )
145+         self .check_global_var ("ClassWithConstexprs::enum_val" , "Enum" , "enum_case2" )
146+         self .check_global_var (
147+             "ClassWithConstexprs::scoped_enum_val" , "ScopedEnum" , "scoped_enum_case2" 
148+         )
149+ 
117150    # With older versions of Clang, LLDB fails to evaluate classes with only 
118151    # constexpr members when dsymutil is enabled 
119152    @expectedFailureAll ( 
0 commit comments