Commit Graph

6 Commits

Author SHA1 Message Date
Alastair Houghton
b50b396e1d [Backtracing] Fix rebasing mistake.
When I rebased, I didn't get the FileImageSource code quite right.

rdar://117681625
2023-11-06 16:00:04 +00:00
Alastair Houghton
1fc2ca35e8 [Backtracing] Add a caching wrapper for MemoryReader.
Currently we read many small chunks from the process we're backtracing.
If it so happens that it's the local process, that isn't really a big
problem, but if it's a remote process, especially on Linux where we have
to use the memory server, it's probably a little slow.

Fix by adding a caching layer.

rdar://117681625
2023-11-03 14:36:19 +00:00
Alastair Houghton
330085e9b8 [Linux] Improve the bounds checks.
It was pointed out that there was a more Swift-y way to write the
bounds checks for the `fetch<T>` implementation, so do that instead.

rdar://117590155
2023-11-03 14:16:54 +00:00
Alastair Houghton
018868e23f [Linux] Don't keep the file descriptor for FileImageSource.
We don't really need it after calling `mmap()`, and not keeping it around
means it's easy to make sure it gets closed properly in all cases.

rdar://117590155
2023-10-31 10:02:37 +00:00
Alastair Houghton
8678ead796 [Linux] Improve backtracer ELF/DWARF parsing performance.
On Linux we use FileImageSource to read data from ELF images.  We were
doing this in a fairly naive manner, which turns out to be a performance
issue with larger statically linked binaries on Linux.

Change FileImageSource to use mmap() instead.

rdar://117590155
2023-10-30 16:09:36 +00: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