mirror of
https://github.com/apple/swift.git
synced 2026-11-18 04:54:16 +01:00
We can't test the alternate image support for ELF, because that's been removed in favour of `SymbolLocator`/`SymbolSource`. Also we must pass `/opt:icf` in the symbolicated backtrace test when using PDB, otherwise we corrupt the metadata. Finally fix a mistake in `Utils.swift` where we were crashing if the environment variable in question wasn't set. rdar://168454023
56 lines
1.4 KiB
Swift
56 lines
1.4 KiB
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %target-build-swift -g -debug-info-format=codeview -Xlinker /debug -Xlinker /opt:icf %s -parse-as-library -Xfrontend -disable-availability-checking -g -Onone -o %t/symbolicated.exe
|
|
// RUN: %target-codesign %t/symbolicated.exe
|
|
// RUN: %target-run %t/symbolicated.exe | %FileCheck %s
|
|
|
|
// UNSUPPORTED: use_os_stdlib
|
|
// UNSUPPORTED: back_deployment_runtime
|
|
// REQUIRES: executable_test
|
|
// REQUIRES: backtracing
|
|
// REQUIRES: OS=windows-msvc
|
|
|
|
import Runtime
|
|
|
|
func kablam() {
|
|
kerpow()
|
|
}
|
|
|
|
func kerpow() {
|
|
whap()
|
|
}
|
|
|
|
func whap() {
|
|
zonk()
|
|
}
|
|
|
|
func zonk() {
|
|
splat()
|
|
}
|
|
|
|
func splat() {
|
|
pow()
|
|
}
|
|
|
|
func pow() {
|
|
let backtrace = try! Backtrace.capture().symbolicated(
|
|
options: [ .showInlineFrames, .showSourceLocations ]
|
|
)!
|
|
|
|
// CHECK: 0{{[ \t]+}}0x{{[0-9a-f]+}} [ra] [0] symbolicated.exe pow()
|
|
// CHECK: 1{{[ \t]+}}0x{{[0-9a-f]+}} [ra] [0] symbolicated.exe splat()
|
|
// CHECK: 2{{[ \t]+}}0x{{[0-9a-f]+}} [ra] [0] symbolicated.exe zonk()
|
|
// CHECK: 3{{[ \t]+}}0x{{[0-9a-f]+}} [ra] [0] symbolicated.exe whap()
|
|
// CHECK: 4{{[ \t]+}}0x{{[0-9a-f]+}} [ra] [0] symbolicated.exe kerpow()
|
|
// CHECK: 5{{[ \t]+}}0x{{[0-9a-f]+}} [ra] [0] symbolicated.exe kablam()
|
|
// CHECK: 6{{[ \t]+}}0x{{[0-9a-f]+}} [ra] [0] symbolicated.exe static SymbolicatedBacktrace.main()
|
|
|
|
print(backtrace)
|
|
}
|
|
|
|
@main
|
|
struct SymbolicatedBacktrace {
|
|
static func main() {
|
|
kablam()
|
|
}
|
|
}
|