3 from lldbsuite
.test
.decorators
import *
4 from lldbsuite
.test
.lldbtest
import *
5 from lldbsuite
.test
import lldbutil
8 class TestWithGmodulesDebugInfo(TestBase
):
9 @skipIf(bugnumber
="llvm.org/pr36146", oslist
=["linux"], archs
=["i386"])
10 @add_test_categories(["gmodules"])
11 def test_specialized_typedef_from_pch(self
):
14 src_file
= os
.path
.join(self
.getSourceDir(), "main.cpp")
15 src_file_spec
= lldb
.SBFileSpec(src_file
)
16 self
.assertTrue(src_file_spec
.IsValid(), "breakpoint file")
18 # Get the path of the executable
19 exe_path
= self
.getBuildArtifact("a.out")
22 target
= self
.dbg
.CreateTarget(exe_path
)
23 self
.assertTrue(target
.IsValid(), VALID_TARGET
)
25 # Break on interesting line
26 breakpoint
= target
.BreakpointCreateBySourceRegex("break here", src_file_spec
)
28 breakpoint
.IsValid() and breakpoint
.GetNumLocations() >= 1, VALID_BREAKPOINT
32 process
= target
.LaunchSimple(None, None, self
.get_process_working_directory())
33 self
.assertTrue(process
.IsValid(), PROCESS_IS_VALID
)
35 # Get the thread of the process
36 self
.assertState(process
.GetState(), lldb
.eStateStopped
)
37 thread
= lldbutil
.get_stopped_thread(process
, lldb
.eStopReasonBreakpoint
)
40 "There should be a thread stopped due to breakpoint condition",
43 # Get frame for current thread
44 frame
= thread
.frames
[0]
46 testValue
= frame
.EvaluateExpression("test")
48 testValue
.GetError().Success(),
49 "Test expression value invalid: %s" % (testValue
.GetError().GetCString()),
52 testValue
.GetTypeName(), "IntContainer", "Test expression type incorrect"
55 memberValue
= testValue
.GetChildMemberWithName("storage")
57 memberValue
.GetError().Success(),
58 "Member value missing or invalid: %s" % (testValue
.GetError().GetCString()),
60 self
.assertEqual(memberValue
.GetTypeName(), "int", "Member type incorrect")
61 self
.assertEqual(42, memberValue
.GetValueAsSigned(), "Member value incorrect")
63 testValue
= frame
.EvaluateExpression("bar")
65 testValue
.GetError().Success(),
66 "Test expression value invalid: %s" % (testValue
.GetError().GetCString()),
69 testValue
.GetTypeName(), "Foo::Bar", "Test expression type incorrect"
72 memberValue
= testValue
.GetChildMemberWithName("i")
74 memberValue
.GetError().Success(),
75 "Member value missing or invalid: %s" % (testValue
.GetError().GetCString()),
77 self
.assertEqual(memberValue
.GetTypeName(), "int", "Member type incorrect")
78 self
.assertEqual(123, memberValue
.GetValueAsSigned(), "Member value incorrect")