Skip to content

[lldb] Cherry-pick missing frame provider chaining changes#12243

Merged
adrian-prantl merged 4 commits intoswiftlang:swift/release/6.3from
medismailben:swift/release/6.3
Feb 2, 2026
Merged

[lldb] Cherry-pick missing frame provider chaining changes#12243
adrian-prantl merged 4 commits intoswiftlang:swift/release/6.3from
medismailben:swift/release/6.3

Conversation

…lvm#172767)

This patch is a follow-up to 96c733e to fix a missing space in the
frame.pc format entity. This space was intended to be prepended to the
module format entity scope but if the module is not valid, which is
often the case for python pc-less scripted frames, the space between the
pc and the function name is missing.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
(cherry picked from commit 6767b86)
This patch adds `get_priority()` support to synthetic frame providers to
enable priority-based selection when multiple providers match a thread.
This is the first step toward supporting frame provider chaining for
visualizing coroutines, Swift async tasks, and et al.

Priority ordering follows Unix nice convention where lower numbers
indicate higher priority (0 = highest). Providers without explicit
priority return `std::nullopt`, which maps to UINT32_MAX (lowest
priority), ensuring backward compatibility with existing providers.

The implementation adds `GetPriority()` as a virtual method to
`SyntheticFrameProvider` base class, implements it through the scripting
interface hierarchy (`ScriptedFrameProviderInterface` and
`ScriptedFrameProviderPythonInterface`), and updates
`Thread::GetStackFrameList()` to sort applicable providers by priority
before attempting to load them.

Python frame providers can now specify priority:

```python
@staticmethod
def get_priority():
   return 10  # Or return None for default priority.
```

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
(cherry picked from commit d6a73d0)
…lvm#172849)

This patch allows threads to have multiple SyntheticFrameProviderSP
instances that chain together sequentially. Each provider receives the
output of the previous provider as input, creating a transformation
pipeline.

It changes `Thread::m_frame_provider_sp` to a vector, adds provider
parameter to SyntheticStackFrameList to avoid calling back into
`Thread::GetFrameProvider()` during frame fetching, updated
`LoadScriptedFrameProvider()` to chain providers by wrapping each
previous provider's output in a `SyntheticStackFrameList` for the next
provider and finally, loads ALL matching providers in priority order
instead of just the first one.

The chaining works as follows:
```
  Real Unwinder Frames
      ↓
  Provider 1 (priority 10) → adds/transforms frames
      ↓
  Provider 2 (priority 20) → transforms Provider 1's output
      ↓
  Provider 3 (priority 30) → transforms Provider 2's output
      ↓
  Final frame list shown to user
  ```

This patch also adds a test for this (test_chained_frame_providers) to verify that 3 providers chain correctly: `AddFooFrameProvider`, `AddBarFrameProvider`, `AddBazFrameProvider`.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
(cherry picked from commit 17b01bb)
@medismailben medismailben requested a review from a team as a code owner January 30, 2026 20:33
@medismailben
Copy link
Author

@swift-ci test

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
@medismailben
Copy link
Author

Regenerated the static bindings

@medismailben
Copy link
Author

@swift-ci test

@medismailben
Copy link
Author

@swift-ci test macOS Platform

@medismailben
Copy link
Author

@swift-ci test windows platform

1 similar comment
@medismailben
Copy link
Author

@swift-ci test windows platform

@adrian-prantl adrian-prantl merged commit 6d6a3f8 into swiftlang:swift/release/6.3 Feb 2, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants