|
1 |
| -from lldbsuite.test import lldbinline |
2 |
| -from lldbsuite.test import decorators |
3 |
| - |
4 |
| -lldbinline.MakeInlineTest( |
5 |
| - __file__, |
6 |
| - globals(), |
7 |
| - [ |
8 |
| - decorators.expectedFailureAll( |
9 |
| - compiler="clang", |
10 |
| - compiler_version=["<", "3.5"], |
11 |
| - bugnumber="llvm.org/pr27845", |
| 1 | +"""Test that inlined argument variables have their correct location in debuginfo""" |
| 2 | + |
| 3 | +import lldb |
| 4 | +from lldbsuite.test.decorators import * |
| 5 | +from lldbsuite.test.lldbtest import * |
| 6 | +from lldbsuite.test import lldbutil |
| 7 | + |
| 8 | + |
| 9 | +class TestRedefinitionsInInlines(TestBase): |
| 10 | + # https://github.com/llvm/llvm-project/issues/28219 |
| 11 | + @skipIf(compiler="clang", compiler_version=["<", "3.5"]) |
| 12 | + def test(self): |
| 13 | + self.source = "main.c" |
| 14 | + self.build() |
| 15 | + (target, process, thread, bp1) = lldbutil.run_to_source_breakpoint( |
| 16 | + self, "first breakpoint", lldb.SBFileSpec(self.source, False) |
| 17 | + ) |
| 18 | + |
| 19 | + bp2 = target.BreakpointCreateBySourceRegex( |
| 20 | + "second breakpoint", lldb.SBFileSpec(self.source, False) |
| 21 | + ) |
| 22 | + bp3 = target.BreakpointCreateBySourceRegex( |
| 23 | + "third breakpoint", lldb.SBFileSpec(self.source, False) |
12 | 24 | )
|
13 |
| - ], |
14 |
| -) |
| 25 | + |
| 26 | + # When called from main(), test2 is passed in the value of 42 in 'b' |
| 27 | + self.expect("expression b", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["42"]) |
| 28 | + |
| 29 | + process.Continue() |
| 30 | + |
| 31 | + self.assertState(process.GetState(), lldb.eStateStopped) |
| 32 | + thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) |
| 33 | + self.assertIsNotNone(thread) |
| 34 | + bp_id = thread.GetStopReasonDataAtIndex(0) |
| 35 | + self.assertEqual(bp_id, bp2.GetID()) |
| 36 | + |
| 37 | + self.expect("expression b", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["42"]) |
| 38 | + self.expect("expression c", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["84"]) |
| 39 | + |
| 40 | + process.Continue() |
| 41 | + |
| 42 | + # Now we're in test1(), and the first thing it does is call test2(24). "Step in" |
| 43 | + # and check that we have the value 24 as the argument. |
| 44 | + self.assertState(process.GetState(), lldb.eStateStopped) |
| 45 | + thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) |
| 46 | + self.assertIsNotNone(thread) |
| 47 | + bp_id = thread.GetStopReasonDataAtIndex(0) |
| 48 | + self.assertEqual(bp_id, bp3.GetID()) |
| 49 | + |
| 50 | + frame = thread.GetFrameAtIndex(0) |
| 51 | + self.assertTrue(frame.IsInlined()) |
| 52 | + self.assertEqual(frame.GetFunctionName(), "test1") |
| 53 | + |
| 54 | + thread.StepInto() |
| 55 | + |
| 56 | + frame = thread.GetFrameAtIndex(0) |
| 57 | + self.assertTrue(frame.IsInlined()) |
| 58 | + self.assertEqual(frame.GetFunctionName(), "test2") |
| 59 | + |
| 60 | + self.expect("expression b", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["24"]) |
0 commit comments