Swiftpack.co - norio-nomura/SwiftBacktrace as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by norio-nomura.
norio-nomura/SwiftBacktrace 1.0.1
Stack traces for Swift on Mac and Linux using `libunwind`.
⭐️ 16
🕓 4 years ago
.package(url: "https://github.com/norio-nomura/SwiftBacktrace.git", from: "1.0.1")

SwiftBacktrace

SwiftPM Nightly

Stack traces for Swift on Mac and Linux using libunwind.

Installation

SwiftBacktrace depends on libunwind.

On macOS

compatible with pre-installed /usr/lib/system/libunwind.dylib.

On Linux

libunwind8 installaion is required.

apt-get update && apt-get install -y libunwind8

Getting started

import SwiftBacktrace

print(backtrace().joined(separator: "\n"))          // backtrace()
print(demangledBacktrace().joined(separator: "\n")) // demangled backtrace

Output example on Linux CI:

/root/project/.build/x86_64-unknown-linux/debug/SwiftBacktracePackageTests.xctest(SwiftBacktrace.callStackSymbols<A>(_: Swift.Int, transform: ((module: Swift.String, name: Swift.String, offset: Swift.UInt64, address: Swift.Optional<Swift.UnsafeRawPointer>)) -> A) -> Swift.Array<A>+0x87) [0x55f78f85c0b7]
/root/project/.build/x86_64-unknown-linux/debug/SwiftBacktracePackageTests.xctest(SwiftBacktrace.demangledBacktrace(Swift.Int) -> Swift.Array<Swift.String>+0x80) [0x55f78f85ae10]
/root/project/.build/x86_64-unknown-linux/debug/SwiftBacktracePackageTests.xctest(SwiftBacktraceTests.SwiftBacktraceTests.test_backtrace() -> ()+0x4a5) [0x55f78f8608d5]
/root/project/.build/x86_64-unknown-linux/debug/SwiftBacktracePackageTests.xctest(partial apply forwarder for SwiftBacktraceTests.SwiftBacktraceTests.test_backtrace() -> ()+0x9) [0x55f78f861119]

Author

Norio Nomura

License

This package is available under the MIT license. See the LICENSE file for more info.

GitHub

link
Stars: 16
Last commit: 4 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Dependencies

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics