2 from lldbsuite
.test
.decorators
import *
3 from lldbsuite
.test
.lldbtest
import *
4 from lldbsuite
.test
import lldbutil
7 class ValueAPIVoidStarTestCase(TestBase
):
11 target
, process
, thread
, _
= lldbutil
.run_to_source_breakpoint(
12 self
, "Break at this line", lldb
.SBFileSpec("main.c")
14 frame
= thread
.GetFrameAtIndex(0)
16 # Verify that the expression result for a void * behaves the same way as the
19 var_val
= frame
.FindVariable("void_ptr")
20 self
.assertSuccess(var_val
.GetError(), "Var version made correctly")
22 expr_val
= frame
.EvaluateExpression("void_ptr")
23 self
.assertSuccess(expr_val
.GetError(), "Expr version succeeds")
25 # The pointer values should be equal:
26 self
.assertEqual(var_val
.unsigned
, expr_val
.unsigned
, "Values are equal")
28 # Both versions should have valid AddressOf, and they should be the same.
30 val_addr_of
= var_val
.AddressOf()
31 self
.assertNotEqual(val_addr_of
, lldb
.LLDB_INVALID_ADDRESS
, "Var addr of right")
33 expr_addr_of
= expr_val
.AddressOf()
35 expr_addr_of
, lldb
.LLDB_INVALID_ADDRESS
, "Expr addr of right"
38 # The AddressOf values should also be equal.
39 self
.assertEqual(expr_addr_of
.unsigned
, val_addr_of
.unsigned
, "Addr of equal")