blob: 12d4e3792af54f19547dd1ab02b6b9d0d83e5a7c [file] [log] [blame]
Sean Callanan85054342015-04-03 15:39:47 +00001"""Test that DWARF types are trusted over module types"""
2
Zachary Turner35d017f2015-10-23 17:04:29 +00003from __future__ import print_function
4
Zachary Turner77db4a82015-10-22 20:06:20 +00005import lldb_shared
6
Sean Callanan85054342015-04-03 15:39:47 +00007import unittest2
Zachary Turner77db4a82015-10-22 20:06:20 +00008import os, time
Sean Callanan85054342015-04-03 15:39:47 +00009import lldb
10import platform
11import lldbutil
12
13from distutils.version import StrictVersion
14
15from lldbtest import *
16
17class IncompleteModulesTestCase(TestBase):
18
19 mydir = TestBase.compute_mydir(__file__)
20
Sean Callanan85054342015-04-03 15:39:47 +000021 def setUp(self):
22 # Call super's setUp().
23 TestBase.setUp(self)
24 # Find the line number to break inside main().
25 self.line = line_number('main.m', '// Set breakpoint 0 here.')
26
Tamas Berghammerc8fd1302015-09-30 10:12:40 +000027 @skipUnlessDarwin
28 @unittest2.expectedFailure("rdar://20416388")
29 @unittest2.skipIf(platform.system() != "Darwin" or StrictVersion('12.0.0') > platform.release(), "Only supported on Darwin 12.0.0+")
30 def test_expr(self):
31 self.build()
Sean Callanan85054342015-04-03 15:39:47 +000032 exe = os.path.join(os.getcwd(), "a.out")
33 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
34
35 # Break inside the foo function which takes a bar_ptr argument.
36 lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
37
Sean Callanan05834cd2015-07-01 23:56:30 +000038 self.runCmd("run", RUN_SUCCEEDED)
Sean Callanan85054342015-04-03 15:39:47 +000039
40 # The stop reason of the thread should be breakpoint.
41 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
42 substrs = ['stopped',
43 'stop reason = breakpoint'])
44
45 # The breakpoint should have a hit count of 1.
46 self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
47 substrs = [' resolved, hit count = 1'])
48
Sean Callanan85054342015-04-03 15:39:47 +000049 self.runCmd("settings set target.clang-module-search-paths \"" + os.getcwd() + "\"")
50
51 self.expect("expr @import myModule; 3", VARIABLES_DISPLAYED_CORRECTLY,
52 substrs = ["int", "3"])
53
54 self.expect("expr [myObject privateMethod]", VARIABLES_DISPLAYED_CORRECTLY,
55 substrs = ["int", "5"])
56
Sean Callananf0c5aeb2015-04-20 16:31:29 +000057 self.expect("expr MIN(2,3)", "#defined macro was found",
58 substrs = ["int", "2"])
59
60 self.expect("expr MAX(2,3)", "#undefd macro was correcltly not found",
61 error=True)