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 @skipUnlessDarwin 23 @skipIf(debug_info=no_match(["gmodules"])) 24 def test_expr(self): 25 self.build() 26 exe = self.getBuildArtifact("a.out") 27 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) 28 lldbutil.run_break_set_by_file_and_line( 29 self, "main.m", self.line, num_expected_locations=1, loc_exact=True) 30 31 self.runCmd("run", RUN_SUCCEEDED) 32 33 # The stop reason of the thread should be breakpoint. 34 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, 35 substrs=['stopped', 36 'stop reason = breakpoint']) 37 38 # The breakpoint should have a hit count of 1. 39 self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, 40 substrs=[' resolved, hit count = 1']) 41 42 self.runCmd( 43 "settings set target.clang-module-search-paths \"" + 44 self.getSourceDir() + 45 "\"") 46 47 self.expect("expr @import myModule; 3", VARIABLES_DISPLAYED_CORRECTLY, 48 substrs=["int", "3"]) 49 50 self.expect( 51 "expr private_func()", 52 VARIABLES_DISPLAYED_CORRECTLY, 53 substrs=[ 54 "int", 55 "5"]) 56 57 self.expect("expr MY_MIN(2,3)", "#defined macro was found", 58 substrs=["int", "2"]) 59 60 self.expect("expr MY_MAX(2,3)", "#undefd macro was correctly not found", 61 error=True) 62