Commit Graph

7 Commits

Author SHA1 Message Date
Alastair Houghton
210eae4f7d Merge pull request #82720 from al45tair/eng/PR-154837649
[Backtracing][Linux] Ignore `SHT_NULL` sections.
2025-07-08 15:38:15 +01:00
Alastair Houghton
fbd87591d0 [Backtracing][Linux] Ignore SHT_NULL sections.
The ELF specification says that if a section's type is set to `SHT_NULL`,
_none_ of the other fields are valid, so we shouldn't even be trying to
read the section name.

(We won't crash, because of how all of this code works, but we might
read an incorrect name.)

rdar://154837649
2025-07-02 14:35:16 +01:00
Alastair Houghton
b498b39b79 [Backtracing][Linux] Fix crash handler for musl.
Musl's `clone()` wrapper returns `EINVAL` if you try to use `CLONE_THREAD`,
which seems a bit wrong (certainly it is in this particular application,
since we *really* don't care whether the thread is a valid C library
thread at this point).

Also properly support ELF images that are built with a base address other
than zero (this typically isn't an issue for dynamically linked programs,
as they will be relocated at runtime anyway, but for statically linked
binaries it's very common to set the base address to a non-zero value).

rdar://154282813
2025-06-30 14:21:27 +01:00
Johannes Weiss
e533b8a7ff fix ELF/DWARF leak 2025-02-05 14:27:18 +00:00
Alastair Houghton
a60dd8f76d [Backtracing] Local|RemoteMemoryReader only exists on macOS and Linux.
When fixing the previous problem, I should have realised that this
would cascade; the `@_specialize` annotations refer to the cached
versions of the types, and those are now turned off except on macOS
and Linux because they rely on the uncached versions, which are only
available on macOS and Linux.

rdar://144023438
2025-02-03 12:34:42 +00:00
Alastair Houghton
2300577b56 [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
2025-01-21 19:05:08 +00:00
Alastair Houghton
760cc57bef [Backtracing] Rename _Backtracing to Runtime.
Move the backtracing code into a new Runtime module.  This means renaming
the Swift Runtime's CMake target because otherwise there will be a name
clash.

rdar://124913332
2025-01-17 10:09:36 +00:00