22Test some SBValue APIs.
33"""
44
5-
65import lldb
76from lldbsuite .test .decorators import *
87from lldbsuite .test .lldbtest import *
@@ -111,6 +110,20 @@ def test_change_value(self):
111110 actual_value , 98765 , "Got the right changed value from ptr->second_val"
112111 )
113112
113+ ptr_fourth_value = ptr_value .GetChildMemberWithName ("fourth_val" )
114+ self .assertTrue (ptr_fourth_value .IsValid (), "Got fourth_value from ptr" )
115+ fourth_actual_value = ptr_fourth_value .GetValueAsUnsigned (error , 1 )
116+ self .assertTrue (error .Success (), "Got an unsigned value for ptr->second_val" )
117+ self .assertEqual (fourth_actual_value , 0 )
118+
119+ result = ptr_fourth_value .SetValueFromCString ("true" )
120+ self .assertTrue (result , "Success setting ptr->fourth_value." )
121+ fourth_actual_value = ptr_fourth_value .GetValueAsSigned (error , 0 )
122+ self .assertTrue (error .Success (), "Got a changed value from ptr->second_val" )
123+ self .assertEqual (
124+ fourth_actual_value , 1 , "Got the right changed value from ptr->fourth_val"
125+ )
126+
114127 # gcc may set multiple locations for breakpoint
115128 breakpoint .SetEnabled (False )
116129
@@ -125,7 +138,7 @@ def test_change_value(self):
125138 )
126139
127140 expected_value = (
128- "Val - 12345 Mine - 55, 98765, 55555555. Ptr - 66, 98765, 66666666"
141+ "Val - 12345 Mine - 55, 98765, 55555555, 0 . Ptr - 66, 98765, 66666666, 1 "
129142 )
130143 stdout = process .GetSTDOUT (1000 )
131144 self .assertIn (expected_value , stdout , "STDOUT showed changed values." )
0 commit comments