2 from lldbsuite
.test
.lldbtest
import *
3 import lldbsuite
.test
.lldbutil
as lldbutil
6 class TestUnionMembers(TestBase
):
7 def test_union_members(self
):
11 bp
= self
.target
.BreakpointCreateBySourceRegex("Break here", self
.src_file_spec
)
12 self
.assertTrue(bp
.IsValid() and bp
.GetNumLocations() >= 1, VALID_BREAKPOINT
)
15 self
.process
= self
.target
.LaunchSimple(
16 None, None, self
.get_process_working_directory()
18 self
.assertTrue(self
.process
.IsValid(), PROCESS_IS_VALID
)
19 self
.assertEqual(self
.process
.GetState(), lldb
.eStateStopped
, PROCESS_STOPPED
)
21 thread
= lldbutil
.get_stopped_thread(self
.process
, lldb
.eStopReasonBreakpoint
)
22 self
.assertTrue(thread
.IsValid())
23 frame
= thread
.GetSelectedFrame()
24 self
.assertTrue(frame
.IsValid())
26 val
= frame
.EvaluateExpression("u")
27 self
.assertTrue(val
.IsValid())
28 val
= frame
.EvaluateExpression("u.s")
29 self
.assertTrue(val
.IsValid())
30 self
.assertEqual(val
.GetNumChildren(), 2)
35 src_file
= os
.path
.join(self
.getSourceDir(), "main.c")
36 self
.src_file_spec
= lldb
.SBFileSpec(src_file
)
37 self
.assertTrue(self
.src_file_spec
.IsValid(), "breakpoint file")
39 # Get the path of the executable
40 exe_path
= self
.getBuildArtifact("a.out")
43 self
.target
= self
.dbg
.CreateTarget(exe_path
)
44 self
.assertTrue(self
.target
.IsValid(), VALID_TARGET
)