You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[lldb][swift] Fix unwinding of Q funclets by comparing PC to continuation ptr
Unwinding these funclets is tricky because they change, halfway through
the function, the meaning of the async register. In particular, the
meaning changes from:
a) "the async context to be freed" [of the async function that just
finished executing]
To:
b) "the async context of the current async function" [which has just
been resumed].
LLDB has no way of identifying the instruction in which this transition
happened.
This patch improves the situation slightly by employing a heuristic: if
the async register has a continuation pointer that is equal to the
currently executing funclet, then the stop is _before_ the transition
point. This heuristic fails on some recursive async functions.
An alternative approach involves assuming we will never stop between the
end of the prologue and the transition point, so that LLDB may always
unwind assuming it is past the transition point if the stop is outside
the prologue. This has the benefit that it should "always work",
including in recursive funclets.
However, it is difficult to reason about where a debugger may stop; in
fact, very often the transition point is the second instruction after
the prologue, which will trigger the fail point in a common scenario.
Breakpoints are often placed in the _first_ instruction after the
prologue, and any kind of step operation will first "instruction step"
over the breakpoint location, placing the debugger exactly in the
"incorrect unwinding" zone.
A correct implementation will likely require more guarantees from the
compiler. See rdar://139676623
0 commit comments