Skip to content

[Backtracing] Add JSON backtrace output #80271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 28, 2025

Conversation

al45tair
Copy link
Contributor

Add an option to use JSON for the crash log output; this makes it easy to ingest crash logs using tools like Splunk or Elastic, which is extremely useful in server environments.

rdar://121430255

@al45tair al45tair added 🍒 release cherry pick Flag: Release branch cherry picks swift 6.1 labels Mar 25, 2025
@al45tair al45tair requested a review from a team as a code owner March 25, 2025 14:47
@al45tair
Copy link
Contributor Author

al45tair commented Mar 25, 2025

It's actually only cc43f59 that's relevant here. The other commits are from #79049, which hasn't merged yet.

@al45tair
Copy link
Contributor Author

Explanation: Adds JSON output support to the backtracer. This makes it easy to feed crash reports into various other pieces of software.
Risk: Low. Only affects the backtracer, which only kicks in when a program crashes, and only then if the option is enabled.
Original PR: #79009
Reviewed by: @mikeash @czechboy0
Resolves: rdar://121430255
Tests: This PR adds a couple of tests to make sure JSON output works as expected. There are also other tests of the backtracer that still pass after this change.

@al45tair
Copy link
Contributor Author

@swift-ci Please test

@al45tair al45tair force-pushed the eng/PR-121430255-6.1 branch from cc43f59 to bfdf9c1 Compare March 27, 2025 11:12
@al45tair
Copy link
Contributor Author

Ah. Missed that I needed to copy across a new file from RuntimeModule on Linux. Also rebased after merging the redirection change.

@al45tair
Copy link
Contributor Author

@swift-ci Please test

Add an option to use JSON for the crash log output; this makes it easy to ingest crash logs using tools like Splunk or Elastic, which is extremely useful in server environments.

rdar://121430255
@al45tair al45tair force-pushed the eng/PR-121430255-6.1 branch from bfdf9c1 to bcd0b90 Compare March 27, 2025 14:45
@al45tair
Copy link
Contributor Author

@swift-ci Please test

It's possible that the last frame in the test is genuinely the
last one we see in the backtrace, in which case there won't be
a `,` after the `}`.

rdar://121430255
@al45tair
Copy link
Contributor Author

@swift-ci Please test Linux platform

@al45tair
Copy link
Contributor Author

@swift-ci Please test macOS platform

@al45tair
Copy link
Contributor Author

@swift-ci Please test Windows platform

@al45tair al45tair merged commit c581445 into swiftlang:release/6.1 Mar 28, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 6.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants