Commit Graph

13 Commits

Author SHA1 Message Date
Carl Peto 8b87e3db49 [Backtracing] [Windows] Bugfixes for windows image crash logs (#89218)
- Fix issue with no build id showing up as `000000`... (e.g. no debug
info), now shows as `<no build id>` as intended.
- Try to avoid loading PE file unless it's necessary on Windows
symbolicating backtraces.
- DefaultSymbolLocator: PDB file finding now respects the overridable
path for use in the offline symbolicator (no effect on standard
backtracing).
- Record timestamp/size in Image Info on windows for possible future use
in offline symbolicator

---------

Co-authored-by: Carl Peto <carlpeto@Carls-MacBook-Pro.local>
2026-05-19 16:35:38 +01:00
Allan Shortlidge ec6bb44c74 stdlib: Adopt #if os(anyAppleOS).
Replace error prone and verbose compilation conditionals like

```
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(visionOS)
```

with

```
#if os(anyAppleOS)
```
2026-03-26 10:19:00 -07:00
Alastair Houghton 6cb7480a69 [Backtracing] Fix function entry table processing during unwind.
The Win32 unwinder has to locate function entry records for the
`StackWalk64()` API to use; the code that was doing this was
incorrect and sometimes found the wrong record, which would result
in a corrupted stack walk.

rdar://172911008
2026-03-19 12:12:48 +00:00
Alastair Houghton c432e9df61 [Backtracing] Decrease minimum availability version.
We need a minimum target of 15.7 or below because of CI, so add a new
`BacktracingDT 6.2` define.  This is a bit of a hack for now to
unblock CI upgrades; we can go and clean things up and perhaps
generalise this mechanism later.

rdar://172129091
2026-03-12 11:32:22 +00:00
Alastair Houghton d13988bd5f [Backtracing][Windows] Initial Windows support.
This doesn't have a working symbolicator yet, but it does build and
it can obtain a basic backtrace.

It also doesn't include a working `swift-backtrace` program yet.

rdar://101623384
2026-02-03 18:23:29 +00:00
Alastair Houghton 22a7c8fa0a [Backtracing] More availability annotations required.
Apparently we need some more availability annotations.

rdar://164850733
2026-01-09 11:58:36 +00:00
Alastair Houghton 64fa447210 [Backtracing] Add missing availability annotations.
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
2026-01-09 11:58:35 +00:00
Carl Peto 740f2d4c81 pr feedback and unit test fixes 2025-12-12 16:32:02 +00:00
Carl Peto 8f8d4585c1 pr feedback
Changed the way swift-backtrace works for JSON, so that it captures
into a CrashLog, then writes to JSON from the CrashLog. Separating out
the two sets of logic so that writing the CrashLog to JSON becomes
simpler and more modular.
2025-12-08 11:29:33 +00:00
Alastair Houghton c9c5dc0de1 [Backtracing] Add platform and architecture information.
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
2025-01-27 15:44:28 +00:00
Alastair Houghton 12aee901c2 [Backtracing] Fix compact image map decoding bug.
If we ended up with a `/` at the beginning of a string segment, we
were erroneously not adding to the expansion dictionary when we
should have been.

rdar://124913332
2025-01-22 16:35:44 +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 0e3e9efcd3 [Backtracing] Add ImageMap instead of just using an Array.
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
2025-01-17 10:09:36 +00:00