mirror of
https://github.com/apple/swift.git
synced 2026-11-18 04:54:16 +01:00
The `FRIENDLY` presentation of the backtracer reads the referenced source file at its compile-time absolute path so it can print surrounding lines. DWARF bakes in that absolute path at build time. Under remote-run the source tree isn't mirrored on the remote (and DWARF paths aren't remapped), so the friendly formatter has no file to read and only frame headers come out — the tests' FRIENDLY-prefix CHECK lines never match. Making this work end-to-end would need either a source-tree upload scoped to each test or `-file-prefix-map` at compile time; both are non-trivial work. Mark them `UNSUPPORTED: remote_run` for now.
78 lines
4.3 KiB
Plaintext
78 lines
4.3 KiB
Plaintext
// RUN: %empty-directory(%t)
|
|
// RUN: %target-build-swift %S/Inputs/CrashAsync.swift -parse-as-library -Onone -g -o %t/CrashAsync
|
|
// RUN: %target-codesign %t/CrashAsync
|
|
|
|
// Demangling is disabled for now because older macOS can't demangle async
|
|
// function names. We test demangling elsewhere, so this is no big deal.
|
|
|
|
// RUN: not --crash env %env-SWIFT_BACKTRACE=enable=yes,demangle=no,cache=no %target-run %t/CrashAsync 2>&1 | %FileCheck %s
|
|
// RUN: not --crash env %env-SWIFT_BACKTRACE=preset=friendly,enable=yes,demangle=no,cache=no %target-run %t/CrashAsync 2>&1 | %FileCheck %s --check-prefix FRIENDLY
|
|
|
|
// UNSUPPORTED: use_os_stdlib
|
|
// UNSUPPORTED: back_deployment_runtime
|
|
// UNSUPPORTED: asan
|
|
// UNSUPPORTED: remote_run
|
|
// REQUIRES: executable_test
|
|
// REQUIRES: backtracing
|
|
// REQUIRES: OS=macosx || OS=linux-gnu
|
|
|
|
// CHECK: *** Program crashed: Bad pointer dereference at 0x{{0+}}4 ***
|
|
|
|
// CHECK: Thread {{[0-9]+( ".*")?}} crashed:
|
|
|
|
// CHECK: 0 0x{{[0-9a-f]+}} {{_?}}$s10CrashAsync5crashyyF + {{[0-9]+}} in CrashAsync at {{.*}}/CrashAsync.swift:4:15
|
|
// CHECK-NEXT: 1 [ra] 0x{{[0-9a-f]+}} {{_?}}$s10CrashAsync5levelyySiYaFTY0_ + {{[0-9]+}} in CrashAsync at {{.*}}/CrashAsync.swift:12:5
|
|
// CHECK-NEXT: 2 [async] 0x{{[0-9a-f]+}} {{_?}}$s10CrashAsync5levelyySiYaFTQ1_ in CrashAsync at {{.*}}/CrashAsync.swift:10
|
|
// CHECK-NEXT: 3 [async] 0x{{[0-9a-f]+}} {{_?}}$s10CrashAsync5levelyySiYaFTQ1_ in CrashAsync at {{.*}}/CrashAsync.swift:10
|
|
// CHECK-NEXT: 4 [async] 0x{{[0-9a-f]+}} {{_?}}$s10CrashAsync5levelyySiYaFTQ1_ in CrashAsync at {{.*}}/CrashAsync.swift:10
|
|
// CHECK-NEXT: 5 [async] 0x{{[0-9a-f]+}} {{_?}}$s10CrashAsync5levelyySiYaFTQ1_ in CrashAsync at {{.*}}/CrashAsync.swift:10
|
|
// CHECK-NEXT: 6 [async] 0x{{[0-9a-f]+}} {{_?}}$s10CrashAsyncAAV4mainyyYaFZ{{TQ0_| \+ [0-9]+}} in CrashAsync at {{.*}}/CrashAsync.swift:20
|
|
// CHECK-NEXT: 7 [async] [system] 0x{{[0-9a-f]+}} {{_?}}$s10CrashAsyncAAV5$mainyyYaFZ{{TQ0_| \+ [0-9]+}} in CrashAsync at {{.*}}/<compiler-generated>
|
|
// CHECK-NEXT: 8 [async] [system] 0x{{[0-9a-f]+}} {{_?}}async_Main{{TQ0_| \+ [0-9]+}} in CrashAsync at {{.*}}/<compiler-generated>
|
|
// CHECK-NEXT: 9 [async] [thunk] 0x{{[0-9a-f]+}} {{_?}}$sIetH_yts5Error_pIegHrzo_TR{{TQ0_| \+ [0-9]+}} in CrashAsync at {{.*}}/<compiler-generated>
|
|
// CHECK-NEXT: 10 [async] [thunk] 0x{{[0-9a-f]+}} {{_?}}$sIetH_yts5Error_pIegHrzo_TRTA{{TQ0_| \+ [0-9]+}} in CrashAsync at {{.*}}/<compiler-generated>
|
|
// CHECK-NEXT: 11 [async] [system] 0x{{[0-9a-f]+}} {{_?}}_ZL23completeTaskWithClosurePN5swift12AsyncContextEPNS_10SwiftErrorE in libswift_Concurrency.{{dylib|so}}
|
|
|
|
// FRIENDLY: *** Program crashed: Bad pointer dereference at 0x{{0+}}4 ***
|
|
|
|
// FRIENDLY: Thread {{[0-9]+( ".*")?}} crashed:
|
|
|
|
// FRIENDLY: 0 {{_?}}$s10CrashAsync5crashyyF + {{[0-9]+}} in CrashAsync at {{.*}}CrashAsync.swift:4:15
|
|
|
|
// FRIENDLY: 2| func crash() {
|
|
// FRIENDLY-NEXT: 3| let ptr = UnsafeMutablePointer<Int>(bitPattern: 4)!
|
|
// FRIENDLY-NEXT: * 4| ptr.pointee = 42
|
|
// FRIENDLY-NEXT: | ^
|
|
// FRIENDLY-NEXT: 5| }
|
|
// FRIENDLY-NEXT: 6|
|
|
|
|
// FRIENDLY: 1 {{_?}}$s10CrashAsync5levelyySiYaFTY0_ + {{[0-9]+}} in CrashAsync at {{.*}}CrashAsync.swift:12:5
|
|
|
|
// FRIENDLY: 10| await level(n + 1)
|
|
// FRIENDLY-NEXT: 11| } else {
|
|
// FRIENDLY-NEXT: * 12| crash()
|
|
// FRIENDLY-NEXT: | ^
|
|
// FRIENDLY-NEXT: 13| }
|
|
// FRIENDLY-NEXT: 14| }
|
|
|
|
// FRIENDLY:2 {{_?}}$s10CrashAsync5levelyySiYaFTQ1_ in CrashAsync at {{.*}}CrashAsync.swift:10
|
|
|
|
// FRIENDLY: 8| func level(_ n: Int) async {
|
|
// FRIENDLY-NEXT: 9| if n < 5 {
|
|
// FRIENDLY-NEXT: * 10| await level(n + 1)
|
|
// FRIENDLY-NEXT: | ^
|
|
// FRIENDLY-NEXT: 11| } else {
|
|
// FRIENDLY-NEXT: 12| crash()
|
|
|
|
// FRIENDLY: 3 {{_?}}$s10CrashAsync5levelyySiYaFTQ1_ in CrashAsync at {{.*}}CrashAsync.swift:10
|
|
// FRIENDLY: 4 {{_?}}$s10CrashAsync5levelyySiYaFTQ1_ in CrashAsync at {{.*}}CrashAsync.swift:10
|
|
// FRIENDLY: 5 {{_?}}$s10CrashAsync5levelyySiYaFTQ1_ in CrashAsync at {{.*}}CrashAsync.swift:10
|
|
// FRIENDLY: 6 {{_?}}$s10CrashAsyncAAV4mainyyYaFZ{{TQ0_| \+ [0-9]+}} in CrashAsync at {{.*}}CrashAsync.swift:20
|
|
|
|
// FRIENDLY: 18| struct CrashAsync {
|
|
// FRIENDLY-NEXT: 19| static func main() async {
|
|
// FRIENDLY-NEXT: * 20| await level(1)
|
|
// FRIENDLY-NEXT: | ^
|
|
// FRIENDLY-NEXT: 21| }
|
|
// FRIENDLY-NEXT: 22| }
|