Skip to content

Fix stepping away from the bottom-most frame of a virtual inlined call stack. #114337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lldb/source/Target/ThreadPlanStepInRange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,8 @@ bool ThreadPlanStepInRange::DoWillResume(lldb::StateType resume_state,
bool ThreadPlanStepInRange::IsVirtualStep() {
if (m_virtual_step == eLazyBoolCalculate) {
Thread &thread = GetThread();
if (thread.GetCurrentInlinedDepth() == UINT32_MAX)
uint32_t cur_inline_depth = thread.GetCurrentInlinedDepth();
if (cur_inline_depth == UINT32_MAX || cur_inline_depth == 0)
m_virtual_step = eLazyBoolNo;
else
m_virtual_step = eLazyBoolYes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,9 @@ def step_in_template(self):
step_sequence = [["// In max_value specialized", "into"]]
self.run_step_sequence(step_sequence)

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

if one_more_step_loc:
thread.StepInto()
frame_0 = thread.frame[0]
self.assertEqual(
frame_0.line_entry.line,
line_number(self.main_source, one_more_step_loc),
"Was able to step one more time",
)
process.Kill()
target.Clear()

Expand All @@ -420,3 +430,9 @@ def virtual_inline_stepping(self):
self.run_to_call_site_and_step(
"In caller_trivial_inline_2", "caller_trivial_inline_2", 3
)
self.run_to_call_site_and_step(
"In caller_trivial_inline_3",
"caller_trivial_inline_3",
4,
"After caller_trivial_inline_3",
)
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void caller_trivial_inline_1() {

void caller_trivial_inline_2() {
caller_trivial_inline_3(); // In caller_trivial_inline_2.
inline_value += 1;
inline_value += 1; // After caller_trivial_inline_3
}

void caller_trivial_inline_3() {
Expand Down
Loading