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] Add swift_task_switch StepThroughPlan in Language plugin
The symbol for swift_task_switch is marked as a trampoline, which triggers a
generic handling of it through DynamicLoaderDarwin. This makes sense, as it is
usually just a symbol stub that we jump through to get to the real task_switch:
```
...
0x1000031bc <+112>: b 0x100003d20 ; symbol stub for: swift_task_switch
...
testt.out`swift_task_switch:
swift_task_switch
-> 0x100003d20 <+0>: adrp x16, 1
0x100003d24 <+4>: ldr x16, [x16, #0x10]
0x100003d28 <+8>: br x16 ; <<< real task_switch_addr
```
DynamicLoaderDarwin will take the thread all the way to the target of the
`br x16` instruction, which is the real task switch.
However, once that's done, there are no thread plans taking the thread
to the target funclet we're switching to. Recall that a task_switch is a
request to run a given funclet inside _some_ executor/thread. It's like
a function call, but with scheduling in the middle.
This commit adds a new step through task_switch thread plan inside
SwiftLanguageRuntime; it is a simplified version of the (now removed)
ThreadPlanStepInAsync: a breakpoint is created to the target funclet,
and we compare async contexts to make sure the breakpoint was hit on the
right task.
Note: we could remove the handling inside DynamicLoaderDarwin with some
kind of "if (symbol == swift_task_switch) don't do anything". The new
thread plan would work even on the stub.
0 commit comments