2
2
Test some SBValue APIs.
3
3
"""
4
4
5
-
6
5
import lldb
7
6
from lldbsuite .test .decorators import *
8
7
from lldbsuite .test .lldbtest import *
@@ -111,6 +110,30 @@ def test_change_value(self):
111
110
actual_value , 98765 , "Got the right changed value from ptr->second_val"
112
111
)
113
112
113
+ ptr_fourth_value = ptr_value .GetChildMemberWithName ("fourth_val" )
114
+ self .assertTrue (ptr_fourth_value .IsValid (), "Got fourth_val from ptr" )
115
+ fourth_actual_value = ptr_fourth_value .GetValueAsUnsigned (error , 1 )
116
+ self .assertTrue (error .Success (), "Got an unsigned value for ptr->fourth_val" )
117
+ self .assertEqual (fourth_actual_value , 0 )
118
+
119
+ result = ptr_fourth_value .SetValueFromCString ("true" )
120
+ self .assertTrue (result , "Success setting ptr->fourth_val." )
121
+ fourth_actual_value = ptr_fourth_value .GetValueAsSigned (error , 0 )
122
+ self .assertTrue (error .Success (), "Got a changed value from ptr->fourth_val" )
123
+ self .assertEqual (
124
+ fourth_actual_value , 1 , "Got the right changed value from ptr->fourth_val"
125
+ )
126
+
127
+ result = ptr_fourth_value .SetValueFromCString ("NO" )
128
+ self .assertFalse (result , "Failed setting ptr->fourth_val." )
129
+ fourth_actual_value = ptr_fourth_value .GetValueAsSigned (error , 0 )
130
+ self .assertTrue (error .Success (), "Got the original value from ptr->fourth_val" )
131
+ self .assertEqual (
132
+ fourth_actual_value ,
133
+ 1 ,
134
+ "Got the original changed value from ptr->fourth_val" ,
135
+ )
136
+
114
137
# gcc may set multiple locations for breakpoint
115
138
breakpoint .SetEnabled (False )
116
139
@@ -125,7 +148,7 @@ def test_change_value(self):
125
148
)
126
149
127
150
expected_value = (
128
- "Val - 12345 Mine - 55, 98765, 55555555. Ptr - 66, 98765, 66666666"
151
+ "Val - 12345 Mine - 55, 98765, 55555555, 0 . Ptr - 66, 98765, 66666666, 1 "
129
152
)
130
153
stdout = process .GetSTDOUT (1000 )
131
154
self .assertIn (expected_value , stdout , "STDOUT showed changed values." )
0 commit comments