[TableGen] Fix validateOperandClass for non Phyical Reg (#118146)
[llvm-project.git] / lldb / test / API / functionalities / find-line-entry / TestFindLineEntry.py
blob3f1760e76dde2978fc4c630674d22239435ca42b
1 """
2 Test that SBCompileUnit::FindLineEntryIndex works correctly.
3 """
5 import lldb
6 import lldbsuite.test.lldbutil as lldbutil
7 from lldbsuite.test.lldbtest import *
10 class FindLineEntry(TestBase):
11 def test_compile_unit_find_line_entry_index(self):
12 """Test the CompileUnit LineEntryIndex lookup API"""
13 self.build()
14 exe = self.getBuildArtifact("a.out")
15 self.target = self.dbg.CreateTarget(exe)
16 self.assertTrue(self.target.IsValid(), "Target is not valid")
18 self.file = lldb.SBFileSpec("main.c")
19 sc_list = self.target.FindCompileUnits(self.file)
20 self.assertEqual(len(sc_list), 1)
21 cu = sc_list[0].GetCompileUnit()
22 self.assertTrue(cu.IsValid(), "CompileUnit is not valid")
24 # First look for valid line
25 self.line = line_number("main.c", "int change_me")
26 self.assertNotEqual(
27 cu.FindLineEntryIndex(0, self.line, self.file),
28 lldb.LLDB_INVALID_LINE_NUMBER,
31 # Then look for a line out of bound
32 self.assertEqual(
33 cu.FindLineEntryIndex(0, 42, self.file), lldb.LLDB_INVALID_LINE_NUMBER