aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/API/python_api
diff options
context:
space:
mode:
authorDave Lee <davelee.com@gmail.com>2024-12-09 10:48:28 -0800
committerGitHub <noreply@github.com>2024-12-09 10:48:28 -0800
commit53fd724b256e1ccfcb04c90f7740f54e1801986d (patch)
treee5923ea54c7b532fccc02e3a8fe7dcbc7873b1fe /lldb/test/API/python_api
parentbef562343fe3ba91f14a9c86d8612f68986589cc (diff)
downloadllvm-53fd724b256e1ccfcb04c90f7740f54e1801986d.zip
llvm-53fd724b256e1ccfcb04c90f7740f54e1801986d.tar.gz
llvm-53fd724b256e1ccfcb04c90f7740f54e1801986d.tar.bz2
[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")`.
Diffstat (limited to 'lldb/test/API/python_api')
-rw-r--r--lldb/test/API/python_api/value/TestValueAPI.py8
1 files changed, 3 insertions, 5 deletions
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",
)