Skip to content

Commit 0d30aca

Browse files
author
Julian Lettner
committed
[Sanitizer] Disable inlining to improve robustness of test
This test checks that Sanitizer reports contain properly symbolicated stacks. Let's make sure that all of the expected frames appear in the stack by disabling inlining. rdar://68171463
1 parent 27f453c commit 0d30aca

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

test/Sanitizers/symbolication-linux.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111
// symbolication. Note that `llvm-symbolizer` does not demangle Swift symbol
1212
// names, so we use `swift demangle`.
1313

14+
@inline(never)
1415
func foo() {
1516
let x = UnsafeMutablePointer<Int>.allocate(capacity: 1)
1617
x.deallocate()
1718
print(x.pointee)
1819
}
1920

21+
@inline(never)
2022
func bar() {
2123
foo()
2224
}
@@ -25,7 +27,7 @@ bar()
2527

2628

2729
// Out-of-process
28-
// OOP: #0 0x{{[0-9a-f]+}} in main.foo() -> () {{.*}}symbolication-linux.swift:[[@LINE-11]]
30+
// OOP: #0 0x{{[0-9a-f]+}} in main.foo() -> () {{.*}}symbolication-linux.swift:[[@LINE-12]]
2931
// OOP-NEXT: #1 0x{{[0-9a-f]+}} in main.bar() -> () {{.*}}symbolication-linux.swift:[[@LINE-8]]
3032
// OOP-NEXT: #2 0x{{[0-9a-f]+}} in main {{.*}}symbolication-linux.swift:[[@LINE-6]]
3133

test/Sanitizers/symbolication.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99
// both out-of-process (via `atos`) and when falling back to in-process
1010
// symbolication. Note that `atos` also demangles Swift symbol names.
1111

12+
@inline(never)
1213
func foo() {
1314
let x = UnsafeMutablePointer<Int>.allocate(capacity: 1)
1415
x.deallocate()
1516
print(x.pointee)
1617
}
1718

19+
@inline(never)
1820
func bar() {
1921
foo()
2022
}
@@ -23,7 +25,7 @@ bar()
2325

2426

2527
// Out-of-process
26-
// OOP: #0 0x{{[0-9a-f]+}} in foo() symbolication.swift:[[@LINE-11]]
28+
// OOP: #0 0x{{[0-9a-f]+}} in foo() symbolication.swift:[[@LINE-12]]
2729
// OOP-NEXT: #1 0x{{[0-9a-f]+}} in bar() symbolication.swift:[[@LINE-8]]
2830
// OOP-NEXT: #2 0x{{[0-9a-f]+}} in main symbolication.swift:[[@LINE-6]]
2931

0 commit comments

Comments
 (0)