Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
eb5f169
Basic LLDB remote protocol scaffolding
MaxDesiatov Oct 8, 2025
0baf7a5
Implement more packet handling, update naming
MaxDesiatov Oct 8, 2025
85a695a
Provide original license notice in `wasmkit-gdb-tool/Entrypoint.swift`
MaxDesiatov Oct 8, 2025
eba97a0
Apply formatter
MaxDesiatov Oct 8, 2025
6546754
Make naming of types more specific to avoid future collisions
MaxDesiatov Oct 8, 2025
7b2c6f6
More cleanups for type naming
MaxDesiatov Oct 8, 2025
4a1c998
Remove unused `import struct Foundation.Date`
MaxDesiatov Oct 8, 2025
f8c08dd
Remove unused `else` clause from command decoder
MaxDesiatov Oct 8, 2025
77bdb04
Add `swift-nio` in `SWIFTCI_USE_LOCAL_DEPS` clause
MaxDesiatov Oct 8, 2025
256c70c
Add FIXME note for `.supportedFeatures` response
MaxDesiatov Oct 8, 2025
111deb8
Use `Logger`, `NIOAsyncChannel`
MaxDesiatov Oct 9, 2025
e392d30
Add required dependencies to `[email protected]`
MaxDesiatov Oct 9, 2025
a7c62b0
Add `iSeqToWasmMapping` to `InstanceEntity`
MaxDesiatov Oct 9, 2025
21e1b44
Fix formatting and iOS compatibility
MaxDesiatov Oct 9, 2025
329e4f5
Update [email protected]
MaxDesiatov Oct 9, 2025
a3d20af
Update doc comment of `func instantiate` in `Module.swift`
MaxDesiatov Oct 9, 2025
8d15b99
Add `targetStatus`/`?` host command
MaxDesiatov Oct 10, 2025
d9b60b1
Fix use of `OK#9a` instead of incorrect `ok#da` response
MaxDesiatov Oct 10, 2025
05583d0
Add `CSystemExtras` to `[email protected]`
MaxDesiatov Oct 10, 2025
39242d6
Handle `targetStatus` in `WasmKitDebugger`
MaxDesiatov Oct 10, 2025
cbff974
Build only `wasmkit-cli` product for WASI in `main.yml`
MaxDesiatov Oct 10, 2025
982fa91
Fix formatting in `WasmKitDebugger.swift`
MaxDesiatov Oct 10, 2025
3a74a91
Fix `QStartNoAckMode` handling
MaxDesiatov Oct 14, 2025
bc539e8
Add `qRegisterInfo` parsing to `GDBHostCommand.init`
MaxDesiatov Oct 14, 2025
fb4e2a2
Use `KeyValuePairs` response for `.registerInfo`
MaxDesiatov Oct 14, 2025
042a2c4
Fix formatting and tests build error
MaxDesiatov Oct 14, 2025
197abd3
Exclude `wasmkit-gdb-tool` on Windows, address PR feedback
MaxDesiatov Oct 14, 2025
a2899f7
Remove retroactive `FilePath` conformance
MaxDesiatov Oct 14, 2025
0b42724
Handle more host commands, up to `qWasmCallStack`
MaxDesiatov Oct 14, 2025
1783176
Fix formatting
MaxDesiatov Oct 14, 2025
c0a9cf6
Address PR feedback, add comment for `DebuggingAddress` sendability
MaxDesiatov Oct 16, 2025
806e7ec
Add `DebuggerExecution` wrapper type
MaxDesiatov Oct 16, 2025
26ea4e5
Implement `.readMemory` command handling
MaxDesiatov Oct 16, 2025
8343902
Fix formatting
MaxDesiatov Oct 16, 2025
ff2fa0d
Pass `-package-name` in CMake to enable use of `package`
MaxDesiatov Oct 16, 2025
3ed9013
Disable `WasmKitGDBHandler` on Windows
MaxDesiatov Oct 16, 2025
3ea5aab
Fix formatting
MaxDesiatov Oct 16, 2025
3fc8fdc
Try nightly `main` for `build-cmake` job
MaxDesiatov Oct 17, 2025
ea83134
Revert "Try nightly `main` for `build-cmake` job"
MaxDesiatov Oct 17, 2025
2893799
Rename `DebuggerExecution` to `Debugger`, hide behind a trait
MaxDesiatov Oct 17, 2025
7bdb16c
Enable `WasmDebuggingSupport` on CI where possible
MaxDesiatov Oct 17, 2025
4ea0fb0
Fix formatting
MaxDesiatov Oct 17, 2025
ee3c7bf
Revert "Pass `-package-name` in CMake to enable use of `package`"
MaxDesiatov Oct 17, 2025
a6d0749
Disable traits in pre-6.1, guard use of `package` on trait
MaxDesiatov Oct 17, 2025
4909d3b
Remove use of `package` from CMake-built code
MaxDesiatov Oct 20, 2025
cce2105
Fix non-CMake build breakage
MaxDesiatov Oct 20, 2025
811589f
Fix formatting
MaxDesiatov Oct 20, 2025
bc2230d
Enable iseq -> wasm instruction mapping
MaxDesiatov Oct 20, 2025
db1ec2d
Fix formatting
MaxDesiatov Oct 20, 2025
62592f1
Add missing `mutating` to `Debugger.swift`
MaxDesiatov Oct 20, 2025
bbfcb45
Make `init` throw effect untyped in `Debugger.swift`
MaxDesiatov Oct 20, 2025
c6213eb
Make throwing method effects untyped in `Debugger.swift`
MaxDesiatov Oct 20, 2025
a993b50
Make `debugger: Debugger` property mutable
MaxDesiatov Oct 20, 2025
2d065e0
Clean up `WasmGen` code
MaxDesiatov Oct 21, 2025
fd0d1ee
Add reverse wasm->iseq mapping, breakpoints toggling PoC
MaxDesiatov Oct 21, 2025
a35b73e
Remove unused `functionAddresses` property from `Debugger`
MaxDesiatov Oct 21, 2025
16ac0cf
Remove changes unrelated to the protocol
MaxDesiatov Oct 22, 2025
410c470
Clarify licensing in `README.md`
MaxDesiatov Oct 22, 2025
977b939
Add license files for separate modules
MaxDesiatov Oct 22, 2025
2acd4f3
Basic doc comments for `GDBHostCommand`
MaxDesiatov Oct 22, 2025
3b2e30f
Add doc comments for `GDBHostCommandDecoder`
MaxDesiatov Oct 22, 2025
fc740e5
Add remaining doc comments
MaxDesiatov Oct 22, 2025
a297f2d
Fix formatting
MaxDesiatov Oct 22, 2025
ff2e940
Fix var naming typo
MaxDesiatov Oct 22, 2025
f6bab20
Remove unused `throws` in `GDBTargetResponseEncoder.swift`
MaxDesiatov Oct 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ jobs:
wasi-swift-sdk-download: "https://download.swift.org/development/wasm-sdk/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm.artifactbundle.tar.gz"
wasi-swift-sdk-id: swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm
wasi-swift-sdk-checksum: "b64dfad9e1c9ccdf06f35cf9b1a00317e000df0c0de0b3eb9f49d6db0fcba4d9"
test-args: "--sanitize address"
test-args: "--sanitize address --traits WasmDebuggingSupport"
# Swift 6.2
- os: macos-15
xcode: Xcode_26.0
development-toolchain-tag: swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a
wasi-swift-sdk-download: "https://download.swift.org/development/wasm-sdk/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm.artifactbundle.tar.gz"
wasi-swift-sdk-id: swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm
wasi-swift-sdk-checksum: "b64dfad9e1c9ccdf06f35cf9b1a00317e000df0c0de0b3eb9f49d6db0fcba4d9"
test-args: "--sanitize address"
test-args: "--sanitize address --traits WasmDebuggingSupport"

