File tree Expand file tree Collapse file tree 2 files changed +68
-0
lines changed Expand file tree Collapse file tree 2 files changed +68
-0
lines changed Original file line number Diff line number Diff line change
1
+ // RUN: %target-build-swift %s -sanitize=address -g -target %sanitizers-target-triple -o %t
2
+ // RUN: env %env-ASAN_OPTIONS=abort_on_error=0 not %target-run %t 2>&1 | %swift-demangle | %FileCheck %s -check-prefix=OOP
3
+ // In-process symbolication doesn't work on Linux (yet)
4
+ // XXX: env %env-ASAN_OPTIONS=abort_on_error=0,external_symbolizer_path= not %target-run %t 2>&1 | %swift-demangle | %FileCheck %s -check-prefix=IP
5
+ // REQUIRES: executable_test
6
+ // REQUIRES: asan_runtime
7
+ // REQUIRES: OS=linux-gnu
8
+
9
+ // Check that Sanitizer reports are properly symbolicated on Linux, both
10
+ // out-of-process (via `llvm-symbolizer`) and when falling back to in-process
11
+ // symbolication. Note that `llvm-symbolizer` does not demangle Swift symbol
12
+ // names, so we use `swift demangle`.
13
+
14
+ func foo( ) {
15
+ let x = UnsafeMutablePointer< Int> . allocate( capacity: 1 )
16
+ x. deallocate ( )
17
+ print ( x. pointee)
18
+ }
19
+
20
+ func bar( ) {
21
+ foo ( )
22
+ }
23
+
24
+ bar ( )
25
+
26
+
27
+ // Out-of-process
28
+ // OOP: #0 0x{{[0-9a-f]+}} in main.foo() -> () {{.*}}symbolication-linux.swift:[[@LINE-11]]
29
+ // OOP-NEXT: #1 0x{{[0-9a-f]+}} in main.bar() -> () {{.*}}symbolication-linux.swift:[[@LINE-8]]
30
+ // OOP-NEXT: #2 0x{{[0-9a-f]+}} in main {{.*}}symbolication-linux.swift:[[@LINE-6]]
31
+
32
+ // In-process
33
+ // IP: #0 0x{{[0-9a-f]+}} in main.foo() -> ()+0x
34
+ // IP-NEXT: #1 0x{{[0-9a-f]+}} in main.bar() -> ()+0x
35
+ // IP-NEXT: #2 0x{{[0-9a-f]+}} in main+0x
Original file line number Diff line number Diff line change
1
+ // RUN: %target-build-swift %s -sanitize=address -g -target %sanitizers-target-triple -o %t
2
+ // RUN: env %env-ASAN_OPTIONS=abort_on_error=0 not %target-run %t 2>&1 | %FileCheck %s -check-prefix=OOP
3
+ // RUN: env %env-ASAN_OPTIONS=abort_on_error=0,external_symbolizer_path= not %target-run %t 2>&1 | %FileCheck %s -check-prefix=IP
4
+ // REQUIRES: executable_test
5
+ // REQUIRES: asan_runtime
6
+ // REQUIRES: VENDOR=apple
7
+
8
+ // Check that Sanitizer reports are properly symbolicated on Apple platforms,
9
+ // both out-of-process (via `atos`) and when falling back to in-process
10
+ // symbolication. Note that `atos` also demangles Swift symbol names.
11
+
12
+ func foo( ) {
13
+ let x = UnsafeMutablePointer< Int> . allocate( capacity: 1 )
14
+ x. deallocate ( )
15
+ print ( x. pointee)
16
+ }
17
+
18
+ func bar( ) {
19
+ foo ( )
20
+ }
21
+
22
+ bar ( )
23
+
24
+
25
+ // Out-of-process
26
+ // OOP: #0 0x{{[0-9a-f]+}} in foo() symbolication.swift:[[@LINE-11]]
27
+ // OOP-NEXT: #1 0x{{[0-9a-f]+}} in bar() symbolication.swift:[[@LINE-8]]
28
+ // OOP-NEXT: #2 0x{{[0-9a-f]+}} in main symbolication.swift:[[@LINE-6]]
29
+
30
+ // In-process
31
+ // IP: #0 0x{{[0-9a-f]+}} in main.foo() -> ()+0x
32
+ // IP-NEXT: #1 0x{{[0-9a-f]+}} in main.bar() -> ()+0x
33
+ // IP-NEXT: #2 0x{{[0-9a-f]+}} in main+0x
You can’t perform that action at this time.
0 commit comments