Skip to content
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
5 changes: 3 additions & 2 deletions lldb/source/Target/ThreadPlanStepOut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,10 @@ bool ThreadPlanStepOut::ShouldStop(Event *event_ptr) {
else
return m_step_through_inline_plan_sp->ShouldStop(event_ptr);
} else if (m_step_out_further_plan_sp) {
if (m_step_out_further_plan_sp->MischiefManaged())
if (m_step_out_further_plan_sp->MischiefManaged()) {
m_step_out_further_plan_sp.reset();
else
done = true;
} else
return m_step_out_further_plan_sp->ShouldStop(event_ptr);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
C_SOURCES := main.c

include Makefile.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""
Test stepping out of a function when the return location is an unsuitable
stopping point.
"""


import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil


class ThreadStepOutLine0TestCase(TestBase):
def test(self):
self.build()
target, process, thread, _ = lldbutil.run_to_source_breakpoint(
self, "// Set breakpoint here", lldb.SBFileSpec("main.c")
)
correct_stepped_out_line = line_number("main.c", "// Should stop here")
return_statement_line = line_number("main.c", "// Ran too far")
safety_bp = target.BreakpointCreateByLocation(
lldb.SBFileSpec("main.c"), return_statement_line
)
self.assertTrue(safety_bp.IsValid())

error = lldb.SBError()
thread.StepOut(error)
self.assertTrue(error.Success())

frame = thread.GetSelectedFrame()
self.assertEqual(
frame.line_entry.GetLine(),
correct_stepped_out_line,
"Step-out lost control of execution, ran too far",
)
11 changes: 11 additions & 0 deletions lldb/test/API/functionalities/thread/step_out_line0/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
int step_out_of_here(int a) {
return a + 5; // Set breakpoint here
}

int main() {
#line 0
int v = step_out_of_here(3) + 7;
#line 9
v += 11; // Should stop here
return v; // Ran too far
}
Loading