Author: Charles Zablit Date: 2026-08-11T12:26:05+02:00 New Revision: 2ddb4d03ffcb9c9197faa211307e8510606ec52c
URL: https://github.com/llvm/llvm-project/commit/2ddb4d03ffcb9c9197faa211307e8510606ec52c DIFF: https://github.com/llvm/llvm-project/commit/2ddb4d03ffcb9c9197faa211307e8510606ec52c.diff LOG: [lldb][Windows] Fix x86_64 default unwind plan (#210076) `ABIWindows_x86_64::CreateDefaultUnwindPlan()` uses a "CFA = rbp + 16" as a placeholder, however, `Windows-x86_64` does not use rbp as a frame pointer. With this bogus rbp based CFA, the unwinder could not produce the caller frame, so stepping out of such a function fails with "Could not create return address breakpoint". This patch uses the `Windows-x86_64` correct rule for the fallback: [the return address is at the top of the stack](https://learn.microsoft.com/en-us/cpp/build/x64-software-conventions?view=msvc-170), so `CFA = rsp + 8` and `pc = [CFA - 8]`. Added: Modified: lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp Removed: ################################################################################ diff --git a/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp b/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp index 079b22a307602..be3c83880bd60 100644 --- a/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp +++ b/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp @@ -751,21 +751,15 @@ UnwindPlanSP ABIWindows_x86_64::CreateFunctionEntryUnwindPlan() { // Windows-x86_64 doesn't use %rbp // No available Unwind information for Windows-x86_64 (section .pdata) -// Let's use SysV-x86_64 one for now UnwindPlanSP ABIWindows_x86_64::CreateDefaultUnwindPlan() { - uint32_t fp_reg_num = dwarf_rbp; uint32_t sp_reg_num = dwarf_rsp; uint32_t pc_reg_num = dwarf_rip; UnwindPlan::Row row; - - const int32_t ptr_size = 8; - row.GetCFAValue().SetIsRegisterPlusOffset(dwarf_rbp, 2 * ptr_size); row.SetOffset(0); row.SetUnspecifiedRegistersAreUndefined(true); - - row.SetRegisterLocationToAtCFAPlusOffset(fp_reg_num, ptr_size * -2, true); - row.SetRegisterLocationToAtCFAPlusOffset(pc_reg_num, ptr_size * -1, true); + row.GetCFAValue().SetIsRegisterPlusOffset(sp_reg_num, 8); + row.SetRegisterLocationToAtCFAPlusOffset(pc_reg_num, -8, false); row.SetRegisterLocationToIsCFAPlusOffset(sp_reg_num, 0, true); auto plan_sp = std::make_shared<UnwindPlan>(eRegisterKindDWARF); _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