runs-on: ${{ matrix.os }}
name: "build-macos (${{ matrix.xcode }})"
Expand Down Expand Up @@ -107,24 +107,26 @@ jobs:
wasi-swift-sdk-download: "https://download.swift.org/development/wasm-sdk/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm.artifactbundle.tar.gz"
wasi-swift-sdk-id: swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm
wasi-swift-sdk-checksum: "b64dfad9e1c9ccdf06f35cf9b1a00317e000df0c0de0b3eb9f49d6db0fcba4d9"
test-args: "--traits WasmDebuggingSupport"
- swift: "swift:6.2-amazonlinux2"
development-toolchain-download: "https://download.swift.org/development/amazonlinux2/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a-amazonlinux2.tar.gz"
wasi-swift-sdk-download: "https://download.swift.org/development/wasm-sdk/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm.artifactbundle.tar.gz"
wasi-swift-sdk-id: swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm
wasi-swift-sdk-checksum: "b64dfad9e1c9ccdf06f35cf9b1a00317e000df0c0de0b3eb9f49d6db0fcba4d9"
test-args: "--traits WasmDebuggingSupport"
- swift: "swift:6.2-noble"
development-toolchain-download: "https://download.swift.org/development/ubuntu2404/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a-ubuntu24.04.tar.gz"
wasi-swift-sdk-download: "https://download.swift.org/development/wasm-sdk/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm.artifactbundle.tar.gz"
wasi-swift-sdk-id: swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm
wasi-swift-sdk-checksum: "b64dfad9e1c9ccdf06f35cf9b1a00317e000df0c0de0b3eb9f49d6db0fcba4d9"
test-args: "--enable-code-coverage"
test-args: "--traits WasmDebuggingSupport --enable-code-coverage"
build-dev-dashboard: true
- swift: "swiftlang/swift:nightly-main-noble"
development-toolchain-download: "https://download.swift.org/development/ubuntu2404/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a-ubuntu24.04.tar.gz"
wasi-swift-sdk-download: "https://download.swift.org/development/wasm-sdk/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm.artifactbundle.tar.gz"
wasi-swift-sdk-id: swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm
wasi-swift-sdk-checksum: "b64dfad9e1c9ccdf06f35cf9b1a00317e000df0c0de0b3eb9f49d6db0fcba4d9"
test-args: "-Xswiftc -DWASMKIT_CI_TOOLCHAIN_NIGHTLY"
test-args: "--traits WasmDebuggingSupport -Xswiftc -DWASMKIT_CI_TOOLCHAIN_NIGHTLY"

