From 53fd724b256e1ccfcb04c90f7740f54e1801986d Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Mon, 9 Dec 2024 10:48:28 -0800 Subject: [lldb] Add lookup by name to SBValue through new member property (#118814) Introduces a `member` property to `SBValue`. This property provides pythonic access to a value's members, by name. The expression `value.member["name"]` will be an alternate form form of writing `value.GetChildMemberWithName("name")`. --- lldb/test/API/python_api/value/TestValueAPI.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'lldb/test/API/python_api') diff --git a/lldb/test/API/python_api/value/TestValueAPI.py b/lldb/test/API/python_api/value/TestValueAPI.py index 5121009..9eaf2c9 100644 --- a/lldb/test/API/python_api/value/TestValueAPI.py +++ b/lldb/test/API/python_api/value/TestValueAPI.py @@ -140,10 +140,8 @@ class ValueAPITestCase(TestBase): val_i = target.EvaluateExpression("i") val_s = target.EvaluateExpression("s") val_a = target.EvaluateExpression("a") - self.assertTrue( - val_s.GetChildMemberWithName("a").GetAddress().IsValid(), VALID_VARIABLE - ) - self.assertTrue(val_s.GetChildMemberWithName("a").AddressOf(), VALID_VARIABLE) + self.assertTrue(val_s.member["a"].GetAddress().IsValid(), VALID_VARIABLE) + self.assertTrue(val_s.member["a"].AddressOf(), VALID_VARIABLE) self.assertTrue(val_a.Cast(val_i.GetType()).AddressOf(), VALID_VARIABLE) # Test some other cases of the Cast API. We allow casts from one struct type @@ -210,7 +208,7 @@ class ValueAPITestCase(TestBase): weird_cast = f_var.Cast(val_s.GetType()) self.assertSuccess(weird_cast.GetError(), "Can cast from a larger to a smaller") self.assertEqual( - weird_cast.GetChildMemberWithName("a").GetValueAsSigned(0), + weird_cast.member["a"].GetValueAsSigned(0), 33, "Got the right value", ) -- cgit v1.1