Skip to content

Commit b50b396

Browse files
committed
[Backtracing] Fix rebasing mistake.
When I rebased, I didn't get the FileImageSource code quite right. rdar://117681625
1 parent 9aac812 commit b50b396

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

stdlib/public/Backtracing/FileImageSource.swift

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,13 @@ class FileImageSource: ImageSource {
6161
public func fetch(from addr: Address,
6262
into buffer: UnsafeMutableRawBufferPointer) throws {
6363
let start = Int(addr)
64-
_ = try buffer.withMemoryRebound(to: UInt8.self) { byteBuf in
65-
guard _mapping.indices.contains(start) else {
66-
throw FileImageSourceError.outOfRangeRead
67-
}
68-
let slice = _mapping[start...]
69-
guard slice.count >= byteBuf.count else {
70-
throw FileImageSourceError.outOfRangeRead
71-
}
64+
guard _mapping.indices.contains(start) else {
65+
throw FileImageSourceError.outOfRangeRead
7266
}
67+
let slice = _mapping[start...]
68+
guard slice.count >= buffer.count else {
69+
throw FileImageSourceError.outOfRangeRead
70+
}
71+
buffer.copyBytes(from: slice[start..<start+buffer.count])
7372
}
7473
}

stdlib/public/Backtracing/Utils.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ internal func hex<T: FixedWidthInteger>(_ value: T,
3030
return "\(prefix)\(padding)\(digits)"
3131
}
3232

33-
internal func hex(_ bytes: [UInt8]) -> String {
33+
internal func hex(_ bytes: some Sequence<UInt8>) -> String {
3434
return bytes.map{ hex($0, prefix: false) }.joined(separator: "")
3535
}
3636

0 commit comments

Comments
 (0)