runs-on: ubuntu-24.04
name: "build-linux (${{ matrix.swift }})"
Expand Down Expand Up @@ -206,9 +208,9 @@ jobs:
run: ./build-exec swift sdk install "${{ matrix.musl-swift-sdk-download }}" --checksum "${{ matrix.musl-swift-sdk-checksum }}"

- name: Build (x86_64-swift-linux-musl)
run: ./build-exec swift build --swift-sdk x86_64-swift-linux-musl
run: ./build-exec swift build --swift-sdk x86_64-swift-linux-musl --traits WasmDebuggingSupport
- name: Build (aarch64-swift-linux-musl)
run: ./build-exec swift build --swift-sdk aarch64-swift-linux-musl
run: ./build-exec swift build --swift-sdk aarch64-swift-linux-musl --traits WasmDebuggingSupport

build-android:
runs-on: ubuntu-24.04
Expand Down Expand Up @@ -266,5 +268,5 @@ jobs:
- name: Install Swift SDK
run: swift sdk install https://download.swift.org/swift-6.2-release/wasm/swift-6.2-RELEASE/swift-6.2-RELEASE_wasm.artifactbundle.tar.gz --checksum fe4e8648309fce86ea522e9e0d1dc48e82df6ba6e5743dbf0c53db8429fb5224
- name: Build with the Swift SDK
run: swift build --swift-sdk "$(swiftc -print-target-info | jq -r '.swiftCompilerTag')_wasm"
run: swift build --swift-sdk "$(swiftc -print-target-info | jq -r '.swiftCompilerTag')_wasm" --product wasmkit-cli

