-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Apply toolset's debugger
property in swift run
#8252
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
Conversation
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 WASI binary.
@swift-ci test |
@swift-ci test |
debugger
property in swift-run
debugger
property in swift-run
@swift-ci test windows |
@@ -40,6 +40,25 @@ final class RunCommandTests: CommandsTestCase { | |||
XCTAssert(stdout.contains("Swift Package Manager"), "got stdout:\n" + stdout) | |||
} | |||
|
|||
// echo.sh script from the toolset won't work on Windows | |||
#if !os(Windows) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: can we create an equivalent target that will run on Windows to ensure the functions work on that host platform?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, I don't have experience with Windows and don't have means to test on Windows. IIRC the test suite doesn't even run on the Windows CI job. I'd prefer to do this in a separate PR, when we have established means of running these Windows-specific tests on CI in the first place.
debugger
property in swift-run
debugger
property in swift run
### 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.
Cherry-pick of #8252, merged as 88e2af7. **Explanation**: 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. **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.
Motivation:
Per SE-0378 toolsets can specify an optional
debugger
property, which so far had no effect. We should respect this property inswift 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 thedebugger
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.