File tree Expand file tree Collapse file tree 2 files changed +89
-0
lines changed Expand file tree Collapse file tree 2 files changed +89
-0
lines changed Original file line number Diff line number Diff line change
1
+ // RUN: %empty-directory(%t)
2
+ // RUN: %target-build-swift %s -parse-as-library -Onone -g -o %t/EarlyMessage
3
+ // RUN: (env SWIFT_BACKTRACE=enable=yes,cache=no %target-run %t/EarlyMessage 2>&1 || true) | %FileCheck %s
4
+
5
+ // UNSUPPORTED: use_os_stdlib
6
+ // UNSUPPORTED: back_deployment_runtime
7
+ // UNSUPPORTED: asan
8
+ // REQUIRES: executable_test
9
+ // REQUIRES: backtracing
10
+ // REQUIRES: OS=macosx || OS=linux-gnu
11
+
12
+ func level1( ) {
13
+ level2 ( )
14
+ }
15
+
16
+ func level2( ) {
17
+ level3 ( )
18
+ }
19
+
20
+ func level3( ) {
21
+ level4 ( )
22
+ }
23
+
24
+ func level4( ) {
25
+ level5 ( )
26
+ }
27
+
28
+ func level5( ) {
29
+ print ( " About to crash " )
30
+ let ptr = UnsafeMutablePointer < Int > ( bitPattern: 4 ) !
31
+ ptr. pointee = 42
32
+ }
33
+
34
+ @main
35
+ struct EarlyMessage {
36
+ static func main( ) {
37
+ level1 ( )
38
+ }
39
+ }
40
+
41
+ // Make sure we get the early crash message from the backtracer (the first
42
+ // part is generated by the runtime itself; the "done ***" on the end is from
43
+ // swift-backtrace).
44
+
45
+ // CHECK: *** Signal {{[0-9]+}}: Backtracing from 0x{{[0-9a-f]+}}... done ***
Original file line number Diff line number Diff line change
1
+ // RUN: %empty-directory(%t)
2
+ // RUN: %target-build-swift %s -parse-as-library -Onone -g -o %t/Timing
3
+ // RUN: (env SWIFT_BACKTRACE=enable=yes,cache=no %target-run %t/Timing 2>&1 || true) | %FileCheck %s
4
+
5
+ // UNSUPPORTED: use_os_stdlib
6
+ // UNSUPPORTED: back_deployment_runtime
7
+ // UNSUPPORTED: asan
8
+ // REQUIRES: executable_test
9
+ // REQUIRES: backtracing
10
+ // REQUIRES: OS=macosx || OS=linux-gnu
11
+
12
+ func level1( ) {
13
+ level2 ( )
14
+ }
15
+
16
+ func level2( ) {
17
+ level3 ( )
18
+ }
19
+
20
+ func level3( ) {
21
+ level4 ( )
22
+ }
23
+
24
+ func level4( ) {
25
+ level5 ( )
26
+ }
27
+
28
+ func level5( ) {
29
+ print ( " About to crash " )
30
+ let ptr = UnsafeMutablePointer < Int > ( bitPattern: 4 ) !
31
+ ptr. pointee = 42
32
+ }
33
+
34
+ @main
35
+ struct Timing {
36
+ static func main( ) {
37
+ level1 ( )
38
+ }
39
+ }
40
+
41
+ // The backtracer should say how long the backtrace took, in seconds, with
42
+ // two decimal places.
43
+
44
+ // CHECK: Backtrace took {{[0-9]+}}.{{[0-9][0-9]}}s
You can’t perform that action at this time.
0 commit comments