Skip to content

Commit 8137dee

Browse files
[lldb][swift] Increase number of Rows inspected when unwinding async functions
We were overly conservatives in our initial estimations: if callee saved registers are used, they are usually spilled first, increasing the number of rows in the prologue. This also revealed an embarrassing bug in how we computed the offset of a iterator in the vector: ``` - int row_idx = fp_locs.end() - it; + int row_idx = it - fp_locs.begin(); ```
1 parent c1d18ab commit 8137dee

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2584,9 +2584,9 @@ GetFrameSetupInfo(UnwindPlan &unwind_plan, RegisterContext &regctx) {
25842584
if (!fp_unwind_regdomain)
25852585
return fp_unwind_regdomain.takeError();
25862586

2587-
// Look at the first few (4) rows of the plan and store FP's location.
2588-
const int upper_bound = std::min(4, unwind_plan.GetRowCount());
2589-
llvm::SmallVector<AbstractRegisterLocation, 4> fp_locs;
2587+
// Look at the first few (8) rows of the plan and store FP's location.
2588+
const int upper_bound = std::min(8, unwind_plan.GetRowCount());
2589+
llvm::SmallVector<AbstractRegisterLocation, 8> fp_locs;
25902590
for (int row_idx = 0; row_idx < upper_bound; row_idx++) {
25912591
RowSP row = unwind_plan.GetRowAtIndex(row_idx);
25922592
AbstractRegisterLocation regloc;
@@ -2613,7 +2613,7 @@ GetFrameSetupInfo(UnwindPlan &unwind_plan, RegisterContext &regctx) {
26132613
// Use subsequent row, if available.
26142614
// Pointer auth may introduce more instructions, but they don't affect the
26152615
// unwinder rows / store to the stack.
2616-
int row_idx = fp_locs.end() - it;
2616+
int row_idx = it - fp_locs.begin();
26172617
int next_row_idx = row_idx + 1;
26182618

26192619
// If subsequent row is invalid, approximate through current row.

0 commit comments

Comments
 (0)