Commit Graph

16 Commits

Author SHA1 Message Date
Alastair Houghton
75b9c8f2cf [Backtracing] Rename unsafeFirst to consumingFirst.
This seems like a better name.
2025-03-21 21:18:31 +00:00
Alastair Houghton
b85bf05a82 [Backtracing] Update copyright dates in boilerplate.
rdar://121430255
2025-02-26 14:12:21 +00:00
Alastair Houghton
fbab10397d [Backtracing] Use reserveCapacity to optimize escaping slightly.
We know we need at least as much space as the number of UTF-8
characters.

rdar://121430255
2025-02-26 14:12:21 +00:00
Alastair Houghton
b5461aeb22 [Backtracing] Added JSON crash log option.
Also made it so the `sanitize` option causes the crash logs to not
include memory dumps.

Fixes #71057
rdar://121430255
2025-02-26 14:12:17 +00:00
Alastair Houghton
9bdd9e73dc [Backtracing] Support redirection to a named file.
Add the ability to specify a filename or directory name as the output-to
setting in `SWIFT_BACKTRACE`.  If the option is set to a directory name,
generate a unique filename in that directory using the process name,
process ID and timestamp.

rdar://136977833
2025-01-29 10:20:15 +00:00
Alastair Houghton
4826d60bc2 [Backtracing] Implement Codable for Backtrace.
Add support for Codable to Bactkrace.

rdar://124913332
2025-01-17 10:09:37 +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
Alastair Houghton
d3352ef272 [Backtracing] memserver_req/resp and thread are only for Linux.
These types only exist on Linux, so need to be conditionalised here.

rdar://137201928
2025-01-15 11:21:25 +00:00
Alastair Houghton
9329776a5d [Backtracing] Use C++ interop to fix elf.h issue on Linux.
We have some problems on Linux where Glibc pulls in `<elf.h>` and then
we end up with conflicting definitions.  Fix by using C++ interop and
putting our definitions into a namespace.

rdar://137201928
2025-01-10 13:49:14 +00:00
Alexander Cyon
c21b1e68fd [stdlib] Fix typos 2024-07-06 13:09:57 +02:00
Alastair Houghton
f4bf27852f [Backtracing] Make the backtracer work for fully-static Linux.
The backtracer and its build system need a couple of changes to make
them work with the new fully-static Linux support.

rdar://123507656
2024-05-07 16:51:34 +01:00
Alastair Houghton
a9ce1cdaee [Backtracing][Linux] Add Linux support to swift-backtrace.
We need a Linux specific `Target` implementation, and a couple of minor
tweaks to make things build everywhere.

rdar://110262673
2023-06-07 09:06:34 +01:00
Alastair Houghton
9209bdd8c4 [Backtracing] Add an option to output to stderr.
In CI, it would be better if the backtraces went to stderr rather than
stdout, so provide an option for that.

rdar://107192120
2023-03-24 17:13:52 +00:00
Alastair Houghton
eb38d80655 [Backtracing] Fix Windows build.
While I was doing this, it turns out Saleem was fixing things to avoid
having to patch the Windows include directories, which is awesome but
necessitates an extra change to the backtracing stuff to make the build
not fail on Windows.

rdar://105409147
2023-03-04 08:00:09 +00:00
Alastair Houghton
dc6f97c274 [Backtracing][Windows] Use CRT not MSVCRT.
The name of the C library on Windows is CRT, apparently.

rdar://105452194
2023-03-04 08:00:09 +00:00
Alastair Houghton
65a6aae04e [Backtracing] Add swift-backtrace to the build.
This is Swift's external backtracer.  It's written in Swift, and it's
responsible for generating nice backtraces when Swift programs crash.
It makes use of the new `_Backtracing` library, which is also (mostly,
aside from some assembly language) implemented in Swift.

rdar://103442000
2023-03-04 08:00:09 +00:00