Commit Graph

5 Commits

Author SHA1 Message Date
Alastair Houghton
a73e98c660 [Linux][Backtracing] Fix unwinder so it stops properly.
On Linux specifically, it was possible for it to return `nil` to signal
the end of the unwind, then subsequently return non-`nil` again.  That
violates the expectations of the code layered above it, and can cause
an "Index out of range" error to occur.

rdar://112534548
2023-07-20 15:32:57 +01:00
Alastair Houghton
0b09af1f2f [Backtracing] Fix crash in CrashAsync test on Ubuntu 18.04.
This seems to be happening because we're hitting an invalid frame
on the stack where the program counter value is read back as zero.

If we find one of those, treat it as the end of our stack walk.

rdar://110846253
2023-06-21 11:09:31 +01:00
Alastair Houghton
438ab7fa29 [Backtracing][Linux] Add Linux support to the _Backtracing module.
Use the new module structure rather the old SwiftShims header.  This
is much cleaner and lets us include operating system headers to get
the relevant definitions where possible.

Add code to support ELF and DWARF, including decompression using
zlib, zstd and liblzma if those turn out to be required and available.

rdar://110261712
2023-06-06 16:16:20 +01:00
Alastair Houghton
43375e7a23 [Backtracing] Fix out-of-process async backtraces.
These weren't working correctly because I made the unwinder call
`_swift_task_getCurrent()`, but of course when out-of-process, it calls
that in `swift-backtrace`, which is wrong.  Remove that for now.

While I'm here, I also tweaked the formatting slightly, and I noticed
that we were saying that all thunks were also system functions, which
seemed unnecessary and odd.

Plus there were a couple of extra system functions I added to make the
async crash backtraces nicer in friendly mode.

rdar://106363539
2023-03-08 09:35:18 +00:00
Alastair Houghton
6caea5386b [Backtracing] Add _Backtracing library to the build.
Adds a new swift_Backtracing library, with a corresponding _Backtracing
module, to the build.  Also add some tests.

This is not public API at this point, but will be used by the external
backtracing program, `swift-backtrace`.

rdar://104336548
2023-03-04 07:56:03 +00:00