5 changes: 5 additions & 0 deletions .sourcekit-lsp/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"swiftPM": {
"traits": ["WasmDebuggingSupport"]
}
}
193 changes: 193 additions & 0 deletions [email protected]
Copy link
Member Author

Choose a reason for hiding this comment

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

Added separate Package.swift manifest to hide debugger support behind a trait for now, and traits aren't supported in 6.0.

Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
// swift-tools-version:6.1

import PackageDescription

import class Foundation.ProcessInfo

let DarwinPlatforms: [Platform] = [.macOS, .iOS, .watchOS, .tvOS, .visionOS]

let package = Package(
name: "WasmKit",
platforms: [.macOS(.v15), .iOS(.v17)],
products: [
.executable(name: "wasmkit-cli", targets: ["CLI"]),
.library(name: "WasmKit", targets: ["WasmKit"]),
.library(name: "WasmKitWASI", targets: ["WasmKitWASI"]),
.library(name: "WASI", targets: ["WASI"]),
.library(name: "WasmParser", targets: ["WasmParser"]),
.library(name: "WAT", targets: ["WAT"]),
.library(name: "WIT", targets: ["WIT"]),
.library(name: "_CabiShims", targets: ["_CabiShims"]),
],
traits: [
.default(enabledTraits: []),
"WasmDebuggingSupport"
],
targets: [
.executableTarget(
name: "CLI",
dependencies: [
"WAT",
"WasmKit",
"WasmKitWASI",
.product(name: "ArgumentParser", package: "swift-argument-parser"),
.product(name: "SystemPackage", package: "swift-system"),
],
exclude: ["CMakeLists.txt"]
),

.target(
name: "WasmKit",
dependencies: [
"_CWasmKit",
"WasmParser",
"WasmTypes",
"SystemExtras",
.product(name: "SystemPackage", package: "swift-system"),
],
exclude: ["CMakeLists.txt"]
),
.target(name: "_CWasmKit"),
.target(
name: "WasmKitFuzzing",
dependencies: ["WasmKit"],
path: "FuzzTesting/Sources/WasmKitFuzzing"
),
.testTarget(
name: "WasmKitTests",
dependencies: ["WasmKit", "WAT", "WasmKitFuzzing"],
exclude: ["ExtraSuite"]
),

.target(
name: "WAT",
dependencies: ["WasmParser"],
exclude: ["CMakeLists.txt"]
),
.testTarget(name: "WATTests", dependencies: ["WAT"]),

.target(
name: "WasmParser",
dependencies: [
"WasmTypes",
.product(name: "SystemPackage", package: "swift-system"),
],
exclude: ["CMakeLists.txt"]
),
.testTarget(name: "WasmParserTests", dependencies: ["WasmParser"]),

.target(name: "WasmTypes", exclude: ["CMakeLists.txt"]),

.target(
name: "WasmKitWASI",
dependencies: ["WasmKit", "WASI"],
exclude: ["CMakeLists.txt"]
),
.target(
name: "WASI",
dependencies: ["WasmTypes", "SystemExtras"],
exclude: ["CMakeLists.txt"]
),
.testTarget(name: "WASITests", dependencies: ["WASI", "WasmKitWASI"]),

.target(
name: "SystemExtras",
dependencies: [
.product(name: "SystemPackage", package: "swift-system"),
.target(name: "CSystemExtras", condition: .when(platforms: [.wasi])),
],
exclude: ["CMakeLists.txt"],
swiftSettings: [
.define("SYSTEM_PACKAGE_DARWIN", .when(platforms: DarwinPlatforms))
]
),

.target(name: "CSystemExtras"),

.executableTarget(
name: "WITTool",
dependencies: [
"WIT",
"WITOverlayGenerator",
"WITExtractor",
.product(name: "ArgumentParser", package: "swift-argument-parser"),
]
),

.target(name: "WIT"),
.testTarget(name: "WITTests", dependencies: ["WIT"]),

.target(name: "WITOverlayGenerator", dependencies: ["WIT"]),
.target(name: "_CabiShims"),

.target(name: "WITExtractor"),
.testTarget(name: "WITExtractorTests", dependencies: ["WITExtractor", "WIT"]),

.target(name: "GDBRemoteProtocol",
dependencies: [
.product(name: "Logging", package: "swift-log"),
.product(name: "NIOCore", package: "swift-nio"),
]
),
.testTarget(name: "GDBRemoteProtocolTests", dependencies: ["GDBRemoteProtocol"]),
],
)

