Skip to content

Commit 77617c9

Browse files
authored
Merge pull request #84735 from mikeash/fix-swift-inspect-32-bit
Fix integer type mismatches in swift-inspect when building 32-bit.
2 parents 1fd5455 + 3869cb5 commit 77617c9

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

tools/swift-inspect/Sources/swift-inspect/DarwinRemoteProcess.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ internal final class DarwinRemoteProcess: RemoteProcess {
241241
internal func iteratePotentialMetadataPages(_ body: (swift_addr_t, UInt64) -> Void) {
242242
if let initialPoolPointer: UInt = readGlobalVariable(named: "_swift_debug_allocationPoolPointer"),
243243
let initialPoolSize: UInt = readGlobalVariable(named: "_swift_debug_allocationPoolSize") {
244-
body(swift_reflection_ptr_t(initialPoolPointer), UInt64(initialPoolSize));
244+
body(swift_addr_t(initialPoolPointer), UInt64(initialPoolSize));
245245
}
246246

247247
if let pageSize: UInt = readGlobalVariable(named: "_swift_debug_metadataAllocatorPageSize") {

tools/swift-inspect/Sources/swift-inspect/Operations/DumpGenericMetadata.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,11 @@ internal struct DumpGenericMetadata: ParsableCommand {
194194
private func metadataFromScanning(process: any RemoteProcess) throws -> [Metadata] {
195195
var metadata: [Metadata] = []
196196

197-
func scanMemory(address: swift_reflection_ptr_t, size: UInt64) {
198-
for candidate in stride(from: address, to: address + swift_reflection_ptr_t(size), by: MemoryLayout<UInt>.size) {
197+
func scanMemory(address: swift_addr_t, size: UInt64) {
198+
let convertedAddress = swift_reflection_ptr_t(address)
199+
for candidate in stride(from: convertedAddress,
200+
to: convertedAddress + swift_reflection_ptr_t(size),
201+
by: MemoryLayout<UInt>.size) {
199202
guard let name = process.context.name(type: candidate, mangled: mangled) else {
200203
continue
201204
}

0 commit comments

Comments
 (0)