[Backtracing] Fix symbol lookup on Linux.

Also removed a spurious `print()` that got left in by accident,
and disabled the `CodableBacktrace.swift` test on Linux since we
need Foundation and we don't have it there.

rdar://124913332
This commit is contained in:
Alastair Houghton
2025-01-21 19:03:51 +00:00
parent ca233af1ea
commit 2300577b56
3 changed files with 3 additions and 5 deletions

View File

@@ -415,8 +415,6 @@ extension Backtrace {
memoryReader: memoryReader) memoryReader: memoryReader)
if let limit = limit { if let limit = limit {
print("limit = \(limit), offset = \(offset), top = \(top)")
let limited = LimitSequence(unwinder, let limited = LimitSequence(unwinder,
limit: limit, limit: limit,
offset: offset, offset: offset,

View File

@@ -1156,13 +1156,13 @@ struct ElfSymbolTable<SomeElfTraits: ElfTraits>: ElfSymbolTableProtocol {
nextValue = _symbols[mid + 1].value nextValue = _symbols[mid + 1].value
} }
if symbol.value <= address && nextValue >= address { if symbol.value <= address && nextValue > address {
var ndx = mid var ndx = mid
while ndx > 0 && _symbols[ndx - 1].value == address { while ndx > 0 && _symbols[ndx - 1].value == address {
ndx -= 1 ndx -= 1
} }
return _symbols[ndx] return _symbols[ndx]
} else if symbol.value < address { } else if symbol.value <= address {
min = mid + 1 min = mid + 1
} else if symbol.value > address { } else if symbol.value > address {
max = mid max = mid

View File

@@ -5,7 +5,7 @@
// REQUIRES: executable_test // REQUIRES: executable_test
// REQUIRES: backtracing // REQUIRES: backtracing
// REQUIRES: OS=macosx || OS=linux-gnu // REQUIRES: OS=macosx
// UNSUPPORTED: use_os_stdlib // UNSUPPORTED: use_os_stdlib
// UNSUPPORTED: back_deployment_runtime // UNSUPPORTED: back_deployment_runtime