Skip to content

Commit 14c19bf

Browse files
committed
Fix stepping away from the bottom-most frame of a virtual inlined call stack.
1 parent c152f18 commit 14c19bf

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

lldb/source/Target/ThreadPlanStepInRange.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,8 @@ bool ThreadPlanStepInRange::DoWillResume(lldb::StateType resume_state,
489489
bool ThreadPlanStepInRange::IsVirtualStep() {
490490
if (m_virtual_step == eLazyBoolCalculate) {
491491
Thread &thread = GetThread();
492-
if (thread.GetCurrentInlinedDepth() == UINT32_MAX)
492+
uint32_t cur_inline_depth = thread.GetCurrentInlinedDepth();
493+
if (cur_inline_depth == UINT32_MAX || cur_inline_depth == 0)
493494
m_virtual_step = eLazyBoolNo;
494495
else
495496
m_virtual_step = eLazyBoolYes;

lldb/test/API/functionalities/inline-stepping/TestInlineStepping.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ def step_in_template(self):
366366
step_sequence = [["// In max_value specialized", "into"]]
367367
self.run_step_sequence(step_sequence)
368368

369-
def run_to_call_site_and_step(self, source_regex, func_name, start_pos):
369+
def run_to_call_site_and_step(self, source_regex, func_name, start_pos, one_more_step_loc = None):
370370
main_spec = lldb.SBFileSpec("calling.cpp")
371371
# Set the breakpoint by file and line, not sourced regex because
372372
# we want to make sure we can set breakpoints on call sites:
@@ -410,6 +410,11 @@ def run_to_call_site_and_step(self, source_regex, func_name, start_pos):
410410
# stepping for this function...
411411
break
412412

413+
if one_more_step_loc:
414+
thread.StepInto()
415+
frame_0 = thread.frame[0]
416+
self.assertEqual(frame_0.line_entry.line, line_number(self.main_source, one_more_step_loc),
417+
"Was able to step one more time")
413418
process.Kill()
414419
target.Clear()
415420

@@ -422,3 +427,7 @@ def virtual_inline_stepping(self):
422427
self.run_to_call_site_and_step(
423428
"In caller_trivial_inline_2", "caller_trivial_inline_2", 3
424429
)
430+
self.run_to_call_site_and_step(
431+
"In caller_trivial_inline_3", "caller_trivial_inline_3", 4, "After caller_trivial_inline_3"
432+
)
433+

lldb/test/API/functionalities/inline-stepping/calling.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ void caller_trivial_inline_1() {
9595

9696
void caller_trivial_inline_2() {
9797
caller_trivial_inline_3(); // In caller_trivial_inline_2.
98-
inline_value += 1;
98+
inline_value += 1; // After caller_trivial_inline_3
9999
}
100100

101101
void caller_trivial_inline_3() {

0 commit comments

Comments
 (0)