From 6d148b48a247ed24ec158008607f610c196efe55 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Thu, 24 Apr 2025 18:35:49 -0700 Subject: [PATCH] [lldb] Use the static value in lldbutil.check_variable when use_dynamic=False --- lldb/packages/Python/lldbsuite/test/lldbutil.py | 2 ++ .../lang/swift/async/frame/variable/TestSwiftAsyncFrameVar.py | 4 ++-- lldb/test/API/lang/swift/metatype/TestSwiftMetatype.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py b/lldb/packages/Python/lldbsuite/test/lldbutil.py index 7bc0a00736fda..a05cb08ebf878 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbutil.py +++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py @@ -1579,6 +1579,8 @@ def check_variable( valobj.IsDynamic(), "dynamic value of %s is not dynamic" % (name if valobj else ""), ) + else: + valobj = valobj.GetStaticValue() if use_synthetic: valobj.SetPreferSyntheticValue(True) if summary: diff --git a/lldb/test/API/lang/swift/async/frame/variable/TestSwiftAsyncFrameVar.py b/lldb/test/API/lang/swift/async/frame/variable/TestSwiftAsyncFrameVar.py index 86f33c1d13e9a..1b6d2295aac79 100644 --- a/lldb/test/API/lang/swift/async/frame/variable/TestSwiftAsyncFrameVar.py +++ b/lldb/test/API/lang/swift/async/frame/variable/TestSwiftAsyncFrameVar.py @@ -25,7 +25,7 @@ def test(self): b = frame.FindVariable("b") self.assertFalse(b.IsValid()) d = frame.FindVariable("d") - lldbutil.check_variable(self, d, False, value='23') + lldbutil.check_variable(self, d, use_dynamic=True, value='23') # The first breakpoint resolves to multiple locations, but only the # first location is needed. Now that we've stopped, delete it to @@ -46,4 +46,4 @@ def test(self): self.assertTrue(b.IsValid()) self.assertGreater(b.unsigned, 0) d = frame.FindVariable("d") - lldbutil.check_variable(self, d, False, value='23') + lldbutil.check_variable(self, d, use_dynamic=True, value='23') diff --git a/lldb/test/API/lang/swift/metatype/TestSwiftMetatype.py b/lldb/test/API/lang/swift/metatype/TestSwiftMetatype.py index d11742421e550..9b90010514132 100644 --- a/lldb/test/API/lang/swift/metatype/TestSwiftMetatype.py +++ b/lldb/test/API/lang/swift/metatype/TestSwiftMetatype.py @@ -37,6 +37,6 @@ def test_metatype(self): var_p = frame.FindVariable("p") lldbutil.check_variable(self, var_s, False, "String") lldbutil.check_variable(self, var_c, False, "@thick a.D.Type") - lldbutil.check_variable(self, var_f, False, '@thick ((Int) -> Int).Type') + lldbutil.check_variable(self, var_f, True, '@thick ((Int) -> Int).Type') lldbutil.check_variable(self, var_t, False, "(Int, Int, String)") lldbutil.check_variable(self, var_p, False, "a.P")