This repository has been archived by the owner on Oct 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
206 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// swift-tools-version:5.0 | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "swift-backtrace", | ||
products: [ | ||
.library( | ||
name: "Backtrace", | ||
targets: ["Backtrace"] | ||
), | ||
], | ||
dependencies: [], | ||
targets: [ | ||
.target(name: "Backtrace", | ||
dependencies: ["CBacktrace"]), | ||
.target(name: "CBacktrace", | ||
dependencies: []), | ||
.target(name: "Sample", | ||
dependencies: ["Backtrace"]), | ||
.testTarget(name: "BacktraceTests", | ||
dependencies: ["Backtrace"]), | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// swift-tools-version:5.0 | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "swift-backtrace", | ||
products: [ | ||
.library( | ||
name: "Backtrace", | ||
targets: ["Backtrace"] | ||
), | ||
], | ||
dependencies: [], | ||
targets: [ | ||
.target(name: "Backtrace", | ||
dependencies: ["CBacktrace"]), | ||
.target(name: "CBacktrace", | ||
dependencies: []), | ||
.target(name: "Sample", | ||
dependencies: ["Backtrace"]), | ||
.testTarget(name: "BacktraceTests", | ||
dependencies: ["Backtrace"]), | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// swift-tools-version:5.0 | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "swift-backtrace", | ||
products: [ | ||
.library( | ||
name: "Backtrace", | ||
targets: ["Backtrace"] | ||
), | ||
], | ||
dependencies: [], | ||
targets: [ | ||
.target(name: "Backtrace", | ||
dependencies: ["CBacktrace"]), | ||
.target(name: "CBacktrace", | ||
dependencies: []), | ||
.target(name: "Sample", | ||
dependencies: ["Backtrace"]), | ||
.testTarget(name: "BacktraceTests", | ||
dependencies: ["Backtrace"]), | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// swift-tools-version:5.0 | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "swift-backtrace", | ||
products: [ | ||
.library( | ||
name: "Backtrace", | ||
targets: ["Backtrace"] | ||
), | ||
], | ||
dependencies: [], | ||
targets: [ | ||
.target(name: "Backtrace", | ||
dependencies: ["CBacktrace"]), | ||
.target(name: "CBacktrace", | ||
dependencies: []), | ||
.target(name: "Sample", | ||
dependencies: ["Backtrace"]), | ||
.testTarget(name: "BacktraceTests", | ||
dependencies: ["Backtrace"]), | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// swift-tools-version:5.0 | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "swift-backtrace", | ||
products: [ | ||
.library( | ||
name: "Backtrace", | ||
targets: ["Backtrace"] | ||
), | ||
], | ||
dependencies: [], | ||
targets: [ | ||
.target(name: "Backtrace", | ||
dependencies: ["CBacktrace"]), | ||
.target(name: "CBacktrace", | ||
dependencies: []), | ||
.target(name: "Sample", | ||
dependencies: ["Backtrace"]), | ||
.testTarget(name: "BacktraceTests", | ||
dependencies: ["Backtrace"]), | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# ``Backtrace`` | ||
|
||
Provides support for automatically printing crash backtraces of Swift programs. | ||
|
||
## Overview | ||
|
||
The Backtrace library is designed to fill a gap in backtraces support for Swift on non-Darwin platforms. | ||
When this gap is closed at the language runtime level, this library will become redundant and be deprecated. | ||
|
||
## Getting started | ||
|
||
When building web-services and daemons, direct usage of this library is discouraged. | ||
Instead, use [swift-service-lifecycle](https://github.com/swift-server/swift-service-lifecycle) which helps manage the application lifecycle including setting up backtraces hooks when needed. | ||
|
||
Add `https://github.com/swift-server/swift-backtrace.git` as a dependency in your `Package.swift`. | ||
|
||
### Crash backtraces | ||
|
||
In your `main.swift`, do: | ||
|
||
```swift | ||
import Backtrace | ||
|
||
// Do this first | ||
Backtrace.install() | ||
``` | ||
|
||
Finally, for Swift < 5.2, make sure you build your application with debug symbols enabled. Debug symbols are automatically included for Swift 5.2 and above. | ||
|
||
``` | ||
$ swift build -c release -Xswiftc -g | ||
``` | ||
|
||
When your app crashes, a stacktrace will be printed to `stderr`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
##===----------------------------------------------------------------------===## | ||
## | ||
## This source file is part of the SwiftLinuxBacktrace open source project | ||
## | ||
## Copyright (c) 2022 Apple Inc. and the SwiftLinuxBacktrace project authors | ||
## Licensed under Apache License v2.0 | ||
## | ||
## See LICENSE.txt for license information | ||
## See CONTRIBUTORS.txt for the list of SwiftLinuxBacktrace project authors | ||
## | ||
## SPDX-License-Identifier: Apache-2.0 | ||
## | ||
##===----------------------------------------------------------------------===## | ||
|
||
##===----------------------------------------------------------------------===## | ||
## | ||
## This source file is part of the Swift Distributed Actors open source project | ||
## | ||
## Copyright (c) 2018-2019 Apple Inc. and the Swift Distributed Actors project authors | ||
## Licensed under Apache License v2.0 | ||
## | ||
## See LICENSE.txt for license information | ||
## See CONTRIBUTORS.md for the list of Swift Distributed Actors project authors | ||
## | ||
## SPDX-License-Identifier: Apache-2.0 | ||
## | ||
##===----------------------------------------------------------------------===## | ||
|
||
swift package --disable-sandbox preview-documentation --target $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters