199451b44SJordan Rupprecht"""Test that DWARF types are trusted over module types""" 299451b44SJordan Rupprecht 399451b44SJordan Rupprecht 499451b44SJordan Rupprechtfrom lldbsuite.test.decorators import * 599451b44SJordan Rupprechtfrom lldbsuite.test.lldbtest import * 699451b44SJordan Rupprechtfrom lldbsuite.test import lldbutil 799451b44SJordan Rupprecht 899451b44SJordan Rupprecht 999451b44SJordan Rupprechtclass IncompleteModulesTestCase(TestBase): 1099451b44SJordan Rupprecht def setUp(self): 1199451b44SJordan Rupprecht # Call super's setUp(). 1299451b44SJordan Rupprecht TestBase.setUp(self) 1399451b44SJordan Rupprecht # Find the line number to break inside main(). 14*2238dcc3SJonas Devlieghere self.line = line_number("main.m", "// Set breakpoint 0 here.") 1599451b44SJordan Rupprecht 161c6826e8SMichael Buch @add_test_categories(["gmodules"]) 1799451b44SJordan Rupprecht def test_expr(self): 1899451b44SJordan Rupprecht self.build() 1999451b44SJordan Rupprecht exe = self.getBuildArtifact("a.out") 2099451b44SJordan Rupprecht self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) 2199451b44SJordan Rupprecht lldbutil.run_break_set_by_file_and_line( 22*2238dcc3SJonas Devlieghere self, "main.m", self.line, num_expected_locations=1, loc_exact=True 23*2238dcc3SJonas Devlieghere ) 2499451b44SJordan Rupprecht 2599451b44SJordan Rupprecht self.runCmd("run", RUN_SUCCEEDED) 2699451b44SJordan Rupprecht 2799451b44SJordan Rupprecht # The stop reason of the thread should be breakpoint. 28*2238dcc3SJonas Devlieghere self.expect( 29*2238dcc3SJonas Devlieghere "thread list", 30*2238dcc3SJonas Devlieghere STOPPED_DUE_TO_BREAKPOINT, 31*2238dcc3SJonas Devlieghere substrs=["stopped", "stop reason = breakpoint"], 32*2238dcc3SJonas Devlieghere ) 3399451b44SJordan Rupprecht 3499451b44SJordan Rupprecht # The breakpoint should have a hit count of 1. 359f0b5f9aSSYNOPSYS\georgiev lldbutil.check_breakpoint(self, bpno=1, expected_hit_count=1) 3699451b44SJordan Rupprecht 3799451b44SJordan Rupprecht self.runCmd( 38*2238dcc3SJonas Devlieghere 'settings set target.clang-module-search-paths "' 39*2238dcc3SJonas Devlieghere + self.getSourceDir() 40*2238dcc3SJonas Devlieghere + '"' 41*2238dcc3SJonas Devlieghere ) 4299451b44SJordan Rupprecht 4399451b44SJordan Rupprecht self.expect( 44*2238dcc3SJonas Devlieghere "expr @import myModule; 3", 4599451b44SJordan Rupprecht VARIABLES_DISPLAYED_CORRECTLY, 46*2238dcc3SJonas Devlieghere substrs=["int", "3"], 47*2238dcc3SJonas Devlieghere ) 4899451b44SJordan Rupprecht 49*2238dcc3SJonas Devlieghere self.expect( 50*2238dcc3SJonas Devlieghere "expr private_func()", VARIABLES_DISPLAYED_CORRECTLY, substrs=["int", "5"] 51*2238dcc3SJonas Devlieghere ) 5299451b44SJordan Rupprecht 53*2238dcc3SJonas Devlieghere self.expect( 54*2238dcc3SJonas Devlieghere "expr MY_MIN(2,3)", "#defined macro was found", substrs=["int", "2"] 55*2238dcc3SJonas Devlieghere ) 56*2238dcc3SJonas Devlieghere 57*2238dcc3SJonas Devlieghere self.expect( 58*2238dcc3SJonas Devlieghere "expr MY_MAX(2,3)", "#undefd macro was correctly not found", error=True 59*2238dcc3SJonas Devlieghere ) 60