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.
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
):
23 mymethod
= "description"
24 method_spec
= "-[%s %s]" % (myclass
, mymethod
)
26 @expectedFailureAll(remote
=True)
28 """Test 'expr member' continues to work for optimized 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
)
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
)
58 desired_pointer
= mo
.group(0)
62 substrs
=[("(%s *) $1 = " % self
.myclass
), desired_pointer
],
66 "expression self->non_member",
68 substrs
=["does not have a member named 'non_member'"],