Thanks for reply!
I have tried it on my macOS machine
swift-driver version: 1.45.2 Apple Swift version 5.6 (swiftlang-5.6.0.323.62 clang-1316.0.20.8)
Target: x86_64-apple-macosx12.0
using following configuration
$ python3 build_script_helper.py --package-path . --build-path .build --toolchain /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain --configuration release
however, it failed too. It looks like there is no issue with SwiftRemoteMirror
but a bunch of types are missing.
/Users/mikolasstuchlik/Developer/swift/tools/swift-inspect/Sources/swift-inspect/Operations/DumpConcurrency.swift:280:33: error: cannot find type 'swift_actor_info_t' in scope
func decodeActorFlags(_ info: swift_actor_info_t) -> (
^~~~~~~~~~~~~~~~~~
/Users/mikolasstuchlik/Developer/swift/tools/swift-inspect/Sources/swift-inspect/Operations/DumpConcurrency.swift:154:18: error: cannot find 'swift_reflection_metadataIsActor' in scope
let result = swift_reflection_metadataIsActor(context, metadata) != 0
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/mikolasstuchlik/Developer/swift/tools/swift-inspect/Sources/swift-inspect/Operations/DumpConcurrency.swift:170:26: error: cannot find 'swift_reflection_asyncTaskInfo' in scope
let reflectionInfo = swift_reflection_asyncTaskInfo(context, task)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(redacted)
/Users/mikolasstuchlik/Developer/swift/tools/swift-inspect/Sources/swift-inspect/Operations/DumpConcurrency.swift:395:18: error: cannot find 'swift_reflection_actorInfo' in scope
let info = swift_reflection_actorInfo(context, actor)
^~~~~~~~~~~~~~~~~~~~~~~~~~
(redacted)
/Users/mikolasstuchlik/Developer/swift/tools/swift-inspect/Sources/swift-inspect/Operations/DumpConcurrency.swift:425:17: error: cannot find 'swift_reflection_nextJob' in scope
job = swift_reflection_nextJob(context, job);
^~~~~~~~~~~~~~~~~~~~~~~~
/Users/mikolasstuchlik/Developer/swift/tools/swift-inspect/Sources/swift-inspect/main.swift:47:36: error: protocol 'RemoteProcess' can only be used as a generic constraint because it has Self or associated type requirements
_ body: (any RemoteProcess) throws -> Void) throws {
^
I have removed error: type of expression is ambiguous without more context
and error: generic parameter 'Element' could not be inferred
from the output.
I have therefore removed the whole DumpConcurrency.swift
file and modified the main.swift
as follows
diff --git a/tools/swift-inspect/Sources/swift-inspect/main.swift b/tools/swift-inspect/Sources/swift-inspect/main.swift
index 649f31c7..5f0b6365 100644
--- a/tools/swift-inspect/Sources/swift-inspect/main.swift
+++ b/tools/swift-inspect/Sources/swift-inspect/main.swift
@@ -44,27 +44,16 @@ internal struct BacktraceOptions: ParsableArguments {
internal func inspect(options: UniversalOptions,
- _ body: (any RemoteProcess) throws -> Void) throws {
+ _ body: (DarwinRemoteProcess) throws -> Void) throws {
guard let processId = process(matching: options.nameOrPid) else {
print("No process found matching \(options.nameOrPid)")
return
}
-
-#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
guard let process = DarwinRemoteProcess(processId: processId,
forkCorpse: options.forkCorpse) else {
print("Failed to create inspector for process id \(processId)")
return
}
-#elseif os(Windows)
- guard let process = WindowsRemoteProcess(processId: processId) else {
- print("Failed to create inspector for process id \(processId)")
- return
- }
-#else
-#error("Unsupported platform")
-#endif
-
try body(process)
}
@@ -79,7 +68,6 @@ internal struct SwiftInspect: ParsableCommand {
DumpGenericMetadata.self,
DumpCacheNodes.self,
DumpArrays.self,
- DumpConcurrency.self,
]
#else
static let subcommands: [ParsableCommand.Type] = [
basically, I have removed the now deleted DumpConcurrency
option from the list of options and removed the any RemoteProcess
syntax since it's not part of the Swift 5.6
The compilation then succeeded using the same command as above. I will try to run the tool in following days.
However, there is one thing that still bothers me @compnerd . Even if I implement something like LinuxRemoteProcess
and use it in some sort of #elseif os(Linux)
macro, I still won't be able to compile it on Linux, since the SwiftRemoteMirror
module is not part of the toolchain, only the .so
file. Is there any workaround