1"""Test that DWARF types are trusted over module types""" 2 3 4 5import unittest2 6 7from lldbsuite.test.decorators import * 8from lldbsuite.test.lldbtest import * 9from lldbsuite.test import lldbutil 10 11 12class IncompleteModulesTestCase(TestBase): 13 14 mydir = TestBase.compute_mydir(__file__) 15 16 def setUp(self): 17 # Call super's setUp(). 18 TestBase.setUp(self) 19 # Find the line number to break inside main(). 20 self.line = line_number('main.m', '// Set breakpoint 0 here.') 21 22 @skipIf(debug_info=no_match(["gmodules"])) 23 def test_expr(self): 24 self.build() 25 exe = self.getBuildArtifact("a.out") 26 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) 27 lldbutil.run_break_set_by_file_and_line( 28 self, "main.m", self.line, num_expected_locations=1, loc_exact=True) 29 30 self.runCmd("run", RUN_SUCCEEDED) 31 32 # The stop reason of the thread should be breakpoint. 33 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, 34 substrs=['stopped', 35 'stop reason = breakpoint']) 36 37 # The breakpoint should have a hit count of 1. 38 self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, 39 substrs=[' resolved, hit count = 1']) 40 41 self.runCmd( 42 "settings set target.clang-module-search-paths \"" + 43 self.getSourceDir() + 44 "\"") 45 46 self.expect("expr @import myModule; 3", VARIABLES_DISPLAYED_CORRECTLY, 47 substrs=["int", "3"]) 48 49 self.expect( 50 "expr private_func()", 51 VARIABLES_DISPLAYED_CORRECTLY, 52 substrs=[ 53 "int", 54 "5"]) 55 56 self.expect("expr MY_MIN(2,3)", "#defined macro was found", 57 substrs=["int", "2"]) 58 59 self.expect("expr MY_MAX(2,3)", "#undefd macro was correctly not found", 60 error=True) 61