Fix integer type mismatches in swift-inspect when building 32-bit.

This commit is contained in:
Mike Ash
2025-10-07 14:00:01 -04:00
parent 62d388a09f
commit 3869cb50ea
2 changed files with 6 additions and 3 deletions

View File

@@ -241,7 +241,7 @@ internal final class DarwinRemoteProcess: RemoteProcess {
internal func iteratePotentialMetadataPages(_ body: (swift_addr_t, UInt64) -> Void) { internal func iteratePotentialMetadataPages(_ body: (swift_addr_t, UInt64) -> Void) {
if let initialPoolPointer: UInt = readGlobalVariable(named: "_swift_debug_allocationPoolPointer"), if let initialPoolPointer: UInt = readGlobalVariable(named: "_swift_debug_allocationPoolPointer"),
let initialPoolSize: UInt = readGlobalVariable(named: "_swift_debug_allocationPoolSize") { 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") { if let pageSize: UInt = readGlobalVariable(named: "_swift_debug_metadataAllocatorPageSize") {

View File

@@ -194,8 +194,11 @@ internal struct DumpGenericMetadata: ParsableCommand {
private func metadataFromScanning(process: any RemoteProcess) throws -> [Metadata] { private func metadataFromScanning(process: any RemoteProcess) throws -> [Metadata] {
var metadata: [Metadata] = [] var metadata: [Metadata] = []
func scanMemory(address: swift_reflection_ptr_t, size: UInt64) { func scanMemory(address: swift_addr_t, size: UInt64) {
for candidate in stride(from: address, to: address + swift_reflection_ptr_t(size), by: MemoryLayout<UInt>.size) { let convertedAddress = swift_reflection_ptr_t(address)
for candidate in stride(from: convertedAddress,
to: convertedAddress + swift_reflection_ptr_t(size),
by: MemoryLayout<UInt>.size) {
guard let name = process.context.name(type: candidate, mangled: mangled) else { guard let name = process.context.name(type: candidate, mangled: mangled) else {
continue continue
} }