if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
package.dependencies += [
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.5.1"),
.package(url: "https://github.com/apple/swift-system", from: "1.5.0"),
.package(url: "https://github.com/apple/swift-nio", from: "2.86.2"),
.package(url: "https://github.com/apple/swift-log", from: "1.6.4"),
]
} else {
package.dependencies += [
.package(path: "../swift-argument-parser"),
.package(path: "../swift-system"),
.package(path: "../swift-nio"),
.package(path: "../swift-log"),
]
}

#if !os(Windows)
// Add build tool plugins only for non-Windows platforms
package.products.append(contentsOf: [
.plugin(name: "WITOverlayPlugin", targets: ["WITOverlayPlugin"]),
.plugin(name: "WITExtractorPlugin", targets: ["WITExtractorPlugin"]),
])

package.targets.append(contentsOf: [
.plugin(name: "WITOverlayPlugin", capability: .buildTool(), dependencies: ["WITTool"]),
.plugin(name: "GenerateOverlayForTesting", capability: .buildTool(), dependencies: ["WITTool"]),
.testTarget(
name: "WITOverlayGeneratorTests",
dependencies: ["WITOverlayGenerator", "WasmKit", "WasmKitWASI"],
exclude: ["Fixtures", "Compiled", "Generated", "EmbeddedSupport"],
plugins: [.plugin(name: "GenerateOverlayForTesting")]
),
.plugin(
name: "WITExtractorPlugin",
capability: .command(
intent: .custom(verb: "extract-wit", description: "Extract WIT definition from Swift module"),
permissions: []
),
dependencies: ["WITTool"]
),
.testTarget(
name: "WITExtractorPluginTests",
exclude: ["Fixtures"]
),

.target(
name: "WasmKitGDBHandler",
dependencies: [
.product(name: "_NIOFileSystem", package: "swift-nio"),
.product(name: "NIOCore", package: "swift-nio"),
.product(name: "SystemPackage", package: "swift-system"),
"WasmKit",
"WasmKitWASI",
"GDBRemoteProtocol",
],
),
])
#endif
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,14 @@ $ swift test
This project was originally developed by [@akkyie](https://github.com/akkyie), and is now maintained by the community.

[^1]: On a 2020 Mac mini (M1, 16GB RAM) with Swift 5.10. Measured by `swift package resolve && swift package clean && time swift build --product PrintAdd`.
License

## License

WasmKit runtime modules are licensed under MIT License. See [LICENSE](https://raw.githubusercontent.com/swiftwasm/WasmKit/refs/heads/main/LICENSE) file for license information.

GDB Remote Protocol support (`GDBRemoteProtocol` and `WasmKitGDBHandler` modules) is licensed separately under Apache License v2.0 with Runtime Library Exception, Copyright 2025 Apple Inc. and the Swift project authors.

See https://swift.org/LICENSE.txt for license information.

See https://swift.org/CONTRIBUTORS.txt for Swift project authors.
Loading