Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / macosx / ctf / TestCTF.py
blobf5fd29f6ed968f7b74102b0cde0a7435605cea51
1 import lldbsuite.test.lldbutil as lldbutil
2 from lldbsuite.test.lldbtest import *
3 from lldbsuite.test.decorators import *
4 import shutil
5 import os
8 class TestCTF(TestBase):
9 NO_DEBUG_INFO_TESTCASE = True
11 def no_ctf_convert(self):
12 if not shutil.which("ctfconvert"):
13 return "ctfconvert not found in path"
14 return None
16 def no_objcopy(self):
17 if not "OBJCOPY" in os.environ:
18 return "llvm-objcopy not found in environment"
19 return None
21 @skipTestIfFn(no_ctf_convert)
22 @skipTestIfFn(no_objcopy)
23 @skipUnlessDarwin
24 def test(self):
25 self.build()
26 self.do_test()
28 @skipTestIfFn(no_ctf_convert)
29 @skipTestIfFn(no_objcopy)
30 @skipUnlessDarwin
31 def test_compressed(self):
32 self.build(dictionary={"COMPRESS_CTF": "YES"})
33 self.do_test()
35 def do_test(self):
36 lldbutil.run_to_name_breakpoint(self, "printf")
38 symbol_file = self.getBuildArtifact("a.ctf")
40 if self.TraceOn():
41 self.runCmd("log enable -v lldb symbol")
43 self.runCmd("target symbols add {}".format(symbol_file))
44 self.expect(
45 "target variable foo",
46 substrs=[
47 "(MyStructT) foo",
48 "i = 1",
49 "foo",
50 "'c'",
51 "[0] = 'c'",
52 "[1] = 'a'",
53 "[2] = 'b'",
54 "[3] = 'c'",
55 'u = (i = 1, s = "")',
56 "f = 0x0000000000000000",
59 self.expect("target variable foo.n.i", substrs=["(MyInt) foo.n.i = 1"])
60 self.expect(
61 "target variable foo.n.s", substrs=["(const char *) foo.n.s", '"foo"']
63 self.expect(
64 "target variable foo.n.c", substrs=["(volatile char) foo.n.c = 'c'"]
66 self.expect(
67 "target variable foo.n.a",
68 substrs=[
69 "(char[4]:8) foo.n.a",
70 "[0] = 'c'",
71 "[1] = 'a'",
72 "[2] = 'b'",
73 "[3] = 'c'",
76 self.expect(
77 "target variable foo.n.u", substrs=['(MyUnionT) foo.n.u = (i = 1, s = "")']
79 self.expect(
80 "target variable foo.f",
81 substrs=["(void (*)(int)) foo.f = 0x0000000000000000"],
84 self.expect(
85 "type lookup MyEnum",
86 substrs=[
87 "enum MyEnum {",
88 "eOne,",
89 "eTwo,",
90 "eThree",
91 "}",
95 self.expect("type lookup RecursiveStruct", substrs=["RecursiveStruct *n;"])