1
1
import lldb
2
+ import lldbsuite .test .lldbplatformutil as lldbplatformutil
2
3
from lldbsuite .test .decorators import *
3
4
from lldbsuite .test .lldbtest import *
4
5
from lldbsuite .test import lldbutil
@@ -11,12 +12,25 @@ def test(self):
11
12
self , "// break here" , lldb .SBFileSpec ("main.cpp" , False )
12
13
)
13
14
14
- self .expect_expr ("f0" , result_type = "Foo<__bf16>" )
15
- self .expect_expr ("f1" , result_type = "Foo<__fp16>" )
15
+ # On 32-bit Arm, you have to have the bfloat16 extension, or an FPU while
16
+ # not using the soft float mode. The target we assume has none of that
17
+ # so instead of __bf16 we get __fp16.
18
+ is_arm_32_bit = lldbplatformutil .getArchitecture () == "arm"
19
+
20
+ self .expect_expr (
21
+ "f0" , result_type = ("Foo<__fp16>" if is_arm_32_bit else "Foo<__bf16>" )
22
+ )
23
+
24
+ # When __bf16 is actually __fp16, f1 looks like it inherits from itself.
25
+ # Which clang allows but LLDB fails to evaluate.
26
+ if not is_arm_32_bit :
27
+ self .expect_expr ("f1" , result_type = "Foo<__fp16>" )
16
28
17
29
# Test sizeof to ensure while computing layout we don't do
18
30
# infinite recursion.
19
31
v = self .frame ().EvaluateExpression ("sizeof(f0)" )
20
32
self .assertEqual (v .GetValueAsUnsigned () > 0 , True )
21
- v = self .frame ().EvaluateExpression ("sizeof(f1)" )
22
- self .assertEqual (v .GetValueAsUnsigned () > 0 , True )
33
+
34
+ if not is_arm_32_bit :
35
+ v = self .frame ().EvaluateExpression ("sizeof(f1)" )
36
+ self .assertEqual (v .GetValueAsUnsigned () > 0 , True )
0 commit comments