https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/213555
A step into a function ran past its prologue only when the pc was exactly the function's first address. A target whose entry point is not a function's first address (such as WebAssembly) is entered past it. This means that the check took every such call for one whose prologue had already run, and the step stopped on the opening brace instead of the first statement. What says the prologue has yet to run is the pc being inside it, which for a target that does enter at the first address is the condition that was there before. >From 92768ff78462869f615459f03fbd41893b345e12 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere <[email protected]> Date: Sun, 2 Aug 2026 09:43:29 -0700 Subject: [PATCH] [lldb] Step past a prologue the pc is inside A step into a function ran past its prologue only when the pc was exactly the function's first address. A target whose entry point is not a function's first address (such as WebAssembly) is entered past it. This means that the check took every such call for one whose prologue had already run, and the step stopped on the opening brace instead of the first statement. What says the prologue has yet to run is the pc being inside it, which for a target that does enter at the first address is the condition that was there before. --- lldb/source/Target/ThreadPlanStepInRange.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lldb/source/Target/ThreadPlanStepInRange.cpp b/lldb/source/Target/ThreadPlanStepInRange.cpp index c90205dc4021a..c0e397fc2873d 100644 --- a/lldb/source/Target/ThreadPlanStepInRange.cpp +++ b/lldb/source/Target/ThreadPlanStepInRange.cpp @@ -246,12 +246,20 @@ bool ThreadPlanStepInRange::ShouldStop(Event *event_ptr) { if (sc.function) { func_start_address = sc.function->GetAddress(); - if (curr_addr == func_start_address.GetLoadAddress(&GetTarget())) - bytes_to_skip = sc.function->GetPrologueByteSize(); + bytes_to_skip = sc.function->GetPrologueByteSize(); } else if (sc.symbol) { func_start_address = sc.symbol->GetAddress(); - if (curr_addr == func_start_address.GetLoadAddress(&GetTarget())) - bytes_to_skip = sc.symbol->GetPrologueByteSize(); + bytes_to_skip = sc.symbol->GetPrologueByteSize(); + } + + // The prologue has yet to run only if the pc is inside it. A function's + // entry point need not be its first address, so a pc past that address + // does not mean the prologue has already run. + if (bytes_to_skip != 0) { + const lldb::addr_t func_start = + func_start_address.GetLoadAddress(&GetTarget()); + if (curr_addr < func_start || curr_addr >= func_start + bytes_to_skip) + bytes_to_skip = 0; } if (bytes_to_skip == 0 && sc.symbol) { _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
