Skip to content

Conversation

@lateralusX
Copy link
Member

As identified by dotnet/runtime#116545, macOS26 have broken semaphores in case debugger and debuggee have been signed with different team ids, currently only mentioned for iOS/iPadOS, https://developer.apple.com/documentation/ios-ipados-release-notes/ios-ipados-26-release-notes, but testing shows its broken for regular apps as well.

This PR adds support for a different startup handshake protocol for debugger/debuggee using FIFO file (aka named pipes) on Apple platforms due to limitation introduced in macOS26. All other POSIX platforms will continue to use the semaphore based handshake protocol.

The implementation is backward compatible on Apple platforms. Implementation will always setup semaphores to support runtimes using semaphore protocol, but on Apple platforms it will also create the new FIFO files, it will then spawn a separate background thread checking the FIFO files for connections and handling the protocol. In case runtime supports new FIFIO based protocol, background thread will handle complete protocol and signal/wait semaphores, making the underlying protocol transparent for the startup thread, it will always use the semaphores. In case runtime doesn't support FIFO files, runtime will signal/wait on the semaphores as normal coordinating with the debugger startup thread. In the case runtime doesn't support FIFO files, the background thread will just sit and wait on connections until canceled. Unregister cancel out background thread in case runtime didn't support FIFO files.

Since this fix supports both semaphores and FIFO files on Apple platform it is compatible with old runtimes using semaphores as well as new runtimes that supports the FIFO based handshake protocol.

In order for this change to work E2E, the debugger needs to use changes introduced in this PR with a runtime including dotnet/runtime#118120. Until both debugger and debuggee have been update, debug launch on macOS26 won't work.

Names of the two new FIFO files follow the same naming pattern as we have for existing debugger FIFO's, using suffix currently used for the startup and continue semaphores, "st" for startup and "co" for continue, example of full FIFO names:

/var/folders/d0/l_56x0lx6l7bbrv3pfr128xc0000gn/T/clr-debug-pipe-11462-1753451225-st
/var/folders/d0/l_56x0lx6l7bbrv3pfr128xc0000gn/T/clr-debug-pipe-11462-1753451225-co

tommcdon
tommcdon previously approved these changes Jul 28, 2025
Copy link
Member

@tommcdon tommcdon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm!

@hoyosjs
Copy link
Member

hoyosjs commented Jul 28, 2025

FYI @gregg-miskelly @WardenGnaw

Copy link
Member

@noahfalk noahfalk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@lateralusX lateralusX merged commit 496f7d7 into dotnet:main Jul 30, 2025
19 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Aug 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants