Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / lang / cpp / gmodules / basic / TestWithModuleDebugging.py
blobc6b2e04cd9c120a34a4721ee9bbdd4640eab1401
1 import lldb
2 import os
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):
12 self.build()
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")
21 # Load the executable
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)
27 self.assertTrue(
28 breakpoint.IsValid() and breakpoint.GetNumLocations() >= 1, VALID_BREAKPOINT
31 # Launch the process
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)
38 self.assertTrue(
39 thread.IsValid(),
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")
47 self.assertTrue(
48 testValue.GetError().Success(),
49 "Test expression value invalid: %s" % (testValue.GetError().GetCString()),
51 self.assertEqual(
52 testValue.GetTypeName(), "IntContainer", "Test expression type incorrect"
55 memberValue = testValue.GetChildMemberWithName("storage")
56 self.assertTrue(
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")
64 self.assertTrue(
65 testValue.GetError().Success(),
66 "Test expression value invalid: %s" % (testValue.GetError().GetCString()),
68 self.assertEqual(
69 testValue.GetTypeName(), "Foo::Bar", "Test expression type incorrect"
72 memberValue = testValue.GetChildMemberWithName("i")
73 self.assertTrue(
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")