[Backtracing] Fix rebasing mistake.

When I rebased, I didn't get the FileImageSource code quite right.

rdar://117681625
This commit is contained in:
Alastair Houghton
2023-11-06 16:00:04 +00:00
parent 9aac812dc7
commit b50b396e1d
2 changed files with 8 additions and 9 deletions

View File

@@ -61,14 +61,13 @@ class FileImageSource: ImageSource {
public func fetch(from addr: Address,
into buffer: UnsafeMutableRawBufferPointer) throws {
let start = Int(addr)
_ = try buffer.withMemoryRebound(to: UInt8.self) { byteBuf in
guard _mapping.indices.contains(start) else {
throw FileImageSourceError.outOfRangeRead
}
let slice = _mapping[start...]
guard slice.count >= byteBuf.count else {
throw FileImageSourceError.outOfRangeRead
}
guard _mapping.indices.contains(start) else {
throw FileImageSourceError.outOfRangeRead
}
let slice = _mapping[start...]
guard slice.count >= buffer.count else {
throw FileImageSourceError.outOfRangeRead
}
buffer.copyBytes(from: slice[start..<start+buffer.count])
}
}