1"""Test that lldb picks the correct DWARF location list entry with a return-pc out of bounds.""" 2 3import lldb 4from lldbsuite.test.decorators import * 5from lldbsuite.test.lldbtest import * 6from lldbsuite.test import lldbutil 7 8 9class LocationListLookupTestCase(TestBase): 10 11 mydir = TestBase.compute_mydir(__file__) 12 13 def setUp(self): 14 # Call super's setUp(). 15 TestBase.setUp(self) 16 17 @skipIf(oslist=["linux"], archs=["arm"]) 18 def test_loclist(self): 19 self.build() 20 exe = self.getBuildArtifact("a.out") 21 22 # Create a target by the debugger. 23 target = self.dbg.CreateTarget(exe) 24 self.assertTrue(target, VALID_TARGET) 25 self.dbg.SetAsync(False) 26 27 li = lldb.SBLaunchInfo(["a.out"]) 28 error = lldb.SBError() 29 process = target.Launch(li, error) 30 self.assertTrue(process.IsValid()) 31 self.assertTrue(process.is_stopped) 32 33 # Find `main` on the stack, then 34 # find `argv` local variable, then 35 # check that we can read the c-string in argv[0] 36 for f in process.GetSelectedThread().frames: 37 if f.GetDisplayFunctionName() == "main": 38 argv = f.GetValueForVariablePath("argv").GetChildAtIndex(0) 39 strm = lldb.SBStream() 40 argv.GetDescription(strm) 41 self.assertNotEqual(strm.GetData().find('a.out'), -1) 42