This is better than the `alternativePaths` mechanism because it means that
a client of the `Runtime` module can do its own thing, which might even
mean fetching things from a remote server or decompressing files or any
other thing we might find useful.
rdar://170642627
Instead of the symbolication method being decided by what platform the symbolication code is running on, use a parameter passed to the symbolication function, defaulted to the current platform for backward compatibility.
Useful for the upcoming offline symbolicator.
rdar://168769519
<!--
If this pull request is targeting a release branch, please fill out the
following form:
https://github.com/swiftlang/.github/blob/main/PULL_REQUEST_TEMPLATE/release.md?plain=1
Otherwise, replace this comment with a description of your changes and
rationale. Provide links to external references/discussions if
appropriate.
If this pull request resolves any GitHub issues, link them like so:
Resolves <link to issue>, resolves <link to another issue>.
For more information about linking a pull request to an issue, see:
https://docs.github.com/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue
-->
<!--
Before merging this pull request, you must run the Swift continuous
integration tests.
For information about triggering CI builds via @swift-ci, see:
https://github.com/apple/swift/blob/main/docs/ContinuousIntegration.md#swift-ci
Thank you for your contribution to Swift!
-->
---------
Co-authored-by: Carl Peto <carlpeto@Carls-MacBook-Pro.local>
This is slightly complicated by us currently not supporting this code
on iOS/tvOS/watchOS/visionOS. We should fix that, at which point we
can use the `SwiftStdlib`/`StdlibDeploymentTarget` macros instead.
rdar://164850733
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
It's useful to capture the platform and platform version with the image map.
Also, display both the platform and architecture information when generating
a crash log.
rdar://124913332
We want to be able to efficiently serialise lists of images, and to do so
it makes most sense to create a separate `ImageMap` type. This also provides
a useful place to put methods to e.g. find an image by address or by build
ID.
rdar://124913332
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