blob: 60bb82da2c604f959f35f6e076c5737cc4ed3f2c [file] [log] [blame]
Sean Callanan85054342015-04-03 15:39:47 +00001"""Test that DWARF types are trusted over module types"""
2
3import os, time
4import unittest2
5import lldb
6import platform
7import lldbutil
8
9from distutils.version import StrictVersion
10
11from lldbtest import *
12
13class IncompleteModulesTestCase(TestBase):
14
15 mydir = TestBase.compute_mydir(__file__)
16
Sean Callanan85054342015-04-03 15:39:47 +000017 def setUp(self):
18 # Call super's setUp().
19 TestBase.setUp(self)
20 # Find the line number to break inside main().
21 self.line = line_number('main.m', '// Set breakpoint 0 here.')
22
Tamas Berghammerc8fd1302015-09-30 10:12:40 +000023 @skipUnlessDarwin
24 @unittest2.expectedFailure("rdar://20416388")
25 @unittest2.skipIf(platform.system() != "Darwin" or StrictVersion('12.0.0') > platform.release(), "Only supported on Darwin 12.0.0+")
26 def test_expr(self):
27 self.build()
Sean Callanan85054342015-04-03 15:39:47 +000028 exe = os.path.join(os.getcwd(), "a.out")
29 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
30
31 # Break inside the foo function which takes a bar_ptr argument.
32 lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
33
Sean Callanan05834cd2015-07-01 23:56:30 +000034 self.runCmd("run", RUN_SUCCEEDED)
Sean Callanan85054342015-04-03 15:39:47 +000035
36 # The stop reason of the thread should be breakpoint.
37 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
38 substrs = ['stopped',
39 'stop reason = breakpoint'])
40
41 # The breakpoint should have a hit count of 1.
42 self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
43 substrs = [' resolved, hit count = 1'])
44
Sean Callanan85054342015-04-03 15:39:47 +000045 self.runCmd("settings set target.clang-module-search-paths \"" + os.getcwd() + "\"")
46
47 self.expect("expr @import myModule; 3", VARIABLES_DISPLAYED_CORRECTLY,
48 substrs = ["int", "3"])
49
50 self.expect("expr [myObject privateMethod]", VARIABLES_DISPLAYED_CORRECTLY,
51 substrs = ["int", "5"])
52
Sean Callananf0c5aeb2015-04-20 16:31:29 +000053 self.expect("expr MIN(2,3)", "#defined macro was found",
54 substrs = ["int", "2"])
55
56 self.expect("expr MAX(2,3)", "#undefd macro was correcltly not found",
57 error=True)
58
Sean Callanan85054342015-04-03 15:39:47 +000059if __name__ == '__main__':
60 import atexit
61 lldb.SBDebugger.Initialize()
62 atexit.register(lambda: lldb.SBDebugger.Terminate())
63 unittest2.main()