From 3869cb50eac90c7a051ffab2eb3d6050a975433b Mon Sep 17 00:00:00 2001 From: Mike Ash Date: Tue, 7 Oct 2025 14:00:01 -0400 Subject: [PATCH] Fix integer type mismatches in swift-inspect when building 32-bit. --- .../Sources/swift-inspect/DarwinRemoteProcess.swift | 2 +- .../swift-inspect/Operations/DumpGenericMetadata.swift | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/swift-inspect/Sources/swift-inspect/DarwinRemoteProcess.swift b/tools/swift-inspect/Sources/swift-inspect/DarwinRemoteProcess.swift index 0c2237d3a863b..c6a4088874aaa 100644 --- a/tools/swift-inspect/Sources/swift-inspect/DarwinRemoteProcess.swift +++ b/tools/swift-inspect/Sources/swift-inspect/DarwinRemoteProcess.swift @@ -241,7 +241,7 @@ internal final class DarwinRemoteProcess: RemoteProcess { internal func iteratePotentialMetadataPages(_ body: (swift_addr_t, UInt64) -> Void) { if let initialPoolPointer: UInt = readGlobalVariable(named: "_swift_debug_allocationPoolPointer"), let initialPoolSize: UInt = readGlobalVariable(named: "_swift_debug_allocationPoolSize") { - body(swift_reflection_ptr_t(initialPoolPointer), UInt64(initialPoolSize)); + body(swift_addr_t(initialPoolPointer), UInt64(initialPoolSize)); } if let pageSize: UInt = readGlobalVariable(named: "_swift_debug_metadataAllocatorPageSize") { diff --git a/tools/swift-inspect/Sources/swift-inspect/Operations/DumpGenericMetadata.swift b/tools/swift-inspect/Sources/swift-inspect/Operations/DumpGenericMetadata.swift index 6697094ddda1c..ff780e06b11a7 100644 --- a/tools/swift-inspect/Sources/swift-inspect/Operations/DumpGenericMetadata.swift +++ b/tools/swift-inspect/Sources/swift-inspect/Operations/DumpGenericMetadata.swift @@ -194,8 +194,11 @@ internal struct DumpGenericMetadata: ParsableCommand { private func metadataFromScanning(process: any RemoteProcess) throws -> [Metadata] { var metadata: [Metadata] = [] - func scanMemory(address: swift_reflection_ptr_t, size: UInt64) { - for candidate in stride(from: address, to: address + swift_reflection_ptr_t(size), by: MemoryLayout.size) { + func scanMemory(address: swift_addr_t, size: UInt64) { + let convertedAddress = swift_reflection_ptr_t(address) + for candidate in stride(from: convertedAddress, + to: convertedAddress + swift_reflection_ptr_t(size), + by: MemoryLayout.size) { guard let name = process.context.name(type: candidate, mangled: mangled) else { continue }