[mlir][acc] Introduce MappableType interface (#122146)
[llvm-project.git] / lldb / test / API / lang / c / local_variables / TestLocalVariables.py
blob686636119314ef16f47382a8fb5fd26b9133a3b8
1 """Show local variables and check that they can be inspected.
3 This test was added after we made a change in clang to normalize
4 DW_OP_constu(X < 32) to DW_OP_litX which broke the debugger because
5 it didn't read the value as an unsigned.
6 """
9 from lldbsuite.test.decorators import *
10 from lldbsuite.test.lldbtest import *
11 from lldbsuite.test import lldbutil
14 class LocalVariablesTestCase(TestBase):
15 def setUp(self):
16 # Call super's setUp().
17 TestBase.setUp(self)
18 # Find the line number to break inside main().
19 self.source = "main.c"
20 self.line = line_number(self.source, "// Set break point at this line.")
22 def test_c_local_variables(self):
23 """Test local variable value."""
24 self.build()
26 # Create a target by the debugger.
27 target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
28 self.assertTrue(target, VALID_TARGET)
30 # Break inside the main.
31 lldbutil.run_break_set_by_file_and_line(
32 self, self.source, self.line, num_expected_locations=1, loc_exact=True
35 # Now launch the process, and do not stop at entry point.
36 process = target.LaunchSimple(None, None, self.get_process_working_directory())
37 self.assertTrue(process, PROCESS_IS_VALID)
39 # The stop reason of the thread should be breakpoint.
40 self.expect(
41 "thread list",
42 STOPPED_DUE_TO_BREAKPOINT,
43 substrs=["stopped", "stop reason = breakpoint"],
46 # The breakpoint should have a hit count of 1.
47 lldbutil.check_breakpoint(self, bpno=1, expected_hit_count=1)
49 self.expect(
50 "frame variable i",
51 VARIABLES_DISPLAYED_CORRECTLY,
52 substrs=["(unsigned int) i = 10"],