Skip to content

[6.1] Apply toolset's debugger property in swift run #8257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 3, 2025

Conversation

MaxDesiatov
Copy link
Contributor

@MaxDesiatov MaxDesiatov commented Jan 29, 2025

Cherry-pick of #8252, merged as 88e2af7.

Explanation: Per SE-0378 toolsets can specify an optional debugger property, which so far had no effect. We should respect this property in swift run invocations when any toolsets or Swift SDKs are selected.

This allows running and debugging cross-compiled products in an environment other than the host, e.g. a container runtime when cross-compiled to Linux, QEMU or a firmware flasher and serial port setup script with Swift Embedded for microcontrollers, or in a Wasm runtime for a Wasm binary.
Scope: Only impacts swift-run when a toolset or a Swift SDK are selected.
Risk: Low, due to limited scope and automated testing.
Testing: Added a new test cause to the existing XCTest suite.
Issue: rdar://143814083
Reviewer: @dschaefer2

### Motivation:

Per [SE-0378 toolsets can specify an optional `debugger` property](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0387-cross-compilation-destinations.md#toolsetjson-files), which so far had no effect. We should respect this property in `swift run` invocations when any toolsets or Swift SDKs are selected.

This allows running and debugging cross-compiled products in an environment other than the host, e.g. a container runtime when cross-compiled to Linux, QEMU or a firmware flasher and serial port setup script with Swift Embedded for microcontrollers, or in a Wasm runtime for a Wasm binary.

### Modifications:

Updated `SwiftRunCommand` to check for the `debugger` property in toolsets or Swift SDKs when such are specified. Its value is then used to launch a freshly built binary.

### Result:

Cross-compiled binaries can be directly launched and debugged with a `swift run` invocation.
@MaxDesiatov MaxDesiatov added the swift 6.1 Related to Swift 6.1 release branch label Jan 29, 2025
@MaxDesiatov MaxDesiatov changed the title Apply toolset's debugger property in swift run (#8252) [6.1] Apply toolset's debugger property in swift run Jan 29, 2025
@MaxDesiatov MaxDesiatov marked this pull request as ready for review January 29, 2025 11:51
@MaxDesiatov
Copy link
Contributor Author

@swift-ci test

@MaxDesiatov
Copy link
Contributor Author

@swift-ci test linux

@MaxDesiatov MaxDesiatov merged commit b7ce674 into release/6.1 Feb 3, 2025
5 checks passed
@MaxDesiatov MaxDesiatov deleted the maxd/toolset-debugger-6.1 branch February 3, 2025 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cross-compilation swift 6.1 Related to Swift 6.1 release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants