Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / lang / objc / objc-optimized / TestObjcOptimized.py
blob1d74047a49bd19a2807f5a95ee8cd3fd28e66265
1 """
2 Test that objective-c expression parser continues to work for optimized build.
4 Fixed a bug in the expression parser where the 'this'
5 or 'self' variable was not properly read if the compiler
6 optimized it into a register.
7 """
10 import lldb
11 import re
13 from lldbsuite.test.decorators import *
14 from lldbsuite.test.lldbtest import *
15 from lldbsuite.test import lldbutil
17 # rdar://problem/9087739
18 # test failure: objc_optimized does not work for "-C clang -A i386"
21 class ObjcOptimizedTestCase(TestBase):
22 myclass = "MyClass"
23 mymethod = "description"
24 method_spec = "-[%s %s]" % (myclass, mymethod)
26 @expectedFailureAll(remote=True)
27 def test_break(self):
28 """Test 'expr member' continues to work for optimized build."""
29 self.build()
30 exe = self.getBuildArtifact("a.out")
31 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
33 lldbutil.run_break_set_by_symbol(
34 self, self.method_spec, num_expected_locations=1, sym_exact=True
37 self.runCmd("run", RUN_SUCCEEDED)
38 self.expect(
39 "thread backtrace",
40 STOPPED_DUE_TO_BREAKPOINT,
41 substrs=["stop reason = breakpoint"],
42 patterns=["frame.*0:.*%s %s" % (self.myclass, self.mymethod)],
45 self.expect("expression member", startstr="(int) $0 = 5")
47 # <rdar://problem/12693963>
48 interp = self.dbg.GetCommandInterpreter()
49 result = lldb.SBCommandReturnObject()
50 interp.HandleCommand("frame variable self", result)
51 output = result.GetOutput()
53 desired_pointer = "0x0"
55 mo = re.search("0x[0-9a-f]+", output)
57 if mo:
58 desired_pointer = mo.group(0)
60 self.expect(
61 "expression (self)",
62 substrs=[("(%s *) $1 = " % self.myclass), desired_pointer],
65 self.expect(
66 "expression self->non_member",
67 error=True,
68 substrs=["does not have a member named 'non_member'"],